This is the mail archive of the systemtap@sourceware.org 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]

[Bug translator/14436] New: warn about use of $vars (e.g. in return probes) with unoptimized object code with poor VTA


http://sourceware.org/bugzilla/show_bug.cgi?id=14436

             Bug #: 14436
           Summary: warn about use of $vars (e.g. in return probes) with
                    unoptimized object code with poor VTA
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
        AssignedTo: systemtap@sourceware.org
        ReportedBy: fche@redhat.com
    Classification: Unclassified


gcc is well-known not to perform proper VTA analysis for object code that is
built with -g but without -O2.  That means that gcc lies as to the
liveness/location of e.g. local variables.


% cat t.c
#include <stdio.h>
static int frob(int x) {
        int a = 42;
        return a + x;
}
int main(void)
{
        printf("%d\n", frob(42));
        return 0;
}
% cat t.stp
probe process("./t").function("frob").return { 
    printf("a=%d\nx=%d\nr=%d\n", @defined($a)?$a:-1, @entry($x), $return) 
}
% gcc -g t.c -o t
% stap t.stp -c ./t
... results in a bad/garbage value for $a and/or $x
% gcc -O2 -fno-inline t.c -o t
% stap t.stp -c ./t
... results in a properly-missing value for $a, and correct values for others

Systemtap should start looking for the DW_TAG_compile_unit / DW_AT_producer
string to see if -g -O* were used together with a modern gcc (yey for working
VTA), and warn otherwise (boohoo for non-working VTA).


PS:  Note prologue checking was done, and could have resulted in a plausible
probe address adjustment to make it work despite non-VTA.  But, due to this
being a .return probe, prologue searching results were duly disposed-of:

searching for prologue of function 'frob'
0x4004c4-0x4004dc@/home/fche/tmp/kkk/t.c:4
checking line record 0x4004c4@/home/fche/tmp/kkk/t.c:4
checking line record 0x4004cb@/home/fche/tmp/kkk/t.c:5
prologue found function 'frob' = 0x4004cb
ignoring prologue for .return probes

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


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