This is the mail archive of the systemtap@sources.redhat.com mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

labels in dwarf


I took an AR from this morning's meeting to see whether C labels are
recorded in the dwarf debug info.  It appears that they are, even if
they're not referenced.  For example, when the following code is
compiled with
	cc -g -S tossme.c
all three labels (with their corresponding instruction addresses) show
up in the debug info (even though 'done' isn't referenced).

int
sum(int a, int b)
{
        if (a < 0)
                goto nega;
        if (b < 0)
                goto negb;
done:
        return a + b;
nega:
        return -1;
negb:
        return -2;
}

However, if you throw in -O, the nega and negb labels both map to the
leave instruction; the return value is stored in %eax even before the "<
0" test is executed.  So, as was suggested this morning, the
label-to-instruction mapping may be surprising when you optimize.

Jim Keniston
IBM LTC-RAS



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]