summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfche <fche>2007-02-09 13:45:49 +0000
committerfche <fche>2007-02-09 13:45:49 +0000
commit44f753868fd81e3b5c614acc3a4898d5c812a610 (patch)
tree459dbe716908765a6d0c36fcb71812d7a30eb2d1
parent7d678473f851dadc2f5a4f6fe1a0bc7635750585 (diff)
downloadsystemtap-steved-44f753868fd81e3b5c614acc3a4898d5c812a610.tar.gz
systemtap-steved-44f753868fd81e3b5c614acc3a4898d5c812a610.tar.xz
systemtap-steved-44f753868fd81e3b5c614acc3a4898d5c812a610.zip
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-09 Frank Ch. Eigler <fche@elastic.org> * systemtap.base/prologue.*: New test case.
-rw-r--r--ChangeLog12
-rw-r--r--NEWS6
-rw-r--r--config.in6
-rwxr-xr-xconfigure11
-rw-r--r--configure.ac4
-rw-r--r--hash.cxx3
-rw-r--r--main.cxx16
-rw-r--r--session.h3
-rw-r--r--stap.1.in4
-rw-r--r--tapsets.cxx33
-rw-r--r--testsuite/ChangeLog4
-rw-r--r--testsuite/systemtap.base/prologues.exp21
-rw-r--r--testsuite/systemtap.base/prologues.stp6
13 files changed, 110 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index b62a8181..0956a4fa 100644
--- 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 84ed4ea6..d5cfa401 100644
--- 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?
diff --git a/config.in b/config.in
index c1d601a9..b3a617dc 100644
--- 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
diff --git a/configure b/configure
index 82fcebd9..2e5b41f1 100755
--- 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.
diff --git a/configure.ac b/configure.ac
index 60807c56..59b7b34d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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],
diff --git a/hash.cxx b/hash.cxx
index b1440377..e1e24af9 100644
--- 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]);
diff --git a/main.cxx b/main.cxx
index 09810bd5..554887a9 100644
--- 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;
diff --git a/session.h b/session.h
index ce977471..956d4394 100644
--- 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;
diff --git a/stap.1.in b/stap.1.in
index 13fcc550..10df892d 100644
--- 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
diff --git a/tapsets.cxx b/tapsets.cxx
index 82903afa..f223d154 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -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))
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 18226d54..1ff99ad4 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -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
index 00000000..b349e839
--- /dev/null
+++ b/testsuite/systemtap.base/prologues.exp
@@ -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
index 00000000..fc32ccd9
--- /dev/null
+++ b/testsuite/systemtap.base/prologues.stp
@@ -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