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 GDBstub not working as expected on Nano using VS 2026 with VM. (Read 7 times)
jimf
Junior Member
**
Offline


Posts: 24
Joined: May 30th, 2015
GDBstub not working as expected on Nano using VS 2026 with VM.
Today at 6:40pm
Print Post  
I'm having a heck of a time getting GDB stub working with VS2026 and VM.  This is the first time I'm using GDBstub.  Below are three examples of how I set up for GDBstub in setup().  My VS project has one .ino file and several .h and .cpp files.  I've attached the build.  target board in Nano 328p. My IDE is set as on the VM tutorials. building a release version, hardware debug with GDBstub. Optimization No project + library optimization.  Any help is much appreciated!  Thanks....jim

Example 1: configured as below, with breakpoints set at lines 82 and 100 (both showing in breakpoints window as "break always".
After starting debugger (attaching to process) the debugger breaks at line 82.  If I press continue (F5) the breakpoint at line 100 is ignored and the program is running.   
When I press pause (break all ctl+alt+break) the debugger breaks within the code for Loop()....clearly not what is expected.


     //#define UseVMserialDebug            // uncomment out if using VM native serial debugger.  Leave in place if using GDBstub
     
14      #ifndef UseVMserialDebug
15      #define DISABLE_HWSERIAL
16      #define SkipMoreBreakpointCalls
17      #include <app_api.h>
18      #include <avr8-stub.h>
19      #include <Arduino.h>
20      #endif // !UseVMserialDebug



67      void setup() {
68      #ifndef UseVMserialDebug
69      // using GDBstub to debug
70      debug_init();      // Initialize GDB suub for debugging
71      #ifdef SkipMoreBreakpointCalls
72            static bool firstBreakpointFncCall = true;
73            if (firstBreakpointFncCall)
74            {
75                  firstBreakpointFncCall = false;
76                  breakpoint();   // debugger on-ramp
77            }
78      #endif
79      #endif
80
81
82      pinMode(s1, INPUT_PULLUP);      // when pressed, pin is pulled low--> active low

Here is the debug output for this:
=cmd-param-changed,param="pagination",value="off"
0x0000224a in setup () at C:\Users\jimfr\OneDrive\JF_Documents\Jim\home stuff\Repos\jimfrankfort\Generic-button-handler\PB_Example1/PB_Example1.ino:76
76                  breakpoint();   // debugger on-ramp
Warning: Exceptions are not supported in this scenario.

Breakpoint 6, setup () at C:\Users\jimfr\OneDrive\JF_Documents\Jim\home stuff\Repos\jimfrankfort\Generic-button-handler\PB_Example1/PB_Example1.ino:82
82            pinMode(s1, INPUT_PULLUP);      // when pressed, pin is pulled low--> active low

Example 2: If I change how Breakpoint() is invoked to that which is below, I get the same behavior, only stopping at the first breakpoint.   
Pressing continue ends up with the program running, stopping in loop() on break-all.


#ifndef UseVMserialDebug
     // using GDBstub to debug
     debug_init();      // Initialize GDB suub for debugging
     breakpoint();   // debugger on-ramp
#endif

here is the debug output for this configuration:
=cmd-param-changed,param="pagination",value="off"
setup () at C:\Users\jimfr\OneDrive\JF_Documents\Jim\home stuff\Repos\jimfrankfort\Generic-button-handler\PB_Example1/PB_Example1.ino:76
76            pinMode(s1, INPUT_PULLUP);      // when pressed, pin is pulled low--> active low
Warning: Exceptions are not supported in this scenario.

Breakpoint 6, setup () at C:\Users\jimfr\OneDrive\JF_Documents\Jim\home stuff\Repos\jimfrankfort\Generic-button-handler\PB_Example1/PB_Example1.ino:76
76            pinMode(s1, INPUT_PULLUP);      // when pressed, pin is pulled low--> active low

Example3: If I move the first breakpoint to the next executable line, it doesn't even break there, just runs the program.  Break-all stops in loop(). Below is the debug output for  this example.
=cmd-param-changed,param="pagination",value="off"
setup () at C:\Users\jimfr\OneDrive\JF_Documents\Jim\home stuff\Repos\jimfrankfort\Generic-button-handler\PB_Example1/PB_Example1.ino:76
76            pinMode(s1, INPUT_PULLUP);      // when pressed, pin is pulled low--> active low
Warning: Exceptions are not supported in this scenario.

Program received signal SIGINT, Interrupt.
0x00000c86 in BI:TonguerocessButtons (this=<optimized out>) at C:\Users\jimfr\OneDrive\JF_Documents\Jim\home 
293                              if (SWreg[x].SWcurState == BIstate::T) SWreg[x].SWevalState = BtnState:Tongueressed;            // Unk, T --> pressed
Natvis: [Error] Natvis failed to parse typename: unsigned long

  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint