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 Debug Confusion (Read 7626 times)
Davidh
Junior Member
**
Offline


Posts: 19
Location: uk
Joined: Nov 20th, 2012
Debug Confusion
Nov 25th, 2012 at 2:47pm
Print Post  
I found this scenario most confusing.

I have an app running under debug with a Brkpt. Which when Hit Continues Execution.

If I edit the code and/or Brkpt (to stop Execution) a simple Start under Debug compiles/uploads/debugs the new version.

Now if edit the Brkpt back to Continue Execution and do Debug/Start  it continues with the existing upload, ignoring my edits.

I have to
    Build/Rebuild the code
    Project/Upload (the last Arduino Build)
    Debug/Start now rebuilds and uploads a new version with the changes.

I think this is something to with the need for two Compiles, it would be nice if the difference between editing when running and editing when stopped at a breakpoint could be removed.

Also when I first opened the Solution double/clicking on the 'blink' folder opened the Properties Dialog and I could set the debug to full, but somehow I closed this dialog, now I cannot re-open it open with a double click (or find any other process) - it closes the entry.

Apart from these  'learning curve' issues it looks great.

I have been running VS C# 10 Express on Netduino, and the above  just did not occur (netduino or arduino which do I use?). So this may be 10 v. 12 issue.

If I have missed something please let me know, thank-you
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debug Confusion
Reply #1 - Nov 25th, 2012 at 3:09pm
Print Post  
I don't know there seems to be a few questions here.

Firstly if you have knowlege of netduino and have not been working with arduino and are a windows user used to normal windows debug I suggest that netduino might be your best option.

Arduino doesn't have a proper hardware debug facility so the whole debug process has to be a little different. 

The debug code is injected into a temp version of your sketch which is then uploaded to the arduino. This means there must be a new compile to remove the debugging. If we leave the debug on the arduino it also means that we can "pick up" an active debug session the next time we re-start vs simply by opening the serial tool. This latter point is a benefit when debugging remote sensors that need to run for weeks or months at a time but this entire process needs to be considered in a new light. 

So this debug solution is not for everyone but a lot better than manually adding Serial.println() statements to the arduino code. This is what Arduino users normally do but is something that Netduino users do not need to do.

Vm should be detecting the changes to your setting prior to debug upload but it sounds like it isn't doing this with some breakpoint properties. I have reported a few small bugs to microsoft in this same area. Vs sometimes provides the previous brkpnt info to vm for a short time, I haven't worked out what causes vs to update its internal knowledge. I guess that saving source code changes or clicking to a different source file in the solution tree might cause vs to update itself correctly. As you say rebuild works for you.

During debug, the first compile, "Release" is simply to ensure that error message line numbers that match with your code lines. Keep in mind the debug compile adds code behind the scenes which would throw out line numbers and make code errors look confusing.

If you are not making source code changes or can easily know when you make mistakes it is possible to switch off the first "Release" compile when you start debugging. There is a project property called "Validation Skip" in the "Micro Debug" section. Setting the property to "True" will skip the "Release" build. 

Quote:
it would be nice if the difference between editing when running and editing when stopped at a breakpoint could be removed.


Can you please explain what you see as the "difference". I've been using it for too long so I've lost sight of things that affect new users. Thanks Smiley
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debug Confusion
Reply #2 - Nov 25th, 2012 at 3:34pm
Print Post  
Oops, forgot to say that the properties window is a confusing name because it only appears as a tool window. The debug settings will be moved to the Micro Explorer in future releases.

To open the properties tool window, select the project node in the solution explorer and press F4. There is also a menu item instead of F4, some versions of vs are different. Make sure the project node is selected in the solution explorer and look for these menu items
VIEW>Properties Window
VIEW>Other Windows>Properties Window
  
Back to top
IP Logged
 
Davidh
Junior Member
**
Offline


Posts: 19
Location: uk
Joined: Nov 20th, 2012
Re: Debug Confusion
Reply #3 - Nov 25th, 2012 at 3:42pm
Print Post  
Thank-you for your comments, I am just starting out, and my first step is to explore the tools available, I am actually a Mac user - I used Visual Basic a long time ago so I found VS 10 reasonably familiar.

To reply to your specific question.

The differences (as I see it) are that:

If I edit while running then Debug/Start  re-builds/uploads/debugs the new version.

If I edit when stopped at a Breakpoint. Debug/Start resumes with the current upload.
I have to explicitly.
    Build/Rebuild the code
    Project/Upload (the last Arduino Build)
    Debug/Start now rebuilds and uploads a new version with the changes.
« Last Edit: Nov 25th, 2012 at 3:43pm by Davidh »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debug Confusion
Reply #4 - Nov 25th, 2012 at 4:12pm
Print Post  
Quote:
If I edit while running then Debug/Start  re-builds/uploads/debugs the new version.


I might be missing your point here so five me... 

I think this is the difference between a normal hardware debugger and a software debugger. 

If you make any changes and Debug>Start (or F5) while debugging then you are prompted to upload the new changes. The debugger has to work this way because the Arduino does not have the facility for interactive changes to the debugger while running. A new program must be uploaded with the new source or debug instructions. 

You can enable/disable breakpoints without uploading again, this is the only thing that can be altered during a debug session.

If I am correct and if you can achieve your project goals using netduino then I think this is the best route for you. The Arduino has a big community and lots of examples but the fact that it does not have normal debugging is difficult to understand for many seasoned programmers.

As a new Arduino users, to understand the benefits of the debugger,  it might be an idea to follow the recommended arduino debug solution using serial text messages. Then your comparisons and expectations will become clearer.

Quote:
If I edit when stopped at a Breakpoint. Debug/Start resumes with the current upload


Okay I missed your point and got confused earlier. I think this will explain it. 

Notice that with netduino in a debug session you are able to "Stop" the debugger using the "DEBUG" menu. The Arduino debugger runs from a serial window so you can close the serial window to stop debugging. The difference is because, with arduino, visual studio does not know it is in debug mode.

If you edit when stopped at a breakpoint then debug>start and F5 will continue the arduino program until the next breakpoint.

Pressing F5 again quickly will prompt to stop debugging and upload a new program. This is an alternative to closing the "serial monitor" (see above)

Sorry about this quick update, does this make sense?
  
Back to top
IP Logged
 
Davidh
Junior Member
**
Offline


Posts: 19
Location: uk
Joined: Nov 20th, 2012
Re: Debug Confusion
Reply #5 - Nov 25th, 2012 at 5:52pm
Print Post  
Thanks for your full explanation - which confirmed for me that an Arduino debugger has to be different from a Netduino debugger.

I was making two points - one it was very confusing, and two I was hoping that it might be possible to eliminate the difference - the double F5 takes much of the hassle.

So yes your reply makes good sense, thank-you.

As for Net or Ar - I now feel that it is free choice for me - so I think I will do my learning using both - e.g. to use Arduino shield on the Arduino and then convert the app to Netduino and see where that gets my head.

Thank-you for being so helpful, I have learned a lot.

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


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debug Confusion
Reply #6 - Nov 25th, 2012 at 7:20pm
Print Post  
I might re-visit the microsoft micro framework and netduino sometime. .net is my preference simply because I know it and find it easier. When I tried it last on small micro-processors I found it produced bigger slower programs that demanded more cpu and memory than was available/cost.

For me, in the end it's whatever gets the job done the quickest with the least amount of code and cost.

Best of luck and I look forward to hearing your findings.

ps: The "BUG" button on the serial window also provides some additional debug control


« Last Edit: Nov 25th, 2012 at 7:25pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint