Skip to content

Instantly share code, notes, and snippets.

Created April 25, 2013 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/5461779 to your computer and use it in GitHub Desktop.
Save anonymous/5461779 to your computer and use it in GitHub Desktop.
dump.c
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
int test(int x, int y) {
return x + y - x * y;
}
int end() {
return 0;
}
int main() {
pid_t pid = getpid();
char cmd[1024];
snprintf(cmd, 1024, "objdump /proc/%d/mem -d --start-address=%p --stop-address=%p", pid, &test, &end);
fprintf(stderr, "running: '%s'\n", cmd);
system(cmd);
fprintf(stderr, "done\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment