VS Arduino
>> >> Arduino struggles in debugging
https://www.visualmicro.com/forums/YaBB.pl?num=1492790262

Message started by RonOhmer on Apr 21st, 2017 at 3:57pm

Title: Arduino struggles in debugging
Post by RonOhmer on Apr 21st, 2017 at 3:57pm
I have a few questions (Paid customer, using Arduino Duo/VS2017):
1. Is there a way to turn off all those ReadWord/WriteWord messages in the upload
2. My breakpoints arent working properly, I cant inspect anything.  My "Expressions on COM4" window is perpetually showing "Waiting for debug breakpoint data" even after a breakpoint is hit.

Title: Re: Arduino struggles in debugging
Post by Visual Micro on Apr 21st, 2017 at 4:20pm
Hi,

I am having a problem understanding the report or questions. Can you help please.

Do you mean you are using an Arduino Due?

What do you mean about "ReadWord/WriteWord messages"? Maybe you have enabled vMicro>Compiler>Verbose or  Upload>Verbose? This will cause the atmel tool chain to show additional messages??

I guess you are not using gdb so you must be using the standard visual micro serial debugger? It's a replacement for serial.print and serial.read allowing named variables (prior to upload to be watched? If you have not switched off "vMicro>General>Tutorial Mode" and you do not have any breakpoints in your code and you have the tool bar configuration set to "Debug" then you will see a demo breakpoint showing how they work. Alternatively the documentation is here

Does this help?

Title: Re: Arduino struggles in debugging
Post by RonOhmer on Apr 21st, 2017 at 4:31pm
Yes, I meant Due.  Sorry about that.  I will try your suggestions and report back the results.

Title: Re: Arduino struggles in debugging
Post by RonOhmer on Apr 22nd, 2017 at 3:25am
Ok, I got rid of the annoying messages.  Thats good :)

The problem I have now is nothing is showing up in debug.

I am using ArduinoLog (Simple wrapper lib for Serial).

I have tried both SerialUSB.begin(115200) and Serial.begin(115200).

I am now using the native port, as it seems faster than the programming port.

Here is my code:
     // Start Logging
     SerialUSB.begin(115200);
#ifdef DEBUG
     Log.begin(LOG_LEVEL_VERBOSE, &Serial);
#else
     Log.begin(LOG_LEVEL_WARNING, &Serial);
#endif

Then later I have stuff like:
Log.verbose("UIElement((%d,%d),%T,%T) created", position.x, position.y, needsUpdate, uiTarget);

I would expect this to show up in the Serial |COM5 monitor (Thats my com port for my due native USB).


As you can see from the attachment, no "Expressions on COM5" nor any info on Serial window.

Breakpoints are awesome, but I need to actually see whats going on when broken, maybe I am missing something.
screen_001.PNG ( 103 KB | 6 Downloads )

Title: Re: Arduino struggles in debugging
Post by Visual Micro on Apr 22nd, 2017 at 12:59pm
It looks like the uploader, the visual micro debugger and your own code is using the Serial port on COM5 ?

The visual micro debugger, by default but optional,  will be performing a Serial.begin(115200) so if you were to use your code with the tool bar set to Release configuration (not Debug) then your logging won't work because your code isn't starting the serial. (It will not matter if both your code and visual micro start the serial)

You need to tell each breakpoint which variables/expressions you want to watch by entering them into the breakpoint action > message. You have a clear red spot for a breakpoint which I think shows you have not configured the breakpoint. This is a useful page from the visual micro docs http://www.visualmicro.com/page/User-Guide.aspx?doc=Working-With-Breakpoints-When-Hit.html

If you delete the breakpoint that you have added and then compile and upload you should see a demo breakpoint that shows how to add millis() as a watch expression. You will see that in a breakpoint message you can add text and or watch expressions and optional configure condition or hit counter.

Because the debugger uses serial I would avoid trying to trace or break on a logging line of code and make sure your own log output works like serial.println() adding the line terminator.

What is code from your log() function?

ps: when you say its a bit quicker with serialusb I don't understand what you mean. You should switch vmicro>debugger>full speed debugging on if speed is important.





Title: Re: Arduino struggles in debugging
Post by RonOhmer on Apr 22nd, 2017 at 4:58pm
What I meant was it seems to upload faster on the Native USB port as opposed to the Programing port.

That being said...

Now for a test I simply did the following:
Serial.println("WindowManager Init");


Getting my log functionality out of the loop, and I see nothing in the Micro Debug Trace, Com inspection window, or anywhere.

Title: Re: Arduino struggles in debugging
Post by Visual Micro on Apr 22nd, 2017 at 5:07pm
I think that is because you are not connected to the serial port.

Sounds like you should be using SerialUSB.println()

Visual Micro automatically detects which port which is why the debugger works. So your code just needs to the use the port that is connected via usb cable or have two cables.


Title: Re: Arduino struggles in debugging
Post by RonOhmer on Apr 22nd, 2017 at 5:08pm
Ah, ok, I did a test.   Yes, it does upload much faster on the Native Port.

THat being said, I do not see the serial.println on the native port, but I DO on the programming port.

So some happiness there :)

With a jtag cable is it possible to use GDB on the Due?

Title: Re: Arduino struggles in debugging
Post by Visual Micro on Apr 22nd, 2017 at 5:16pm
Serial.print is for programming port

SerialUSB.print is for native port.

Log.begin(LOG_LEVEL_VERBOSE, &SerialUSB);

Yes we can do gdb on the due, when you get jtag hooked up we can try some additional settings to use gdb

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.