2012-08-11 60 views
0

爲什麼該程序的otx(otool)程序集輸出中沒有來自gdb backtrace輸出的地址?我的印象是,他們對應於我的otool asm輸出中的偏移量......我很抱歉如果這是一個愚蠢的問題。 gdb backtrace輸出和otx(otool)輸出?

(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> 

回答

0

的以下可以幫助你:在全局和局部範圍定義

  • 變量可能由於地址空間佈局隨機化(ASLR)不同的地址
  • 堆中分配的變量可能有不同地址由於ASLR,如果您的程序是多線程的

在Linux上GDB默認爲disa bles ASLR。在Mac上試用禁用ASLR。