[fpc-devel] DEBUGSTART_, DEBUGINFO_ and DEBUGEND_ symbols

Marc Weustink marc at dommelstein.net
Sun Nov 22 19:25:56 CET 2009

Jonas Maebe wrote:
> On 22 Nov 2009, at 18:43, Marc Weustink wrote:
>> while adding sourceline info to the Lazarus disassembler output I ran into the DEBUGSTART_<unitnamehere>, DEBUGINFO_<unitnamehere> and DEBUGEND_<unitnamehere> symbols.
>> What I wonder is why DEBUGSTART and DEBUGEND are reported as functions, while DEBUGINFO is reported as datavariable (fpc 2.2.4, stabs).
> DEBUGSTART and DEBUGEND are symbols in text section, while DEBUGINFO
> is a label in the data section. I don't know exactly how the
> mechanism works, but the only purpose of these symbols is to prevent
> debug info from being smartlinked out. They are irrelevant for the
> actual debugging.

not really (otherwise I won't run into it ;) )

Since the exe doesn't contain NOP beweeen unit code, when disassembling, 
you can get the following:

(gdb) disas 0x0808b0cc 0x0808b0d6
Dump of assembler code from 0x808b0cc to 0x808b0d6:
0x0808b0cc <FORMS_finalize+44>: ret
0x0808b0cd <DEBUGEND_FORMS+0>:  add    %al,(%eax)
0x0808b0cf <DEBUGEND_FORMS+2>:  add    %dl,0xffffff89(%ebp)
0x0808b0d2 <TFORM1__BUTTON1CLICK+2>:    in     $0x81,%eax
0x0808b0d4 <TFORM1__BUTTON1CLICK+4>:    in     (%dx),%al
0x0808b0d5 <TFORM1__BUTTON1CLICK+5>:    pushf

while this is correct:
(gdb) disas 0x0808b0d0 0x0808b0d6
Dump of assembler code from 0x808b0d0 to 0x808b0d6:
0x0808b0d0 <TFORM1__BUTTON1CLICK+0>:    push   %ebp
0x0808b0d1 <TFORM1__BUTTON1CLICK+1>:    mov    %esp,%ebp
0x0808b0d3 <TFORM1__BUTTON1CLICK+3>:    sub    $0x9c,%esp

Anyway, I now know that when I encounter a DEBUGEND function, I need to 
take special actions.


More information about the fpc-devel mailing list