From 2c384610cea3e62da8a4af676b5f8be523741b88 Mon Sep 17 00:00:00 2001 From: dsmith Date: Mon, 21 May 2007 21:21:13 +0000 Subject: 2007-05-21 David Smith PR 4446. * elaborate.h (derived_probe::initialize_probe_context_vars): New virtual function that will allow added context vars to be initialized. * translate.cxx (c_unparser::emit_common_header): Added 'mark_va_list'. (c_unparser::emit_probe): Calls new function initialize_probe_context_vars. (translate_pass): Includes linux/marker.h if CONFIG_MARKERS is defined. * tapsets.cxx (struct dwarf_query): Split into base_query (which contains most of the original code) and a much smaller dwarf_query class. (struct base_query): New class. (dwarf_query::handle_query_module): New function. (query_module): Moved code into dwarf_query::handle_query_module(). (mark_derived_probe): Adjusted for new kernel markers. (mark_derived_probe_group): Ditto. (mark_var_expanding_copy_visitor): Ditto. (mark_var_expanding_copy_visitor::visit_target_symbol): Generates code for new kernel markers. (struct mark_query): New class. (mark_query::handle_query_module): New function. (mark_derived_probe::mark_derived_probe): Adjusted for new kernel markers. (mark_derived_probe::join_group): Ditto. (mark_derived_probe::emit_probe_context_vars): Ditto. (mark_derived_probe::parse_probe_sig): New function. (mark_derived_probe::initialize_probe_context_vars): New function. (mark_derived_probe::emit_module_decls): Adjust for new kernel markers. (mark_derived_probe::emit_module_init): Ditto. (mark_derived_probe::emit_module_exit): Ditto. (struct mark_builder): Ditto. (mark_builder::build): Ditto. --- translate.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'translate.cxx') diff --git a/translate.cxx b/translate.cxx index 8996bc4c..b5fef890 100644 --- a/translate.cxx +++ b/translate.cxx @@ -858,6 +858,7 @@ c_unparser::emit_common_header () o->newline() << "const char *last_stmt;"; o->newline() << "struct pt_regs *regs;"; o->newline() << "struct kretprobe_instance *pi;"; + o->newline() << "va_list mark_va_list;"; o->newline() << "#ifdef STP_TIMING"; o->newline() << "Stat *statp;"; o->newline() << "#endif"; @@ -1482,6 +1483,8 @@ c_unparser::emit_probe (derived_probe* v) throw semantic_error ("unsupported local variable type", v->locals[j]->tok); } + + v->initialize_probe_context_vars (o); v->body->visit (this); @@ -4340,6 +4343,10 @@ translate_pass (systemtap_session& s) s.op->newline() << "#define read_trylock(x) ({ read_lock(x); 1; })"; s.op->newline() << "#endif"; + s.op->newline() << "#if defined(CONFIG_MARKERS)"; + s.op->newline() << "#include "; + s.op->newline() << "#endif"; + s.up->emit_common_header (); // context etc. for (unsigned i=0; i