程序接收到信号SIGTRAP,跟踪/断点陷阱. [切换到线程6] [英] Program received signal SIGTRAP, Trace/breakpoint trap. [Switching to Thread 6]

查看:943
本文介绍了程序接收到信号SIGTRAP,跟踪/断点陷阱. [切换到线程6]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道之前曾有人问过这个问题,但是我已经阅读了所有主题,却没有找到答案. 从我执行run开始调试项目的那一刻起,我得到的是:Program received signal SIGTRAP, Trace/breakpoint trap. [Switching to Thread 6].当我执行ctrl+c时,gdb告诉我:Program received signal SIGINT, Interrupt. 0x00000000 in ?? ()

I know this question has been asked before, but I have read all the threads and I didn't find an answer. From the moment I execure run to start debugging my project, I get this : Program received signal SIGTRAP, Trace/breakpoint trap. [Switching to Thread 6]. When I do ctrl+c, gdb tells me : Program received signal SIGINT, Interrupt. 0x00000000 in ?? ()

通常它会告诉我哪个文件和哪个功能在不是0x00000000 in ?? ()时被中断了 GDB不再遇到断点,更让人发狂的是,我和我的同事共享同一个会话(调试是使用cygwin与远程计算机完成的),并且对他们来说很好,但对我而言却不行. 当我尝试使用info threads获取有关线程的信息时,这就是我得到的:

Usually it'll tell me which file and which function it got interrupted at not 0x00000000 in ?? () GDB no longer hits breakpoints, and what makes matter crazier is the fact that a colleague and I, are sharing the same session (the debug is done using cygwin with a remote machine) and it works fine for them but not for me. when I try to get info about the threads using info threads here's what I get :

[New Thread 20]
 [New Thread 21]
 [New Thread 22]
  Id   Target Id         Frame
  4    Thread 22 (ssp=0xa9004d5c) 0x00000000 in ?? ()
  3    Thread 21 (ssp=0xa9002e64) 0x00000010 in ?? ()
  2    Thread 20 (ssp=0xa9000ef4) 0x00000000 in ?? ()

The current thread <Thread ID 1> has terminated.  See `help thread'

没有线程6,没有*来指示gdb正在使用哪个线程.而且我什至不知道这是否与问题有关. 谁能帮我吗?

there's no thread 6, there's no * to indicate which thread gdb is using. And I don't even know if that's linked to the problem. Can anyone please help me?

推荐答案

有效地,这是您正如我在评论中所说的那样,您没有提供足够的信息来帮助您.详细信息事项,您将保留它们. GDB和gdbserver的版本很重要,如何调用GDB和gdbserver都很重要,从GDB收到的警告(如果有)也很重要.

As I have said in comments there, you are not providing nearly enough info to help you. Details matter, and you are withholding them. Versions of GDB and gdbserver matter, how you invoke GDB and gdbserver matter, what warnings you receive from GDB (if any) matter.

现在,此错误消息:

Program received signal SIGTRAP, Trace/breakpoint trap. [Switching to Thread 6]

通常意味着gdbserver尚未连接进程的一个线程,并且该线程已尝试执行断点指令(您确实在发生断点之前设置了断点,对吗?).

usually means that gdbserver has not attached one of the threads of your process, and that thread has tried to execute breakpoint instruction (you do have breakpoints set before this happens, don't you?).

发生这种情况的原因之一是您的GDB加载了错误的" libthread_db.so(与目标libc.so.6不匹配的一个).

One of the reasons this may happen is when your GDB loads "wrong" libthread_db.so (one that doesn't match the target libc.so.6).

更疯狂的是,我和同事共享同一个会话(调试是使用cygwin与远程计算机完成的),对他们而言却很好,但对我而言却不是.

what makes matter crazier is the fact that a colleague and I, are sharing the same session (the debug is done using cygwin with a remote machine) and it works fine for them but not for me.

我不确定同一会话"是什么意思,但是可能不是当他键入命令时它们起作用;但是当我在同一GDB中键入相同命令时,它们就没有作用."

I am not sure what you mean by "same session", but it's probably not "when he types commands, they work; but when I type the same commands into the same GDB, they don't".

您和您的同事之间的一个不同之处可能是LD_LIBRATY_PATH环境变量设置.另一个可能在~/.gdbinit./.gdbinit中.

One difference between you and your colleague could be LD_LIBRATY_PATH environment variable setting. Another could be in ~/.gdbinit or in ./.gdbinit.

我建议运行gdb -nx摆脱后者,并取消设置LD_LIBRARY_PATH摆脱前者.

I suggest running gdb -nx to get rid of the latter, and unsetting LD_LIBRARY_PATH to get rid of the former.

这篇关于程序接收到信号SIGTRAP,跟踪/断点陷阱. [切换到线程6]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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