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
Normal Topic Setting break or trace statements causing Arduino to reset (Read 3987 times)
NightFly85
Newbies
*
Offline


Posts: 6
Joined: Nov 4th, 2015
Setting break or trace statements causing Arduino to reset
Jun 2nd, 2016 at 6:09am
Print Post  
Using 1605.28 plugin in VS2015 SP2

In one program I am getting a hang or auto reset when using VM debugging. I've tried everything to get it to work.

To be clear, debugging works in my other programs using same board (Nano 328) and environment.

On one point in time the program was overriding "OnSerialEvent" but no longer. Some ideas would be appreciated as I need debugging!

Problem program attached.
  
Back to top
 
IP Logged
 
NightFly85
Newbies
*
Offline


Posts: 6
Joined: Nov 4th, 2015
Re: Setting break or trace statements causing Arduino to reset
Reply #1 - Jun 2nd, 2016 at 6:19am
Print Post  
I #ifdef out a a lot of code and now on compile I get the following error after simply adding a breakpoint:

Code (C++)
Select All
DewMeNot.ino:In function 'void loop()
controller_v312_HTU21D_BT.ino:2328:63: error: 'MicroDebug' was not declared in this scope
:if ((tempcurrentMillis - _probe_prevMillis) > tempwaitdelay) {
    debugger: The error shown above might be caused by invalid breakpoint syntax or the board is not yet supported for debugging (pls let us know!)
Error compiling project sources 

« Last Edit: Jun 2nd, 2016 at 6:20am by NightFly85 »  
Back to top
 
IP Logged
 
NightFly85
Newbies
*
Offline


Posts: 6
Joined: Nov 4th, 2015
Re: Setting break or trace statements causing Arduino to reset
Reply #2 - Jun 2nd, 2016 at 6:44am
Print Post  
Ok came across a post about that compile error and re-organizing my header and defines fixed that issue.

So now it seems that simple breakpoints do not break (at least no reset). But trace statements do cause the Nano to reset when hit. 

My trace statement is: Hello World
  
Back to top
 
IP Logged
 
NightFly85
Newbies
*
Offline


Posts: 6
Joined: Nov 4th, 2015
Re: Setting break or trace statements causing Arduino to reset
Reply #3 - Jun 2nd, 2016 at 7:13am
Print Post  
Ok, got further.

My project file named the same as my project was empty - my code was in another project file.

Moved that code over to the main project file. I got basic trace to work (just some text), but trace with variable capture will reset the Nano.

Breakpoint will not break. Disabled "Trace only..." debug setting had no affect.
  
Back to top
 
IP Logged
 
NightFly85
Newbies
*
Offline


Posts: 6
Joined: Nov 4th, 2015
Re: Setting break or trace statements causing Arduino to reset
Reply #4 - Jun 2nd, 2016 at 7:29am
Print Post  
Holy crap, I think I figured it all out.

Pre-processor defines are messing with things.

1) Even if something is #ifdef out, it would seem the compiler sill parses it somewhat. I had some code using a type that was #ifdef out and although that code was also defined out, I was getting compiler errors until I commented the code out as well.

2) Setting breakpoints or traces inside of a defined (i.e. compiled code)  #ifdef block are ignored.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Setting break or trace statements causing Arduino to reset
Reply #5 - Jun 2nd, 2016 at 2:29pm
Print Post  
Thanks for the update. I am sure others will find it very useful Smiley
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint