From: fche Date: Fri, 9 Feb 2007 13:45:49 +0000 (+0000) Subject: 2007-02-09 Frank Ch. Eigler X-Git-Tag: release-0.5.13~79 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=44f753868fd81e3b5c614acc3a4898d5c812a610;p=systemtap.git 2007-02-09 Frank Ch. Eigler 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 * systemtap.base/prologue.*: New test case. --- diff --git a/ChangeLog b/ChangeLog index b62a81812..0956a4fad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2007-02-09 Frank Ch. Eigler + + 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 * stapfuncs.5.in: Add docs for kernel_{long,int,short,char} and diff --git a/NEWS b/NEWS index 84ed4ea6f..d5cfa401e 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 c1d601a9c..b3a617dc1 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 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 82fcebd95..2e5b41f1e 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 60807c56d..59b7b34da 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 b14403772..e1e24af92 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 09810bd5e..554887a9c 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 ce977471f..956d4394f 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 13fcc5509..10df892dd 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 82903afac..f223d1543 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -48,7 +48,6 @@ extern "C" { #include #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 18226d542..1ff99ad43 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2007-02-09 Frank Ch. Eigler + + * systemtap.base/prologue.*: New test case. + 2007-02-06 Josh Stone * 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 000000000..b349e8393 --- /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 000000000..fc32ccd90 --- /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