diff options
author | Mark Wielaard <mjw@redhat.com> | 2009-08-20 16:31:55 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2009-08-20 16:31:55 +0200 |
commit | 30868aad20865f5a949c22ad0a20d1ebe2fd669a (patch) | |
tree | bcf328c8a25f40d7991da4015428847ae2be834f /testsuite/systemtap.base/inlinedvars.c | |
parent | b313f94ed30b4342eb02def7d8e895f5d2af8008 (diff) | |
download | systemtap-steved-30868aad20865f5a949c22ad0a20d1ebe2fd669a.tar.gz systemtap-steved-30868aad20865f5a949c22ad0a20d1ebe2fd669a.tar.xz systemtap-steved-30868aad20865f5a949c22ad0a20d1ebe2fd669a.zip |
PR10537 process().function().label() should select multiple inlined instances.
This is less useful than one would hope. gcc will often emit a label with
a DW_AT_low_pc that is not really in the neighbourhood of where one would
expect it when the label is inlined and gcc can proof the label isn't really
used in the optimized code. dwflpp::iterate_over_labels will now really
iterate recursively through the die, even for dies without a name (like
lexical blocks). This means we should now always find the concrete inlined
label instances that have a real DW_AT_low_pc and so we don't need the trick
to use the line table to get at the actual address.
* dwflpp.cxx (iterate_over_labels): Accept dies without a name. Don't handle
labels without a name or without a lowpc attribute.
* testsuite/systemtap.base/inlinedvars.c (m): Trick gcc into thinking label
is always used.
(call, call2): Activate.
(main): Call call and call2.
* testsuite/systemtap.base/inlinedvars.exp: New result_string.
Test both unoptimized and optimized (inlined) builds.
Diffstat (limited to 'testsuite/systemtap.base/inlinedvars.c')
-rw-r--r-- | testsuite/systemtap.base/inlinedvars.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/testsuite/systemtap.base/inlinedvars.c b/testsuite/systemtap.base/inlinedvars.c index 2756323e..ab1d9fb2 100644 --- a/testsuite/systemtap.base/inlinedvars.c +++ b/testsuite/systemtap.base/inlinedvars.c @@ -4,16 +4,20 @@ m(char *name, int i, long j) // Random syntactical block to be inlined. // Mimics what STAP_PROBE macro does a bit. do { + // Dummy (volatile) counter to trick gcc into thinking we are actually + // using the label. If not it will partially optimize the label away, + // but still emits a somewhat bogus DW_AT_low_pc for it... + volatile int c = 0; volatile __typeof__(name) p_name = name; volatile __typeof__(i) p_i = i; volatile __typeof__(j) p_j = j; // empty asm to force locals into regs. - inlined_label: asm volatile ("" :: "g"(p_name), "g"(p_i), "g"(p_j)); + inlined_label: asm volatile ("nop" : "=g"(c) : "g"(p_name), "g"(p_i), "g"(p_j)); + if (c != 0) goto inlined_label; } while (0); return i + 32; } -/* XXX PR10537 label() doesn't select multiple instances. static inline int call(int pi, long pj) { @@ -29,15 +33,14 @@ call2(int pi2, long pj2) volatile jc2 = pj2 - 64; return m("call2", ic2, jc2); } -*/ int main (int argc, char **argv) { volatile int i = 64; volatile long j = 42; - i = 54;// XXX PR10537 call(i, j); - j = 150; // XXX PR10537 call2(i, j); + call(i, j); + call2(i, j); m("main", i, j); return 0; } |