diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-04-11 13:37:07 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-04-11 13:37:07 -0400 |
commit | bf50bb491c5bfcf3035de45ac58acf11ed02af06 (patch) | |
tree | 2ea9006cb818783ccf7f026500a092903df869db | |
parent | 68eef6bdafca37b9b05dbc6d773a642ccafd9962 (diff) | |
parent | 48899faa2d1280f7715b0abf892fb8b4b5c8ff43 (diff) | |
download | systemtap-steved-bf50bb491c5bfcf3035de45ac58acf11ed02af06.tar.gz systemtap-steved-bf50bb491c5bfcf3035de45ac58acf11ed02af06.tar.xz systemtap-steved-bf50bb491c5bfcf3035de45ac58acf11ed02af06.zip |
Merge branch 'master' of git://sources.redhat.com/git/systemtap
* 'master' of git://sources.redhat.com/git/systemtap:
2008-04-11 David Smith <dsmith@redhat.com>
2008-04-11 David Smith <dsmith@redhat.com>
2008-04-11 David Smith <dsmith@redhat.com>
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | ChangeLog | 26 | ||||
-rw-r--r-- | elaborate.h | 6 | ||||
-rw-r--r-- | tapsets.cxx | 53 | ||||
-rw-r--r-- | testsuite/.gitignore | 4 | ||||
-rw-r--r-- | translate.cxx | 9 |
6 files changed, 85 insertions, 14 deletions
@@ -20,3 +20,4 @@ stapio stap_merge SNAPSHOT *.o +git_version.h @@ -1,3 +1,29 @@ +2008-04-11 David Smith <dsmith@redhat.com> + + * elaborate.h (struct derived_probe_group): Added + emit_module_header virtual function. + * translate.cxx (c_unparser::emit_common_header): Calls each probe + group's emit_module_header function. + (translate_pass): Moved inclusion of linux/marker.h to + mark_derived_probe_group::emit_module_header(). + * tapsets.cxx (struct be_derived_probe_group): Added empty + emit_module_header function. + (struct timer_derived_probe_group): Ditto. + (struct profile_derived_probe_group): Ditto. + (struct procfs_derived_probe_group): Ditto. + (struct hrtimer_derived_probe_group): Ditto. + (struct perfmon_derived_probe_group): Ditto. + (dwarf_derived_probe_group::emit_module_header): Moved kprobes + kernel check from emit_module_decls() to here. + (uprobe_derived_probe_group::emit_module_header): Moved uprobe + kernel check from emit_module_decls() to here. + (uprobe_derived_probe_group::emit_module_decls): Moved uprobe + kernel check to emit_module_header(). + (mark_derived_probe_group::emit_module_header): Moved marker + kernel check from emit_module_decls and translate_pass() to here. + (uprobe_derived_probe_group::emit_module_decls): Moved marker + kernel check to emit_module_header(). + 2008-04-10 Frank Ch. Eigler <fche@elastic.org> PR 2949. diff --git a/elaborate.h b/elaborate.h index 30bf5bce..f53f3870 100644 --- a/elaborate.h +++ b/elaborate.h @@ -150,6 +150,12 @@ struct derived_probe_group { virtual ~derived_probe_group () {} + virtual void emit_module_header (systemtap_session& s) = 0; + // The _header-generated code may assume that only basic includes + // have been generated. _header is called near the start of the + // code generation process, before the context, embedded-C code, + // etc. are generated. + virtual void emit_module_decls (systemtap_session& s) = 0; // The _decls-generated code may assume that declarations such as // the context, embedded-C code, function and probe handler bodies diff --git a/tapsets.cxx b/tapsets.cxx index ceda9015..a7f8034e 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -104,6 +104,7 @@ struct be_derived_probe: public derived_probe struct be_derived_probe_group: public generic_dpg<be_derived_probe> { public: + void emit_module_header (systemtap_session& ) { }; void emit_module_decls (systemtap_session& s); void emit_module_init (systemtap_session& s); void emit_module_exit (systemtap_session& s); @@ -2068,6 +2069,7 @@ private: public: void enroll (dwarf_derived_probe* probe); + void emit_module_header (systemtap_session& s); void emit_module_decls (systemtap_session& s); void emit_module_init (systemtap_session& s); void emit_module_exit (systemtap_session& s); @@ -3927,17 +3929,22 @@ dwarf_derived_probe_group::enroll (dwarf_derived_probe* p) void -dwarf_derived_probe_group::emit_module_decls (systemtap_session& s) +dwarf_derived_probe_group::emit_module_header (systemtap_session& s) { if (probes_by_module.empty()) return; - s.op->newline() << "/* ---- dwarf probes ---- */"; - - // Warn of misconfigured kernels + // Warn of misconfigured kernels s.op->newline() << "#if ! defined(CONFIG_KPROBES)"; s.op->newline() << "#error \"Need CONFIG_KPROBES!\""; s.op->newline() << "#endif"; - s.op->newline(); +} + +void +dwarf_derived_probe_group::emit_module_decls (systemtap_session& s) +{ + if (probes_by_module.empty()) return; + + s.op->newline() << "/* ---- dwarf probes ---- */"; // Forward declare the master entry functions s.op->newline() << "static int enter_kprobe_probe (struct kprobe *inst,"; @@ -4264,6 +4271,7 @@ struct uprobe_derived_probe: public derived_probe struct uprobe_derived_probe_group: public generic_dpg<uprobe_derived_probe> { public: + void emit_module_header (systemtap_session& s); void emit_module_decls (systemtap_session& s); void emit_module_init (systemtap_session& s); void emit_module_exit (systemtap_session& s); @@ -4313,10 +4321,9 @@ struct uprobe_builder: public derived_probe_builder void -uprobe_derived_probe_group::emit_module_decls (systemtap_session& s) +uprobe_derived_probe_group::emit_module_header (systemtap_session& s) { if (probes.empty()) return; - s.op->newline() << "/* ---- user probes ---- */"; // If uprobes isn't in the kernel, pull it in from the runtime. s.op->newline() << "#if defined(CONFIG_UPROBES) || defined(CONFIG_UPROBES_MODULE)"; @@ -4324,6 +4331,14 @@ uprobe_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "#else"; s.op->newline() << "#include \"uprobes/uprobes.h\""; s.op->newline() << "#endif"; +} + + +void +uprobe_derived_probe_group::emit_module_decls (systemtap_session& s) +{ + if (probes.empty()) return; + s.op->newline() << "/* ---- user probes ---- */"; s.op->newline() << "struct stap_uprobe {"; s.op->newline(1) << "union { struct uprobe up; struct uretprobe urp; };"; @@ -4442,6 +4457,7 @@ struct timer_derived_probe_group: public generic_dpg<timer_derived_probe> { void emit_interval (translator_output* o); public: + void emit_module_header (systemtap_session& ) { }; void emit_module_decls (systemtap_session& s); void emit_module_init (systemtap_session& s); void emit_module_exit (systemtap_session& s); @@ -4583,6 +4599,7 @@ struct profile_derived_probe: public derived_probe struct profile_derived_probe_group: public generic_dpg<profile_derived_probe> { public: + void emit_module_header (systemtap_session& ) { }; void emit_module_decls (systemtap_session& s); void emit_module_init (systemtap_session& s); void emit_module_exit (systemtap_session& s); @@ -4711,6 +4728,7 @@ profile_derived_probe_group::emit_module_exit (systemtap_session& s) } + // ------------------------------------------------------------------------ // procfs file derived probes // ------------------------------------------------------------------------ @@ -4749,6 +4767,7 @@ public: has_read_probes(false), has_write_probes(false) {} void enroll (procfs_derived_probe* probe); + void emit_module_header (systemtap_session& ) { }; void emit_module_decls (systemtap_session& s); void emit_module_init (systemtap_session& s); void emit_module_exit (systemtap_session& s); @@ -5189,6 +5208,7 @@ procfs_builder::build(systemtap_session & sess, } + // ------------------------------------------------------------------------ // statically inserted macro-based derived probes // ------------------------------------------------------------------------ @@ -5223,6 +5243,7 @@ struct mark_derived_probe: public derived_probe struct mark_derived_probe_group: public generic_dpg<mark_derived_probe> { public: + void emit_module_header (systemtap_session& s); void emit_module_decls (systemtap_session& s); void emit_module_init (systemtap_session& s); void emit_module_exit (systemtap_session& s); @@ -5661,18 +5682,26 @@ mark_derived_probe::initialize_probe_context_vars (translator_output* o) void -mark_derived_probe_group::emit_module_decls (systemtap_session& s) +mark_derived_probe_group::emit_module_header (systemtap_session& s) { if (probes.empty()) return; - s.op->newline() << "/* ---- marker probes ---- */"; - // Warn of misconfigured kernels s.op->newline() << "#if ! defined(CONFIG_MARKERS)"; s.op->newline() << "#error \"Need CONFIG_MARKERS!\""; s.op->newline() << "#endif"; + s.op->newline() << "#include <linux/marker.h>"; s.op->newline(); +} + +void +mark_derived_probe_group::emit_module_decls (systemtap_session& s) +{ + if (probes.empty()) + return; + + s.op->newline() << "/* ---- marker probes ---- */"; s.op->newline() << "struct stap_marker_probe {"; s.op->newline(1) << "const char * const name;"; @@ -5887,6 +5916,7 @@ mark_builder::build(systemtap_session & sess, } + // ------------------------------------------------------------------------ // hrtimer derived probes // ------------------------------------------------------------------------ @@ -5928,6 +5958,7 @@ struct hrtimer_derived_probe_group: public generic_dpg<hrtimer_derived_probe> { void emit_interval (translator_output* o); public: + void emit_module_header (systemtap_session& ) { }; void emit_module_decls (systemtap_session& s); void emit_module_init (systemtap_session& s); void emit_module_exit (systemtap_session& s); @@ -6180,6 +6211,7 @@ timer_builder::register_patterns(match_node *root) } + // ------------------------------------------------------------------------ // perfmon derived probes // ------------------------------------------------------------------------ @@ -6282,6 +6314,7 @@ public: struct perfmon_derived_probe_group: public generic_dpg<perfmon_derived_probe> { public: + void emit_module_header (systemtap_session& ) { }; void emit_module_decls (systemtap_session&) {} void emit_module_init (systemtap_session&) {} void emit_module_exit (systemtap_session&) {} diff --git a/testsuite/.gitignore b/testsuite/.gitignore new file mode 100644 index 00000000..34a4e8d0 --- /dev/null +++ b/testsuite/.gitignore @@ -0,0 +1,4 @@ +.systemtap +site.exp +systemtap.log +systemtap.sum diff --git a/translate.cxx b/translate.cxx index c9ec094a..ba848d43 100644 --- a/translate.cxx +++ b/translate.cxx @@ -849,6 +849,11 @@ translator_output::line () void c_unparser::emit_common_header () { + vector<derived_probe_group*> g = all_session_groups (*session); + for (unsigned i=0; i<g.size(); i++) + g[i]->emit_module_header (*session); + + o->newline(); o->newline() << "typedef char string_t[MAXSTRINGLEN];"; o->newline(); o->newline() << "#define STAP_SESSION_STARTING 0"; @@ -4526,10 +4531,6 @@ 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 <linux/marker.h>"; - s.op->newline() << "#endif"; - s.up->emit_common_header (); // context etc. for (unsigned i=0; i<s.embeds.size(); i++) |