gdb os x sierra 10.12.3 not working

喜你入骨 提交于 2019-12-05 08:07:10

问题


the problem is already known, that gdb doesn't work with OS X Sierra anymore.

This is really annoying, since I researched already about the solution, and there were some solutions, but they apparently don't work anymore. I tried to use the .gdbinit file solution and the disable csrutil solution, both doesn't work.

Sooo my question is: Does anyone know how to fix it in 10.12.3 ?

Thank you very much!


回答1:


Looks like there still isn't a solution to this. I don't think "use LLDB instead of GDB" is the ultimate solution. So I went ahead and built a fairly basic docker container which contains the very basics (g++ and gdb).

Here is the Docker Hub container, and the the Dockerfile is on this Github repo.

This solution at least allows you to use GDB on your Mac via a couple simple commands. And since the folder you're coding on is mounted, as soon as you hit save, all your changes appear automatically.

Hope this helps someone else out there.




回答2:


So thanks to Basile Starynkevitch, who just gave me the idea to update gdb

SOLUTION:

You simply have to update gdb for the latest version (which is 7.12.1 currently). Assuming you have installed Homebrew:

That's what I did:

brew update 
brew remove gdb
brew install gdb

It has now updated to the latest version.

Now codesign gdb again with the cert that you used before.

sudo killall taskgated
codesign -fs gdb-certi /usr/local/bin/gdb 
launchctl load /System/Library/LaunchDaemons/com.apple.taskgated.plist

Last step is still to use the workaround to create the .gdbinit file:

nano ~/.gdbinit 

-> set startup-with-shell off

Debugging works for me now :) (OS X Sierra 10.12.3 - gdb 7.12.1).

UPDATE:

Apparently it will fix certain problems, but not the whole problematic itself. It will still cause errors. Honestly, my solution: When you can: Switch to LLDB and another IDE (Netbeans does not support LLDB). Or use Linux. I currently use Ubuntu with a stick on my MacBook Pro.




回答3:


None GDB 7.11 or 7.12.1 will not work on Sierra 10.12.4 In short it's because of Apple security upgrade. We need to wait for re-enabling when some new version will shows up.

Easy WA is to use LLDB as a debugger for now. Sample instructions here

Another LLDB instruction here




回答4:


I found that gdb 7.12.1 did not work for me either. I do not think it includes the crucial commit 82b19a4d2f9c9e8d56f to gdb made on the 9th Nov 2016. I was able to get the gdb 8.0 development branch to work, however.

Download with, e.g.

git clone --depth 1 --branch gdb-8.0-branch git://sourceware.org/git/binutils-gdb.git

Then go into the checked-out directory

cd binutils-gdb

I have macports so (a) wanted to link to macports libraries and (b) wanted to avoid putting stuff in /usr/local so configured with

./configure prefix=$HOME LDFLAGS="-L/opt/local/lib" CPPFLAGS="-I/opt/local/include"


make -j8

make install

=> puts gdb executable into ~/bin; (static) libraries into ~/lib; documentation into ~/share

Then follow André's tip above to do the code signing; though it will now be codesign -fs gdb-certi ~/bin/gdb



来源:https://stackoverflow.com/questions/42320878/gdb-os-x-sierra-10-12-3-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!