The breakpoint will ot currently be hit - atmel studion 6.2

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

 

I'm using atmel studio 6.2 and Im having problems with breakpoints. The problem is that I want to set a breakpoints in my program but while running the compiler gives me an error : "The breakpoint will not currently be hit" which leads me to that I can't debug my program

 

the optimisation is configured like that :

 

 

what should I do to be able to set the breakpoints where I want and to fix it

 

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kobidon wrote:
while running the compiler (sic?) gives me an error : "The breakpoint will not currently be hit" 

 

Are you sure it's the Compiler giving you that error?

 

The Compiler really doesn't have anything to do with breakpoints or debugging - so it seems a bit unlikely.

 

 

kobidon wrote:
which leads me to that I can't debug my program

Not necessarily - it's just telling you that this specific breakpoint will never be hit.

 

Possibly, you've put the breakpoint somewhere that is unreachable.

 

Perhaps you set the breakpoint, then changed the source & rebuilt - and the breakpoint is no longer in a position that corresponds to any executable code.

 

Have you tried deleting all breakpoints, then (re-)setting the one(s) you require?

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

 

Are you sure it's the Compiler giving you that error?

 

The Compiler really doesn't have anything to do with breakpoints or debugging - so it seems a bit unlikely.

 

 

Plese don't catch me in words. While running, I see that the breakpoint dissapeard and instead of it I get a hollow breakpoint with an exclamation mark and if I stand on it I see that message. I don't know if it the compiler / linker ... that gives me the error, the point is that I can't stop in the wanted line. 

 

 

awneil wrote:

Not necessarily - it's just telling you that this specific breakpoint will never be hit.

 

Possibly, you've put the breakpoint somewhere that is unreachable.

 

 

I know for sure that it's reachable cause I see an output on my screen from that line.

 

awneil wrote:

Perhaps you set the breakpoint, then changed the source & rebuilt - and the breakpoint is no longer in a position that corresponds to any executable code.

 

Have you tried deleting all breakpoints, then (re-)setting the one(s) you require?

 

 

How can I delete all ? just click another time on that I set ?

Last Edited: Sat. Jan 16, 2016 - 03:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is not unlikely that this is an effect of the compiler optimizing the code. In that process, the mapping between source code lines and generated machine code (often called "debug info", and used by Studio during aq debug session) can be "blurred" or lost.

 

One possible workaround is to put a breakpoint at an earlier point in the execution path, and single step from there.

 

Sometimes this will reveal the next effect of optimized code: The execution seems to jump back and forth in the code. This is because the compiler is free to re-arrange the order of code as long as it does not break the semantics that the source code (and the C language standard) stipulates.

 

For some cases, there is no other alternative than to fall down to debugging on assembler level. In Atmel Studio you can open a disassembly window while debugging, and there you can always put a breakpoint on any machine instruction. Also, the .lss listing file will be of great help understanding what the compiler actually did.

 

Sometimes we see suggestions on turning off optimization while debugging. This is very rarely a recommendable solution, since the generated code will then be bloated and inefficient to a ridiculous level.

 

Lately, there has been introduced a optimization level that tries to negotiate between debug-able and efficient code. It was discussed here at AVRfreaks just a week ago or so. I can't recall the specifics, and it is not presented in the optimization drop down menu in Atmel Studios project Properties dialogue. I'll go searching for it and will return here..

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Sat. Jan 16, 2016 - 09:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Found it. The debug optimization setting is -Og .For how to apply it in Atmel Studio, read from Cliff Lawsons ("clawson") post here and a few posts onward. Also, follow the link clawson gives to his tutorial on the matter.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]