This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Missed breakpoints: Why is expat excluded from arm-none-eabi-gdb?

I'm having trouble getting an ARM Cortex M33 to stop at breakpoints using arm-none-eabi-gdb on MaxOSX.

Running "show configuation" inside the arm-none-eabi-gdb environment, I see that expat was excluded during the GDB configuration process. (--without-expat)

$ arm-none-eabi-gdb
GNU gdb (GNU Toolchain for the Arm Architecture 11.2-2022.02 (arm-11.14)) 11.2.90.20220202-git
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin19.6.0 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.linaro.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) show configuration
This GDB was configured as follows:
   configure --host=x86_64-apple-darwin19.6.0 --target=arm-none-eabi
	     --with-auto-load-dir=$debugdir:$datadir/auto-load
	     --with-auto-load-safe-path=$debugdir:$datadir/auto-load
	     --without-expat
	     --with-gdb-datadir=//share/gdb (relocatable)
	     --with-jit-reader-dir=//lib/gdb (relocatable)
	     --without-libunwind-ia64
	     --without-lzma
	     --without-babeltrace
	     --without-intel-pt
	     --with-mpfr
	     --without-xxhash
	     --without-python
	     --without-python-libdir
	     --without-debuginfod
	     --without-guile
	     --disable-source-highlight
	     --with-separate-debug-dir=//lib/debug (relocatable)

("Relocatable" means the directory can be moved with the GDB installation
tree, and GDB will still find it.)

I'm using max OSX x86_64 and I downloaded the latest release of the toolchain here. I'm trying to connect to a GDB server, specifically an openocd instance:

openocd -f ../st_nucleo_u575zi_q.cfg
Open On-Chip Debugger 0.11.0+dev-00755-g5e96b012a (2022-07-21-13:58)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : DEPRECATED target event trace-config; use TPIU events {pre,post}-{enable,disable}
srst_only separate srst_nogate srst_open_drain connect_deassert_srst

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 500 kHz
Info : STLINK V3J9M3 (API v3) VID:PID 0483:374E
Info : Target voltage: 3.297196
Info : [stm32u5x.cpu] Cortex-M33 r0p4 processor detected
Info : [stm32u5x.cpu] target has 8 breakpoints, 4 watchpoints
stm32u5x.dap
Error executing event halted on target stm32u5x.cpu:
/usr/local/Cellar/open-ocd/HEAD-5e96b01/bin/../share/openocd/scripts/target/stm32x5x_common.cfg:75: Error:
in procedure 'mmw' called at file "/usr/local/Cellar/open-ocd/HEAD-5e96b01/bin/../share/openocd/scripts/target/stm32x5x_common.cfg", line 90
in procedure 'mrw' called at file "/usr/local/Cellar/open-ocd/HEAD-5e96b01/bin/../share/openocd/scripts/mem_helper.tcl", line 32
in procedure 'stm32x5x_ahb_ap_non_secure_access' called at file "/usr/local/Cellar/open-ocd/HEAD-5e96b01/bin/../share/openocd/scripts/target/stm32x5x_common.cfg", line 105
at file "/usr/local/Cellar/open-ocd/HEAD-5e96b01/bin/../share/openocd/scripts/target/stm32x5x_common.cfg", line 75
Info : starting gdb server for stm32u5x.cpu on 3333
Info : Listening on port 3333 for gdb connections

Using the arm-none-eabi-gdb binary:

arm-none-eabi-gdb
GNU gdb (GNU Toolchain for the Arm Architecture 11.2-2022.02 (arm-11.14)) 11.2.90.20220202-git
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin19.6.0 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.linaro.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) file wearable.elf
Reading symbols from wearable.elf...
(gdb) target extended-remote :3333
Remote debugging using :3333
warning: Can not parse XML target description; XML support was disabled at compile time
warning: Can not parse XML memory map; XML support was disabled at compile time
0x08001d98 in HAL_GetTick ()
    at /Users/charlie/Documents/placeholder/firmware/third_party/STM32CubeU5/Drivers/STM32U5xx_HAL_Driver/Src/stm32u5xx_hal.c:313
313	}
(gdb) b main
Breakpoint 1 at 0x80010c2: file /Users/charlie/Documents/placeholder/firmware/main.c, line 197.
(gdb) monitor reset halt
Unable to match requested speed 480 kHz, using 200 kHz
Unable to match requested speed 480 kHz, using 200 kHz
stm32u5x.dap
Error executing event halted on target stm32u5x.cpu:
/usr/local/Cellar/open-ocd/HEAD-5e96b01/bin/../share/openocd/scripts/target/stm32x5x_common.cfg:75: Error:
in procedure 'ocd_process_reset'
in procedure 'ocd_process_reset_inner' called at file "embedded:startup.tcl", line 876
in procedure 'stm32x5x_ahb_ap_non_secure_access' called at file "/usr/local/Cellar/open-ocd/HEAD-5e96b01/bin/../share/openocd/scripts/target/stm32x5x_common.cfg", line 105
at file "/usr/local/Cellar/open-ocd/HEAD-5e96b01/bin/../share/openocd/scripts/target/stm32x5x_common.cfg", line 75
target halted due to debug-request, current mode: Thread
xPSR: 0xf9000000 pc: 0x08001bd8 msp: 0x200c0000
(gdb) si
stm32u5x.dap
Error executing event halted on target stm32u5x.cpu:
/usr/local/Cellar/open-ocd/HEAD-5e96b01/bin/../share/openocd/scripts/target/stm32x5x_common.cfg:75: Error:
in procedure 'stm32x5x_ahb_ap_non_secure_access' called at file "/usr/local/Cellar/open-ocd/HEAD-5e96b01/bin/../share/openocd/scripts/target/stm32x5x_common.cfg", line 105
at file "/usr/local/Cellar/open-ocd/HEAD-5e96b01/bin/../share/openocd/scripts/target/stm32x5x_common.cfg", line 75
halted: PC: 0x08001bdc
Reset_Handler () at /Users/charlie/Documents/placeholder/firmware/third_party/STM32CubeU5/Drivers/CMSIS/Device/ST/STM32U5xx/Source/Templates/gcc/startup_stm32u575xx.s:65
65	  movs	r1, #0
(gdb) continue
Continuing.

Of note are the two warnings "Can not parse XML target description" and "Can not parse XML memory map". AFAIK expat is an XML parser ... and it's missing from arm-none-eabi-gdb. So my guess is that's the cause of these two warnings.

The result is that I can successfully set breakpoints, but they are ignored. In the above example, the code never stops at the main() entry point. This behavior was described here too: https://github.com/earlephilhower/arduino-pico/discussions/457