Troubleshooting the certificate generationIf it does not show the script we want to run, revert to the standard way to run a script: right-click in the Editor tab for that script, and then select Run Asand Python Run. What to do if the Eclipse IDE does not start The Eclipse IDE requires at least Java 11 to run. You should eventually see a screen like this.To start Eclipse, double-click the eclipse.exe (Microsoft Windows) or eclipse (Linux / Mac) file from your installation directory. After that point, you can keep hitting 'yes' and select all the default options (unless you want to change something). You should see a window like the one below Select the first 'Eclipse IDE for Java Developers' option.Brew install The pinning operation makes sure that brew doesn't upgrade gdb to newer versions.In case you have already a newer version of gdb, you first need to unlink the other version before installing the old one. Install gdb 8.0.1Should you decide to do so, you can install gdb version 8.0.1 in this way. Install gdb 8.3 (recommended)To install the latest version of gdb, run this command: brew install gdbVerify that the operation was successfull by running: gdb -versionTake note of the version: you'll need it later. In this tutorial, I'm going to use gdb 8.3. You can either use gdb 8.0.1 or one of the latest versions, starting from 8.3. If you're using High Sierra (macOS 10.13) or later, be aware that gdb 8.1 and 8.2 are not compatible.
Launch Keychain Access application: Applications > Utilities > Keychain Access. For security reasons, this is the default behaviour.To give gdb those permissions, you need to generate a self-signed certificate. If you try debugging a file, you'll get an error since the Darwin kernel doesn't allow gdb to control another process without having special rights. Generate a certificateInstalling gdb is not enough. After these steps, you can see the new certificate under System keychains. Finally, you can click on the Create button. Here you need to set Keychain to System. At this point, you can go on with the installation process until you get the Specify a Location For The Certificate dialogue box. Check the Let me override defaults checkbox. From the toolbar, go to Keychain Access > Certificate Assistant > Create a Certificate. Here there are a few things you can try to solve the problem. It seems that the error is related to the creation of the certificate in the System keychain. Then, from the Keychains list on the left, right-click on the System item and select Lock Keychain "System".Troubleshooting the certificate generationAt the end of the procedure to generate a certificate, you might get the following error message: Unknown error: -2,147,414,007This kind of error has bothered a lot of macOS users over the past years, I don't know why Apple has not replaced it with a more meaningful message yet. In the dialogue box, expand the Trust item and set Code signing to Always Trust. Best compact laser printer for macPlease leave a comment if you are encountering any other error during the procedure. Finally, delete the certificate originally created in the login folder (it's not done automatically).Notice that once you have created the certificate using one of the previous workarounds, you still need to go through steps 9 to 11 of the prior section.I hope that one of the solutions worked well for you. Then, go in the System folder, choose File -> Import items from the toolbar and select your certificate. If the drag-and-drop option doesn't work for you, then find your certificate in the login keychain, select it, then choose File -> Export items from the toolbar and save the certificate somewhere on your disk. Create the certificate in the login keychain and then drag and drop the newly created certificate, the public key and the private key from the login keychain to the System keychain. If it is and you're still getting the same error, than you can use a workaround. Instead, you need to run this command: codesign -fs gdb-cert gdbPathWhere gdb-cert is the name of your certificate and gdbPath is the full path to your gdb binary file. Com.apple.security.cs.allow-unsigned-executable-memoryCom.apple.security.cs.allow-dyld-environment-variablesCom.apple.security.cs.disable-library-validationCom.apple.security.cs.disable-executable-page-protectionThen, open your Terminal prompt, go to the directory where you saved the xml file and run: codesign -entitlements gdb-entitlement.xml -fs gdb-cert gdbPathIf you're using macOS High Sierra (10.13) or older, you don't need an entitlement configuration. In this case, just for debugging. This will tell the operating system which operations the gdb process has to be trusted. If you're using maOS Mojave (10.14) or later, create a gdb-entitlement.xml file. If you use Eclipse, follow the next step. Gdbinit and write the following command in it: set startup-with-shell offAlternatively, from the Terminal, you can do that by running this: echo "set startup-with-shell off" > ~/.gdbinitNow you can use gdb for debugging files on your Mac. Create a gdb command fileIf you are on macOS Sierra (10.12) or later, you need to do this extra step.In the home directory, create a new file called. /usr/local/Cellar/gdb/8.3/bin/gdb). Set GDB debugger to the full path of your gdb binary file (the same used for signing the certificate) Open the Debugger tab from the menu on the right Select a launch configuration from the list on the left (e.g. Troubleshooting the Eclipse configurationIf there is no GDB option in Eclipse > Preferences > C/C++ > Debug, then you need first to debug any C/C++ project. From the left menu select C/C++ > Debug > GDBNow, you can debug files from inside Eclipse using gdb. Gdbinit file: ~/.gdbinit (or the extended form /Users/yourname/.gdbinit, where yourname is your username)In case you want to define a default configuration for gdb to be used in any Eclipse project, these are the steps to follow: Execute Code In Eclipse How To Install GdbConclusionIn this tutorial, I've shown you how to install gdb and use it to debug a C/C++ application on macOS.Special thanks to those people who helped me improve this article by commenting with suggestions and tips. The operation will fail since you haven't configured gdb yet, but in this way, you will be able to see the gdb option in the main Preferences window.
0 Comments
Leave a Reply. |
AuthorAmy ArchivesCategories |