I'm working with SE using gdb to try to debug my ARM bare metal target using a J-Link debug probe (much faster than openocd which I discussed in a previous post).
Unfortunately SE is issuing a reset to my target after it loads my program, and this is messing up the debug session.
I have configured my gdb to run my custom gdbinit file which does this:
set verbose on
# Below connects to a special "gdbserver" which controls my bare-metal target
target extended-remote aaa.bbb.ccc.ddd:2331
monitor reset
monitor halt
load my_program.axf
source post_load.gdb
The problem occurs after this gdbinit is executed, SE is issuing a reset command to my target and this is screwing up the debug session. I already issue the reset before loading the program in my gdbinit.
When I was using openocd (a different debug probe) to debug, I was able to override this reset in the openocd config to not actually perform a reset, and I was able to debug my bare metal target.
But when using the J-Link debugger, I can't find a way to override this reset in the J-Link configuration. Since I can't do that, I would like a way to tell SE not to issue this reset command.
The above I tried using the "Debug" option in my build configuration.
I also tried Debug->Attach Debugger->Attach to running process(GDB)
But this method has some issues:
1) The dialog asks for a PID. My target is not linux, it is a bare metal target with a special gdbserver that is debugging the lone process running on a microcontroller.
2) I did provide my IP and port in "connect via socket" and provided my special gdb config in "gdb configuration", however after clicking "OK", SE locks up for a while before issuing error "Error starting debugger: GDB returned an error attaching to the remote process 'Don't know how to attach. Try 'help target''"
Note that Eclipse for embedded (
https://projects.eclipse.org/projects/iot.embed-cdt) provides more control about how gdb runs. I have attached 2 screenshots. It shows that you can tell eclipse to tell gdb to:
1) reset/not reset before loading
2) issue custom gdb commands after the reset
3) load/not load symbols
4) load/not load executable
5) reset/not reset after loading
6) issue custom gdb commands after loading
7) set/not set a breakpoint at main
continue or not continue
It would be nice if SE offered this level of control. I'm particularly interested in disabling the reset at 5) above.