加载的符号非常慢

时间:2012-05-06 09:31:12

标签: c++ macos gdb

我最近注意到gdb在从目标应用程序开始执行代码之前需要很长时间。我无法弄清楚为什么。我正在使用MacOS 10.6.5和GNU gdb 6.3.50-20050815(Apple版本gdb-1510)

如果我用CTRL-C中断它,我可以从backtrace(下面)看到以下输出。它看起来像卡住加载符号?

无论如何,我对于gdb如何在幕后工作是相当不熟悉的。有人可以向我建议一些改进措施吗?

#0  0x00007fff5fc05136 in __dyld__ZN4dyldL10loadPhase5EPKcRKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE ()
#1  0x00007fff5fc0523f in __dyld__ZN4dyldL10loadPhase4EPKcRKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE ()
#2  0x00007fff5fc0599e in __dyld__ZN4dyldL10loadPhase3EPKcRKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE ()
#3  0x00007fff5fc05a47 in __dyld__ZN4dyldL10loadPhase1EPKcRKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE ()
#4  0x00007fff5fc05b65 in __dyld__ZN4dyldL10loadPhase0EPKcRKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE ()
#5  0x00007fff5fc05bf0 in __dyld__ZN4dyld4loadEPKcRKNS_11LoadContextE ()
#6  0x00007fff5fc06a5d in __dyld__ZN4dyldL14libraryLocatorEPKcbS1_PKN11ImageLoader10RPathChainE ()
#7  0x00007fff5fc0c746 in __dyld__ZN11ImageLoader22recursiveLoadLibrariesERKNS_11LinkContextEbRKNS_10RPathChainE ()
#8  0x00007fff5fc0c66f in __dyld__ZN11ImageLoader22recursiveLoadLibrariesERKNS_11LinkContextEbRKNS_10RPathChainE ()
#9  0x00007fff5fc0c66f in __dyld__ZN11ImageLoader22recursiveLoadLibrariesERKNS_11LinkContextEbRKNS_10RPathChainE ()
#10 0x00007fff5fc0c7b6 in __dyld__ZN11ImageLoader4linkERKNS_11LinkContextEbbRKNS_10RPathChainE ()
#11 0x00007fff5fc04d48 in __dyld__ZN4dyld4linkEP11ImageLoaderbRKNS0_10RPathChainE ()
#12 0x00007fff5fc068d6 in __dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_ ()
#13 0x00007fff5fc016d2 in __dyld__ZN13dyldbootstrap5startEPK12macho_headeriPPKcl ()
#14 0x00007fff5fc01052 in __dyld__dyld_start ()

1 个答案:

答案 0 :(得分:0)

我认为这是由于在gdb代码中反复设置/恢复信号处理程序造成的。当我使用

ptrace -p

我得到匹配的系统调用页面...

rt_sigaction(SIGSEGV,{SIG_DFL,[],SA_RESTORER,0x3bfc60f710},NULL,8)= 0 rt_sigaction(SIGSEGV,{0x68a820,[],SA_RESTORER | SA_STACK,0x3bfc60f710},{SIG_DFL,[],SA_RESTORER,0x3bfc60f710},8)= 0 rt_sigprocmask(SIG_BLOCK,NULL,[],8)= 0 rt_sigaction(SIGSEGV,{SIG_DFL,[],SA_RESTORER,0x3bfc60f710},NULL,8)= 0 rt_sigaction(SIGSEGV,{0x68a820,[],SA_RESTORER | SA_STACK,0x3bfc60f710},{SIG_DFL,[],SA_RESTORER,0x3bfc60f710},8)= 0 rt_sigprocmask(SIG_BLOCK,NULL,[],8)= 0 rt_sigaction(SIGSEGV,{SIG_DFL,[],SA_RESTORER,0x3bfc60f710},NULL,8)= 0 rt_sigaction(SIGSEGV,{0x68a820,[],SA_RESTORER | SA_STACK,0x3bfc60f710},{SIG_DFL,[],SA_RESTORER,0x3bfc60f710},8)= 0 rt_sigprocmask(SIG_BLOCK,NULL,[],8)= 0 rt_sigaction(SIGSEGV,{SIG_DFL,[],SA_RESTORER,0x3bfc60f710},NULL,8)= 0 rt_sigaction(SIGSEGV,{0x68a820,[],SA_RESTORER | SA_STACK,0x3bfc60f710},{SIG_DFL,[],SA_RESTORER,0x3bfc60f710},8)= 0 rt_sigprocmask(SIG_BLOCK,NULL,[],8)= 0 rt_sigaction(SIGSEGV,{SIG_DFL,[],SA_RESTORER,0x3bfc60f710},NULL,8)= 0 rt_sigaction(SIGSEGV,{0x68a820,[],SA_RESTORER | SA_STACK,0x3bfc60f710},{SIG_DFL,[],SA_RESTORER,0x3bfc60f710},8)= 0 rt_sigprocmask(SIG_BLOCK,NULL,[],8)= 0 rt_sigaction(SIGSEGV,{SIG_DFL,[],SA_RESTORER,0x3bfc60f710},NULL,8)= 0 rt_sigaction(SIGSEGV,{0x68a820,[],SA_RESTORER | SA_STACK,0x3bfc60f710},{SIG_DFL,[],SA_RESTORER,0x3bfc60f710},8)= 0 rt_sigprocmask(SIG_BLOCK,NULL,[],8)= 0