问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

mac上gdb怎么调试二进制文件

发布网友 发布时间:2022-04-07 18:42

我来回答

2个回答

懂视网 时间:2022-04-07 23:03

  • For the remainder of the tutorial, use /opt/local/bin/gdb-apple as the GDB executable
  • Remember if you want breakpoints in template functions to work, you‘ll need to change your compiler to g++-apple-4.2 instead of g++! This can be done in your Makefiles or in your IDE settings.
  • Install with Homebrew

    1. Install Xcode and Homebrew, if not already installed.
    2. Now install GDB from Homebrew: $ brew tap homebrew/dupes
      $ brew install gdb
    3. For the remainder of the tutorial, use /usr/local/bin/gdb as the GDB executable

    If that worked, then lucky you! Getting it compiled is where many people seem to have trouble. Now you just need to sign it to give it permission to control OS X processes.

    Certifying GDB

    Open up the Keychain Access application (/Applications/Utilities/Keychain Access.app). Navigate via the menu to Keychain Access > Certificate Assistant > Create Certificate...

    技术分享

    Enter a name for the certificate. For this how-to, I‘ll call it "gdb-cert". Set the fields exactly as shown below.

    技术分享

    The maximum validity period is 999 days. I don‘t really want to deal with this again, so I‘m going to max it out.

    技术分享

    Keep clicking the "Continue" button until you are asked for a location. Set it to "System".3

    技术分享

    Success!

    技术分享

    Now make sure the cert is always trusted. Right-click the new certificate and select Get Info. Under the Trust section, set Code Signing to Always Trust.

    技术分享

    技术分享

    Now that we have a certificate, we need to use it to sign GDB. First, we‘ll restart the taskgatedprocess to make sure it picks up the new certificate. Quit Keychain Access (you must quit Keychain Access!) and return to the Terminal for these final commands.

    Find the taskgated process.

    $ ps -e | grep taskgated
    56822 ??         0:03.11 /usr/libexec/taskgated -s
    60944 ttys002    0:00.00 grep --color=auto taskgated

    The first number in the above output is the PID. Use this to kill the process (it will immediately restart itself).

    $ sudo kill -9 56822

    Now you can finally code sign GDB.

    # MacPorts version
    $ codesign -s gdb-cert $(which gdb-apple)
    # Homebrew version
    $ codesign -s gdb-cert $(which gdb)

    Now you should be all set! The OS X Keychain may ask for your password the first time you attempt to debug a program, but it should work!

    Getting it to Work with Eclipse

    There‘s one more step for Eclipse users. You need to specify where Eclipse can find the new GDB. Specify the path to GDB in Preferences > C/C++ > Debug > GDB:

    技术分享

    If you already have some debug configurations, you may need to edit them individually to point to the correct place (under Run > Debug Configurations...):

    技术分享


      1. The CDT developers are planning to support LLDB, but they will have to write a whole new interface, and I think most of them only work on Eclipse in their spare time, so it will likely be at least some months before LLDB support is there.
      2. The procedure is derived from this StackOverflow post and this GDB Wiki page.
      3. If you are unable to save it to the System keychain, then save it to the login keychain. You can later export the cert, and then import it into the System keychain. I didn‘t have to do this, so comment if you have any problem.

    mac上eclipse用gdb调试(转)

    标签:

    热心网友 时间:2022-04-07 20:11

    一、安装GDB1在进行gdb安装前应首先配置好homebrew安装管理工具,由于先前写过Homebrew的详细安装过程(可以参考本人先前经验)2安装好homebrew后,输入如下命令查看homebrew中是否有gdb安装包,可以看到现在的版本中并没有gdb安装包。3输入命令...
    声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
    天将雄师观后感600字 为什么喝酒会降血糖 牛栏山 52度浓香型白酒-购买最佳价格 全兴大曲 52度浓香型白酒-购买最佳价格 笔记本电脑怎么接音箱电脑如何连接外置音箱 笔记本电脑有音箱插孔吗笔记本电脑如何连接喇叭 冰箱压缩机过热启动5秒就停了 周长相等的正方形和圆,其面积比是多少 周长相等的正方形和圆面积比是多少 周长相等的正方形与圆形,边长与半径的比是( ),面积之比是( )。 要有... 竞选班干部的竞选宣言怎么写 升级win10之后开机变慢怎么办 小学大队委竞选宣言该怎么写? 同一台电脑,同样的硬件,win10和win7哪个启动速度快 大队委竞选宣言有哪些? 大队委竞选宣言 win10快速启动设置后,下次开机16秒然后关机再开机又变成以前那么慢了,怎么会这样啊 win10开机16秒正常吗? 急!急!急!区三好学生主要事迹范文 win10固态硬盘开机要16秒 小学五年级竞选大队委,竞选宣言或口号! 电脑开机十六秒。正常吗 装的是win10专业版 没装显卡 区级三好生竞选稿 win10系统恢复前开机7秒回复后16秒 三好生竞选稿400字(火速) 初一市级三好学生演讲稿 争当四好少年的句子、成长宣言,诗歌。句子要短 怎么卸载迈克菲?! 求高手啊! 怎么卸载迈克菲 小学生争章宣言怎么写? 系统是win10最新版,就是redstone,查看c盘4k对齐为bad,用分区助手进行对齐 win10哪些开机系统启动项可以关闭,求大神看下。实际开机有16秒,以前只要11秒的 联想电脑开机12秒WIN10系统,但是打开软件很慢, 新人求助,760p装的win10开机还要十几秒,装 win10在升级1703后出现的问题 WIN10突然这个状况,求大佬解决 iphone12短信横屏怎么恢复 换了以前的微信好友怎么找回来? iphone4短信横屏了怎么切换成竖屏 我想开个店主要卖内蒙特产应该起什么名字比较好? 开淘宝店铺卖KN95 口罩需要哪些步骤? 内蒙开特产店起什么名字好? 换还能找回之前被删的好友吗? 淘宝上的承德店铺口罩是正规的吗 在天猫上搜到一家金士达医疗的店铺,看口罩销量还可以,请问是个靠谱的品牌么? 北京哪里有卖内蒙古特产亚? 梁平区哪有卖外科医用口罩的商店? 我的被盗了,重新注册了,怎么恢复微信,找回以前的微信好友和重要信息? 什么营业执照可以卖口罩 石家庄有哪些内蒙特产店