From e2ae0696f7b8cbbafad87a8739c0cc450f7ee887 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 19 Mar 2009 13:02:19 -0400 Subject: Disable kprobe blacklist in guru mode. --- tapsets.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 894a7447..6de6271b 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -3521,9 +3521,17 @@ dwarf_query::blacklisted_p(const string& funcname, if (! (goodfn && goodfile)) { - if (sess.verbose>1) - clog << " skipping - blacklisted"; - return true; + if (sess.guru_mode) + { + if (sess.verbose>1) + clog << " guru mode enabled - ignoring blacklist"; + } + else + { + if (sess.verbose>1) + clog << " skipping - blacklisted"; + return true; + } } // This probe point is not blacklisted. -- cgit From d0cd971e70eba3781a95862223d1f7d45e2f5135 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 19 Mar 2009 22:22:25 +0100 Subject: Throw type into semantic_error message of @cast when not found. * tapsets.cxx (dwarf_cast_expanding_visitor::visit_cast_op): Add type to msg added to semantic_error when thrown. --- tapsets.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 6de6271b..103c39fa 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -5067,7 +5067,8 @@ void dwarf_cast_expanding_visitor::visit_cast_op (cast_op* e) // cast_op to the next pass. We hope that this value ends // up not being referenced after all, so it can be optimized out // quietly. - semantic_error* er = new semantic_error ("type definition not found", e->tok); + string msg = "type definition '" + e->type + "' not found"; + semantic_error* er = new semantic_error (msg, e->tok); // NB: we can have multiple errors, since a @cast // may be expanded in several different contexts: // function ("*") { @cast(...) } -- cgit From ad370dccd460ebfc66f21d3d16f44807d789484f Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 19 Mar 2009 16:23:02 -0700 Subject: PR9960: support tracepoint struct/union value arg If a tracepoint arg is a structure or union that is passed by value, then this takes the address of the parameter so it can be used like a pointer in the rest of our code. --- tapsets.cxx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 103c39fa..a8653d8a 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -9242,7 +9242,7 @@ mark_builder::build(systemtap_session & sess, struct tracepoint_arg { - string name, c_type; + string name, c_type, typecast; bool usable, used, isptr; Dwarf_Die type_die; tracepoint_arg(): usable(false), used(false), isptr(false) {} @@ -9345,6 +9345,9 @@ tracepoint_var_expanding_visitor::visit_target_symbol_arg (target_symbol* e) if (lvalue && (!dw.sess.guru_mode || e->components.empty())) throw semantic_error("write to tracepoint variable '" + e->base_name + "' not permitted", e->tok); + // XXX: if a struct/union arg is passed by value, then writing to its fields + // is also meaningless until you dereference past a pointer member. It's + // harder to detect and prevent that though... if (e->components.empty()) { @@ -9685,6 +9688,14 @@ resolve_tracepoint_arg_type(tracepoint_arg& arg) if (dwarf_attr_integrate(&arg.type_die, DW_AT_type, &type_attr) && dwarf_formref_die(&type_attr, &arg.type_die)) arg.isptr = true; + arg.typecast = "(intptr_t)"; + return true; + case DW_TAG_structure_type: + case DW_TAG_union_type: + // for structs/unions which are passed by value, we turn it into + // a pointer that can be dereferenced. + arg.isptr = true; + arg.typecast = "(intptr_t)&"; return true; default: // should we consider other types too? @@ -9787,8 +9798,7 @@ tracepoint_derived_probe_group::emit_module_decls (systemtap_session& s) { s.op->newline() << "c->locals[0]." << p->name << ".__tracepoint_arg_" << p->args[j].name << " = (int64_t)"; - if (p->args[j].isptr) - s.op->line() << "(intptr_t)"; + s.op->line() << p->args[j].typecast; s.op->line() << "__tracepoint_arg_" << p->args[j].name << ";"; } s.op->newline() << p->name << " (c);"; -- cgit