gdb 調試不停出現Program received signal SIGTRAP

問題描述:

gdb 調試zephyr程序的時候,之前下過的某個斷點,monitor reset 後重新跑,竟然會一直觸發這個斷點,雖然b命令已經列出當前沒有break point,一直卡在這裏 continue 和 next 都走不下去

問題解決:

from stack overflow 的答案: 

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).

知道原因後,果斷板子斷電重啓就解決了,中間試過板子的reset按鈕竟然不行必須斷電,顯然板子的reset並不會給cpu斷電,導致cpu寄存器的值還在的原因

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章