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) Simple debugging idea (Read 19267 times)
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Simple debugging idea
Oct 18th, 2011 at 10:37pm
Print Post  
A register level debugger is difficult to implement for arduino but it also seems that it would be of little use to non-avr people like myself.

I would like to be able to see a serial trace when certain methods are called, when the value of a variable changes to within a given range or if a variable value changes to any other value.

It is possible for the arduino visual studio addin to distinguish between, for example, "Release" and "Debug" builds. 

For "Debug" builds the addin could automatically alter/append serial debug statements to the temporary version of the sketch that it creates prior to compile.

Obvously memory needs to be considered so we would need a compact serial message system. To conserve memory in debug mode the addin could automatically exclude unused memory hogs such as unused arduino serial ports.

So the question is how can we neatly use the visual studio interface + additional tool window(s) to allow us to configure what we would like to debug? 

Breakpoints might be one obvious way to enable a serial debug message to be automatically generated stating the source method and line number hit.

But do we also need a "watch variable" tool window that we can access and populate prior to debugging. A watch window that saves the "watches" for each arduino project? 

Would you find this useful? What else would be useful?
  
Back to top
WWW  
IP Logged
 
Marius
Developer
****
Offline


Posts: 204
Location: Centurion RSA
Joined: Sep 7th, 2011
Re: Simple debugging idea
Reply #1 - Oct 23rd, 2011 at 1:06pm
Print Post  
I like your suggestion very much. I could do with just a watch window that print out a value for a watched variable. Or maybe a group of variables.

You would have to look at the linker output or direct the linker to place the selected variables in a specific location. You can then add a procedure to print the variables from that location or block of memory and maybe have a table somewhere of the type for each variable. Just a thought.
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Simple debugging idea
Reply #2 - Oct 23rd, 2011 at 3:47pm
Print Post  
Yes i thought about that but i don't have the experience to implement the idea. If you can help it would be very useful.

This is the sort of thing I was going to do but your idea would better i think. or maybe some sort of combination

I was simply going to add some serial output to the hidden temporary source prior to compile. A pre-parsed list of watched variables would allow a byte to be assigning as as an id that would tie back to the known watch list. It might also be possible to add an id of the "line number/source file" the debug message relates to. It seems that with a serial header we would only need a few serial bytes to be sent to the debug listener.

In the meantime, I had another little thought of something small and easy that we could have immediately. In Visual Studio when we switch between "release" and "debug", a compiler define could be automatically added and used something like this:- 

#ifdef ARDUINO_DEBUG
\\do some stuff for debug
#endif

This would save us having to add and maintain our own debug constant and make it easy to switch our projects into test mode
« Last Edit: Oct 23rd, 2011 at 3:48pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
diecore
Newbies
*
Offline


Posts: 2
Joined: Jul 24th, 2011
Re: Simple debugging idea
Reply #3 - Nov 13th, 2011 at 5:15pm
Print Post  
What about the Atmel AVR Studio 5 which is based on Visual Studio 2010 (shell)?

I am not sure if it supports plugins but at least supports extentions.

It could be fantastic to use the AS5 avr-gcc toolchain to program and then simulate or even jtag debug arduino programs in AS5!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Simple debugging idea
Reply #4 - Nov 13th, 2011 at 6:38pm
Print Post  
yes i looked at it but there are complications. maybe with some help.

they haven't added addin support in 5.0 so we would have to move to an extension.

i can't find any documentation to see how to program any of their own extensions such as boards and programmers which are probably required to make their intellisense work correctly.

we use the visual studio c++ intellisense and we control and override the visual studio c++ project proeprties.

5.0 had it's own C and CPP language extensions so we would need to know how to override or set the correct properties

it should be amazingly easy to make this work because the visual micro system is spilt in two UI and Arduino API. So boards, libs, compile etc is all available to any windows application. 

we just need more info about avr studio 5.0 but it is hard work communicating with atmel

it might be that arduino will hook up with atmel to produce a special version next year. 

finally avr probably uses isp to debug. in my hunt for how to switch on for arduino i found that switching on the correct fuses breaks the isp and spi features of arduino. it can't be switched off again and I don't understand arduino chips enough to understand why. I suspect the bootloader needs to do something that it does not.

anyone interested in having a go please contact me
« Last Edit: Nov 13th, 2011 at 6:40pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Rei Vilo
Member
***
Offline


Posts: 123
Joined: Jan 10th, 2012
Re: Simple debugging idea
Reply #5 - Feb 2nd, 2012 at 3:00pm
Print Post  
There's an interesting idea here: http://emulare.sourceforge.net/



There's even an explanation on how to integrate it with Eclipse.

How to integrate it into Visual Micro plug-in?
« Last Edit: Feb 2nd, 2012 at 3:06pm by Rei Vilo »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Simple debugging idea
Reply #6 - Feb 2nd, 2012 at 8:26pm
Print Post  
Intesting. I will look at that.

How do you think it should integrate from a user point of view?
  
Back to top
WWW  
IP Logged
 
Rei Vilo
Member
***
Offline


Posts: 123
Joined: Jan 10th, 2012
Re: Simple debugging idea
Reply #7 - Feb 7th, 2012 at 9:22pm
Print Post  
We should make a difference between an emulator and a debugger.

Emulare is clearly an emulator, but it is based on avr-gdb.

I'm more interested in a debugger, to track some values and some functions, all this in order to avoid the endless Serial.print commands.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Simple debugging idea
Reply #8 - Feb 7th, 2012 at 10:49pm
Print Post  
me too! by the way your xcode make file is a work of art. very nice, mac users should be very excited. i'm thinking of setting up vs to use the same or similar. well done again!
  
Back to top
WWW  
IP Logged
 
Rei Vilo
Member
***
Offline


Posts: 123
Joined: Jan 10th, 2012
Re: Simple debugging idea
Reply #9 - Feb 8th, 2012 at 9:01am
Print Post  
Back to debugging, main issue is, as a rule of thumb, twice as much resources are required: one for running the sketch, another for monitoring what's going on. I'm afraid micro-controllers can't afford it!

So here's an idea from another micro-controller, fischertechnik Robo TX I'm playing with.



If offers two modes:
  • stand-alone compiled mode: the program is uploaded to the micro-controller and then operates without the help of the PC, much like an Arduino board runs,
  • on-line debug mode: the micro-controller is a passive I/Os device and the program is run by the PC


Now, what's needed? A specific sketch for the Arduino board, a communication protocol and a main program for Visual Studio.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Simple debugging idea
Reply #10 - Feb 8th, 2012 at 10:54am
Print Post  
okay but auto injection of serial into an existing sketch would be most useful otherwise it's not a true debug/report

as for your idea, maybe firmata will help?
  
Back to top
WWW  
IP Logged
 
Rei Vilo
Member
***
Offline


Posts: 123
Joined: Jan 10th, 2012
Re: Simple debugging idea
Reply #11 - Feb 8th, 2012 at 2:21pm
Print Post  
Tim@Visual Micro wrote on Feb 8th, 2012 at 10:54am:
as for your idea, maybe firmata will help?


Maybe, but I don't want to write lines of codes just for debugging!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Simple debugging idea
Reply #12 - Feb 8th, 2012 at 2:42pm
Print Post  
true. I like the idea of injecting serial "watchers/reports", it will save adding the prints and be an 80% solution
  
Back to top
WWW  
IP Logged
 
Rei Vilo
Member
***
Offline


Posts: 123
Joined: Jan 10th, 2012
Re: Simple debugging idea
Reply #13 - May 5th, 2012 at 7:51am
Print Post  
Is there a date for the release of the debugging tools for Visual Micro?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Simple debugging idea
Reply #14 - May 5th, 2012 at 9:42am
Print Post  
i'm trying to get a manual/guide done this weekend so it will hopefully be soon
  
Back to top
WWW  
IP Logged
 
Rei Vilo
Member
***
Offline


Posts: 123
Joined: Jan 10th, 2012
Re: Simple debugging idea
Reply #15 - May 5th, 2012 at 3:20pm
Print Post  
Great! 

Good luck with the manual Wink
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Simple debugging idea
Reply #16 - May 6th, 2012 at 2:14am
Print Post  
Update. I've written first drafts on some of the features and hope to add more over the next week or so. There are some extra bits of work on the software to finish but they should only take a day or so when I get to it. So I hope for a release this month, hopefully next week or so.

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