Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic GDB Stub strange result (Read 1784 times)
Sylvain
Junior Member
**
Offline


Posts: 67
Location: Montreal, Canada
Joined: Nov 13th, 2014
GDB Stub strange result
Feb 28th, 2021 at 11:02pm
Print Post  
Hi,

    After a week playing around GDB Stub, I have some interrogation.  At base it is working but I have some strange problems.   If my code is running and I set a breakpoint the red breakpoint spot in the left column say "Attempting to bind breakpoint" and it never came back. after that I try to stop debugging and VS can't shot down the debugger. after a will it ask to force to stop.  after this the usb comport is frozen and I had to unconnected my usb port. when all is done it work again.  is it possible to place a breakpoint when the code is running?  If I place a breakpoint before sending the code to the esp it's work and I'm able to change the breakpoint location and continue to execute the code to the next breakpoint.  And somethime when the code is running after hitting a breakpoint vs receive a breakpoints in ESP core library.

Thanks for all
Sylvain Bissonnette 
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2174
Joined: Feb 13th, 2019
Re: GDB Stub strange result
Reply #1 - Mar 1st, 2021 at 10:21am
Print Post  
Thanks for the report.

The ESP8266 GDB Stub only supports a single breakpoint at a time, so once you stop on one, you have to remove it to accurately set the next one. If you do set > 1 breakpoint it may show "Unknown Stopping Event" and not stop where you expect.

The limitation of one breakpoint, and one watchpoint is a limitation of the GDBStub itself (see Git Notes)

Does this help?
  
Back to top
 
IP Logged
 
Sylvain
Junior Member
**
Offline


Posts: 67
Location: Montreal, Canada
Joined: Nov 13th, 2014
Re: GDB Stub strange result
Reply #2 - Mar 1st, 2021 at 9:05pm
Print Post  
Thanks Simon for your reply,

    That's fine for that, but if I have no breakpoint in my code, I upload in debug mode the debugger start and if I place a breakpoint while the code is running it is not working the binding don't work is it normal? after 3 minutes that the code is running the breakpoint look to bind and in the output window I have message like:

Breakpoint 2, loop () at C:\Users\Sylvain Bissonnette\Documents\Arduino\Wifi_RGB/Wifi_RGB.ino:175
175            if (WiFi.status() == WL_CONNECTED)

Program received signal SIGTRAP, Trace/breakpoint trap.
0x40100849 in millis () at C:\Users\Sylvain s\esp8266\core_esp8266_wiring.cpp:185
185        acc.q += ( m * (uint64_t)MAGIC_1E3_wHI );
The program '' has exited with code 42 (0x2a).

OR ------------- 

or a new window open with
Frame not in module
The current stack frame was not found in a loaded module. Source cannot be shown for this location.

OR ------------- 

and sometime it's crash in WString with the messages
Program received signal SIGTRAP, Trace/breakpoint trap.
0x4021aea3 in String::setLen (len=0, this=0x3fffff14) at C:\Users\Sylvain s\esp8266/WString.h:304
304              inline void setLen(int len) { if (isSSO()) sso.len = len; else ptr.len = len; }
Trace/breakpoint trap

This condition only occur only when I place the breakpoint while the code is running.

PS: Excuse for my bad English I'm French speaking.

Thanks for all your time
Sylvain Bissonnette
  
Back to top
 
IP Logged
 
Sylvain
Junior Member
**
Offline


Posts: 67
Location: Montreal, Canada
Joined: Nov 13th, 2014
Re: GDB Stub strange result
Reply #3 - Mar 1st, 2021 at 9:46pm
Print Post  
Additional info

I connect my oscilloscope on the RX line of my ESP, I can see the data coming in from the debugger but if I put a breakpoints into my code while the code is running nothing pass through the serial port at first but after 1 minutes data came in from the debugger and the code break but not in the good place some ware like "random" in esp library code.

Sylvain Bissonnette

  
Back to top
 
IP Logged
 
Sylvain
Junior Member
**
Offline


Posts: 67
Location: Montreal, Canada
Joined: Nov 13th, 2014
Re: GDB Stub strange result
Reply #4 - Mar 6th, 2021 at 12:41am
Print Post  
No Reply, No Comments??? Sad
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: GDB Stub strange result
Reply #5 - Mar 6th, 2021 at 1:03am
Print Post  
Sorry we missed your posts. 

Frame not in module can happen if you try to step into core code that is distributed as an  archive or pre built loibrary that does not provide the source code. Optimization settings can also cause this but changing optimization settings should be done carefully as some cores and libraries are not designed for certain settings. That is out of our hands and for reference you should read about the core or libraries you are using.

Visual Micro is responsible for building, uploading the code and showing data in the serial monitor, not for how the GDB stub works which is an open source library that you have installed. 

Hardware debuggers and GDB stub make complex use of interrupts as does the wifi and other background tasks of the ESP devices. I wish we could be more helpful but I have to suggest that you direct any questions about how GDB Stub plays alongisde ESP8266 and your code usage of WiFi/Timers and Interrupts etc.

Visual Micro launches the Microsoft GDB debugger which then controls Visual Studio and manages breakpoints etc. Visual Micro does not have any interaction with the debugger after it has launched. If the author of the GDb Stub library has any questions then it might be possible to switch on some of the ms gdb logging although that isn't great. 

One suggestion would be to use the "vMicro > Show/Hide Hidden Files" so that the underlying core and library sources appear in the project. This might make setting a breakpoint in the correct location possible but you do need to be careful of how you step. Clicking the little green arrow that appears left of each code line during debug when the mouse is hovered over the code line is often the safest way to jump to a bit of code without needing a breakpoint.

As Simon stated previously having only a single breakpoint to work with is a feature of the GDB stub library you are using and it does make life quite tricky. I would try to run without breakpoint and use the little green arrow instead. That effectively sets a breakpoint in background but in a softer way the gdb stuff might be happier with. This is certainly true for hardware debuggers.

I know the Visual Micro serial/wifi debugger isnt ideal for library and core sources but it is recommended whenever possible because it provides unlimited (limited only by memory) break/trace points and avoids using mcu menory for trace message.

Sorry can't be more help. Simon might have some extra insight next week but I suspect that GDB Stub on an ESP8266 needs very careful use. If there was an alternative solution we would support it.




  
Back to top
WWW  
IP Logged
 
Sylvain
Junior Member
**
Offline


Posts: 67
Location: Montreal, Canada
Joined: Nov 13th, 2014
Re: GDB Stub strange result
Reply #6 - Mar 10th, 2021 at 9:33pm
Print Post  
Thanks for your reply Tim, It's now clear,  I understand all your points.

Sylvain Bissonnette
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint