Program received signal SIGTRAP, Trace/breakpoint trap


FROM stackoverFlow

https://stackoverflow.com/questions/9809413/program-received-signal-sigtrap-trace-breakpoint-trap


Breakpoint trap just means the processor has hit a breakpoint. There are two possibilities for why this is happening. Most likely, your initialization code is being hit because your CPU is resetting and hitting the breakpoint again. The other possibility would be that the code where you set the breakpoint is actually run in places other than initialization. Sometimes with aggressive compiler optimization it can be hard to tell exactly which code your breakpoint maps to and which execution paths can get there.

he other possibility i can think of is:

1.Your process is running more than one thread.

For eg - 2 say x & y.

2.Thread y hits the break point but you have attached gdb to thread x.

This case is a Trace/breakpoint trap.

The other possibility i can think of is:

1.Your process is running more than one thread.

For eg - 2 say x & y.

2.Thread y hits the break point but you have attached gdb to thread x.

This case is a Trace/breakpoint trap.

I got this problem running linux project in Visual studio 2015 and debugging remotely. My solution is project_properties -> Configuration properties -> Debugging -> Debugging mode and change the value from "gdbserver" to "gdb"

If you use V BAT as backup supply and your backup voltage drives lower than 1.65V then you get the same problem after conecting to a power supply.

In this case you have to disconnect all power supplies and reconnect with correct voltage level. Then the problem with debugging goes away.



问 题

I'm debugging a piece of (embedded) software. I've set a breakpoint on a function, and for some reason, once I've reached that breakpoint and continue I always come back to the function (which is an initialisation function which should only be called once). When I remove the breakpoint, and continue, GDB tells me:

Program received signal SIGTRAP, Trace/breakpoint trap.

Since I was working with breakpoints, I'm assuming I fell in a "breakpoint trap". What is a breakpoint trap?

解决方案

Breakpoint trap just means the processor has hit a breakpoint. There are two possibilities for why this is happening. Most likely, your initialization code is being hit because your CPU is resetting and hitting the breakpoint again. The other possibility would be that the code where you set the breakpoint is actually run in places other than initialization. Sometimes with aggressive compiler optimization it can be hard to tell exactly which code your breakpoint maps to and which execution paths can get there.


  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值