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
Hot Topic (More than 8 Replies) debug serial (Read 2193 times)
patenteux
Junior Member
**
Offline


Posts: 26
Joined: Jan 15th, 2024
debug serial
Jan 25th, 2024 at 9:36pm
Print Post  
I have two questions:

1- When using the serial debugger is it possible to execute the code line by line without putting breakpoints on each line?

2- When using the serial debugger is it possible to enter a function with breakpoints inside the function?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12166
Location: United Kingdom
Joined: Apr 10th, 2010
Re: debug serial
Reply #1 - Jan 25th, 2024 at 10:08pm
Print Post  
1. no, you need the gdb stub or hardware debug option for that.

2. not sure what you mean. You can put breakpoints inside functions.
  
Back to top
IP Logged
 
patenteux
Junior Member
**
Offline


Posts: 26
Joined: Jan 15th, 2024
Re: debug serial
Reply #2 - Jan 26th, 2024 at 4:48am
Print Post  
HI Tim!

If I have functions that are defined in .H files and I request these functions in the LOOP of the .INO file I can put a brakpoint in the .INO file but if I put a breakpoint in the .H file when I 'uses the debugger the pointer which tells me at which line the debugger is rendered does not switch to the .H file.
Is it possible to switch to the .H file with the serial debugger?
If yes, how?
Regard,
Lepatenteux
  

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


Posts: 12166
Location: United Kingdom
Joined: Apr 10th, 2010
Re: debug serial
Reply #3 - Jan 26th, 2024 at 5:28pm
Print Post  
Yes header files are not compiled as units therefore software serial does not manage breakpoints in them.

I suggest moving the function to a .ccp with #include of the header. the prototype can stay in the header.
  
Back to top
IP Logged
 
patenteux
Junior Member
**
Offline


Posts: 26
Joined: Jan 15th, 2024
Re: debug serial
Reply #4 - Jan 27th, 2024 at 3:06am
Print Post  
H1!

As you will see in the image attached to this message, I made a Source1.cpp file with the flasher2 function and the BP does not execute in the .cpp but the code executes the flasher2 function.
For what? Where is the problem, it's a very simple code!
  

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


Posts: 26
Joined: Jan 15th, 2024
Re: debug serial
Reply #5 - Jan 27th, 2024 at 3:08am
Print Post  
Look this image please.
  

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


Posts: 12166
Location: United Kingdom
Joined: Apr 10th, 2010
Re: debug serial
Reply #6 - Jan 27th, 2024 at 4:07am
Print Post  
The falsher2 prototype goes in the header.h and marked as extern

The .cpp is never #include in code only .h.

#include <header1.h>

Why not just put your function in another .ino file. Then you don't need the prototype or to learn how h/cpp works

  
Back to top
IP Logged
 
patenteux
Junior Member
**
Offline


Posts: 26
Joined: Jan 15th, 2024
Re: debug serial
Reply #7 - Jan 28th, 2024 at 10:00pm
Print Post  
HI!

For the serial debugger to start, after having recompiled and uploaded the code, I must unplug and plug in the USB port on the ESP32Wroom card. Even if I do a reset with the switch it doesn't start.
What can be done to solve this problem?

This mis message from Micro Debug Trace:

Launching Debugger...
   - Serial debug will start immediately. WiFi (or gdb) debug will start a few seconds or a short time after the remote device connects to the network.
   - Switch on 'vmicro>debugger>full speed' to prevent debugger message throttling. (read the docs)
   - If 'in-break live watch' is disabled, continue an existing paused debug session by sending the character 'c' to the board using the Serial window.
   - If uploading on WiFi but debug is on Serial then it is possible the cpu will be in debug break when OTA upload is attempting connect. If this is the case then sending char 'c' using the serial/debug terminal will force the mcu to continue (like F5).
   - WiFi debug? Wifi debug is not fully supported yet. Use the vMicro>Debugger menu to set an alternative debug port such as Serial (default speed is 115k)
   - To view debug messages without trace messages use the 'message windows' option on the monitor window.
   - Switch off this message and other Tutorial messages using the 'vMicro>General' menu

Regard,
:Le patenteux
  

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


Posts: 12166
Location: United Kingdom
Joined: Apr 10th, 2010
Re: debug serial
Reply #8 - Jan 28th, 2024 at 10:22pm
Print Post  
The serial debugger works in combination with the serial window.

Dock the serial window that you currently have minimized so that it is visible.

Does that help?
  
Back to top
IP Logged
 
patenteux
Junior Member
**
Offline


Posts: 26
Joined: Jan 15th, 2024
Re: debug serial
Reply #9 - Jan 28th, 2024 at 11:48pm
Print Post  
Hi!
The behavior is identical even when fixing all windows.
What is the solution?
  

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


Posts: 26
Joined: Jan 15th, 2024
Re: debug serial
Reply #10 - Jan 28th, 2024 at 11:51pm
Print Post  
Hi!
I send  the debug trace.

  

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


Posts: 12166
Location: United Kingdom
Joined: Apr 10th, 2010
Re: debug serial
Reply #11 - Jan 29th, 2024 at 2:35am
Print Post  
Are your breakpoints from setup() or loop().

When the serial monitor shows "connect" in green that means the serial is connected. That and the trace show the debugger is active.

If you are trying to debug code in the setup() it is possible the setup() has happen before the debugger could attach. To prove this you can add a delay(3000) to the start of the setup().

Other notes.

It's not important to have so many windows pinned. In this discussion we just need to see serial monitor, trace. 

Selecting the board option called "Debug: serial" is not related to the serial debugger. That is an esp32 board option that causes the esp core to send verbose internal info to the serial monitor.

Arduino boards usually have a way to force a reboot when the serial monitor connects but the esp32 boards do not have that facility. This means other arduino boards will more easily land in the setup(0 when serial debug starts.
  
Back to top
IP Logged
 
patenteux
Junior Member
**
Offline


Posts: 26
Joined: Jan 15th, 2024
Re: debug serial
Reply #12 - Jan 29th, 2024 at 4:14am
Print Post  
Hi!
The BPs are without the loop.
I will put a delay of 3 seconds at the start of setup to allow the debugger to start even if there is no BP in setup.

regard,
Le patenteux
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12166
Location: United Kingdom
Joined: Apr 10th, 2010
Re: debug serial
Reply #13 - Jan 29th, 2024 at 6:54pm
Print Post  
The delay only helps if there are breakpoints in the setup or functions called from setup and is not always required even in those circumstances.

It looks like the breakpoints are not being hit. Are they conditional or on code lines that are "if" statements?
  
Back to top
IP Logged
 
patenteux
Junior Member
**
Offline


Posts: 26
Joined: Jan 15th, 2024
Re: debug serial
Reply #14 - Jan 31st, 2024 at 11:12am
Print Post  
Hi!

The BPs are not in the setup and they are not conditional or in an IF.
Regard,
le patenteux
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12166
Location: United Kingdom
Joined: Apr 10th, 2010
Re: debug serial
Reply #15 - Feb 1st, 2024 at 1:48am
Print Post  
The optimisation settings are for advanced use or for with hardware debugging. 

Leave the optimization on default. The serial debugger works fully optimized.

Please show an image of your solution explorer so we can see the structure of your project code files.

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