'GDB STM32 Clion flash but no debug

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



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Torbjörn Svensson