-
Notifications
You must be signed in to change notification settings - Fork 13.3k
How to use gdbstub #4169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Did you "see" debug-output on the serial port (visible after resetting the target)? |
I would expect that the device would stop at a breakpoint after reset since I've set GDBSTUB_BREAK_ON_INIT in gdbstub-cfg.h, but that is not happening. After resetting the device appears to boot normally as I see the debug output from my sketch. I do see some output immediately after restart that looks binary-ish and is not from my code. Yes I built with -ggdb and -Og. Output immediately after reset: |
I do not recognize the output, you should see something like $T05#B9.... |
What baud rate does the GDB stub use? I could not find anything in the stub that established the rate. |
The baud rate is flexible. |
Thanks for the tips. I have it working. My sketch stops at the initial breakpoint in the gdbstub just as it should. Beautiful. Now if I can find a way to get vscode to work with remote serial debugging I'll be happy. |
@weswitt I've seen this question several times. Given that you got it working, could you please do a writeup with instructions? You could either do a PR with a new doc that links from readthedocs, or just post the guide here and someone will transcribe it into a doc. |
@weswitt Another instruction can be found here: https://www.youtube.com/watch?v=S_QTMNhaDwM&t=742s |
@freeck I speak german, but not dutch, but in any case, the link is blocked for me due to policy beyond my control. |
I am in the middle of the process of making an instruction manual for the esp32 using OpenOCD-JTAG ( large parts are already available on readthedocs). |
I said:
My intent is to have it in a doc here in the repo, to be visible from readthedocs, so yes. There is a Troubleshooting doc already with a debugging section, it could be added as an addition there. |
@devyte I could translate my doc into English, and update it. |
@devyte |
@weswitt @freeck we're talking about the same. Both using gdb and building with debug messages are debugging, they're just different aspects of it. There are other methods as well. |
I will complete an instruction document asap. What I still do not understand why the core-team changed gdbstub in such a way that it does not support source level debugging.... See discussion:
|
In looking at the diffs between the 2.4.0 gdbstub and the private copy from @freeck the material changes are in gdbstub-cfg.h for config settings and some minor changes in gdbstub.c. It seems that the changes, if necessary, in gdbstub.c should be pushed into the mast code base for everyone. |
@weswitt I you read topic #2663 it seems to be an intentional decision not to support source level debugging. I refer to my previous question (above) to the core-team (@devyte) . |
OK folks I finally found some inspiration to finalize an instruction...it is available at |
@freeck I haven't delved into gdbstub and debugging with gdb myself (I'm old school: on embedded devices I use printf everywhere), I'm not aware of the reasons behind the decision either. |
@devyte I reopened the link, do you have access now? (onedrive: https://1drv.ms/f/s!AgjNziQJTfNOhoJztuFNADmz1_F_1g ). |
Nope, my devices are company issued (Free Stuff!) and cloud storage sites are blocked because IT is retarded. |
Quite a hassle....a totally other environment than what I am used to. |
@devyte I think I have managed to create a pull request :) "GDBStub-source-level-debug". No idea whether that is the right location. Please let me know whether you have acces to the files. |
I just read this post: #4386 |
Closing as this is better tracked in #5559 where there is a documented example in the docs/ subdir. |
I need some help getting gdbstub to work. This is what I'm seeing. I am running this on Windows.
I have compiled gdbstub and linked it into my sketch. I modified user_init() to call gdbstub_init(). I then flash the device and reset. I then start xtensa-lx106-elf-gdb with the gdb commands below. I have also listed the gdb log below too.
GDB COMMANDS:
file d:/dev/src/homeauto/sonoff/app/bin/esp8266/sonoff.elf
set remotelogfile d:/dev/src/homeauto/sonoff/app/gdblog.txt
set serial baud 115200
set remote hardware-breakpoint-limit 1
set remote hardware-watchpoint-limit 1
target remote com4
GDB LOG:
w +$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEve
nts+;no-resumed+#df
r <Timeout: 2 seconds>
w $qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEven
ts+;no-resumed+#df
r <Timeout: 2 seconds>
w $qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEven
ts+;no-resumed+#df
r <Timeout: 2 seconds>
w $qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEven
ts+;no-resumed+#df
r <Timeout: 2 seconds><Timeout: 2 seconds>
w -
r <Timeout: 2 seconds>
w -
r <Timeout: 2 seconds>
w -+$Hg0#df
r <Timeout: 2 seconds>
w $Hg0#df
r <Timeout: 2 seconds>
w $Hg0#df
r <Timeout: 2 seconds>
w $Hg0#df
r <Timeout: 2 seconds>
End of log
The text was updated successfully, but these errors were encountered: