[Dwarf-discuss] dwarf ver3.0: prologue_end and epilogue_begin bits

Ramanaiah Nalamothu ramana.venkat83@gmail.com
Tue May 22 04:44:19 GMT 2007


On 5/21/07, Michael Eager <eager at eagercon.com> wrote:
>
> Quoting Ramanaiah Nalamothu <ramana.venkat83 at gmail.com>:
>
> > Hi,
> >
> >  I am working at assembler context to emit the ELF-DWARF(dwarf ver3.0).
> I
> > need to set the bits prologue_end and epilogue_begin. My compiler emits
> > debug directive with specific -ve line numbers to indicate prologue_end
> and
> > epilogue_begin. But they are not acceptable line numbers in source file.
> > My doubt is, do I need to associate the their occurance with the source
> line
> > numbers or is it sufficient just to tell at what 'address' the
> prologue_end
> > or epilogue_begin occur? If debugger needs line number, what line
> numbers
> > should be emitted in my case?
>
> Each address in the line table is associated with a source line/column.
>
> Commonly, the line number associated with the prolog_end is the first
> line of the body of the function.  This is where a debugger will stop
> when you ask to set a breakpoint on the function.


For prologue_end, i can generate the line number as next one(start of
function body). And this is meaningful also in my case.

The line number associated with the epilogue_begin is after the body
> of the function, usually the closing brace.


But for epilogue_begin, in my case the next line number is .dbgline 0, this
will be generated always, please check the sample code snippet below with my
comments in between # #, which is also an invalid source line.

sample assembly code
----------------------------------------
;              x -> R5
;              z -> R7
_foo:
    mov R12,R13
    stmfd R13!,{R4,R5,R6,R7,R11,R12,R14}
    mov R11,R13
    sub R13,R13,#0x8
    mov R7,R0
    mov R5,R1
    mov R6,R2
    .dbline -1
    .dbline 20
; }
;
; void
; foo (char *z, struct baz x, char *y)
; {
    .dbline 21
;   bar (&x, 6, 7, 8, 9, 10);
    mov R0,R5
    mov R1,#6
    mov R2,#7
    mov R3,#8
    mov R4,#9
    str R4,[R13,#0]
    mov R4,#10
    str R4,[R13,#+4]
    bl _bar
    .dbline -2                                                 # INDICATES
EPILOGUE_BEGIN #
L13:
    ldmfd R11,{R4,R5,R6,R7,R11,SP,R15}
    .dbline 0 ; func end                                   # FUNCTION BODY
END. BUT 0 IS NOT AN VALID SOURCE LINE NUMBER #
    .dbfile C:\cygwin\home\Administrator\Arm\test.c
    .dbsym r y 6 pc
    .dbsym r x 5 pS[baz]
    .dbsym r z 7 pc
    .dbend
    EXPORT _main
    .dbfunc e main _main fI
    AREA    "C$$code", CODE, READONLY
----------------------------------------------------------------------------
If the line number for epilogue_begin is the end of function body, if i
understood correctly, then we will be setting the line - address pair after
the end of epilogue operations, at least in my case i.e .dbgline 0
(func_end). Is this acceptable?

Is it ok if I say the debugger that at 'address' epilogue_begin occurs and
not associating that with any valid source line??

Am I missing anything? I am a newbie to DWARF. And i have no experience with
debugger. Sorry if i am wasting your time with silly doubts.

Please tell me if there is any online document, apart from dwarf standard
document itself, about dwarf or dwarf generator - debugger inter working
which should clarify my basic doubts.

Thanks for your reply.

Regards,
Ramana

--
> Michael Eager    Eager Consulting     eager at eagercon.com
> 1960 Park Blvd., Palo Alto, CA 94306  650-325-8077
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20070522/a1a818d1/attachment.htm>



More information about the Dwarf-discuss mailing list