xcode OS X v10.9 (Mavericks) 中缺少 GDB

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19554439/
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-09 04:58:53  来源:igfitidea点击:

GDB missing in OS X v10.9 (Mavericks)

xcodemacosgdb

提问by l'L'l

I went to use GDB in OS X v10.9 (Mavericks), and it's not there. Where has it gone?

我在 OS X v10.9 (Mavericks) 中使用 GDB,但它不存在。它去哪儿了?

# /usr/lib/gdb
-bash: /usr/bin/gdb: No such file or directory
# gdb
-bash: gdb: command not found

I also launched Xcode 5.0.1:

我还推出了 Xcode 5.0.1:

Preferences > Downloads

首选项 > 下载

..and there's no longer command line tools available — ffs!

..并且不再有可用的命令行工具 - ffs!

回答by Catfish_Man

gdbhas been replaced by lldb, and is no longer supported. gccand llvm-gccare also gone, replaced by clang.

gdb已被 取代lldb,不再受支持。gcc并且llvm-gcc也消失了,取而代之的是clang

回答by Jakub G?azik

You can install it on Mavericks with Homebrew.

您可以使用 Homebrew 在 Mavericks 上安装它。

brew install homebrew/dupes/gdb

回答by xin

This Homebrew command works to install GDB tools on Mavericks:

这个 Homebrew 命令用于在 Mavericks 上安装 GDB 工具:

brew install https://raw.github.com/Homebrew/homebrew-dupes/master/gdb.rb

回答by user1008139

Thanks I'L'I. I used your ./configure options and worked like a charm. Next step is to tell OS X that we allow GDB to debug. This is done by creating a certificate through the keychain, export it and then sudo codesing -s gdb-cert /route/to/gdb, give credential and we are done.

谢谢我L'I。我使用了你的 ./configure 选项并且工作得很有魅力。下一步是告诉 OS X 我们允许 GDB 进行调试。这是通过通过钥匙串创建证书,导出它,然后sudo codesing -s gdb-cert /route/to/gdb提供凭据来完成的,我们就完成了。

See GDB wiki detailed instructions

查看GDB wiki 详细说明

回答by Ben

I compiled GDB from the source in Maverics.

我从 Maverics 的源代码编译了 GDB。

I altered the makefile (after ./configure) to suppress some errors that should have been warnings...(added the -Wno-string-plus-int)

我更改了 makefile(在 ./configure 之后)以抑制一些应该是警告的错误......(添加了 -Wno-string-plus-int)

Line 385:
CFLAGS = -g -O2 -Wno-string-plus-int

Line 388:
CXXFLAGS = -g -O2 -Wno-string-plus-int

Don't know if both are necessary.

不知道这两个有没有必要。

But

As it turns out the standard version does not support debugging from .app files (as needed for Lazarus apps using the Carbon interface)

事实证明,标准版本不支持从 .app 文件进行调试(根据使用 Carbon 接口的 Lazarus 应用程序的需要)

If you want to do it yourself follow this link: https://sourceware.org/gdb/wiki/BuildingOnDarwin

如果您想自己动手,请点击此链接:https: //sourceware.org/gdb/wiki/BuildingOnDarwin

回答by Mehul Thakkar

Follow the steps given at here, it is working fine:http://wiki.lazarus.freepascal.org/GDB_on_OS_X_Mavericks_and_Xcode_5

按照这里给出的步骤,它工作正常:http: //wiki.lazarus.freepascal.org/GDB_on_OS_X_Mavericks_and_Xcode_5

回答by Evalds Urtans

In my case I got it working on OS X with the following steps:

就我而言,我通过以下步骤使其在 OS X 上运行:

  1. Setup GDB Homebrewexactly like described here http://wiki.lazarus.freepascal.org/GDB_on_OS_X_Mavericks_and_Xcode_5

  2. Then set debugging to Dwarf2: Project -> Project Options.. Enter image description here

  1. 完全按照此处描述的方式设置 GDB Homebrew http://wiki.lazarus.freepascal.org/GDB_on_OS_X_Mavericks_and_Xcode_5

  2. 然后将调试设置为Dwarf2: Project -> Project Options.. 在此处输入图片说明

If Run/Build hangs upthen restart computer(taskgated or some other process certificate most likely not authenticated), debugging settings back to "automatic (-g)"compile & run(authentication dialog appears & log in), then change debugging settings to "Dwarf2"and it should compile again

如果Run/Build 挂了,然后重新启动计算机(taskgated 或其他一些进程证书很可能未通过身份验证),调试设置回到“自动(-g)”编译和运行(出现身份验证对话框并登​​录),然后将调试设置更改为“Dwarf2”,它应该再次编译

Try to always stop GDB when if it crashes after a run operation to prevent this authentication failure.

如果 GDB 在运行操作后崩溃,请尝试始终停止 GDB,以防止此身份验证失败。

回答by Ben

When I looked MacPorts WAS not yet available for Mavericks, but now it is!

当我看到 MacPorts 还不能用于 Mavericks 时,但现在它是!

Fink still isn't.

芬克仍然不是。

But the standard GDB still does not support debugging .app files.

但是标准的 GDB 仍然不支持调试 .app 文件。

回答by antonae

You could install www.macports.org and install GDB. However, you'll have to wait for the MacPortsinstaller for Mavericks, as at the time of writing this it is not yet released.

您可以安装 www.macports.org 并安装 GDB。但是,您必须等待Mavericks的MacPorts安装程序,因为在撰写本文时它尚未发布。

回答by user2922471

Run this to install command line tools:

运行此命令以安装命令行工具:

xcode-select --install