How to get rid of cached/ghost/phantom breakpoint in STM32CubeIDE?
This is somewhat similar to OpenSTM32 Community Site | Phantom Breakpoint - except in STM32Cube IDE.
I have managed to create a reproducible example. I use MSYS2 on Windows 10, so excuse the bashisms.
$ systeminfo
...
OS Name: Microsoft Windows 10 Home
OS Version: 10.0.19042 N/A Build 19042
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free
...
$ cat /c/ST/STM32CubeIDE_1.6.1/STM32CubeIDE/.eclipseproduct
name=STM32CubeIDE
id=com.st.stm32cube.ide.mcu.rcp.product
version=1.6.1First, creating a fresh directory for a workspace:
$ mkdir /c/tmp/temp_workspaceStart "clean slate" STM32CubeIDE, with this directory as a workspace:
$ /c/ST/STM32CubeIDE_1.6.1/STM32CubeIDE/stm32cubeide.exe -clean -clearPersistedState -data /c/tmp/temp_workspaceClick "Start new STM32 project". From the Target Selection wizard, I go to Board Selector, choose NUCLEO-G071RB, -select the board, Next. Project name: my_nucleo_proj, keep the rest at defaults, click Finish; say Yes to other defaults in dialogs during project creation.
At this point, I save this as a git project in another terminal:
$ cd /c/tmp/temp_workspace/my_nucleo_proj/
$ git init
hint: Using 'master' as the name for the initial branch. This default branch name
...
Initialized empty Git repository in /c/tmp/temp_workspace/my_nucleo_proj/.git/
$ git config user.name me
$ git config user.email me@example.com
$ git add .
$ git commit -m 'init commit'
[master (root-commit) 24114eb] init commit
84 files changed, 105400 insertions(+)
create mode 100644 .cproject
...
create mode 100644 my_nucleo_proj.iocBack to STM32CubeIDE: click Run / Run once - as first time, the project "* Debug" configuration gets created; accept all defaults, click OK.
For me, this build & run proceeds without errors.
Back to git, a new "my_nucleo_proj Debug.launch" file got created, add it and commit:
$ git add '*.launch'
$ git add -u
$ git status -uno
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: .settings/stm32cubeide.project.prefs
new file: my_nucleo_proj Debug.launch
Untracked files not listed (use -u option to show untracked files)
$ git commit -m '.launch created'
[master cbd9b8b] .launch created
2 files changed, 73 insertions(+)
create mode 100644 my_nucleo_proj Debug.launchBack to STM32CubeIDE: click Run / Debug Configurations / Startup (tab); confirm we have "Set breakpoint at: main" checked; click Debug. The debugger starts, and as expected, breaks at main - Debugger Console says:
Temporary breakpoint 1, main () at ../Core/Src/main.c:75
75 HAL_Init();Click Resume, then Terminate to stop this debug run. Back to git, our launch file has changed:
$ git diff
diff --git a/my_nucleo_proj Debug.launch b/my_nucleo_proj Debug.launch
index 1159a47..1ce3860 100644
--- a/my_nucleo_proj Debug.launch
+++ b/my_nucleo_proj Debug.launch
@@ -68,5 +68,6 @@
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"><listEntry value="4"/></listAttribute>
+ <stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="reserved-for-future-use"/> "/>^M
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/></launchConfiguration>
$ git add -u
$ git commit -m '.launch after first debug'
[master 1c70ff7] .launch after first debug
1 file changed, 1 insertion(+)Back to STM32CubeIDE: click Run / Debug Configurations / Startup (tab); uncheck "Set breakpoint at: main" ; click Apply, then click Debug. The debugger starts, and as expected does not break, but instead keeps going.
Click Terminate to stop this debug run. Back to git, our launch file has changed:
$ git diff
diff --git a/my_nucleo_proj Debug.launch b/my_nucleo_proj Debug.launch
index 1ce3860..a8091ad 100644
--- a/my_nucleo_proj Debug.launch
+++ b/my_nucleo_proj Debug.launch
@@ -48,7 +48,7 @@
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/><booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/><booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
- <booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
+ <booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="false"/>^M
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/><stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="arm-none-eabi-gdb"/><booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="true"/>
@@ -56,7 +56,7 @@
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/><stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/><stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>
- <booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
+ <booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="false"/>^M
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/><stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug\my_nucleo_proj.elf"/><stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="my_nucleo_proj"/>
$ git add -u
$ git commit -m '.launch after uncheck of main breakpoint'
[master 1fe7d2c] .launch after uncheck of main breakpoint
1 file changed, 2 insertions(+), 2 deletions(-)Back to STM32CubeIDE: click Run / Debug Configurations / Startup (tab); check again "Set breakpoint at: main" ; then under "Run Commands", type or copy/paste the following:
b main
b SystemClock_Config
... then click Apply, then click Debug. The debugger starts, and as expected, breaks at main; click Resume, then as expected, debugger breaks at SystemClock_Config; click Resume, and as expected, debugger does not break anymore. In Debugger Console, we have:
Temporary breakpoint 1, main () at ../Core/Src/main.c:75
75 HAL_Init();
Breakpoint 3, SystemClock_Config () at ../Core/Src/main.c:112
112 RCC_OscInitTypeDef RCC_OscInitStruct = {0};(text is too large - continued in reply)
