[fpc-devel] gdb and stopping at the begin line

Martin fpc at mfriebe.de
Mon Jun 6 16:38:24 CEST 2011

On 06/06/2011 15:27, Marc Weustink wrote:
> Martin wrote:
>> Having just reported http://bugs.freepascal.org/view.php?id=19466
>> I started wondering (to late, should have done before the report) and
>> googled.
>> It appears that gdb has a "feature" to skip function prologue and
>> epilogue. However I could not find any info on what info gdb uses to
>> know what is the prologue.
>> So it is possible that something tells gdb that the code on which no
>> stop occurs is the proluge.
> :)
> Thats why we in lazarus query the address of a procedure first and set 
> the breakpoint on that address. This way you always get a break on the 
> start of the procedure (otherwise it depends on debug symbols beeing 
> present or not (for exported functions))

Ah well, but that is for the internal breakpoints...

user breakpoints aren't always by start-of-proc, they are by unit + line 
number. => and in this case gdb does it's own interpretation.....

Also it would need investigation. Since a line can have more thna one 
statement, and since in conditional code, the first statement is not 
necessarily executed, I do not know how smart gdb is on this.
But if you translated that to address first, it would certainly limit to 
the 1st statement on the line (or to which ever statement picked...)

Anyway, so does that mean the stopping (or not stopping) at begin, is a 
feature (if we call it that) in gdb, and fpc does nothing wrong?

More information about the fpc-devel mailing list