简体   繁体   English

适用于Mac的Eclipse C ++ GDB调试器

[英]Eclipse C++ GDB debugger for Mac

i've been trying for a whole day to use Eclipse but i failed every time. 我一直在尝试使用Eclipse一整天,但我每次都失败了。 I know that i may be wrong and i do know that there are a lot of people out there who are working hard for an open source project, but if i can't use a program, run and debug an "Hello world" file, there must be something wrong. 我知道我可能错了,我知道有很多人在为开源项目努力工作,但如果我不能使用程序,运行并调试“Hello world”文件,一定有什么不对劲。

I'm using OSX 10.9.5 (yeah, maybe using a mac is my first error, right?). 我正在使用OSX 10.9.5(是的,也许使用mac是我的第一个错误,对吧?)。

Every time i try to debug the "Hello World.cpp" program i get the following error. 每次我尝试调试“Hello World.cpp”程序时,我都会收到以下错误。

http://imgur.com/RgXCSyW http://imgur.com/RgXCSyW

Yes, i've searched everywhere on google. 是的,我在谷歌搜索到处都是。 Yes, i've already seen the other replies on a similar topic and i've already tried the solutions they offered. 是的,我已经看过其他类似主题的回复,我已经尝试了他们提供的解决方案。 Sadly, it didn't work. 可悲的是,它没有用。

Thanks guys for your patience, i hope to learn how to code and maybe being helpful to others one day. 谢谢你的耐心,我希望有一天能学习如何编码,也许会对别人有所帮助。

Luca 卢卡

ps writing the error so other people who are googling it can find it ps写错误,所以其他人谷歌搜索它可以找到它

" Error in final launch sequence Failed to execute MI command: -exec-run Error message from debugger back end: Unable to find Mach task port for process-id 33383: (os/kern) failure (0x5).\\n (please check gdb is codesigned - see taskgated(8)) Unable to find Mach task port for process-id 33383: (os/kern) failure (0x5).\\n (please check gdb is codesigned - see taskgated(8)) " “最终启动序列出错无法执行MI命令:-exec-run来自调试器后端的错误消息:无法找到进程号为33383的Mach任务端口:(os / kern)失败(0x5)。\\ n(请检查gdb是codesigned - 参见taskgated(8))无法找到进程id 33383的Mach任务端口:(os / kern)失败(0x5)。\\ n(请检查gdb是否为codesigned - 请参阅taskgated(8))“

There is another option to debug you code using LLDB debugger . 使用LLDB调试器调试代码还有另一种选择。 You can check this link for install the LLDB debugger integration. 您可以查看此链接以安装LLDB调试器集成。 It is super easy and does the work. 它非常简单,可以完成工作。

Btw The GDB debugger is part of GNU. 顺便说一下GDB调试器是GNU的一部分。 Xcode does not use GNU tools (gcc, gdb) anymore. Xcode不再使用GNU工具(gcc,gdb)。 Xcode uses LLVM. Xcode使用LLVM。 LLVM's debugger is LLDB. LLVM的调试器是LLDB。 Some info about it: apple developers , The LLDB Debugger Probably your problem has been solved, but sharing another solution to others cant be bad :) 关于它的一些信息: 苹果开发人员LLDB调试器可能你的问题已经解决了,但是与其他人分享另一个解决方案可能不好:)

This is relevant to macOS Sierra also. 这也与macOS Sierra有关。

This is a relatively well known "issue" on OS X (which btw is a pain-in-the-neck-to-develop-c++ on). 这是OS X上一个相对众所周知的“问题”(顺便说一下,这是一个痛苦的开发 - 开发 - c ++)。 You first need to install g++ and GDB debugger (since LLVM clang++ in combination with LLVM debugger are not yet supported by Eclipse on OS X). 您首先需要安装g ++和GDB调试器(因为OS X上的Eclipse尚不支持LLVM clang ++与LLVM调试器的结合)。 The easiest way is via macports . 最简单的方法是通过macports First install macports via the native installer , then, from a terminal, install g++ and gdb (debugger) 首先通过本机安装程序安装macport ,然后从终端安装g ++和gdb(调试器)

sudo port install gcc5 # or gcc49

and

sudo port install gdb

After this, you need to codesign it, see this link . 在此之后,您需要对其进行编码, 请参阅此链接 The name of the debugger will be ggdb ( not gdb ), and macoprts will install it in /opt/local/bin/ggdb . 调试器的名称将是ggdb而不是gdb ),macoprts将其安装在/opt/local/bin/ggdb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM