Install-mac-os-sierra.app Scanner Internet Archive HTML5 Uploader 1.6.4 Year 2016. Plus-circle Add Review. Reviews There are no reviews yet. Menu Mac OS X Sierra and Ruby debugging: An unhappy marriage 21 December 2016. In my new role I've found myself having to debug Ruby native gems again. Debugging C code is normally a pretty mundane task involving lots of poking around with gdb, and one I've done many times before in a previous life.
- Install Gdb Mac High Sierra
- Install Gdb For Mac Sierra Free
- Install Gdb For Mac Sierra Os
- Install Gdb For Mac Sierra
- Install Gdb For Mac Sierra Update
Question or issue on macOS:
I am a new Mac user and wonder how to install the latest version of GDB (> 7.1). I prefer to use Homebrew, but I could not find GDB listed.
What is the best way to do it?
When installed Xcode, it may have installed an older version. Currently,
But I need version > 7.1
System version,
How to solve this problem?
Solution no. 1:
Homebrew does not provide gcc and the associated development tool formulas over concerns that custom/non-system compilers could break builds. Two possibilities for easiness:
- Use http://www.macports.org/
- Look here https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers
This is probably the command for you:
Solution no. 2:
Some new users may find themselves in the same situation given the Mac OS X v10.9 (Mavericks) upgrade.
Solution
Install the development tools and Xcode
Then install Homebrew
Then do:
You will notice that some applications will not allow you to use the newly added GDB.
This is because it is not signed by Apple any more.
To side step this issue: Follow this; thanks to @andre
I’ve had some people hit me up on IRC for more detailed instructions for this. I made a post on my site. You can find it here.
Solution no. 3:
This does not directly answer the given question, but if you’re like me, what you really want is a simple way to run (something very much like) gdb.
Apple now uses Clang as its compiler, and it turns out that the clang debugger, lldb, is installed along with the other command-line tools. It appears that lldb is designed with a user interface that mimics gdb very closely.
So, the answer to your question may in fact be:
just use lldb!
Hope this helps!
Question or issue on macOS:
I get gdb by brew install gdb.
The source file content is:
Here is the executable file named 'demo':
https://pan.baidu.com/s/1wg-ffGCYzPGDI77pRxhyaw
I compile the source file like this:
And run gdb
But, it can't work. It can't recognized the executable file.
I use file demo,its ouput is demo: Mach-O 64-bit executable x86_64
I use file ./demo,its output is ./demo: Mach-O 64-bit executable x86_64
Type c++ -v, output is :
run ./demo,its output is 55
type show configuration in gdb,it shows:
Who can help me ? Thank you very much !!!
Install Gdb Mac High Sierra
How to solve this problem?
Solution no. 1:
The problem is that clang-1000.11.45.2
distributed with Apple LLVM version 10.0.0
add a new load command to o-mach executables named LC_BUILD_VERSION
.
From the apple source:
So currently bfd
(program used by gdb to manipulate executables) is not able to interpret this command, and returns the error.
The temporary solution I found is directly edit bfd
sources provide with gdb
.
I've only test with gdb-8.0.1
.
First, download gdb-8.0.1
sources from mirrors. Then add to gdb-8.0.1/bfd/mach-o.c
the following code at line 4649
:
And finally add int gdb-8.0.1/include/mach-o/loader.h
:
at line 189
(don't forget to add a ,
at the end of the line 188 after BFD_MACH_O_LC_VERSION_MIN_WATCHOS = 0x30
).
After these instructions you can follow a classic gdb
compilation as indicate inside the README :
Don't forget to sign gdb
as explain here.
If you still get the (os/kern) failure (0x5) error, just run sudo gdb
.
This is a temporary solution waiting for the GNU team fix the problem directly on the repo.
EDIT
Binutils-gdb
has been updated, these changes are now implemented in commit fc7b364.
Hope It will be helpfull.
Solution no. 2:
I published a temporary brew formula that seems to work, while awaiting for official brew formula to be updated:
brew install https://raw.githubusercontent.com/timotheecour/homebrew-timutil/master/gdb_tim.rb
Solution no. 3:
Upgrade to GDB version 8.3. Also see Issue 23728, binutils fail on macOS 10.14 (Mojave) due to unimpl in the Binutils bug tracker.
From the bug report:
I've found the root of the issue. binutils does not handle load
command 0x32 LC_BUILD_VERSION (nor 0x31 LC_NOTE, actually). They are
defined in recent LLVM versions: see
https://github.com/llvm-mirror/llvm/blob/master/include/llvm/BinaryFormat/MachO.def#L77
Looking at the output of objdump -private-headers there is one clear
difference:
@@ -56,16 +56,18 @@ attributes NO_TOC STRIP_STATIC_SYMS LIVE
reserved1 0
reserved2 0
Load command 1
- cmd LC_VERSION_MIN_MACOSX
- cmdsize 16
- version 10.13
- sdk n/a
+ cmd LC_BUILD_VERSION
+ cmdsize 24
+ platform macos
+ sdk n/a
+ minos 10.14
+ ntools 0
Load command 2
cmd LC_SYMTAB
cmdsize 24
LC_VERSION_MIN_MACOSX is implemented in binutils, while
LC_BUILD_VERSION is not. It is apparently new in Mojave.
Solution no. 4:
I have got a good solution for me from stack overflow and I do not know why it works.
Here is the link.
I am new to macOS, and I do the following:
- Codesign gdb 8.0.1 in high Sierra
- Update to Mojave
- gdb 8.0.1 died with
BFD: /Users/xxx/Codes/demo: unknown load command 0x32
- Change to gdb 8.2.1 and come across Keychain error
Unknown Error -2,147,414,007
.Solve this by getting the certificate in
Login
then export it and import it intoSystem
(Delete it from Login if unable to import). - Finally, because of some kind of errors it still does not work and it comes with
ERROR: Unable to start debugging. Unexpected GDB output from command '-exec-run'. Unable to find Mach task port for process-id 1510: (os/kern) failure (0x5).
, according to how to undo codesign, something wrong still exist and the answer tells me to
(please check gdb is codesigned - see taskgated(8))brew reinstall gdb
, but it still does not work, I called it a day yesterday. - Finally I come across that link, I AM HAPPYY, now I am able to debug!
Hope my solution can help.
Solution no. 5:
I got gdb working on Mojave by:
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) build gdb. I got errors for variable shadowing in darwin-nat.c so I edited the file and rebuilt.
c) follow steps in https://forward-in-code.blogspot.com/2018/11/mojave-vs-gdb.html
Voila.
(source: GDB on Mac/Mojave: During startup program terminated with signal ?, Unknown signal)
Solution no. 6:
gdb 8.2 installed from Homebrew is not compatible with Mac mojave.
I have upgrade to 8.2.1. The issue should be resolved.
Solution no. 7:
The answer by timotheecour above did work for me:
brew install https://raw.githubusercontent.com/timotheecour/homebrew-timutil/master/gdb_tim.rb
Then I had to generate a generate a self-signed certificate as in
https://www.thomasvitale.com/how-to-setup-gdb-and-eclipse-to-debug-c-files-on-macos-sierra/
Install Gdb For Mac Sierra Free
Solution no. 8:
Install Gdb For Mac Sierra Os
I got past this issue on Mojave by thinning the app. GDB does not understand universal binaries. So if file myapp
tells you myapp is a universal binary, try this:
Install Gdb For Mac Sierra
And then