From 36f9dd1ddd9f5a7418d884caa050ef5e23784816 Mon Sep 17 00:00:00 2001 From: fche Date: Mon, 7 Nov 2005 22:00:16 +0000 Subject: [PATCH] 2005-11-07 Frank Ch. Eigler PR 1828. * tapsets.cxx (blacklisted_p): New function. Add a few blacklist entries. * testsuite/semko/thirtythree.stp: New test. --- ChangeLog | 7 ++++ tapsets.cxx | 57 +++++++++++++++++++++++++++------ testsuite/semko/thirtythree.stp | 5 +++ 3 files changed, 59 insertions(+), 10 deletions(-) create mode 100755 testsuite/semko/thirtythree.stp diff --git a/ChangeLog b/ChangeLog index 50c1ed13b..48876061d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-11-07 Frank Ch. Eigler + + PR 1828. + * tapsets.cxx (blacklisted_p): New function. Add a few blacklist + entries. + * testsuite/semko/thirtythree.stp: New test. + 2005-11-07 Frank Ch. Eigler * testsuite/buildok/twentytwo.stp: Add another test for PR 1271. diff --git a/tapsets.cxx b/tapsets.cxx index 0e4357e75..21c3aad73 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -1348,6 +1348,12 @@ dwarf_query Dwarf_Die *scope_die, Dwarf_Addr addr); + bool blacklisted_p(string const & funcname, + char const * filename, + int line, + Dwarf_Die *scope_die, + Dwarf_Addr addr); + // Extracted parameters. bool has_kernel; bool has_process; @@ -1636,15 +1642,14 @@ target_variable_flavour_calculating_visitor::visit_target_symbol (target_symbol } -void -dwarf_query::add_probe_point(string const & funcname, - char const * filename, - int line, - Dwarf_Die *scope_die, - Dwarf_Addr addr) -{ - dwarf_derived_probe *probe = NULL; +bool +dwarf_query::blacklisted_p(string const & funcname, + char const * filename, + int line, + Dwarf_Die *scope_die, + Dwarf_Addr addr) +{ // Check whether the given address points into an .init section, // which will have been unmapped by the kernel by the time we get to // insert the probe. In this case, just ignore this call. @@ -1660,7 +1665,7 @@ dwarf_query::add_probe_point(string const & funcname, clog << "skipping function '" << funcname << "' base 0x" << hex << addr << dec << " is within section '" << name << "'" << endl; - return; + return true; } } else @@ -1695,12 +1700,44 @@ dwarf_query::add_probe_point(string const & funcname, clog << "skipping function '" << funcname << "' base 0x" << hex << addr << dec << " is within section '" << name << "'" << endl; - return; + return true; } } } } + // Check probe point against blacklist. XXX: This has to be + // properly generalized, perhaps via a table populated from script + // files. A "noprobe kernel.function("...")" construct might do + // the trick. + string filename_s = filename ? filename : ""; // is passed as const char* + if (funcname == "do_IRQ" || + filename_s == "kernel/kprobes.c" || + 0 == fnmatch ("arch/*/kernel/kprobes.c", filename, 0)) + { + if (sess.verbose) + clog << "skipping function '" << funcname << "' file '" + << filename << "' is blacklisted" << endl; + return true; + } + + // This probe point is not blacklisted. + return false; +} + + +void +dwarf_query::add_probe_point(string const & funcname, + char const * filename, + int line, + Dwarf_Die *scope_die, + Dwarf_Addr addr) +{ + dwarf_derived_probe *probe = NULL; + + if (blacklisted_p (funcname, filename, line, scope_die, addr)) + return; + if (probe_has_no_target_variables) { assert(probe_flavours.size() == 1); diff --git a/testsuite/semko/thirtythree.stp b/testsuite/semko/thirtythree.stp new file mode 100755 index 000000000..36b997c84 --- /dev/null +++ b/testsuite/semko/thirtythree.stp @@ -0,0 +1,5 @@ +#! stap -p2 + +// should fail since all these functions are blacklisted +probe kernel.function("do_IRQ") {} +probe kernel.function("*@*/kprobes.c") {} -- 2.43.5