gdb 以信号 ? 终止,未知信号 [英] gdb terminated with signal ?, unknown signal

查看:20
本文介绍了gdb 以信号 ? 终止,未知信号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是尝试在 Mac OSX 版本 10.12 上使用 gdb 调试代码,但在 gdb 中启动我的程序时总是出现这个未知错误.

I'm just trying to debug code with gdb on Mac OSX Version 10.12 but always getting this unknown error when launching my program in gdb.

我在安装后对 gdb 进行了代码签名,并使用 -g 标志编译了我的代码.

I codesigned the gdb after installation and compiled my code with the -g flag.

这是正在发生的事情:

computer:hello user$ gdb a.out
GNU gdb (GDB) 7.12
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin16.0.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...Reading symbols from /Users/user/Documents/Programming/hello/a.out.dSYM/Contents/Resources/DWARF/a.out...done.
done.
(gdb) r
Starting program: /Users/user/Documents/Programming/hello/a.out 
During startup program terminated with signal ?, Unknown signal.

我暂时收到了 SIGTRAP 信号,但我不知道为什么它现在再次抛出 Unknown 信号.

Temporary I got the SIGTRAP signal, but I could not figure out why it's now throwing the Unknown signal again.

推荐答案

Mac OS X 10.12.5 及更高版本的解决方案

在您的主目录中创建一个 .gdbinit 文件,并在其中写入set startup-with-shell off".

Create a .gdbinit file in your home-direcetory and write "set startup-with-shell off" in it.

可以使用 vi ~/.gdbinit 创建文件.

File can be created using vi ~/.gdbinit.

打开一个新的终端,gdb 就可以工作了.

Open a new terminal and gdb will work.

这篇关于gdb 以信号 ? 终止,未知信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆