Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Abort trap 6: when running gdb on Mac OS

I have installed gdb on my Mac (with Mac OS 10.9 / Mavericks) via homebrew and codesigned it successfully.

Before starting a debug session with gdb I compiled my C-files like in this example:

gcc -g test.c -o test

Afterwards I called gdb:

Users-MacBook-Pro:Test User$ gdb ./test
GNU gdb (GDB) 8.0.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin13.4.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./test...Reading symbols from /Users/User/Test/test.dSYM/Contents/Resources/DWARF/test...done.
done.

Calling gdb commands like r or sta always results in the following error:

(gdb) r 
Abort trap: 6

What is the problem? Any ideas how to fix it?

like image 760
HerthaBSC Avatar asked Jan 13 '18 16:01

HerthaBSC


1 Answers

I'd suggest rebuilding gdb from the scratch. Instead of using some pre-built installations, you can always try to install it by yourself:

mkdir src
cd src
curl "http://ftp.gnu.org/gnu/gdb/gdb-8.0.tar.gz" -o gdb-8.0.tar.gz
tar zxf gdb-8.0.tar.gz
cd gdb-8.0
./configure --prefix=$HOME/opt/usr/local
make
make install

Remember to sign it before you can use it: https://gcc.gnu.org/onlinedocs/gcc-4.8.1/gnat_ugn_unw/Codesigning-the-Debugger.html

This way, you can easily debug your code. For details of installation, take a look here: Running GDB in macOS sierra

like image 84
Oo.oO Avatar answered Oct 11 '22 02:10

Oo.oO