gdb - OpenOCD - 卡在断点上,跳过并继续不起作用
问题描述
我正在使用带有 STLinkV3 的 STM32H745ZI Nucleo 板。我已经成功编译并运行了在 Cortex M7 内核上闪烁 LED 的简单程序。当程序在没有调试器的情况下运行时,一切都很好。
调试时出现问题。当我在打开 LED 的线路上设置断点时,调试器会在此位置停止。问题是一旦停止,continue 和 step over 在断点未设置之前都不起作用。
代码并不复杂:
while (1) {
LD1_SET(1);
HAL_Delay(100);
LD2_SET(1);
HAL_Delay(100);
LD3_SET(1);
HAL_Delay(100);
LD1_SET(0);
HAL_Delay(100);
LD2_SET(0);
HAL_Delay(100);
LD3_SET(0);
HAL_Delay(100);
}
这是它在 gdb 控制台中的样子:
# Setting breakpoint on LED ON
(gdb) b main.c:166
Breakpoint 1 at 0x8001788: file Src/main.c, line 166.
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
# Hit! Debugger seems working, LED is still OFF
Breakpoint 1, main () at Src/main.c:166
166 LD1_SET(1);
(gdb) c
Continuing.
# Hit the same breakpoint with no blinking between
Breakpoint 1, main () at Src/main.c:166
166 LD1_SET(1);
# Setting breakpoint on LED OFF
(gdb) b main.c:174
Breakpoint 2 at 0x80017c6: file Src/main.c, line 174.
(gdb) c
Continuing.
# Still hits LED ON, LED is still OFF
Breakpoint 1, main () at Src/main.c:166
166 LD1_SET(1);
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y 0x08001788 in main at Src/main.c:166
breakpoint already hit 3 times
2 breakpoint keep y 0x080017c6 in main at Src/main.c:174
# Removing breakpoint on LED ON
(gdb) del 1
(gdb) c
Continuing.
# LED is ON, prorgram finally hit next breakpoint
Breakpoint 2, main () at Src/main.c:174
174 LD1_SET(0);
如何让它发挥作用?你以前有没有遇到过类似的问题?
解决方案
推荐阅读
- python-3.x - Pandas set_index 在没有 inplace=True 的情况下创建 NoneType 对象
- asp.net - 尝试验证 JWT 时无法从以下位置获取配置:“/.well-known/openid-configuration”
- authentication - Yubico / Attestation 和 Assertion 之间的凭证 ID 长度不匹配
- mysql - 获取链接表中最频繁的值,并在 MySQL 的主表中引用它
- email - 如何设置电子邮件跟踪代码来跟踪不同客户电子邮件提供商的电子邮件打开/点击?
- r - R:如何将日期附加到 timeseries(ts) 对象中?
- javascript - angularjs 指令 ngrepeat 不适用于角度向导中的对象
- visual-studio - Visual Studio Diff 显示不需要的大小写差异
- vitess - Vitess 分片问题
- python - 基于“时间瞬间”的不同字典中的值总和