0

I'd like to debug my program through eclipse-cdt or emacs. But, now both of them fail because gdb is not certificated yet in Yosemite.

My gdb installation status is here. I installed gdb through home-brew.

dplee@dpleeui-MacBook-Pro ~/w/fish-shell> uname -a
Darwin dpleeui-MacBook-Pro.local 14.4.0 Darwin Kernel Version 14.4.0: 

Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64

dplee@dpleeui-MacBook-Pro ~/w/fish-shell> gdb --version
GNU gdb (GDB) 7.9.1
Copyright (C) 2015 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-darwin14.3.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".

If I execute gdb, I continue to encounter the same error message as below.

(gdb) b main
Breakpoint 1 at 0x10020b9a9: file fish.cpp, line 512.
(gdb) r
Starting program: /Users/dplee/work/fish-shell/fish 
Unable to find Mach task port for process-id 719: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))
(gdb) 

I followed these guide lines, but I can't restart task gated because it's process id is 0.

https://sourceware.org/gdb/wiki/BuildingOnDarwin

https://stackoverflow.com/questions/11504377

    dplee@dpleeui-MacBook-Pro ~/w/fish-shell> ps -ef| grep taskgate
    0    91     1   0  4:28PM ??         0:01.08 /usr/libexec/taskgated -s
  501   826   350   0  5:04PM ttys000    0:00.00 grep taskgate

Is there anyone who has already faced through this issue and is using eclipse and emacs debugging functions with gdb? I really like to use gdb with emacs in MacOS.

Community
  • 1
  • 1
cloudrain21
  • 649
  • 5
  • 17

2 Answers2

0

I found the answer here about eclipse with gdb in MacOS Yosemite.

In brief, the gdb team almost stopped updating gdb in os x and supporting only lldb. Many c++ developers are having trouble with this issue. Some of them are moving to Xcode, but they say it's not so nice IDE as eclipse-cdt.

If you still want to use eclipse as your debugger, there's one way you can try. Here is Jim Knarf's comment. (See Comment #23)

You need to download GDB source code from http://www.gnu.org/software/gdb/download/
Then after building it, you will need to "sign" the application with appropriate certificate, and reboot the system before you can use it. See https://sourceware.org/gdb/wiki/BuildingOnDarwin about how to use 'codesign' and 'task gated' commands.

Here are the steps you need to take:

1. download gdb source code
2. become root (su command)
3. build the application using configure, make, and make install commands
4. put the new gdb application to /usr/local/bin
5. vi /System/Library/LaunchDaemons/com.apple.taskgated.plist
      change option -s to -sp
      and save the file
6. spctl --master-disable
7. create 'gdb-cert' certificate in System using Keychain Access application
8. codesign -s gdb-cert `which gdb`
9. restart the computer.

Now you can use gdb as a standalone debugger or use it in Eclipse.
cloudrain21
  • 649
  • 5
  • 17
0

If you want to use lldb in eclipse, this can be your another option. https://github.com/freedib/lldbmi2

cloudrain21
  • 649
  • 5
  • 17