running gdb on a child executable
I ha开发者_开发知识库ve a bash script which calls another bash script which calls a (very fast) executable. I would like to know if there's a way of attaching gdb to the executable without modifying the second script or without attaching to PID (given the very quick execution).
The only way I can imagine is to rename your executable (or change the PATH to get same result if you can not modify your exe name) and wrap it with a script that has your executable former name (or which is first in the PATH order) which call gdb. The bash script should be something like :
#!/bin/bash
gdb -q -x gdbCommandsFile --args "$@"
with at least 'run' in gdbCommandsFile
, depending on what you want to do ...
my2c
精彩评论