4

我最近注意到 gdb 需要很长时间才能开始从我的目标应用程序执行代码。我不知道为什么。我正在使用 MacOS 10.6.5 和 GNU gdb 6.3.50-20050815(Apple 版本 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 ()
4

1 回答 1

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, 0x3bfc60, 0x3bfc60, ) = 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_0f710}, 0x3bfc 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0SA_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) = 0SA_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

于 2020-07-30T21:03:48.890 回答