macOS Mojave 上的 GDB 错误 [英] GDB errors on macOS Mojave
问题描述
环境:Mac/Mojave 和 GDB 8.2.1(通过自制软件).
Environment: Mac/Mojave and GDB 8.2.1 (via homebrew).
我按照说明工作 https://forward-in-code.blogspot.com/2018/11/mojave-vs-gdb.html 即:
I worked through instructions https://forward-in-code.blogspot.com/2018/11/mojave-vs-gdb.html i.e.:
通过brew的最新GDB,解决了可执行格式问题
latest GDB via brew, which solves the executable format issue
用新的权利签署 GDB
sign GDB with new entitlements
此外,我还修改了 SIP 以允许调试(在 Recovery OS 终端中:csrutil enable --without debug
).
Additionally, I've also modified SIP to allow debugging (in Recovery OS terminal: csrutil enable --without debug
).
但是,我仍然无法让 gdb 工作:
However, I still can’t get gdb to work:
(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 在同一个二进制文件上为我工作:
Interestingly, lldb works for me on the same binary:
(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)
有什么想法吗?
推荐答案
我让 gdb 在 Mojave 上工作:
I got gdb working on Mojave by:
a) 获取最新的 gdb 源存档(在撰写本文时,ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-8.2.50.20190212.tar.xz) - 除其他外,它增加了识别可执行文件的处理在 Mac 上.
a) getting the latest gdb source archive (at time of writing, ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-8.2.50.20190212.tar.xz) - amongst other things, it adds handling for recognizing executables on Mac.
b) 构建 gdb.我在 darwin-nat.c 中遇到变量阴影错误,所以我编辑了文件并重建(diff https:///gist.github.com/joubertnel/267ca0fff4eaad494cc19ec3ba7953ed).
b) build gdb. I got errors for variable shadowing in darwin-nat.c so I edited the file and rebuilt (diff https://gist.github.com/joubertnel/267ca0fff4eaad494cc19ec3ba7953ed).
c) 遵循 https://中的步骤forward-in-code.blogspot.com/2018/11/mojave-vs-gdb.html
瞧.
这篇关于macOS Mojave 上的 GDB 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!