本文介绍了gdb失败,并显示“Unable to find Mach task port for process-id”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序运行正常,但gdb未能通过以下错误进行调试:

 (gdb)运行
启动程序:/ path / to / app
无法找到用于process-id 83767:(os / kern)失败(0x5)的Mach任务端口。

我在OS X Lion上。 GDB版本是

pre $ $ c $ gdb --version
GNU gdb 6.3.50-20050815(Apple版本gdb-1752) (星期六1月28日03:02:46 UTC 2012)
版权所有2004自由软件基金会,Inc.
GDB是免费软件,涵盖GNU通用公共许可证,您欢迎b $ b在特定条件下更改和/或分发它的副本。
输入show copying查看条件。
GDB绝对没有担保。输入显示保修以获取详细信息。
此GDB被配置为x86_64-apple-darwin。


解决方案

在Snow Leopard及更高版本的Mac OS中,并不足以对 gdb 可执行文件进行编码签名。



必须遵循本指南才能使其工作:



该指南解释了如何为 lldb ,但这个过程与 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).

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".
解决方案

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

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

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

这篇关于gdb失败,并显示“Unable to find Mach task port for process-id”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 04:21