Created
December 9, 2011 22:59
-
-
Save brson/1453710 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We return below with a ret $8. We will return to a single | |
# return instruction, which will return to the caller of our | |
# caller. We let the unwinder skip that single return | |
# instruction, and just return to the real caller. | |
# Here CFA points just past the return address on the stack, | |
# e.g., on function entry it is %esp + 4. Later we will | |
# change it to %ebp + 8, as set by .cfi_def_cfa_register and | |
# .cfi_def_cfa_offset above. The stack looks like this: | |
# CFA + 12: stack pointer after two returns | |
# CFA + 8: return address of morestack caller's caller | |
# CFA + 4: size of parameters | |
# CFA: new stack frame size | |
# CFA - 4: return address of this function | |
# CFA - 8: previous value of %ebp; %ebp points here | |
# We want to set %esp to the stack pointer after the double | |
# return, which is CFA + 12. | |
.cfi_offset 8, 8 # New PC stored at CFA + 8 | |
.cfi_escape 0x15, 4, 0x7d # DW_CFA_val_offset_sf, %esp, 12/-4 | |
# i.e., next %esp is CFA + 12 | |
# Set up a normal backtrace. | |
pushl %ebp | |
.cfi_def_cfa_offset 8 | |
.cfi_offset %ebp, -8 | |
movl %esp,%ebp | |
.cfi_def_cfa_register %ebp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment