This is the mail archive of the
systemtap@sources.redhat.com
mailing list for the systemtap project.
labels in dwarf
- From: Jim Keniston <jkenisto at us dot ibm dot com>
- To: SystemTAP <systemtap at sources dot redhat dot com>
- Date: 10 Mar 2005 11:59:36 -0800
- Subject: labels in dwarf
- Organization:
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