public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/14436] New: warn about use of $vars (e.g. in return probes) with unoptimized object code with poor VTA
@ 2012-08-06 12:09 fche at redhat dot com
  2012-08-06 12:50 ` [Bug translator/14436] " mjw at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: fche at redhat dot com @ 2012-08-06 12:09 UTC (permalink / raw)
  To: systemtap

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-04 21:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-06 12:09 [Bug translator/14436] New: warn about use of $vars (e.g. in return probes) with unoptimized object code with poor VTA fche at redhat dot com
2012-08-06 12:50 ` [Bug translator/14436] " mjw at redhat dot com
2014-02-19 16:35 ` jlebon at redhat dot com
2014-03-04 21:56 ` jlebon at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).