GDB STM32 Clion flash但无法调试

发布于 01-15 12:42 字数 3872 浏览 8 评论 0原文

我已经成功设置 gdb 在 Clion 上调试 stm32。 但是,它只能将 .elf 烧写到目标上,烧写完成后 Clion 会立即退出调试模式。 我当然希望能够使用断点等进行正确调试,

以下是调试属性: 调试属性我相信我应该在目标远程参数中添加一些内容,我所有的问题都来自这里。我已经使用 target Extended-remote \\.\COM5 进行了测试,但它以失败告终

args 文件的内容:

target extended-remote \\.\COM5
monitor swdp_scan
attach 1
load
set mem inaccessible-by-default off
run

这是 Clion 控制台:

arm-none-eabi-gdb.exe cmake-build-debug\EPUCK2Test.elf --interpreter=mi --command=cmake-build-debug\args
=thread-group-added,id="i1"
~"GNU gdb (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 8.0.50.2017112
8-git\n"
~"Copyright (C) 2017 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\
nThis is free software: you are free to change and redistribute it.\nThere is NO
 WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show wa
rranty\" for details.\n"
~"This GDB was configured as \"--host=i686-w64-mingw32 --target=arm-none-eabi\".
\nType \"show configuration\" for configuration details."
~"\nFor bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
~"Find the GDB manual and other documentation resources online at:\n<http://www.
gnu.org/software/gdb/documentation/>.\n"
~"For help, type \"help\".\n"
~"Type \"apropos word\" to search for commands related to \"word\"...\n"
~"Reading symbols from cmake-build-debug\\EPUCK2Test.elf..."
~"done.\n"
@"Target voltage: ABSENT!\n"
@"Available Targets:\n"
@"No. Att Driver\n"
@" 1      STM32F40x M3/M4\n"
=thread-group-started,id="i1",pid="1"
=thread-created,id="1",group-id="i1"
~"HAL_GetTick () at D:/Data/Dev/Minor/STM32/EPUCK2Test/Drivers/STM32F4xx_HAL_Dri
ver/Src/stm32f4xx_hal.c:326\n"
~"326\t}\n"
*stopped,frame={addr="0x08000744",func="HAL_GetTick",args=[],file="D:/Data/Dev/M
inor/STM32/EPUCK2Test/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c",fullname
="D:\\Data\\Dev\\Minor\\STM32\\EPUCK2Test\\Drivers\\STM32F4xx_HAL_Driver\\Src\\s
tm32f4xx_hal.c",line="326"},thread-id="1",stopped-threads="all"
+download,{section=".isr_vector",section-size="392",total-size="49699"}
+download,{section=".isr_vector",section-sent="392",section-size="392",total-sen
t="392",total-size="49699"}
+download,{section=".text",section-size="4264",total-size="49699"}
+download,{section=".rodata",section-size="20",total-size="49699"}
+download,{section=".ARM",section-size="8",total-size="49699"}
+download,{section=".init_array",section-size="8",total-size="49699"}
+download,{section=".fini_array",section-size="4",total-size="49699"}
+download,{section=".data",section-size="1084",total-size="49699"}
=cmd-param-changed,param="mem inaccessible-by-default",value="off"
=thread-exited,id="1",group-id="i1"
=thread-group-exited,id="i1"
=thread-group-started,id="i1",pid="42000"
=thread-created,id="1",group-id="i1"
*running,thread-id="all"
com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$GDBCommandException: To open a remote debug connection, you need to specify what
serial device is attached to the remote system
(e.g. /dev/ttyS0, /dev/ttya, COM1, etc.).
Debugger disconnected

Process finished with exit code 0
GDB Server stopped, exit code 1

日志的结尾很奇怪,看起来就像由于某种原因 gdb 已与目标断开连接

com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$GDBCommandException: To open a remote debug connection, you need to specify what
serial device is attached to the remote system
(e.g. /dev/ttyS0, /dev/ttya, COM1, etc.).
Debugger disconnected

更奇怪的是,运行相同的命令时没有这样的“断开连接”arm-none-eabi-gdb.exe cmake-build-debug\EPUCK2Test.elf --interpreter=mi --command=cmake-build-debug\args 直接在终端中。

预先感谢您的帮助

I have successfully set up gdb to debug stm32 on Clion.
However, it's only able to flash the .elf on to the target, Clion exits the debugging mode immediately when the flashing is done.
I would like of course to have the ability to properly debug using breakpoints, etc

Here are the debugging properties :
Debugging properties
I believe I should put something in target remote args and that all my problem arise from here. I've tested with target extended-remote \\.\COM5 but it ended with a failure

Content of the args file :

target extended-remote \\.\COM5
monitor swdp_scan
attach 1
load
set mem inaccessible-by-default off
run

Here is the Clion console :

arm-none-eabi-gdb.exe cmake-build-debug\EPUCK2Test.elf --interpreter=mi --command=cmake-build-debug\args
=thread-group-added,id="i1"
~"GNU gdb (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 8.0.50.2017112
8-git\n"
~"Copyright (C) 2017 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\
nThis is free software: you are free to change and redistribute it.\nThere is NO
 WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show wa
rranty\" for details.\n"
~"This GDB was configured as \"--host=i686-w64-mingw32 --target=arm-none-eabi\".
\nType \"show configuration\" for configuration details."
~"\nFor bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
~"Find the GDB manual and other documentation resources online at:\n<http://www.
gnu.org/software/gdb/documentation/>.\n"
~"For help, type \"help\".\n"
~"Type \"apropos word\" to search for commands related to \"word\"...\n"
~"Reading symbols from cmake-build-debug\\EPUCK2Test.elf..."
~"done.\n"
@"Target voltage: ABSENT!\n"
@"Available Targets:\n"
@"No. Att Driver\n"
@" 1      STM32F40x M3/M4\n"
=thread-group-started,id="i1",pid="1"
=thread-created,id="1",group-id="i1"
~"HAL_GetTick () at D:/Data/Dev/Minor/STM32/EPUCK2Test/Drivers/STM32F4xx_HAL_Dri
ver/Src/stm32f4xx_hal.c:326\n"
~"326\t}\n"
*stopped,frame={addr="0x08000744",func="HAL_GetTick",args=[],file="D:/Data/Dev/M
inor/STM32/EPUCK2Test/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c",fullname
="D:\\Data\\Dev\\Minor\\STM32\\EPUCK2Test\\Drivers\\STM32F4xx_HAL_Driver\\Src\\s
tm32f4xx_hal.c",line="326"},thread-id="1",stopped-threads="all"
+download,{section=".isr_vector",section-size="392",total-size="49699"}
+download,{section=".isr_vector",section-sent="392",section-size="392",total-sen
t="392",total-size="49699"}
+download,{section=".text",section-size="4264",total-size="49699"}
+download,{section=".rodata",section-size="20",total-size="49699"}
+download,{section=".ARM",section-size="8",total-size="49699"}
+download,{section=".init_array",section-size="8",total-size="49699"}
+download,{section=".fini_array",section-size="4",total-size="49699"}
+download,{section=".data",section-size="1084",total-size="49699"}
=cmd-param-changed,param="mem inaccessible-by-default",value="off"
=thread-exited,id="1",group-id="i1"
=thread-group-exited,id="i1"
=thread-group-started,id="i1",pid="42000"
=thread-created,id="1",group-id="i1"
*running,thread-id="all"
com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$GDBCommandException: To open a remote debug connection, you need to specify what
serial device is attached to the remote system
(e.g. /dev/ttyS0, /dev/ttya, COM1, etc.).
Debugger disconnected

Process finished with exit code 0
GDB Server stopped, exit code 1

The end of the log is quite odd, it looks like for some reason gdb has been disconnected from the target

com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$GDBCommandException: To open a remote debug connection, you need to specify what
serial device is attached to the remote system
(e.g. /dev/ttyS0, /dev/ttya, COM1, etc.).
Debugger disconnected

What is even stranger is that there is no such "disconnection" when running the very same command arm-none-eabi-gdb.exe cmake-build-debug\EPUCK2Test.elf --interpreter=mi --command=cmake-build-debug\args directly in the terminal.

Thanks in advance for your help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七七2025-01-22 12:42:35

The problem you are seeing is probably related to https://sourceware.org/bugzilla/show_bug.cgi?id=28711

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文