macOS Mojave上的GDB错误 [英] GDB errors on macOS Mojave

查看:151
本文介绍了macOS Mojave上的GDB错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

环境: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

Voila.

这篇关于macOS Mojave上的GDB错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆