Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2009-11

DEBUGSTART_, DEBUGINFO_ and DEBUGEND_ symbols

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marc Weustink

hi,

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).

(gdb) ptype DEBUGSTART_UNIT1
type = function : int
(gdb) ptype DEBUGINFO_UNIT1
type = <data variable, no debug info>
(gdb) ptype DEBUGEND_UNIT1
type = function : int

Marc

Reply by email

Jonas Maebe
to Marc Weustink
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.

Jonas

Reply by email

Marc Weustink
to Jonas Maebe
Jonas Maebe wrote 10 lines
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.

Marc

Reply by email