This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

tapsets.cxx patch for testsuite/systemtap.apps/tcl.exp


This patch gets the tcl.exp tests to pass:

tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): Do not reject mmaped VM_WRITE segments while finding the spec_index, to enable setting semaphores
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -4802,7 +4802,8 @@ uprobe_derived_probe_group::emit_module_decls
(systemtap_session& s)
s.op->newline() << "if (likely(sups->tfi != tfi)) continue;";
// skip probes with an address beyond this map event; should not
// happen unless a shlib/exec got mmapped in weirdly piecemeal
- s.op->newline() << "if (likely(sups->address >= length)) continue;";
+ // However allow a writeable segment so semaphores can be enabled.
+ s.op->newline() << "if (likely(sups->address >= length && !(vm_flags &
VM_WRITE))) continue;";


   // Found a uprobe_spec for this stap_uprobe_tf.  Need to lock the
   // stap_uprobes[] array to allocate a free spot, but then we can
@@ -4846,7 +4847,16 @@ uprobe_derived_probe_group::emit_module_decls
(systemtap_session& s)
   s.op->newline() << "sdt_sem_address[spec_index] = relocation +
sups->sdt_sem_offset;";
   s.op->newline() << "sdt_sem_tid[spec_index] = tsk->tgid;";
   s.op->newline(-1) << "}";
-  // If the probe is in a .so, we have to calculate the address.
+  // If the probe is in a .so, we have to calculate the address
+  // when the initial mmap maps the entire solib, e.g.
+  // 7f089885a000-7f089885b000  rw-p-  libtcl.so
+  // A subsequent mmap maps in the writeable segment where the
+  // semaphore control variable lives, which is when the variable is set.
+  // 7f089850d000-7f0898647000  r-xp-  libtcl.so
+  // 7f0898647000-7f0898846000  ---p   libtcl.so
+  // 7f0898846000-7f089885b000  rw-p-  libtcl.so
+  // If the task changes, then recalculate the address.
+
   s.op->newline() << "else {";
   s.op->indent(1);
   s.op->newline() << "sdt_sem_address[spec_index] = (relocation - offset) +
sups->sdt_sem_offset;";


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]