Skip to content

Instantly share code, notes, and snippets.

@gnosis23
Created September 29, 2014 07:15
Show Gist options
  • Select an option

  • Save gnosis23/ebe9c24ed47a832765e7 to your computer and use it in GitHub Desktop.

Select an option

Save gnosis23/ebe9c24ed47a832765e7 to your computer and use it in GitHub Desktop.
backtrace
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