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 Does not stop at expected breakpoint (Read 8416 times)
Jan Friberg
Junior Member
**
Offline


Posts: 72
Joined: Dec 13th, 2013
Does not stop at expected breakpoint
Jul 1st, 2014 at 9:14am
Print Post  
Part of my sketch is below. Here I can see that the debugger stops at 'No valid datapacket' in loop. Then this must mean that ReadDataPacket() returns false. But it never stops in ReadDataPacket(). How is that possible ? I have breakpoints at both return statements.

Code (C++)
Select All
void loop()
{
	if(RTC.read(tm))  //Read the time & date from DS3231 check for new hour
	{
		if (tm.Hour>hour_now)
		{
			hour_now=tm.Hour;
			SaveData(tm);
		}
	}
	else if(RTC.chipPresent())
		{Serial.println("No time but Chip present");}
	else
		Serial.println("Error no chip present");

	DisplayTime();							//Display time on TFT
	//Serial1.print('R');					//Request data packet

	if ( ReadDataPacket() )
		{Serial.println(data_packet);}
	else
		{Serial.println("No valid data packet");}

	DisplaySensors();
	HandleTouch();
}

boolean	ReadDataPacket()
{
	char	tkn;
	int		i;

	data_packet="";
	do
	{
	  if (Serial1.available())
		{tkn=Serial1.read();}
	} while (tkn != 'P');

	for (i=0;i<18;i++)
	{
		if( Serial1.available() )
			{data_packet+=Serial1.read();}
		else
			{Serial.println(data_packet);return	false;}
	}
	//Serial.println(data_packet);
	return	true;
}

 

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Does not stop at expected breakpoint
Reply #1 - Jul 1st, 2014 at 10:41am
Print Post  
Hi Jan,

You will read that the debugger makes a best attempt to inject serial statements. It caters for quite a few scenarios but  it is a difficult area so normally we suggest adding breakpoints to simple code lines. 

It does attempt to handle single line 'if' statements without braces by adding braces. It handles multi lines 'if' statements with braces so in theory your two breakpoint locations are okay.

Please switch on "tools>options>visual micro>show build folder" then make a debug compile and upload then email the [sketchname].cpp from the build folder that appears in the compiler output. (ctrl+click the link to open the build folder). Email to info[at]visualmicro.com this will show exactly what we need to add to support the syntax although I will look into what happens when {braces contain a one line if}

Thanks
« Last Edit: Jul 1st, 2014 at 11:53am by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Jan Friberg
Junior Member
**
Offline


Posts: 72
Joined: Dec 13th, 2013
Re: Does not stop at expected breakpoint
Reply #2 - Jul 2nd, 2014 at 9:50am
Print Post  
Tim@Visual Micro wrote on Jul 1st, 2014 at 10:41am:
Hi Jan,

You will read that the debugger makes a best attempt to inject serial statements. It caters for quite a few scenarios but  it is a difficult area so normally we suggest adding breakpoints to simple code lines. 

It does attempt to handle single line 'if' statements without braces by adding braces. It handles multi lines 'if' statements with braces so in theory your two breakpoint locations are okay.

Please switch on "tools>options>visual micro>show build folder" then make a debug compile and upload then email the [sketchname].cpp from the build folder that appears in the compiler output. (ctrl+click the link to open the build folder). Email to info[at]visualmicro.com this will show exactly what we need to add to support the syntax although I will look into what happens when {braces contain a one line if}

Thanks


I found out what my problem was. The debugger inserted a print after return false since that was on the same line.
I made that line to three separate program lines and it worked as intended.
But my experience is that the debugger does not add braces. I get compiler error on if else statement with only one code line after if. When I add curly braces to the single code line it compiles fine.
Another thing I have noticed is that when the debugger stops at a breakpoint my source code window is not updated so the code line is displayed in the window. I must manually scroll to the line in question.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Does not stop at expected breakpoint
Reply #3 - Jul 2nd, 2014 at 11:39am
Print Post  
Thanks

I will look into it but i can tell you that currently braces are only inserted in this case

if (true)
  x=1
else x=2

It needs more work.

As for the selecting/activating of the current line when the debugger breaks. I have never seen the current line not be focussed and become active. Visual Micro should also open the respective code file if it is not already open.

Please remind me which version of vs or atmel you are using?

Thanks
  
Back to top
WWW  
IP Logged
 
Jan Friberg
Junior Member
**
Offline


Posts: 72
Joined: Dec 13th, 2013
Re: Does not stop at expected breakpoint
Reply #4 - Jul 3rd, 2014 at 10:40am
Print Post  
Tim@Visual Micro wrote on Jul 2nd, 2014 at 11:39am:
Thanks

I will look into it but i can tell you that currently braces are only inserted in this case

if (true)
  x=1
else x=2

It needs more work.

As for the selecting/activating of the current line when the debugger breaks. I have never seen the current line not be focussed and become active. Visual Micro should also open the respective code file if it is not already open.

Please remind me which version of vs or atmel you are using?

Thanks


I use Atmel Studio 6.1.2.2730 Service Pack 2
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Does not stop at expected breakpoint
Reply #5 - Jul 3rd, 2014 at 5:33pm
Print Post  
I am using sp2

Have you got any other extensions installed in "tools>extension manager" or "tools>addin manager"

edit: pls try install the Xfeatures plugin in the Extension Manager. Then re-start.

With the extension installed, does the correct line highlight when the debugger stops?

Thanks

« Last Edit: Jul 3rd, 2014 at 5:48pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Jan Friberg
Junior Member
**
Offline


Posts: 72
Joined: Dec 13th, 2013
Re: Does not stop at expected breakpoint
Reply #6 - Jul 4th, 2014 at 7:01am
Print Post  
Tim@Visual Micro wrote on Jul 3rd, 2014 at 5:33pm:
I am using sp2

Have you got any other extensions installed in "tools>extension manager" or "tools>addin manager"

edit: pls try install the Xfeatures plugin in the Extension Manager. Then re-start.

With the extension installed, does the correct line highlight when the debugger stops?

Thanks



I have now. All my lines with breakpoints are highlighted. Is that supposed to be so ? I would prefer that only lines where the debugger gets highlighted to be highlighted.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Does not stop at expected breakpoint
Reply #7 - Sep 6th, 2014 at 10:13pm
Print Post  
Update: You do not need a plugin to clearly highlight the current line. There is an Atmel option in tools>options>text editor that does it very well along with line numbers  Smiley
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint