本文介绍了gdb 失败并显示“无法找到进程 ID 的 Mach 任务端口";错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序运行良好,但 gdb 无法调试它并出现以下错误

My app runs fine but gdb fails to debug it with the following error

(gdb) run
Starting program: /path/to/app 
Unable to find Mach task port for process-id 83767: (os/kern) failure (0x5).

我使用的是 OS X Lion.GDB 版本是

I am on OS X Lion. GDB version is

$ gdb --version
GNU gdb 6.3.50-20050815 (Apple version gdb-1752) (Sat Jan 28 03:02:46 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".

推荐答案

在 Snow Leopard 和更高版本的 Mac OS 版本中,对 gdb 可执行文件进行协同设计是不够的.

In Snow Leopard and later Mac OS versions, it isn't enough to codesign the gdb executable.

您必须按照本指南进行操作:http://www.opensource.apple.com/source/lldb/lldb-69/docs/code-signing.txt

You have to follow this guide to make it work: http://www.opensource.apple.com/source/lldb/lldb-69/docs/code-signing.txt

该指南解释了如何为 lldb 执行此操作,但该过程对于 gdb 完全相同.

The guide explains how to do it for lldb, but the process is exactly the same for gdb.

这篇关于gdb 失败并显示“无法找到进程 ID 的 Mach 任务端口";错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 04:21