views:

162

answers:

2

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.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?

A: 

Maybe you need to use the -batch option.

Peter Stuifzand
just tried it, still seems to get stuck in the same place.
cobbal
A: 

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
cobbal