Hi
I use STM32CubeIDE but me and eclipse has never been good friends. Especially the build system and project structure is a pain in the .......
I therefore have moved my project to be selfsustained. I now use code::blocks but have some issues having the gdb working
The first ting I do is to setup the stlink gdbserver, then I use arm-none-eabi-gdb to attach to the target remotly (localhost:61234)
But:
1) Some "additional shell commands" are not executed.
I try to run a script which sets up the stlink server. The same used by STM32CubeIDE
If I run the script from a terminal it works, but code::blocks shell says it cant find the script
This is the command
/opt/tools/stlink/tools/bin/ST-LINK_gdbserver.sh
If passing this into a terminal, it runs, and the server is started listening on port 61234 as specified
but code::blocks says "[debug]/opt/tools/stlink/tools/bin/ST-LINK_gdbserver.sh: 2: ./ST-LINK_gdbserver: not found" when starting debugger
I also have a sleep 1 command which runs
2) Since 1) does not work I have started the gdbserver manually from terminal for now
then I start the debugger. It is attaching to target, and code runs but I have no access to debugg info.
file Z045.elf is loading but I cant set or use any breakpoints, including main
only thing I may do is to pause or continue, and I can see that the target operates as expected (it have a display among other stuff) but I may not accsess the code
"Cannot find bounds of current function". Issuing gdb command "file Target.elf" loads the symbol
Have tried some different debug settings for the compiler. like -g3 and -ggdb with no success
Active debugger config: GDB/CDB debugger:arm-embedded
Building to ensure sources are up-to-date
Selecting target:
.obj
Adding source dir: /opt/tools/gnutools/tools/lib
Adding source dir: /opt/tools/gnutools/tools/lib/gcc/arm-none-eabi/7.3.1
Adding source dir: /opt/tools/gnutools/tools/lib/gcc/arm-none-eabi/7.3.1/include
Adding source dir: /home/mini/proj/Z045_Port/sw/
Adding source dir: /home/mini/proj/Z045_Port/sw/
Adding file: /home/mini/proj/Z045_Port/sw/Z045.elf
Changing directory to: /home/mini/proj/Z045_Port/sw/.
Set variable: LD_LIBRARY_PATH=.:
[debug]Command-line: /opt/tools/gnutools/tools/bin/arm-none-eabi-gdb -fullname -quiet -args /home/mini/proj/Z045_Port/sw/Z045.elf
[debug]Working dir : /home/mini/proj/Z045_Port/sw
Starting debugger: /opt/tools/gnutools/tools/bin/arm-none-eabi-gdb -fullname -quiet -args /home/mini/proj/Z045_Port/sw/Z045.elf
Setting SHELL to '/bin/sh'
done
[debug]Reading symbols from /home/mini/proj/Z045_Port/sw/Z045.elf...
[debug]done.
[debug](gdb)
[debug]> set prompt >>>>>>cb_gdb:
Connecting to remote target
Setting breakpoints
[debug]Using terminal's PID as console PID 219048, TTY /dev/pts/0
[debug]Queued:[tty /dev/pts/0]
[debug]>>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GNU Tools for STM32 7-2018-q2-update.20190328-1800) 8.1.0.20180315-git
[debug]Copyright (C) 2018 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law. Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "--host=x86_64-linux-gnu --target=arm-none-eabi".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off
Debugger name and version: GNU gdb (GNU Tools for STM32 7-2018-q2-update.20190328-1800) 8.1.0.20180315-git
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 200
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor intel
[debug]No symbol "disassembly" in current context.
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> directory /opt/tools/gnutools/tools/lib
[debug]Source directories searched: /opt/tools/gnutools/tools/lib:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> directory /opt/tools/gnutools/tools/lib/gcc/arm-none-eabi/7.3.1
[debug]Source directories searched: /opt/tools/gnutools/tools/lib/gcc/arm-none-eabi/7.3.1:/opt/tools/gnutools/tools/lib:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> directory /opt/tools/gnutools/tools/lib/gcc/arm-none-eabi/7.3.1/include
[debug]Source directories searched: /opt/tools/gnutools/tools/lib/gcc/arm-none-eabi/7.3.1/include:/opt/tools/gnutools/tools/lib/gcc/arm-none-eabi/7.3.1:/opt/tools/gnutools/tools/lib:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> directory /home/mini/proj/Z045_Port/sw/
[debug]Source directories searched: /home/mini/proj/Z045_Port/sw:/opt/tools/gnutools/tools/lib/gcc/arm-none-eabi/7.3.1/include:/opt/tools/gnutools/tools/lib/gcc/arm-none-eabi/7.3.1:/opt/tools/gnutools/tools/lib:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[color=green][debug]> shell /opt/tools/stlink/tools/bin/ST-LINK_gdbserver.sh
[debug]/opt/tools/stlink/tools/bin/ST-LINK_gdbserver.sh: 2: ./ST-LINK_gdbserver: not found[/color]
[debug]>>>>>>cb_gdb:
[debug]> shell sleep 1
[debug]>>>>>>cb_gdb:
[debug]> target remote tcp:localhost:61234
[debug]Remote debugging using tcp:localhost:61234
[debug]0x0803beb6 in ?? ()
[debug]>>>>>>cb_gdb:
Connected
[debug]> file Z045.elf
In ?? () ()
[debug]> file Z045.elf
[debug]Reading symbols from Z045.elf...
[debug]done.
[debug]>>>>>>cb_gdb:Reading symbols from Z045.elf...done.
[debug]> b main
[debug]>>>>>>cb_gdb:
[debug]> break "/home/mini/proj/Z045_Port/sw/Src/main.c:62"
[debug]Breakpoint 2 at 0x8000cf8: file Src/main.c, line 62.
[debug]>>>>>>cb_gdb:Note: breakpoint 2 also set at pc 0x8000cf8.
[debug]> tty /dev/pts/0
[debug]Breakpoint 3 at 0x8000cf8: file Src/main.c, line 62.
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:
Breakpoint 3 at 0x8000cf8: file Src/main.c, line 62.
[debug]> continue
[debug]Continuing.
[debug]Note: automatically using hardware breakpoints for read-only addresses.
Trying to interrupt process with pid: 219045; child pid: 0 gdb pid: 219045
[debug]Program received signal SIGINT, Interrupt.
[debug]0x0803beb8 in ?? ()
[debug]>>>>>>cb_gdb:
Program received signal SIGINT, Interrupt.
In ?? () ()
[debug]> bt 30
[debug]#0 0x0803beb8 in ?? ()
[debug]#1 0x080390e4 in ?? ()
[debug]Backtrace stopped: previous frame identical to this frame (corrupt stack?)
[debug]>>>>>>cb_gdb:
[debug]> bt 30
[debug]#0 0x0803beb8 in ?? ()
[debug]#1 0x080390e4 in ?? ()
[debug]Backtrace stopped: previous frame identical to this frame (corrupt stack?)
[debug]>>>>>>cb_gdb:
[debug]> next
[debug]Cannot find bounds of current function
[debug]>>>>>>cb_gdb:
Cannot find bounds of current function
[debug]> next
[debug]Cannot find bounds of current function
[debug]>>>>>>cb_gdb:
Cannot find bounds of current function
[debug]> next
[debug]Cannot find bounds of current function
[debug]>>>>>>cb_gdb:
Cannot find bounds of current function
[debug]> next
[debug]Cannot find bounds of current function
[debug]>>>>>>cb_gdb:
Cannot find bounds of current function
[debug]> next
[debug]Cannot find bounds of current function
[debug]>>>>>>cb_gdb:
Cannot find bounds of current function
[debug]> next
[debug]Cannot find bounds of current function
[debug]>>>>>>cb_gdb:
Cannot find bounds of current function
[debug]> next
[debug]Cannot find bounds of current function
[debug]>>>>>>cb_gdb:
Cannot find bounds of current function
[debug]> next
[debug]Cannot find bounds of current function
[debug]>>>>>>cb_gdb:
Cannot find bounds of current function
[debug]> next
[debug]Cannot find bounds of current function
[debug]>>>>>>cb_gdb:
Cannot find bounds of current function
[debug]> next
[debug]Cannot find bounds of current function
[debug]>>>>>>cb_gdb:
Cannot find bounds of current function
[debug]> step
[debug]Cannot find bounds of current function
[debug]>>>>>>cb_gdb:
Cannot find bounds of current function
[debug]> finish
[debug]Run till exit from #0 0x0803beb8 in ?? ()
Trying to interrupt process with pid: 219045; child pid: 0 gdb pid: 219045
[debug]Program received signal SIGINT, Interrupt.
[debug]0x080390e4 in ?? ()
[debug]>>>>>>cb_gdb:
Program received signal SIGINT, Interrupt.
In ?? () ()
[debug]> bt 30
[color=red][b][debug]#0 0x080390e4 in ?? ()[/b]
[color=yellow][/color][debug]Backtrace stopped: previous frame identical to this frame (corrupt stack?)
[/color][debug]>>>>>>cb_gdb:
[debug]> step
[debug]Cannot find bounds of current function
[debug]>>>>>>cb_gdb:
[color=red][b]Cannot find bounds of current function[/b][/color]
The map file shows that the address 0x080390e4 is within a function,
GDB asks if it could be a corrupt stack, I do not believe that to be an issue. This because the same code runs well within CubeIDE