Teensy GDBStub Debugging via Serial with VS Integration

visual_micro

Active member
Using the amazing GDBStub Library for Teensy 3/4 by Fernando Trias, you can now have the GDB experience on Teensy 3/4 without any additional hardware!

With the Teensy servicing multiple Serial Ports you don't lose your Serial output or need extra hardware.

This has been integrated into Visual Micro with the familiar menu options used for Serial and other Hardware Debugging in our latest release 20.06.18.2.
TB_Teensy4x-GDBStub.png

All Standard GDB Features are readily available:
Step by Step execution using breakpoints, with navigational Into / Over / Out functions as well
Add breakpoints dynamically at runtime without rebuild / upload
Conditional breakpoints
Editable Watch / Local / Autos Windows
Call Stack Tracing
And More...

Further Information and a Video Example of this GDB Stub in Action in Visual Micro are below:
GDBStub Arduino Library for Teensy 3/4 by Fernando Trias

Visual Micro VS Extension Website

Visual Micro Documentation

You Tube Video of Teensy GDB Stub Setup + Debugging in Action in Visual Micro

Debug-Break-TEENSY4-GDBSTUB-VSOnly.jpg
 
Thanks,

As I mentioned on thread up on VisualMicro(https://www.visualmicro.com/forums/YaBB.pl?num=1593297620/0#9)
This will come in handy to help debug some stuff including some hexapod code.

The YouTube video helped understand setting this up.

For awhile I was having difficulty figuring out how to get breakpoints set changed. But I believe now you can only change the breakpoints while already in the debugger and/or if you set a breakpoint and then recompile reconnect...

So I added code that makes it easier for me with the hexapod code. I added simple command in my terminal monitor code as well as if I press the L3 button on my PS3 and if GDB is connected, I use the halt() macro and it breaks into the debugging. At which point I can now change the state of breakpoints, add new ones...

So again thanks to both @ftria as well as VisualMicro, it is nice to have another option on how to debug stuff on a Teensy!
 
Forgot to mention, what gotcha that I have found using Visual Studio,

Is their library search order does not match the Arduino Search Order.

For example with a current build of my Hexapod code, Arduino tells you:
Code:
Multiple libraries were found for "LSS.h"
 Used: C:\Users\kurte\Documents\Arduino\libraries\LSS_Library_Arduino
 Not used: C:\Users\kurte\Documents\Arduino\libraries\Lynxmotion_Smart_Servo_-LSS-
Multiple libraries were found for "SoftwareSerial.h"
 Used: C:\Users\kurte\Documents\Arduino\libraries\SoftwareSerial
 Not used: C:\arduino-1.8.13\hardware\teensy\avr\libraries\SoftwareSerial
Multiple libraries were found for "ST7735_t3.h"
 Used: C:\Users\kurte\Documents\Arduino\libraries\ST7735_t3
 Not used: C:\arduino-1.8.13\hardware\teensy\avr\libraries\ST7735_t3
Multiple libraries were found for "SPI.h"
 Used: C:\Users\kurte\Documents\Arduino\libraries\SPI
 Not used: C:\arduino-1.8.13\hardware\teensy\avr\libraries\SPI
Multiple libraries were found for "USBHost_t36.h"
 Used: C:\Users\kurte\Documents\Arduino\libraries\USBHost_t36
 Not used: C:\arduino-1.8.13\hardware\teensy\avr\libraries\USBHost_t36
Using library TeensyDebug at version 0.0.1 in folder: C:\Users\kurte\Documents\Arduino\libraries\TeensyDebug 
Using library EEPROM at version 2.0 in folder: C:\arduino-1.8.13\hardware\teensy\avr\libraries\EEPROM 
Using library LSS_Library_Arduino at version 1.3.1 in folder: C:\Users\kurte\Documents\Arduino\libraries\LSS_Library_Arduino 
Using library SoftwareSerial at version 1.0 in folder: C:\Users\kurte\Documents\Arduino\libraries\SoftwareSerial 
Using library ST7735_t3 at version 1.0.0 in folder: C:\Users\kurte\Documents\Arduino\libraries\ST7735_t3 
Using library SPI at version 1.0 in folder: C:\Users\kurte\Documents\Arduino\libraries\SPI 
Using library USBHost_t36 at version 0.1 in folder: C:\Users\kurte\Documents\Arduino\libraries\USBHost_t36
But when I load this into VisualMicro, it instead will use:
Code:
 Not used: C:\arduino-1.8.13\hardware\teensy\avr\libraries\ST7735_t3
 Not used: C:\arduino-1.8.13\hardware\teensy\avr\libraries\USBHost_t36
But for me is more of an issue as I do developement work on those two libraries, and for example with the USBHost code I am using a different branch with additional Bluetooth support

My current fixes for this (after I remember to do after new version of Teensyduino installed) is to remove the versions from Teensyduino and then have the VisualMicro than rescan...

Again not a big deal, but just something to keep an eye out for.
 
Not sure if these posts are helping anyone, but thought I would give a few updates from things I have played with plus responses and information from Visual Micro.

Things like: When you are setup for DualSerial, how do you view/send data to your Serial object...
What I was doing was: change the comm port as part of the drop down and then press the button the right of it (Open Serial Monitor). But there is a different way:
Click on the vMicro Tool bar button, go to the general menu and then choose the Monitor Alternative item which has drop down with Serial ports.

Also I asked about with the GDBStub which has command line extensions, can I access these?
They put up a page that shows you how to do so:
https://www.visualmicro.com/page/Executing-Custom-GDB-Commands-in-Visual-Micro.aspx

Now back to playing
 
Back
Top