The question is “How can I install GDB on a Mac?” I’ve never tried - but if you’re using Xcode or the “command line development tools” on the Mac from Apple and want to use a command line debugger, then use “lldb” instead (llvm/clang seems to be t.
- CUDA‐GDB runs on Linux and Mac OS X, 32‐bit and 64‐bit. CUDA‐GDB is based on GDB 7.2 on both Linux and Mac OS X. Supported features CUDA‐GDB is designed to present the user with a seamless debugging environment that.
- Fantastical For Mac Os X Install Gdb For Mac Sierra Imovie Software For Mac Os X Torrent For Mac Os X 10.5 Flac Tools For Os X Verification Code For Apple Id On Mac Os Sierra Free Ms Project For Os X Mac Os X For Pc Amd Download Cubase 6 For Os X Western Digital My Passport For Mac High Sierra.
I downloaded gdb and when I try to run configure, it doesn't work, it appears:
new-host:gdb-7.4 lorota$ ./configure
checking build system type... i386-apple-darwin11.3.0
checking host system type... i386-apple-darwin11.3.0
checking target system type... i386-apple-darwin11.3.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/lorota/downloads/gdb-7.4':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
Someone can help me, please!? Tks..
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
Install Gdb Mac High Sierra
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 !!!
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.
Install Gdb For Mac Sierra
Solution no. 5:
I got gdb working on Mojave by:
Install Gdb For Mac Sierra Os
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/
Solution no. 8:
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:
And then