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] 2  Send TopicPrint
Very Hot Topic (More than 25 Replies) Comm ports disappear from Visual Studio when using GDBStub (Read 9044 times)
Tom Thibault
Junior Member
**
Offline


Posts: 18
Joined: Jan 8th, 2020
Comm ports disappear from Visual Studio when using GDBStub
Sep 21st, 2023 at 9:48pm
Print Post  
Project set up like the web page: https://www.visualmicro.com/page/Teensy-GDBDebugging.aspx

Worked fine for a while.  Later, I started to get the can't start up debugging
message:

Unable to start debugging. Unexpected GDB output from command "-exec-run". Don't know how to run.  Try "help target".

The "dual serial" comm ports are no longer listed in the drop down on the IDE.
They are also no longer listed on Win 10 Device Manager.

Can't reliably bring them back.  Any ideas?

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #1 - Sep 21st, 2023 at 10:20pm
Print Post  
Please post the info requested in the yellow box near the top of this page
  
Back to top
IP Logged
 
Tom Thibault
Junior Member
**
Offline


Posts: 18
Joined: Jan 8th, 2020
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #2 - Sep 22nd, 2023 at 7:06pm
Print Post  
Sent by email is a log for re-build after a "clean"
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #3 - Sep 22nd, 2023 at 7:30pm
Print Post  
Thanks, which port have you set for debug and which for upload?

Do you get the issue if you just try to use "Debug>Attach to process"?
  
Back to top
IP Logged
 
Tom Thibault
Junior Member
**
Offline


Posts: 18
Joined: Jan 8th, 2020
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #4 - Sep 22nd, 2023 at 7:59pm
Print Post  
As I said before those two ports have disappeared from the IDE.  They used to be there and now they are not.  See the images.  Attach to process does the same thing
« Last Edit: Sep 22nd, 2023 at 8:01pm by Tom Thibault »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #5 - Sep 22nd, 2023 at 10:05pm
Print Post  
Oh yes. 

The ports are discovered by running an exe called teensy_ports.exe in background. Not really something we have control of.

If you cant see anything in device manager then did you try powering down the pc and restarting it? 

Normally the teensy ports system works well, therefore might be a windows problem.

We also reproduced similar by selecting the wrong teensy board and attempting build/upload. The COM port disppeared but when we selected the corect board and performed the upload again the ports reappered.

I think first thing is to recycle power.
« Last Edit: Sep 22nd, 2023 at 10:05pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Tom Thibault
Junior Member
**
Offline


Posts: 18
Joined: Jan 8th, 2020
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #6 - Sep 23rd, 2023 at 2:48am
Print Post  
Recycled power several times and it made no difference.

Swapped cables and the first time I inserted it, Windows reported a com5 created (connected to a T3.6 not a T4.1).  Opened Visual S. for that T3.6 box and the com5 showed there.  When I tried to compile/upload a T3.6 program it would not load and the com5 disappeared.  Can not make it or any other com ports come back.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #7 - Sep 23rd, 2023 at 11:01pm
Print Post  
I think we have got to the bottom of this.

If you upload to a teensy 4.1 with "No optimization" the ports disappear. 

After that, all upload attempts do not auto upload. The upload window appears but the reset button on the teensy must be pressed for the upload to happen.

This means that to get your ports back you need to change the optimizarion setting to anything other than "No optimization". Then attempt upload and click the reset button on the board.

We will let pjrc know about the issue and add a note to the documentation.

After that is working we can review why the gdb stub is failing for you.

  
Back to top
IP Logged
 
Tom Thibault
Junior Member
**
Offline


Posts: 18
Joined: Jan 8th, 2020
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #8 - Sep 25th, 2023 at 9:10pm
Print Post  
I think there is more to it than that.

Many hours of experimenting later here is what I know.

The serial debug port did not "disappear" from Windows Device Manager.  Instead it disconnected whenever upload was triggered in VS.  I learned about "hidden devices".  It was there but disconnected.  Switching to Arduino !.8.19, compile/upload, then press the button on the Teensy reconnected the port.  Then all was well while you compile and upload from Arduino.  Switch back to VS IDE and you could watch the serial data from the Teensy program on the reconnected VS port.  As soon as you compile and upload on VS, the port disconnected.  Going back to Arduino would re-connect it.  From VS I could not load a one line program into the T3.6 or the T4.1.  The serial port always disconnected.

Now, the very bizarre.  I was annoyed during all this that VMicro stuck a message about "Converting solution to latest format".  I finally did that and then VS could compile and upload the program.  That message claimed that this only affected intellisense.  Now, if I watch the VS upload, Device Manager shows the port disconnected temporarily, but then it comes back a few seconds later and my program works normally.  The other oddity is that after the "Converting solution" the Solutions Platform no longer says x86.  It now says ARM.  This makes sense, but did that conversion really only affect intellisense.

There was one more message that appears in the VS output log that says

Teensy should be selected from "teensy ports" rather than "Serial ports" in Arduino's Tools > Port menu.

Don't understand why VS would put that one out.  Over in the Arduino ide I had selected Teensy not Serial.

I will now try to do the debugging once again.  I'm pretty convinced this problem was never Windows, because Arduino IDE always behaved normally and reconnected the port, then uploaded automatically thereafter. The problem seemed only within VS.
  
Back to top
 
IP Logged
 
Tom Thibault
Junior Member
**
Offline


Posts: 18
Joined: Jan 8th, 2020
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #9 - Sep 25th, 2023 at 10:48pm
Print Post  
Well now I'm back where I was with the original post.  Can compile and load with Arduino and everything is good.  But I tried one time to use GDBStub debugging like before and now every time I upload, the port disconnects.  Happens for Release and Debug.  Now I can not use VS at all.
  
Back to top
 
IP Logged
 
Tom Thibault
Junior Member
**
Offline


Posts: 18
Joined: Jan 8th, 2020
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #10 - Sep 25th, 2023 at 10:58pm
Print Post  
Well now I'm back where I was with the original post.  Can compile and load with Arduino and everything is good.  But I tried one time to use GDBStub debugging like before and now every time I upload, the port disconnects.  Happens for Release and Debug.  Now I can not use VS at all.

Is this data from the loader any help?
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tom Thibault
Junior Member
**
Offline


Posts: 18
Joined: Jan 8th, 2020
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #11 - Sep 25th, 2023 at 11:08pm
Print Post  
More data.  This is from the loader when it worked with Arduino.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #12 - Sep 26th, 2023 at 12:26am
Print Post  
If I understand correct, Arduino and Visual Micro work the same without GDBStub.

GDBStub and teensy 4x is working for us on multiple boards. Visual Micro doesn't have to do anything special except lauch the vs debugger.

It is important to be clear about which dual serial ports you have configured. One using Serial and one using SerialUSB1?

The teensy loader doesn't show much. The information shown in the yellow box above, after clicking Debug>Start, will show us your config. 






  
Back to top
IP Logged
 
Tom Thibault
Junior Member
**
Offline


Posts: 18
Joined: Jan 8th, 2020
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #13 - Sep 26th, 2023 at 7:37pm
Print Post  
No.  Arduino always works.  VS worked for a few attempts with a "Release" compile and upload.  Since I then had VS working, I tried a "debug".  When I setup the IDE for Debug it never produced the two new com ports.  I have only seen them produced twice.

When I attempted to compile and then upload, the serial port disconnected again.  The Arduino compile, upload, push the Teensy button sequence always brings back the com port as before.

Now I have switched back to "Release" build and did a clean, then a re-build, then pressed "Start".  The port again disconnected during the upload.

Attached are two logs, one from the re-build, the other from the start.

What is with the last three lines of the second file?
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #14 - Sep 26th, 2023 at 8:29pm
Print Post  
Is "tools>options>visual micro>communications>network discovery" enabled?
  
Back to top
IP Logged
 
Tom Thibault
Junior Member
**
Offline


Posts: 18
Joined: Jan 8th, 2020
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #15 - Sep 26th, 2023 at 8:55pm
Print Post  
Yes it is.
  
Back to top
 
IP Logged
 
Tom Thibault
Junior Member
**
Offline


Posts: 18
Joined: Jan 8th, 2020
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #16 - Sep 26th, 2023 at 8:58pm
Print Post  
However the next line is:

Port Discovery Error    The given key was not present in the dictionary.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #17 - Sep 27th, 2023 at 12:48pm
Print Post  
Quote:
What is with the last three lines of the second file?

The last 3 lines in the second file are shown when the teensy loader has been passed a normal COM Port, so not all properties are merged (protocol/label).  This is the same in the Arduino IDE.  If you select the upload port as the Teensy Port e.g. usb:0/14000/0, then this error is not shown in either IDE.

Quote:
The port again disconnected during the upload.

The Serial port has to be disconnected during the upload, so the upload can happen through it, and optionally so the Teensy can present its' new COM ports once it has flashed (in the case where the Serial Type has been changed in the board options).  This also happens in the Arduino IDE. The Auto-Reconnect button at the bottom of the Serial Monitor Window in Visual Micro will make it reconnect again after the upload has completed.

Quote:
When I setup the IDE for Debug it never produced the two new com ports.

From your logs it appears you only have one Serial Port configured in the board options (USB Type: Serial). which means only one port is presented.  If this is changed to "Dual Serial" then there will be 2 x COM ports listed once the code is recompiled and flashed.

Quote:
The Arduino compile, upload, push the Teensy button sequence always brings back the com port as before.

Are you running the exact same code in the Arduino IDE, including the TeensyDebug.h, with the same board options selected?
  
Back to top
IP Logged
 
Tom Thibault
Junior Member
**
Offline


Posts: 18
Joined: Jan 8th, 2020
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #18 - Sep 27th, 2023 at 9:21pm
Print Post  
First of all.  I am not doing any debug right now.  Just trying to get Release code to build/load/run.  The entire program is this:

void setup() {
  Serial.println("\nStartup");
}

// the loop function runs over and over again until power down or reset
void loop() {
  Serial.println("\nNext");
  delay(1000);
}


In your last response:

First:  Agree those last three lines behave like you said.

Second:  Agree that the Arduino build disconnects and then re-connects with the above code and all other code tried.  The VM build is release not debug, so there are no additional ports.  The VM build does not re-connect after upload.  The output window says the upload completed but the port remains disconnected.  The only way I can find to re-connect the port is to use the Arduino IDE (1.8.19).

Third:  I don't understand.  Since I'm trying to run Release mode now, why would I select dual serial.  Before, when I was trying to run Debug mode, I did select 
Dual Serial.  The very first time I did that, the system worked exactly the way your tutorial says.  Two new ports were presented, the lower number was selected for serial output and the higher was selected for debug.  I built, it uploaded, connected and I could use the debugger commands.  About the third time I changed the source code, the IDE stopped connecting to the debugger.  I started getting the message in the Original Post.  I have only seen the two additional ports presented once more when I created a new project with only a few lines of code in it (the above code plus the required references to GDB).  Now it won't even do that, so I abandoned GDB altogether, took out the references to GDB and tried just to build the simplest project with Release properties.  So hear I am,  VM can not load the above program at all.

Fourth:  Again, I don't understand exactly what you are asking.  Yes, the code is exactly what you see above.  There is no TeensyDebug.h involved.    What board options do you mean?  I don't even know how to select debug in the Arduino IDE.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Comm ports disappear from Visual Studio when using GDBStub
Reply #19 - Sep 27th, 2023 at 10:06pm
Print Post  
The board options are where you select serial or dual serial etc. These are teensy settings nothing to do with debug. These board Options are shown on the "vMicro" menu and also in the Arduino IDE.

It is possible to configure release to debug that is why we asked about debugging. The release/debug setting in Visual Studio is just a quick way for you to configure different settings and switch between them.

The serial ports disappearing when optimization was none is caused by the teensyDebug.h library. Nothing to do with Visual Micro.

When you say the port remain disconnected do you mean the port does not show in the ports list? Normally the word disconnected would apply to the serial monitor.

When you enable debugging the port you select for debugging must be the one that you initialize in your code with debug.begin(). For example debug.begin(SerialUSB1) will be one of the two dual serial ports. It is for you to determine which is the COM port that is used for the Serial monitor and which is the COM port for debugging.

Can you please post the output for your Release build/upload. The last output you sent included the Teensydebug.h

Also clarify disconnect means the port disappears from the ports list.

Thanks
  
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint