+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
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?
/* 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
--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]
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.
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],
// 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
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]);
<< " -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 "
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());
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)
s.guru_mode = true;
break;
+ case 'P':
+ s.prologue_searching = true;
+ break;
+
case 'b':
s.bulk_mode = true;
break;
// -*- 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
int buffer_size;
unsigned perfmon;
bool symtab;
+ bool prologue_searching;
// Cache data
bool use_cache;
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
#include <perfmon/perfmon.h>
#endif
-
using namespace std;
}
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)
// 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))
+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.
--- /dev/null
+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
--- /dev/null
+# These sys_ functions often display prologue sensitivity
+probe syscall.read, syscall.write {
+ log (name . argstr)
+ if (num++ > 20) exit()
+}
+global num