summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2008-06-23 12:41:45 -0500
committerDavid Smith <dsmith@redhat.com>2008-06-23 12:43:23 -0500
commita21d81ec8b00571cb5987fe04ce74a3fe873351c (patch)
treed38eae80a5cfaf3cb5bdf0a8da6cbe0b8b98cd88 /tapsets.cxx
parentb857a3649c0f8e4e2d8a7209424f23c5d55adac7 (diff)
downloadsystemtap-steved-a21d81ec8b00571cb5987fe04ce74a3fe873351c.tar.gz
systemtap-steved-a21d81ec8b00571cb5987fe04ce74a3fe873351c.tar.xz
systemtap-steved-a21d81ec8b00571cb5987fe04ce74a3fe873351c.zip
Major update to memory map change notification code.
2008-06-23 David Smith <dsmith@redhat.com> * tapsets.cxx (utrace_derived_probe_group::emit_probe_decl): Handles UDPF_NONE value. (utrace_derived_probe_group::emit_vm_callback_probe_decl): New function. (utrace_derived_probe_group::emit_module_decls): Calls emit_vm_callback_probe_decl() to set up vm_callbacks. 2008-06-23 David Smith <dsmith@redhat.com> * task_finder.c (__stp_tf_vm_cb): New function. (stap_register_task_finder_target): Sets up syscall entry and syscall exit handlers. (__stp_find_file_based_vma): New function. (__stp_utrace_task_finder_target_syscall_entry): New function. Saves vma information off at syscall entry. (__stp_target_call_vm_callback): New function. (__stp_utrace_task_finder_target_syscall_exit): New function. Handles changes to memory maps based on information saved at syscall entry. * syscall.h: New file containing syscall function. * task_finder_vma.c: New file containing saved vma information handling functions.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r--tapsets.cxx57
1 files changed, 57 insertions, 0 deletions
diff --git a/tapsets.cxx b/tapsets.cxx
index 3f9291f2..5b66d186 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -5225,6 +5225,9 @@ private:
bool flags_seen[UDPF_NFLAGS];
void emit_probe_decl (systemtap_session& s, utrace_derived_probe *p);
+ void emit_vm_callback_probe_decl (systemtap_session& s, bool has_path,
+ string path, int64_t pid,
+ string vm_callback);
public:
utrace_derived_probe_group(): num_probes(0), flags_seen() { }
@@ -5484,6 +5487,11 @@ utrace_derived_probe_group::emit_probe_decl (systemtap_session& s,
s.op->line() << " .ops={ .report_syscall_exit=stap_utrace_probe_syscall, .report_death=stap_utrace_task_finder_report_death },";
s.op->line() << " .events=(UTRACE_EVENT(SYSCALL_EXIT)|UTRACE_EVENT(DEATH)),";
break;
+ case UDPF_NONE:
+ s.op->line() << " .flags=(UDPF_NONE),";
+ s.op->line() << " .ops={ },";
+ s.op->line() << " .events=0,";
+ break;
default:
throw semantic_error ("bad utrace probe flag");
break;
@@ -5494,6 +5502,40 @@ utrace_derived_probe_group::emit_probe_decl (systemtap_session& s,
void
+utrace_derived_probe_group::emit_vm_callback_probe_decl (systemtap_session& s,
+ bool has_path,
+ string path,
+ int64_t pid,
+ string vm_callback)
+{
+ s.op->newline() << "{";
+ s.op->line() << " .tgt={";
+
+ if (has_path)
+ {
+ s.op->line() << " .pathname=\"" << path << "\",";
+ s.op->line() << " .pid=0,";
+ }
+ else
+ {
+ s.op->line() << " .pathname=NULL,";
+ s.op->line() << " .pid=" << pid << ",";
+ }
+
+ s.op->line() << " .callback=NULL,";
+ s.op->line() << " .vm_callback=&" << vm_callback << ",";
+ s.op->line() << " },";
+ s.op->line() << " .pp=\"internal\",";
+ s.op->line() << " .ph=NULL,";
+ s.op->line() << " .flags=(UDPF_NONE),";
+ s.op->line() << " .ops={ NULL },";
+ s.op->line() << " .events=0,";
+ s.op->line() << " .engine_attached=0,";
+ s.op->line() << " },";
+}
+
+
+void
utrace_derived_probe_group::emit_module_decls (systemtap_session& s)
{
if (probes_by_path.empty() && probes_by_pid.empty())
@@ -5737,6 +5779,14 @@ utrace_derived_probe_group::emit_module_decls (systemtap_session& s)
for (p_b_path_iterator it = probes_by_path.begin();
it != probes_by_path.end(); it++)
{
+ // Emit a "fake" probe decl that is really a hook for to get
+ // our vm_callback called.
+ string path = it->first;
+ s.op->newline() << "#ifdef DEBUG_TASK_FINDER_VMA";
+ emit_vm_callback_probe_decl (s, true, path, (int64_t)0,
+ "__stp_tf_vm_cb");
+ s.op->newline() << "#endif";
+
for (unsigned i = 0; i < it->second.size(); i++)
{
utrace_derived_probe *p = it->second[i];
@@ -5751,6 +5801,13 @@ utrace_derived_probe_group::emit_module_decls (systemtap_session& s)
for (p_b_pid_iterator it = probes_by_pid.begin();
it != probes_by_pid.end(); it++)
{
+ // Emit a "fake" probe decl that is really a hook for to get
+ // our vm_callback called.
+ s.op->newline() << "#ifdef DEBUG_TASK_FINDER_VMA";
+ emit_vm_callback_probe_decl (s, false, NULL, it->first,
+ "__stp_tf_vm_cb");
+ s.op->newline() << "#endif";
+
for (unsigned i = 0; i < it->second.size(); i++)
{
utrace_derived_probe *p = it->second[i];