gdb从命令行运行,但不是从脚本运行

问题描述:

如果我在控制台gdb中执行此脚本的每一行,它将按预期运行(除了挂起挂起,但我可以解决这个问题。)但是,如果我将它保存到脚本文件并使用-x选项运行gdb,它挂在[Visor install]行上。很高兴知道它为什么这样做,或者甚至只是一个黑客的解决方法。gdb从命令行运行,但不是从脚本运行

脚本:

break -[NSApplication finishLaunching] 
run 
p (char)[[NSBundle bundleWithPath:@"~/Library/Application Support/SIMBL/Plugins/Visor.bundle"] load] 
p (char)[Visor install] 
detach 
quit 

运行有:

gdb ~/Desktop/misc/dt/dt2/VisorTerminal.app/Contents/MacOS/Terminal -x load.gdb 

版本:

$ 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". 

更新:

如果我cat将文件转换成GDB挂起,除非在线之间存在3次等待,这可能是多线程问题还是什么?

也许你需要使用-batch选项。

+0

刚刚尝试过它,似乎仍然陷在了同一个地方。 – cobbal 2009-12-07 20:29:00

丑陋的解决方法:在问题调用之前添加一个睡眠呼叫。更好的解决方案仍然值得赞赏。

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