Last active
July 22, 2020 16:54
-
-
Save jstaursky/6bb061ada3f0f7a356e42c12e760d98e to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# Useful for debugging a process that gets initialized from another process. | |
# credit to https://stackoverflow.com/questions/4382348/is-there-any-way-to-tell-gdb-to-wait-for-a-process-to-start-and-attach-to-it | |
progstr=$1 | |
progpid=`pgrep -o $progstr` | |
while [ "$progpid" = "" ]; do | |
progpid=`pgrep -o $progstr` | |
done | |
gdb -ex 'break <function signature>' -ex 'starti' -p $progpid | |
# eg. gdbwait <app> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment