[Lazarus] Invisible Breakpoint

Martin Frb lazarus at mfriebe.de
Wed Jun 24 19:20:06 CEST 2015


Do you at any time replace (e.g. copy and paste -- undo/redo -- 
delete-all/undo ) the content of the entire file? Or at least from line 
1 to the line with the breakpoint?

undo only undoes the text, but the breakpoint pos might in some cases be 
off, after the undo.

replacing lines, moves breakpoints in the replaced range, to (iirc) the 
top of that range.

On 24/06/2015 16:55, aradeonas wrote:
> Yes,File is correct,I removed a breakpoint and change code but 
> debugger think its still there.
> Yes line exists but Line/Length column in BreakPoint viewer is 0 most 
> of the times.
Ok it all sounds as if some part of the IDE thinks there is a different 
file.
Is it a file in your project (main folder or via some path), or is it in 
some package?

Do the logfile anyway, it should tell what filename and path the IDE 
sends to GDB. And also the line number. (see below)

"line" is 0... Interesting.

> Yes I edit file.But I dont know what you mean from "blue dots".
When you run your app, there should be blue dots in the gutter for any 
executable line.


> Intersting is BreakPoint viewer show there should be a breakpoint but 
> code editor doesnt and debugger think there is so BreakPoint viewer 
> and debugger think same.

Where exactly does the debugger stop in that unit?

First line of first procedure? Or the actual line in which the 
breakpoint used to be, before it became corrupted?

--------------------------
Some background.

A breakpoint at line 0 can not be shown in the editor. (since first line 
is 1). However if setting a breakpoint in gdb to a line with no code 
(line 0 has no code) gdb searches the next line with code, and sets it 
there. (set a breakpoint on an empty line, will stop on next line)
This can be useful (if its just 1 or 2 lines off), and harmful if its 
100 or more lines away (e.g. in the interface section)

So if you stop at the first line of code in the unit, then you got a 
breakpoint at line 0, and that can not be displayed in the editor. The 
question is, how it moved to line 0.

Something else:
1) when you edit a file while NOT debugging, breakpoints move as you 
insert/delete lines (obviously)
2) edit a file while debugging, they still move, but only in the IDE. 
Because the exe in the debugger still needs the old positions.
So if procedure Foo is at line 500 to 550, with a breakpoint (in foo) at 
510; and you delete 5 lines somewhere before 500, then in the 
SourceEditor Foo is from 495 to 545 (but the loaded exe still is from 
500 to 550) The IDE then maps the breakpoint (that is now displayed at 
505) to still stop at 510 (in loaded exe). This map is reset when the 
debugger stops.

Maybe there is an issue with that map...





More information about the Lazarus mailing list