I am using macOS 10.15.2 Catalina and am trying to debug a Hello World C++ program in Eclipse. I have set up gdb debugger by installing it from Homebrew and signing the certificate by following the procedure in the below link.
https://www.thomasvitale.com/how-to-setup-gdb-and-eclipse-to-debug-c-files-on-macos-sierra/
The debugger does not get starts.
I have set gdb settings in the Eclipse as mentioned in the below screenshot.
When I debug the project, I am getting error: Configuring GDB Aborting configuring GDB
(its screenshot is also provided below).
As with GCC, the easiest way to install GDB is through Homebrew. In a Terminal window, run the command brew install gdb , and wait for it to complete. (As usual, it may ask for your password.) Now, we need to code-sign the GDB executable, so it will be allowed to control other processes, as necessary for a debugger.
I just installed it (gdb 8.0) following this procedure as of today, it works on Mac OS High Sierra 10.13. 2 (17C88). For the latest version "brew install gdb" is fine. However, the steps above will allow you to install older versions which is handy.
1.4. To debug your application, select a Java file with a main method. Right-click on it and select Debug As Java Application. If you started an application once via the context menu, you can use the created launch configuration again via the Debug button in the Eclipse toolbar.
If you don't already have gdb on your system, then you'll need to install it. I'm going to show you how to install gdb by using Homebrew. If you have gdb on your system already, you can skip to the Generate a certificate step. If you received an error, then you'll need to install gdb using Homebrew.
Which versions of gdb and Eclipse are you using?
I'll try to mention some aspects with which I had problems in the past.
In case you installed gdb with Homebrew, try setting the "GDB debugger" field to the actual path, something like /usr/local/Cellar/gdb/8.3/bin/gdb
instead of the link /usr/local/bin/gdb
.
Where is your .gdbinit
file located? In the tutorial, it is located in the user home folder, so in the Eclipse debug configuration the GDB command file is set to ~/.gdbinit
. The value in your screenshot doesn't specify an absolute path, it might be looking for it in the wrong place.
Is your gdb certificate part of the System Keychain (rather than the login Keychain)? During the signing have you passed the entitlements file as argument?
I faced a similar problem, and I had to do two steps to fix it. I'm not sure if they are both needed or not:
set startup-with-shell off
My debug configuration in eclipse pointed to this file, but it wasn't reading it until I changed the path to be absolute.
Create a gdb-entitlement.xml file with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
<key>com.apple.security.get-task-allow</key>
<true/>
</dict>
</plist>
Then, open your Terminal prompt, go to the directory where you saved the xml file and run:
codesign --entitlements gdb-entitlement.xml -fs gdb-cert $(which gdb)
Where "gdb-cert" is the certificated you created before for code signing. After those steps and setting the GDB path correctly on Eclipse, debugging worked again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With