gdb来自Linux/gdb世界,默认情况下,在检测到SEGV之前,gdb会在默认处理程序清理进程之前中断程序的执行。
11分局怎么能做类似的把戏呢?目前,该进程只是退出,使得无法查询回溯等。
编辑:proccess handle -p true -n true -s true尝试-没有结果:(
(lldb) process handle -p true -n true -s true SIGSEGV
NAME PASS STOP NOTIFY
========== ===== ===== ======
SIGSEGV true true true
(lldb) run
Process 97630 launched: '/Volumes/My Finder Extensions 1/My_Daemon.app/Contents/PlugIns/My_ShellExt.appex/Contents/MacOS/My_ShellExt' (x86_64)
Process 97630 exited with status = 0 (0x00000000) Terminated due to signal 9编辑:更多信息:
(lldb) bt all
error: invalid thread我怀疑lldb不会很好地处理损坏的堆栈--我正试图找到一个涉及_NSExtensionMain入口点的问题,或者从那里开始的问题。
发布于 2014-10-23 13:52:31
您应该根据process handle SIGSEGV --notify true --pass true --stop true在lldb上键入this。
(Lldb)进程句柄SIGSEGV --通知真--传递真--停止真
发布于 2014-10-23 18:11:04
我做了一个快速测试程序,
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
void handler (int in)
{
puts ("signal received");
}
int main ()
{
signal (SIGSEGV, handler);
kill (getpid (), SIGSEGV);
return 0;
}然后,我尝试调试它,让lldb停止在SIGSEGV上。
(lldb) br s -n main
(lldb) r
(lldb) pr h -p true -n true -s true SIGSEGV
NAME PASS STOP NOTIFY
========== ===== ===== ======
SIGSEGV true true true
(lldb) c
Process 5024 resuming
Process 5024 stopped
(lldb) bt
* thread #1: tid = 0x19d6ae, 0x00007fff8f27fc7e libsystem_kernel.dylib`__kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSEGV
* #0: 0x00007fff8f27fc7e libsystem_kernel.dylib`__kill + 10
#1: 0x0000000100000f25 a.out`main + 53 at a.c:13
#2: 0x00007fff8c0e65c9 libdyld.dylib`start + 1
(lldb) c
Process 5024 resuming
signal received
Process 5024 exited with status = 0 (0x00000000)
(lldb) 好的,这看起来和我们预期的一样。我还可以要求lldb不间断地转发信号:
(lldb) br s -n main
(lldb) r
(lldb) pr h -p true -n true -s false SIGSEGV
NAME PASS STOP NOTIFY
========== ===== ===== ======
SIGSEGV true false true
(lldb) c
Process 5055 resuming
Process 5055 stopped and restarted: thread 1 received signal: SIGSEGV
signal received
Process 5055 exited with status = 0 (0x00000000)
(lldb) 看起来它做了我们想做的事情: lldb通知我们信号已经接收,然后发送给程序。
这是在Mac上安装了Xcode 6。
https://stackoverflow.com/questions/26529581
复制相似问题