Skip to content

Instantly share code, notes, and snippets.

@robvinson
Last active December 19, 2015 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robvinson/5910816 to your computer and use it in GitHub Desktop.
Save robvinson/5910816 to your computer and use it in GitHub Desktop.
tracer.gdb
set logging file /tmp/Good-log.txt
set logging on
attach --waitfor Good
### Generic objective-c tracing
b objc_msgSend
commands
silent
# print class name and method name
printf "-[%s %s]\n", (char *)class_getName(*(long *)$r0,$r1),$r1
# attempt to ask the first parameter to print itself
# po $r2
c
end
### General c functions of interest
# stat()
b stat
commands
silent
printf "c stat() path:[%s]\n", $r0
c
end
# fork
b fork
commands
silent
printf "c fork() called\n"
c
end
# open()
b open
commands
silent
printf "c open() path:[%s]\n", $r0
c
end
# fopen()
b fopen
commands
silent
printf "c fopen() path:[%s]\n", $r0
c
end
c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment