gdb works from command line, but not from script
If I execute each line of this script in console gdb it works as expected (except for detach hanging, but I can work around that.) However, if I save it to a script file and run gdb with the -x option it hangs on the [Visor install]
line. It would be nice to know why it's doing this, or even just a hacky workaround for it.
The script:
break -[NSApplication finishLaunching]
run
p (char)[[NSBundle bundleWithPath:@"~/Library/Application Support/SIMBL/Plugins/Visor.bundle"] load]
p (char)[Visor install]
detach
quit
run with:
gdb ~/Desktop/misc/dt/dt2/VisorTerminal开发者_JS百科.app/Contents/MacOS/Terminal -x load.gdb
version:
$ gdb --version
GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009)
...
This GDB was configured as "x86_64-apple-darwin".
Update:
If I cat
the file into GDB it hangs, unless there is a 3 secondish wait between lines, could this be a multithreaded problem or something?
Maybe you need to use the -batch
option.
ugly workaround: add a sleep call right before problem call. A better solution would still be appreciated.
break -[NSApplication finishLaunching]
run
p (char)[[NSBundle bundleWithPath:@"~/Library/Application Support/SIMBL/Plugins/Visor.bundle"] load]
p (void) sleep(10)
p (char)[Visor install]
detach
quit
精彩评论