在 mac 上使用 eclipse 的 C++ 调试器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19536142/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 21:16:25  来源:igfitidea点击:

debugger for c++ using eclipse on mac

eclipsemacosdebugging

提问by Roy Weinstein

After I finally setup my mac to work with eclipse, I can't debug.

在我最终设置我的 mac 以使用 eclipse 后,我无法调试。

I've tried to google for help but non of the answers worked for me.

我试图谷歌寻求帮助,但没有一个答案对我有用。

so, I need someone to help me install and use a debugger on eclipse for c\c++.

所以,我需要有人帮助我在 Eclipse 上为 c\c++ 安装和使用调试器。

I have Xcode 5.0 installed.

我安装了 Xcode 5.0。

Thanks for your help

谢谢你的帮助

Roy

罗伊

回答by Franklin Yu

You have got several options:

你有几个选择:

  1. Install GDB with MacPorts or Homebrew, as mentioned by trojanfoeand Charles Chow.
  2. Use LLDB-MI from LLDB team; note that LLDB-MI does not come with the native LLDB on OS X, meaning you have to build LLDB your own with options to switch on the feature.
  3. Use third-party LLDB-MI2(see the page for reasons why he needs another Machine Interface)
  1. 使用 MacPorts 或 Homebrew 安装 GDB,如trojanfoeCharles Chow 所述
  2. 使用 LLDB 团队的 LLDB-MI;请注意,LLDB-MI 不附带 OS X 上的本机 LLDB,这意味着您必须构建自己的 LLDB,并使用选项来打开该功能。
  3. 使用第三方LLDB-MI2(有关他需要另一个机器接口的原因,请参阅页面)

All of these three options require a lot of configuration and are error-prone. I guess you may want to think twice when you prefer Eclipse to Xcode on OS X.

所有这三个选项都需要大量配置并且容易出错。我想当您在 OS X 上更喜欢 Eclipse 而不是 Xcode 时,您可能需要三思。

回答by trojanfoe

It looks likeeclipse doesn't support lldb, so you are probably better off ignoring the Xcode toolchain and instead installing Macportsand g++/gdb from there:

看起来eclipse 不支持lldb,所以你最好忽略 Xcode 工具链,而是从那里安装Macports和 g++/gdb:

$ sudo port install gcc49 gdb

It should then just be a case of setting up this new toolchain in eclipse; perhaps using:

那么它应该只是在 eclipse 中设置这个新工具链的一个例子;也许使用:

how to add custom tool chain to eclipse CDT

如何将自定义工具链添加到 Eclipse CDT

(if not google "eclipse cdt configure toolchain")

(如果不是谷歌“eclipse cdt 配置工具链”)

回答by Charles Chow

I found this tutorialteaches you how to install and setup GDB for eclipse on Mac OS X. It works on my machine. You need install Home Brewfirst.

我发现这个教程教你如何在 Mac OS X 上为 eclipse 安装和设置 GDB。它在我的机器上工作。您需要先安装Home Brew