SIGTRAP尽管没有设定断点;隐藏的硬件断点? [英] SIGTRAP despite no set breakpoints; hidden hardware breakpoint?

查看:342
本文介绍了SIGTRAP尽管没有设定断点;隐藏的硬件断点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试这块STM32嵌入式系统的软件。在其中一个功能我的程序不断击中某种断点:


SIGTRAP,跟踪/断点陷阱


但是,在GDB中,当我做信息断点我得到没有断点或观察点。断点实际上对应于我之前设置的断点,在另一个版本的可执行文件中。当我设置断点时,GDB会在只读内存上使用硬件断点来自动使用(或类似的消息)。



我认为硬件断点仍然在我的芯片上,尽管加载了一个新版本的软件。如果确实有一个假的断点,我该如何找到并删除它?

解决方案

长回答:
硬件断点通常是通过写入一些特殊的CPU寄存器来设置的。这是由gdb完成的。如果gdb死机,可以把这些安装在CPU中。
我猜你的gdb实现不会清除或检查那些,当它连接到你的目标。
要找到它们,您需要在CPU上列出硬件断点寄存器的内容(不知道如何在STM32上执行此操作)。解决办法是(通知猜测)是:使用gdb设置几个HW断点(通常只有少数,很少超过8个),然后将其全部删除。这应该覆盖然后清理这些hw寄存器。一旦你设置了这些断点(在删除它们之前),做继续(以防万一,因为gdb只在那时设置断点)。


I am debugging this piece of software for an STM32 embedded system. In one of the functions my programs keeps hitting some sort of breakpoint:

SIGTRAP, Trace/breakpoint trap

However, in GDB, when I do info breakpoints I get No breakpoints or watchpoints. The breakpoint actually corresponds to a breakpoint I had set quite some time ago, in another version of the executable. When I set that breakpoint, GDB told me automatically using a hardware breakpoint on read-only memory (or a similar message).

I think the hardware breakpoint remains on my chip, despite having loaded a new version of the software. If there is indeed a spurious breakpoint, how can I locate and remove it?

解决方案

Ok. Long answer: Hardware breakpoints are usually set by writing to some special CPU registers. This is done by gdb. If gdb dies, it can left those installed in CPU. I guess your implementation (of gdb) does not either clear or examine those, when it connects to your target. To locate them, you would need to list the contents of hardware breakpoints registers on your CPU (don't know how to do this on STM32). Workaround would be (informed guess) be this: set few HW breakpoints (typically there are only a few, seldom more than 8) using gdb, then remove all of them. This should overwrite and then clean those hw registers. Once you do set those breakpoints (before removing them), do "continue" (just in case, as gdb sets breakpoints only at that time).

这篇关于SIGTRAP尽管没有设定断点;隐藏的硬件断点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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