环境:Mac/Mojave 和 GDB 8.2.1(通过自制软件)。
我按照说明工作https://forward-in-code.blogspot.com/2018/11/mojave-vs-gdb.html即:
通过 brew 的最新 GDB,它解决了可执行格式问题
用新的权利签署 GDB
此外,我还修改了 SIP 以允许调试(在 Recovery OS 终端中:)csrutil enable --without debug
。
但是,我仍然无法让 gdb 工作:
(gdb) file main
Reading symbols from main...done.
(gdb) run
Starting program: /Users/joubertold/code/Rhodus/obj/debug/main
[New Thread 0x1a03 of process 5082]
[New Thread 0x2803 of process 5082]
During startup program terminated with signal ?, Unknown signal.
(gdb)
有趣的是,lldb 在同一个二进制文件上为我工作:
(lldb) file main
Current executable set to 'main' (x86_64).
(lldb) run
Process 5086 launched: '/Users/joubertold/code/Rhodus/obj/debug/main' (x86_64)
Rhodus
1 is ONE
1 is between 1 and 10
1 is between 1 and 10
1 is between 1 and 10
1 is between 1 and 10
1 is between 1 and 10
1 is between 1 and 10
1 is between 1 and 10
1 is between 1 and 10
1 is beyond
1 is beyond
1 is beyond
Process 5086 exited with status = 0 (0x00000000)
(lldb)
有什么想法吗?