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 and Verbose
  • 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 Debugging breakpoints in header files (Read 817 times)
ausculta
Newbies
*
Offline


Posts: 3
Joined: Jul 6th, 2022
Debugging breakpoints in header files
Jul 6th, 2022 at 3:13pm
Print Post  
I've got a rather large piece of ESP32 code broken down into a .ino file and .h header files containing a number of classes (declarations and implementation - yes, we know its not ideal practice but it's a lot easier to manage and work on than a 15,000 line .ino file). The header files are all #include'd into the .ino file.
When I place a breakpoint in the .ino file VisualMicro stops correctly, etc. But when I place the breakpoint in the .h file they never trigger, even with a breakpoint in the .ino file too. If I take the code from the header file and move it to the .ino file, the breakpoints trigger.

Is this expected? Is there a setting I haven't tried, yet, to use the header files as intended even when debugging?
Thank you!
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 1615
Joined: Feb 13th, 2019
Re: Debugging breakpoints in header files
Reply #1 - Jul 6th, 2022 at 5:20pm
Print Post  
Thanks for the report.

I believe this is expected behaviour, however if you use multiple INO files (same as "Tabs" in Arduino IDE), or CPP files the Serial debugging features should work as expected.

Does this help?
  
Back to top
 
IP Logged
 
ausculta
Newbies
*
Offline


Posts: 3
Joined: Jul 6th, 2022
Re: Debugging breakpoints in header files
Reply #2 - Jul 6th, 2022 at 10:14pm
Print Post  
Thank you Simon. I had kind of expected this to be the answer, unfortunately, but was hoping there was a magic switch somewhere I hadn't found.
I'll try with cpp files. The alternative would be to turn all the supporting classes into 1 or more libraries.
Thanks.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Online


Posts: 11674
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging breakpoints in header files
Reply #3 - Jul 8th, 2022 at 10:23pm
Print Post  
An alternative would be to use hardware debugging. It is only the serial/wifi debugger that can not currently debug .h files.
  
Back to top
WWW  
IP Logged
 
ausculta
Newbies
*
Offline


Posts: 3
Joined: Jul 6th, 2022
Re: Debugging breakpoints in header files
Reply #4 - Jul 9th, 2022 at 5:02pm
Print Post  
Thank you Tim. I re-factored the code properly (I was being lazy). So now I've got a nice bunch of proper header files and CPP with my .ino. The .ino wouldn't compile when it had the same name as one of the .cpp files so I renamed it.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Online


Posts: 11674
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging breakpoints in header files
Reply #5 - Jul 9th, 2022 at 5:14pm
Print Post  
Great, yes if you add a .cpp with same name as the [project_name].ino then it becomes an override for ALL .ino code. + The serial debugger can't work in that mode.
« Last Edit: Jul 9th, 2022 at 5:15pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Michael B
Newbies
*
Offline


Posts: 3
Joined: Jun 2nd, 2022
Re: Debugging breakpoints in header files
Reply #6 - Jul 17th, 2022 at 3:00am
Print Post  
99.9999% of my code is templates. Template interfaces and implementations must reside in the same translation unit. Standard practices are to put everything in a header <.h> file (e.g. the C++ Standard Library). So, without breaking any ANSI/ISO Standards or 30+ years of coding practice, what is your workaround for using the serial debugger in a header?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint