Moving breakpoint problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Moving breakpoint problem

1,142 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jdupre on Tue Aug 18 11:27:38 MST 2015
LPCxpresso v7.9.0:

Normally when I add or remove lines from code, breakpoints will stay "fixed" to the original code line that they were set at.  In other words, if I add a line, breakpoints below the line will shift down.  If I delete a line, the following breakpoints will shift up.  This is the correct behavior.

However, if the debugger is running when the code is edited, the breakpoints will not shift according to the changes and they end up in the wrong position when the debugger is halted or restarted.

Can this be fixed so the breakpoints stay affixed to the line that there were intended for?

- Joe
0 Kudos
Reply
5 Replies

1,130 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Aug 20 13:59:00 MST 2015
Joe,

The IDE will try maintain the breakpoint against the correct line in most circumstances but generally you have to save your changes before it knows. If you are not saving the changes, then this may explain what you are seeing.

However as already explained, editing your source code whilst debugging is not a good idea as it breaks the debug linkage. And I am afraid that we are not in position to make any changes to the way breakpoints are handled. Thus we're unable to accommodate you at this time. Sorry.

LPCXpresso Support
0 Kudos
Reply

1,130 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jdupre on Thu Aug 20 13:44:04 MST 2015
I'm not concerned with debugging after I change the code.  I just don't want to have to remember to stop the debugger before I change the code.  If I add or remove lines to the code without stopping the debugger, then the breakpoints move when I do stop the debugger.  I don't want my breakpoints moving!

- Joe
0 Kudos
Reply

1,130 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Aug 20 13:36:03 MST 2015
I'm not sure what you misunderstood. The (ELF/DWARF) debug line information of your compiled source file has a code address associated with the source file line. When the debugger encounters a stop event (breakpoint, or halt), the IDE attempts to reconcile the stopped context with the debug line information read in from the compiled executable. No context is shown if it can't do so. If it can, it has no choice but to attempt to display the source file line number associated with the stopped context. This is correct behavior.

Compare this behavior to the behavior of Microsoft's Visual Studio. If you were to edit a source file while stopped on a breakpoint, once you resumed execution Visual Studio would disable any breakpoint associated with that file. If you tried to single-step in the same file, you would be warned the source doesn't match.

Thanks and regards,
LPCXpresso Support
0 Kudos
Reply

1,130 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jdupre on Thu Aug 20 12:50:01 MST 2015
>>Once you have changed the source from which an image was compiled the debug information about the code that was compiled to generate it will no longer correspond with the updated source.<<

Well sure.  While the debugger is running, when I hit a breakpoint I often step through code and insert comments or makes changes based on my observations.  When I do this, the breakpoints will shift to accommodate the changes.  (That is, the breakpoints stay affixed to the _code_ not the line number.  I see this as the correct behavior.)

The problem is, when I _halt_ the debugger, the breakpoints shift back to the original line number.  They are no longer fixed to the code where I originally placed them.

What I'd like is that the breakpoints NOT revert to the original line number when the debugger is stopped.

-Joe 

0 Kudos
Reply

1,130 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Aug 19 05:39:00 MST 2015
Hi Joe


Quote:
However, if the debugger is running when the code is edited, the breakpoints will not shift according to the changes and they end up in the wrong position when the debugger is halted or restarted.

Can this be fixed so the breakpoints stay affixed to the line that there were intended for?



Once you have changed the source from which an image was compiled the debug information about the code that was compiled to generate it will no longer correspond with the updated source.

LPCXpresso moves from
[list]
  [*]trying to remember where breakpoints are to be placed when a debug session is begun to
  [*](once the debug session has begun) trying to manage the breakpoints currently set in the downloaded code.
[/list]
Although very useful, this second mode is only possible when the original source is available.  (Imagine trying to remove a breakpoint on a line of code that you have deleted in the editor, for example.)

I'm afraid that the representation of the state of code currently executing while displaying an amended source will never be very reliable.

Sincerely

LPCXpresso Support
0 Kudos
Reply