]> sourceware.org Git - systemtap.git/commitdiff
2007-02-09 Frank Ch. Eigler <fche@elastic.org>
authorfche <fche>
Fri, 9 Feb 2007 13:45:49 +0000 (13:45 +0000)
committerfche <fche>
Fri, 9 Feb 2007 13:45:49 +0000 (13:45 +0000)
PR 3965
* configure.ac: Add --enable-prologue option.
* configure, config.in: Regenerated.
* session.h (prologue_searching): New field.
* main.cxx (main): Parse new "-P" option.  Initialize based on
autoconf flag.
* stap.1.in, NEWS: Document it.
* hash.cxx (find_hash): Include it in computation.
* tapsets.cxx (query_func_info, query_cu): Respect it.

2007-02-09  Frank Ch. Eigler  <fche@elastic.org>

* systemtap.base/prologue.*: New test case.

13 files changed:
ChangeLog
NEWS
config.in
configure
configure.ac
hash.cxx
main.cxx
session.h
stap.1.in
tapsets.cxx
testsuite/ChangeLog
testsuite/systemtap.base/prologues.exp [new file with mode: 0644]
testsuite/systemtap.base/prologues.stp [new file with mode: 0644]

index b62a818122c8c3a955250380450d5bf876c53ca6..0956a4fad537878855500e2cc6286016d5da813c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-02-09  Frank Ch. Eigler  <fche@elastic.org>
+
+       PR 3965
+       * configure.ac: Add --enable-prologue option.
+       * configure, config.in: Regenerated.
+       * session.h (prologue_searching): New field.
+       * main.cxx (main): Parse new "-P" option.  Initialize based on
+       autoconf flag.
+       * stap.1.in, NEWS: Document it.
+       * hash.cxx (find_hash): Include it in computation.
+       * tapsets.cxx (query_func_info, query_cu): Respect it.
+
 2007-02-06  Frank Ch. Eigler  <fche@elastic.org>
 
        * stapfuncs.5.in: Add docs for kernel_{long,int,short,char} and
diff --git a/NEWS b/NEWS
index 84ed4ea6f48b466185fa1d75f6e7697f2822abd5..d5cfa401edd9403e5b11d92b18a17fe575c16b97 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,12 @@
   To delete such an element, the scripts needs to use an explicit
   "delete array[idx]" statement rather than something like "array[idx]=0".
 
+- The new "-P" option controls whether prologue searching heuristics
+  will be activated for function probes.  This was needed to get correct
+  debugging information (dwarf location list) data for $target variables.
+  Modern compilers (gcc 4.1+) tend not to need this heuristic, so it is
+  no longer default.  A new configure flag (--enable-prologues) restores
+  it as a default setting, and is appropriate for older compilers (gcc 3.*).
 
 * What's new since version 0.5.10?
 
index c1d601a9cfa6b49365f5e8712c0e48abf5fbf5d4..b3a617dc1f9453584d67e48a77233ee69232978e 100644 (file)
--- a/config.in
+++ b/config.in
@@ -3,12 +3,18 @@
 /* Configuration/build date */
 #undef DATE
 
+/* make -P prologue-searching default */
+#undef ENABLE_PROLOGUES
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
 /* Define to 1 if you have the `dw' library (-ldw). */
 #undef HAVE_LIBDW
 
+/* Define to 1 if you have the `ebl' library (-lebl). */
+#undef HAVE_LIBEBL
+
 /* Define to 1 if you have the `pfm' library (-lpfm). */
 #undef HAVE_LIBPFM
 
index 82fcebd95b163885e89147d0d00aea26984e3ef7..2e5b41f1eeba92e5055dd749da689846c5e5efc5 100755 (executable)
--- a/configure
+++ b/configure
@@ -865,6 +865,7 @@ Optional Features:
   --disable-dependency-tracking  speeds up one-time build
   --enable-dependency-tracking   do not reject slow dependency extractors
   --enable-perfmon                 enable perfmon support (default is disabled)
+  --enable-prologues      make -P prologue-searching default
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -5195,6 +5196,16 @@ fi
   LDFLAGS="$LDFLAGS -DPERFMON -L$with_perfmon/lib -lpfm"
 fi
 
+# Check whether --enable-prologues or --disable-prologues was given.
+if test "${enable_prologues+set}" = set; then
+  enableval="$enable_prologues"
+
+cat >>confdefs.h <<\_ACEOF
+#define ENABLE_PROLOGUES
+_ACEOF
+
+fi;
+
 build_elfutils=no
 
 # Check whether --with-elfutils or --without-elfutils was given.
index 60807c56d4d61125816c8e7b547d02d76559e4c6..59b7b34da1c46e37dc30c0c216fa14d927526ec0 100644 (file)
@@ -48,6 +48,10 @@ if test $perfmon_support = yes; then
   LDFLAGS="$LDFLAGS -DPERFMON -L$with_perfmon/lib -lpfm"
 fi
 
+AC_ARG_ENABLE(prologues,
+         AC_HELP_STRING([--enable-prologues],[make -P prologue-searching default]),
+         AC_DEFINE([ENABLE_PROLOGUES],[],[make -P prologue-searching default]))
+
 build_elfutils=no
 AC_ARG_WITH([elfutils],
             AC_HELP_STRING([--with-elfutils=DIRECTORY],
index b14403772bdc483a031bb65eb28e310dd00fc326..e1e24af920994b949ad4895bd4368a0dc939aa24 100644 (file)
--- a/hash.cxx
+++ b/hash.cxx
@@ -1,5 +1,5 @@
 // Copyright (C) Andrew Tridgell 2002 (original file)
-// Copyright (C) 2006 Red Hat Inc. (systemtap changes)
+// Copyright (C) 2006-2007 Red Hat Inc. (systemtap changes)
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -97,6 +97,7 @@ find_hash (systemtap_session& s, const string& script)
   h.add(s.bulk_mode);                  // '-b'
   h.add(s.merge);                      // '-M'
   h.add(s.timing);                     // '-t'
+  h.add(s.prologue_searching);         // '-P'
   for (unsigned i = 0; i < s.macros.size(); i++)
     h.add(s.macros[i]);
 
index 09810bd5e52703d9ef87e5ad16e457be1fb0c6da..554887a9c918eddcbe2c1a7ed5404904cd3a6c6e 100644 (file)
--- a/main.cxx
+++ b/main.cxx
@@ -71,6 +71,8 @@ usage (systemtap_session& s, int exitcode)
     << "   -k         keep temporary directory" << endl
     << "   -u         unoptimized translation" << (s.unoptimized ? " [set]" : "") << endl
     << "   -g         guru mode" << (s.guru_mode ? " [set]" : "") << endl
+    << "   -P         prologue-searching for function probes" 
+    << (s.prologue_searching ? " [set]" : "") << endl
     << "   -b         bulk (relayfs) mode" << (s.bulk_mode ? " [set]" : "") << endl
     << "   -M         Don't merge per-cpu files for bulk (relayfs) mode" << (s.merge ? "" : " [set]") << endl
     << "   -s NUM     buffer size in megabytes, instead of "
@@ -197,6 +199,13 @@ main (int argc, char * const argv [])
   s.guru_mode = false;
   s.bulk_mode = false;
   s.unoptimized = false;
+
+#ifdef ENABLE_PROLOGUES
+  s.prologue_searching = true;
+#else
+  s.prologue_searching = false;
+#endif
+
   s.buffer_size = 0;
   s.last_pass = 5;
   s.module_name = "stap_" + stringify(getpid());
@@ -256,7 +265,8 @@ main (int argc, char * const argv [])
 
   while (true)
     {
-      int grc = getopt (argc, argv, "hVMvtp:I:e:o:R:r:m:kgc:x:D:bs:u");
+      // NB: also see find_hash(), help(), switch stmt below, stap.1 man page
+      int grc = getopt (argc, argv, "hVMvtp:I:e:o:R:r:m:kgPc:x:D:bs:u");
       if (grc < 0)
         break;
       switch (grc)
@@ -328,6 +338,10 @@ main (int argc, char * const argv [])
           s.guru_mode = true;
           break;
 
+        case 'P':
+          s.prologue_searching = true;
+          break;
+
         case 'b':
           s.bulk_mode = true;
           break;
index ce977471f1dbbdca7a94cee89f5135c026f12dfa..956d4394f4fb911fc392abc719ea7b2bd802e36e 100644 (file)
--- a/session.h
+++ b/session.h
@@ -1,5 +1,5 @@
 // -*- C++ -*-
-// Copyright (C) 2005, 2006 Red Hat Inc.
+// Copyright (C) 2005-2007 Red Hat Inc.
 //
 // This file is part of systemtap, and is free software.  You can
 // redistribute it and/or modify it under the terms of the GNU General
@@ -94,6 +94,7 @@ struct systemtap_session
   int buffer_size;
   unsigned perfmon;
   bool symtab;
+  bool prologue_searching;
 
   // Cache data
   bool use_cache;
index 13fcc5509d80d1a3e6d151b795e5c22bedcca285..10df892dd39cf78ee04bd3fb9e753233ae1f7db0 100644 (file)
--- a/stap.1.in
+++ b/stap.1.in
@@ -97,6 +97,10 @@ kernel object.
 Guru mode.  Enable parsing of unsafe expert-level constructs like
 embedded C.
 .TP
+.B \-P
+Prologue-searching mode.  Enable parsing of unsafe expert-level constructs like
+embedded C.
+.TP
 .B \-u
 Unoptimized mode.  Disable unused code elision during elaboration.
 .TP
index 82903afac797c2f1201c252b7a8bd46d2b644664..f223d1543baf8688d355a26d10ad3405d0c7ef44 100644 (file)
@@ -48,7 +48,6 @@ extern "C" {
 #include <perfmon/perfmon.h>
 #endif
 
-
 using namespace std;
 
 
@@ -2415,19 +2414,19 @@ query_func_info (Dwarf_Addr entrypc,
        }
       else
        {
-#ifdef __ia64__
-       // In IA64 platform function probe point is set at its
-       // entry point rather than prologue end pointer
-          query_statement (fi.name, fi.decl_file, fi.decl_line,
-               &fi.die, entrypc, q);
-
-#else
-         if (fi.prologue_end == 0)
-           throw semantic_error("could not find prologue-end "
-                                "for probed function '" + fi.name + "'");
-         query_statement (fi.name, fi.decl_file, fi.decl_line,
-                          &fi.die, fi.prologue_end, q);
-#endif
+          if (q->sess.prologue_searching)
+            {
+              if (fi.prologue_end == 0)
+                throw semantic_error("could not find prologue-end "
+                                     "for probed function '" + fi.name + "'");
+              query_statement (fi.name, fi.decl_file, fi.decl_line,
+                               &fi.die, fi.prologue_end, q);
+            }
+          else
+            {
+              query_statement (fi.name, fi.decl_file, fi.decl_line,
+                               &fi.die, entrypc, q);
+            }
        }
     }
   catch (semantic_error &e)
@@ -2657,8 +2656,10 @@ query_cu (Dwarf_Die * cudie, void * arg)
          // matching the query, and fill in the prologue endings of them
          // all in a single pass.
          q->dw.iterate_over_functions (query_dwarf_func, q);
-          if (! q->filtered_functions.empty())
-            q->dw.resolve_prologue_endings (q->filtered_functions);
+
+          if (q->sess.prologue_searching)
+            if (! q->filtered_functions.empty())
+              q->dw.resolve_prologue_endings (q->filtered_functions);
 
          if ((q->has_statement_str || q->has_function_str || q->has_inline_str)
              && (q->spec_type == function_file_and_line))
index 18226d5420ee837df279297670f5967ef152a9e7..1ff99ad4300b81b50070e62d54de74bcee2d2423 100644 (file)
@@ -1,3 +1,7 @@
+2007-02-09  Frank Ch. Eigler  <fche@elastic.org>
+
+       * systemtap.base/prologue.*: New test case.
+
 2007-02-06  Josh Stone  <joshua.i.stone@intel.com>
 
        * systemtap.base/deref.stp: Test kread with const sources.
diff --git a/testsuite/systemtap.base/prologues.exp b/testsuite/systemtap.base/prologues.exp
new file mode 100644 (file)
index 0000000..b349e83
--- /dev/null
@@ -0,0 +1,21 @@
+set test "prologues -P"
+set ok 0
+spawn stap -P $srcdir/$subdir/prologues.stp
+expect {
+    -re {read[^\r\n]*\r\n} { incr ok; exp_continue }
+    -re {write[^\r\n]*\r\n} { incr ok; exp_continue }
+    eof
+}
+wait
+if {$ok > 10} { pass $test } else { fail $test }
+
+set test "prologues no-P"
+set ok 0
+spawn stap $srcdir/$subdir/prologues.stp
+expect {
+    -re {read[^\r\n]*\r\n} { incr ok; exp_continue }
+    -re {write[^\r\n]*\r\n} { incr ok; exp_continue }
+    eof
+}
+wait
+if {$ok > 10} { pass $test } else { fail $test }
\ No newline at end of file
diff --git a/testsuite/systemtap.base/prologues.stp b/testsuite/systemtap.base/prologues.stp
new file mode 100644 (file)
index 0000000..fc32ccd
--- /dev/null
@@ -0,0 +1,6 @@
+# These sys_ functions often display prologue sensitivity
+probe syscall.read, syscall.write {
+  log (name . argstr)
+  if (num++ > 20) exit()
+}
+global num
This page took 0.058756 seconds and 5 git commands to generate.