How to install GDB in Mac OS and code signing for GDB

Source: Internet
Author: User
Tags install homebrew administrator password

1. Installing GDB

GDB has been a good companion to program apes as a powerful, C + + debugging tool, but to Mac OS only to discover that there is no default installation, fortunately there are powerful homebrew tools:

Brew Install Homebrew/dupes/gdb

Then is the long wait + compile the installation time, after the installation is done, tapping GDB can print out the version information, indicating that the correct installation:

If you use GDB to debug your program now, you'll find that it doesn't work:

2. Generate a Certificate

This is because the security mechanism of Mac OS prevents our GDB from having full control over the program to be debugged, so we need to assign the appropriate permissions to GDB, first we need to add the corresponding keychain (keychain) in keychain access:

Then enter the name and type of the certificate in the input box below:

Specify the validity period:

All the way "continue", know that appears for our certificate Select location (Specify a locations for the Certificate) Note: "System" is selected here (if you cannot select the system here, you can choose login, Only after generating the corresponding certificate, you need to manually export the certificate, and then manually import the Gdb-cert into the system):

Well, after "create", our certificate was successfully generated. D

Next, we select "Always Trust" the certificate we just generated so that we don't have to manually enter the administrator password each time we run GDB:

3. Signing a certificate for GDB

After completing the above steps you can exit keychain access, but this is not enough, to sign GDB, we also need to kill a special process:

Open Activity Monitor, enter ' taskgated ' in the search box in the CPU column, and then double-click on the line of the process, and click ' Quit ', which is what you will find the taskgated process is gone (a good innocent process: (). GDB can now be signed:

Codesign-s Gdb-cert/usr/local/bin/gdb

Where '/usr/local/bin/gdb ' is where gdb is located in My computer (in fact it isa soft link to '/usr/local/cellar/gdb/7.8.1/bin/gdb '), this command performs without any output.

Note: If you want to cancel the signing of GDB's certificate one day, you can use ' codesign--remove-signature/usr/local/bin/gdb ' to complete it, if your gdb-cert signature is still there.

Okay, now you can use GDB for debugging, wait!

Kill the taskgated process again first (yes, tenacious taskgated is just restarted in the background and killed by us: ( )

At this point, it is merit perfection, quickly using GDB to try to run our program it:

4. Reference Links:

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

http://ntraft.com/installing-gdb-on-os-x-mavericks/

How to install GDB in Mac OS and code signing for GDB

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.