[Dwarf-discuss] dwarf ver3.0: prologue_end and epilogue_begin bits
Ramanaiah Nalamothu
ramana.venkat83@gmail.com
Mon May 21 12:52:47 GMT 2007
On 5/21/07, Ron Brender <ron.brender at charter.net> wrote:
>
> The prologue beginning and ending location are compiler code generation
> artifacts that do not correlate usefully with line number. For example,
> the same source might be input as
>
> void foo (...) {...}
>
> or
>
> void
> foo (
> ...)
> {
> ...
> }
>
> The compiled code, hence the begin and end prologue addresses, will be
> identical,
how the both addresses will be same?? (see below assembly code)
but the line numbers will vary. The "normal" line-address
> correlation will naturally associate a line number with those same
> instructions--unrelated to the fact that they are begin or
> end prologue related; that is expected.
but with what line numbers i need to associate them with?? As i told you in
my first mail -1, -2 and 0 are the special line numbers that my compiler
will generate. I can't propagate them because they are not valid source line
numbers.
Here i am providing a sample source code and corresponding assembly code.
See my comments with # ......#.
.dbgline -1, .dbgline -2 and .dbgline 0 represents prologue_end,
epilogue_begin and end of function or epilogue.
test.c
---------------
int res;
extern void abort (void);
extern void exit (int);
struct baz
{
int a, b, c, d, e;
};
void
bar (struct baz *x, int f, int g, int h, int i, int j)
{
if (x->a != 1 || x->b != 2 || x->c != 3 || x->d != 4 || x->e != 5 ||
f != 6 || g != 7 || h != 8 || i != 9 || j != 10)
res = -1;
}
void
foo (char *z, struct baz x, char *y)
{
bar (&x, 6, 7, 8, 9, 10);
}
int main (){
struct baz x;
x.a = 1;
x.b = 2;
x.c = 3;
x.d = 4;
x.e = 5;
foo ((char *) 0, x, (char *) 0);
if (res == -1)
return 0;
else
return 1;
}
------------------------------------------
test.s
-------------------
.dbfile C:\cygwin\home\Administrator\Arm\test.c
AREA "C$$code", CODE, READONLY
CODE32
ALIGN 4
.dbfile C:\cygwin\home\Administrator\Arm\test.c
EXPORT _main
; .dbfunc e main _main fI
AREA "C$$code", CODE, READONLY
CODE32
ALIGN 4
_main:
stmfd R13!,{R14}
.dbline -1 # indicates prologue_end #
.dbline 3
; #include <stdio.h>
; int main()
; {
.dbline 4
; if( 1 )
.dbline 5
; goto label;
b L4
L5:
.dbline 9
; else
; goto lab;
; lab:
; foo(10);
mov R0,#10
bl _foo
L4:
.dbline 11
; label:
; return 0;
mov R0,#0
.dbline -2 # indicates epilogue_begin #
L1:
ldmfd R13!,{R15}
.dbline 0 ; func end # indicates end of epilogue.
Here begin and end addresses or not same as you suggested #
.dbfile C:\cygwin\home\Administrator\Arm\test.c
; .dbend
; .dbfunc s foo _foo fI
AREA "C$$code", CODE, READONLY
CODE32
ALIGN 4
; value -> R4
_foo:
mov R12,R13
stmfd R13!,{R4,R12,R14}
mov R4,R0
.dbline -1
.dbline 15
; }
;
; static int foo(int value)
; {
.dbline 16
; return 0;
mov R0,#0
.dbline -2
L6:
ldmfd R13!,{R4,SP,R15}
.dbline 0 ; func end
.dbfile C:\cygwin\home\Administrator\Arm\test.c
; .dbsym r value 4 I
; .dbend
END
------------------------------------------------------------------
So if the debugger needs line numbers info what should be the line numbers
for these prologue and epilogue cases?
Thanks for your replies.
Regards,
Ramana
Ron
>
> --------------------------
> Ramanaiah Nalamothu wrote:
> > 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?
> >
> > Thanks in advance for your replies.
> >
> > Regards,
> > Ramana
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20070521/572f3cf9/attachment.htm>
More information about the Dwarf-discuss
mailing list