Created
September 29, 2014 07:15
-
-
Save gnosis23/ebe9c24ed47a832765e7 to your computer and use it in GitHub Desktop.
backtrace
This file contains hidden or 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
| int mon_backtrace(int argc, char **argv, struct M *m) { | |
| uint32_t *ebp = (uint32_t*)read_ebp(); | |
| uint32_t *base, *eip; | |
| int i; | |
| eip = ebp + 1; | |
| for (ebp = POINTTO(ebp) ; *ebp != 0 ; ebp = POINTTO(ebp)) { | |
| base = ebp + 1; | |
| printf("ebp %08x eip %08x args", *ebp, *eip); | |
| for (i = 1; i <= 5; i++) { | |
| printf(" %08x", *(base + i)); | |
| } | |
| printf("\n"); | |
| eip = base; | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment