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 Question on general debugging (Read 2287 times)
snakethumper
Newbies
*
Offline


Posts: 8
Joined: Jul 3rd, 2014
Question on general debugging
Jul 3rd, 2014 at 5:30am
Print Post  
Hi

Question from noob... I havent installed and tried this software yet but thought I'd ask before I do....

I have a Sketch running on Arduino Mega 1280. Every now and then it freezes (locks up), I assume because there is some kind of code error and the Arduino is crashing. The only way to get it going again is to reset it. 

Since Arduino code by default doesn't seem to have any way of Error Handling or Error Trapping, I'm looking for a way to find out what the problem might be. 

Could someone advise me if Visual Micro (with/without debug addition) would be able to assist me in this ? 

I'm used to programming in Visual Studio using C#. Does this plugin work the same way? - e.g. if the Arduino error occurred while running in the Visual Studio / Visual Micro Plugin environment, would it stop at the offending line of code, and identify the particular error code where the problem happened ?

Any advice much appreciated

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


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Question on general debugging
Reply #1 - Jul 3rd, 2014 at 5:25pm
Print Post  
Hi,

The best that can happen is that you can use the debugger in "Trace" mode and add a few breakpoints at various points in the code to report expression/variable values but not to halt the processing by breaking. This allows you to slowly find the problem by trial and error, moving breakpoints close to the crash.

Often an Arduino crash means the memory limit is exceeded. If using Arduino 1.5 formats the compiler should show you how much memory has been used. If the value exceeds 90% there is high chance of crash as the code uses more memory during processing.

If the memory usage is very high the Visual Micro debugger will make things worse because it has to use some memory so be aware of that.

Strings in your code can consume the special 2k or 4+k of memory provided by these chips for that type of storage. If you have a lot of serial.print("my string") or "long quoted string" in your code this would consume some important memory and cause a crash more easily.

If debug strings in code are the problem then the Visual Micro debugger can help if you transfer the strings from your code to break point messages. Visual mciro does not store the breakpoint messages on the Arduino. 

notes: You probably know that VS stores breakpoints in the .sln file so it must be saved to be sure that breakpoints messages are saved. Breakpoints can also be exported for safe keeping but can fall out of sync with the code so another thing to be aware of
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint