Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 

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
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Debugging breakpoints in header files (Read 650 times)
ausculta
Newbies
*
Offline



Posts: 3
Debugging breakpoints in header files
Jul 6th, 2022 at 4:13pm
 
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: 1578
Re: Debugging breakpoints in header files
Reply #1 - Jul 6th, 2022 at 6:20pm
 
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
Re: Debugging breakpoints in header files
Reply #2 - Jul 6th, 2022 at 11:14pm
 
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
*****
Offline



Posts: 11542
United Kingdom
Re: Debugging breakpoints in header files
Reply #3 - Jul 8th, 2022 at 11:23pm
 
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
 

Tim Leek
home
WWW  
IP Logged
 
ausculta
Newbies
*
Offline



Posts: 3
Re: Debugging breakpoints in header files
Reply #4 - Jul 9th, 2022 at 6:02pm
 
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
*****
Offline



Posts: 11542
United Kingdom
Re: Debugging breakpoints in header files
Reply #5 - Jul 9th, 2022 at 6:14pm
 
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.
Back to top
« Last Edit: Jul 9th, 2022 at 6:15pm by Tim@Visual Micro »  

Tim Leek
home
WWW  
IP Logged
 
Michael B
Newbies
*
Offline



Posts: 3
Re: Debugging breakpoints in header files
Reply #6 - Jul 17th, 2022 at 4:00am
 
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 Topic Print