Run GDB commands on debug
已完成
I'm trying to use JLinkGDBServer to debug on a Nordic nRF52832 using CLion. The problem I have is the application is already running when the debugging starts. So I need to run
monitor reset
continue
To reset the device. In ~/.gdbinit I added:
define target hookpost-remote
monitor reset
continue
end
My application is currently hitting a SIGTRAP due to a bug, so execution is paused when the debugger starts. When I debug in CLion as normal, this happens:
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Reading 64 bytes @ address 0x00027D40
Read 2 bytes @ address 0x00027D98 (Data = 0x4A39)
Read 4 bytes @ address 0x00029D38 (Data = 0x462ABE00)
Reading 64 bytes @ address 0x2000FFC0
Read 4 bytes @ address 0x00029A22 (Data = 0xBD00B003)
Received monitor command: reset
Resetting target
Resetting target
Setting breakpoint @ address 0x00027D98, Size = 2, BPHandle = 0x0001
Starting target CPU...
com.intellij.execution.ExecutionException: Unexpected response: ^running
...Breakpoint reached @ address 0x00027D98
Reading all registers
Removing breakpoint @ address 0x00027D98, Size = 2
Read 4 bytes @ address 0x00027D98 (Data = 0xA9034A39)
Debugger requested to halt target...
GDB closed TCP/IP connection
Process finished with exit code 0
Remote doesn't know how to detach
Debugger disconnected
GDB Server stopped, exit code 0
请先登录再写评论。
Hello!
Do you use the Embedded GDB Server configuration? If yes, please try the following: make your ~/.gdbinit empty, launch the debug session and use the R button on the left-hand bar of the Debugger tool window to perform a reset. Does it work?
Yes, pressing the reset button and continue works. But I was looking for a way to do this automatically.
It seems the problem needs a proper investigation. Please create an issue in our tracker: https://youtrack.jetbrains.com/issues/CPP.
Also the problem looks related to https://youtrack.jetbrains.com/issue/CPP-12455, so feel free to comment or upvote.