ESP8266 Developer Zone The Official ESP8266 Forum 2015-11-16T17:03:21+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=1239 2015-11-16T17:03:21+08:00 2015-11-16T17:03:21+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1239&p=4613#p4613 <![CDATA[Re: esp-gdbstub: cannot step through code]]>
Is there any progress on this subject? I also posted this issue to Sysprogs , but they refer to Espressif as being the developer of gdb-stub. I hope you will continue your efforts resolving this issue.
Thanks.

Statistics: Posted by Freeck — Mon Nov 16, 2015 5:03 pm


]]>
2015-11-02T14:25:17+08:00 2015-11-02T14:25:17+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1239&p=4411#p4411 <![CDATA[Re: esp-gdbstub: cannot step through code]]> Statistics: Posted by ESP_Sprite — Mon Nov 02, 2015 2:25 pm


]]>
2015-10-21T16:27:23+08:00 2015-10-21T16:27:23+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1239&p=4214#p4214 <![CDATA[Re: esp-gdbstub: cannot step through code]]> Statistics: Posted by Freeck — Wed Oct 21, 2015 4:27 pm


]]>
2015-10-21T15:31:37+08:00 2015-10-21T15:31:37+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1239&p=4209#p4209 <![CDATA[Re: esp-gdbstub: cannot step through code]]>
It's strange, I've debugged ARM chips via JTAG with code running from flash, and there the 'b' command sets a hardware breakpoint. Here I have to issue the 'hb' command explicitly, otherwise it tries to set a software breakpoint.

Code:

MacBook-Pro:wifirgbled joostn$ ./gdb.command
GNU gdb (crosstool-NG 1.20.0) 7.5.1
Copyright (C) 2012 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-build_apple-darwin14.5.0 --target=xtensa-lx106-elf".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /Users/joostn/GitProjects/ucprojects/projects/wifirgbled/build/app.elf...done.
Remote debugging using /dev/cu.wchusbserial1410
0x4010649b in gdbstub_do_break_breakpoint_addr ()
(gdb) hb main.cpp:535
Hardware assisted breakpoint 1 at 0x4023a5d1: file user/main.cpp, line 535.
(gdb) c
Continuing.

Breakpoint 1, jnuc::Application::Run (this=this@entry=0x3fff1618) at user/main.cpp:535
535      m_TimerInterrupt.Start(1);
(gdb) d
Delete all breakpoints? (y or n) y
(gdb) n
0x40000504 in ?? ()
(gdb) bt
#0  0x40000504 in ?? ()
#1  0x4023a994 in main () at user/main.cpp:42
(gdb)

Statistics: Posted by joostn — Wed Oct 21, 2015 3:31 pm


]]>
2015-10-21T16:14:50+08:00 2015-10-20T21:43:01+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1239&p=4188#p4188 <![CDATA[Re: esp-gdbstub: cannot step through code]]>
First of all, great news there is a gdbstub available, it saves 4 IO pins. I have used VisualGdb and a jtag-device for debugging, but it was/is far from stable.

To answer your question: It should be possible to single step through flash code, at least that was possible using jtag.
First you have to disable all breakpoints before continuing single stepping.

Statistics: Posted by Freeck — Tue Oct 20, 2015 9:43 pm


]]>
2015-10-18T00:09:57+08:00 2015-10-18T00:09:57+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1239&p=4144#p4144 <![CDATA[Re: esp-gdbstub: cannot step through code]]> So does that mean it is not supposed to work for code in flash?

Anyway I can put relevant sections of code to RAM for debugging, so it's no big deal.

Statistics: Posted by joostn — Sun Oct 18, 2015 12:09 am


]]>
2015-10-17T23:55:05+08:00 2015-10-17T23:55:05+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1239&p=4143#p4143 <![CDATA[esp-gdbstub: cannot step through code]]>
Many thanks espressif (and sprite_tm?) for releasing esp-gdbstub! Not sure where to post questions regarding this so I'll just try here.

I got it mostly working by following the instructions. I'm able to set the hardware breakpoint (code in flash) and I can inspect variables. Only thing which doesn't seem to work is stepping through the code. I can step manually by clearing the breakpoint and setting it to the next source line. But stepping with the 'next' command fails with message '0x40000504 in ?? ()'. See log:

Code:

MacBook-Pro:wifirgbled joostn$ ../../esp8266/xtensa-lx106-elf/bin/xtensa-lx106-elf-gdb -x gdbcmds -b 115200
GNU gdb (crosstool-NG 1.20.0) 7.5.1
Copyright (C) 2012 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-build_apple-darwin14.5.0 --target=xtensa-lx106-elf".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
0x4010649b in gdbstub_do_break_breakpoint_addr ()
(gdb) hb main.cpp:535
Hardware assisted breakpoint 1 at 0x4023a5d1: file user/main.cpp, line 535.
(gdb) c
Continuing.

Breakpoint 1, jnuc::Application::Run (this=this@entry=0x3fff1608) at user/main.cpp:535
535      m_TimerInterrupt.Start(1);
(gdb) bt
#0  jnuc::Application::Run (this=this@entry=0x3fff1608) at user/main.cpp:535
#1  0x4023a994 in main () at user/main.cpp:42
(gdb) d 1
(gdb) hb main.cpp:536
Hardware assisted breakpoint 2 at 0x4023a5db: file user/main.cpp, line 536.
(gdb) c
Continuing.

Breakpoint 2, jnuc::Application::Run (this=this@entry=0x3fff1608) at user/main.cpp:536
536      m_FlashStorage.LoadData(&m_ConfigData);
(gdb) bt
#0  jnuc::Application::Run (this=this@entry=0x3fff1608) at user/main.cpp:536
#1  0x4023a994 in main () at user/main.cpp:42
(gdb) n
0x40000504 in ?? ()
(gdb) bt
#0  0x40000504 in ?? ()
#1  0x4023a5db in jnuc::Application::Run (this=0x3fffc230) at user/main.cpp:535
#2  0x40104d5c in gdbPacketEnd () at ../../esp8266/esp-gdbstub/gdbstub.c:184
#3  0x401053c5 in gdbHandleCommand (cmd=cmd@entry=0x3ffef808 <cmd> "m3ffef800,8",
    len=len@entry=1) at ../../esp8266/esp-gdbstub/gdbstub.c:457
#4  0x40105492 in gdbReadCommand () at ../../esp8266/esp-gdbstub/gdbstub.c:509
#5  0x3ffea2d2 in info ()
warning:
Unrecognised function prologue. Stack trace cannot be resolved. This message will not be repeated in this session.

(gdb)


The finish command gives similar problems:

Code:

(gdb) hb main.cpp:535
Hardware assisted breakpoint 1 at 0x4023a5d1: file user/main.cpp, line 535.
(gdb) c
Continuing.

Breakpoint 1, jnuc::Application::Run (this=this@entry=0x3fff1608) at user/main.cpp:535
535      m_TimerInterrupt.Start(1);
(gdb) d
Delete all breakpoints? (y or n) y
(gdb) finish
Run till exit from #0  jnuc::Application::Run (this=this@entry=0x3fff1608)
    at user/main.cpp:535
Warning:
Cannot insert breakpoint 0.
Error accessing memory address 0x4023a994: Input/output error.

(gdb)


I suspect this is because my code is in flash and gdb is trying to set a temporary software breakpoint instead of a hardware breakpoint?

Statistics: Posted by joostn — Sat Oct 17, 2015 11:55 pm


]]>