我最近注意到,gdb在开始从我的目标应用程序执行代码之前需要很长时间。我不知道为什么。我使用的是MacOS 10.6.5和GNU gdb 6.3.50-20050815 (苹果版本gdb-1510)
如果我使用CTRL-C中断它,我可以从回溯看到以下输出(如下所示)。看起来它在加载符号时卡住了?
无论如何,我对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 ()发布于 2020-07-31 05:03:49
我认为这是由于在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,[],{SIG_DFL,[],SA_RESTORER,0x3bfc60f710},8) =0 rt_sigprocmask(SIG_BLOCK,NULL,[],8) =0
https://stackoverflow.com/questions/10469508
复制相似问题