gdb回溯输出和otx(otool)输出?

时间:2012-08-11 19:47:18

标签: debugging assembly gdb otool

为什么这个程序的otx(otool)程序集输出中没有gdb backtrace输出的地址?我的印象是他们对应我的otool asm输出中的偏移...如果这是一个愚蠢的问题,我道歉。

(gdb) bt
#0  0x9a4e1aa2 in __semwait_signal ()
#1  0x9a4e175e in _pthread_cond_wait ()
#2  0x9a4e12b1 in pthread_cond_timedwait$UNIX2003 ()
#3  0x0d8f3f87 in unregister_ShockwaveFlash ()
#4  0x0d45cf19 in dyld_stub_write$UNIX2003 ()
#5  0x0d6f9d7e in dyld_stub_write$UNIX2003 ()
#6  0x0d72db5a in dyld_stub_write$UNIX2003 ()
#7  0x0d72e24c in dyld_stub_write$UNIX2003 ()
#8  0x0d8eb5a2 in unregister_ShockwaveFlash ()
#9  0x0d95b9c9 in unregister_ShockwaveFlash ()
#10 0x9277df60 in CAOpenGLLayerDraw ()
#11 0x9277e897 in -[CAOpenGLLayer _display] ()
#12 0x92503ef1 in CALayerDisplayIfNeeded ()
#13 0x925032bc in CA::Context::commit_transaction ()
#14 0x92502f04 in CA::Transaction::commit ()
#15 0x958a1dd2 in __CFRunLoopDoObservers ()
#16 0x9585d3ea in CFRunLoopRunSpecific ()
#17 0x9585d1f1 in CFRunLoopRunInMode ()
#18 0x95530e04 in RunCurrentEventLoopInMode ()
#19 0x95530bb9 in ReceiveNextEventCommon ()
#20 0x956b9084 in _AcquireNextEvent ()
#21 0x956aed40 in RunApplicationEventLoop ()
#22 0x100083e2 in fkDecode ()
#23 0x10026167 in fkCall ()
#24 0x100081f6 in fkDecode ()
#25 0x10026167 in fkCall ()
#26 0x100081f6 in fkDecode ()
#27 0x10003be5 in fkRunMain ()
#28 0x00001e84 in main ()</code>

1 个答案:

答案 0 :(得分:0)

以下内容可能会对您有所帮助:

  • 由于地址空间布局随机化(ASLR),全局和本地范围中定义的变量可能具有不同的地址
  • 如果您的程序是多线程的,那么由于ASLR,堆分配的变量可能具有不同的地址

在Linux上,GDB默认禁用ASLR。在Mac上尝试禁用ASLR。