From 903b9fcdc3f5bf294514376e2e428bd45c647290 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Thu, 1 Oct 2009 09:18:21 -0400 Subject: Add DEBUG_UPROBES for sdt semaphores. * tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): Add DEBUG_UPROBES for sdt semaphores * dtrace.in (main): Add -k option to keep around the temp files. --- tapsets.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index fdbddd9e..4433af3f 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -4601,6 +4601,10 @@ uprobe_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "sup->sdt_sem_address = relocation + sups->sdt_sem_address;"; s.op->newline() << "(void) __access_process_vm (tsk, sup->sdt_sem_address, &sdt_semaphore, sizeof (sdt_semaphore), 0);"; s.op->newline() << "sdt_semaphore ++;"; + s.op->newline() << "#ifdef DEBUG_UPROBES"; + s.op->newline() << "_stp_dbug (__FUNCTION__,__LINE__, \"+semaphore %#x @ %#lx\\n\", sdt_semaphore, sup->sdt_sem_address);"; + s.op->newline() << "#endif"; + s.op->newline() << "(void) __access_process_vm (tsk, sup->sdt_sem_address, &sdt_semaphore, sizeof (sdt_semaphore), 1);"; // XXX: error handling in __access_process_vm! // XXX: need to analyze possibility of race condition @@ -4864,6 +4868,9 @@ uprobe_derived_probe_group::emit_module_exit (systemtap_session& s) s.op->newline() << "if (tsk) {"; // just in case the thing exited while we weren't watching s.op->newline(1) << "(void) __access_process_vm (tsk, sup->sdt_sem_address, &sdt_semaphore, sizeof (sdt_semaphore), 0);"; s.op->newline() << "sdt_semaphore --;"; + s.op->newline() << "#ifdef DEBUG_UPROBES"; + s.op->newline() << "_stp_dbug (__FUNCTION__,__LINE__, \"-semaphore %#x @ %#lx\\n\", sdt_semaphore, sup->sdt_sem_address);"; + s.op->newline() << "#endif"; s.op->newline() << "(void) __access_process_vm (tsk, sup->sdt_sem_address, &sdt_semaphore, sizeof (sdt_semaphore), 1);"; // XXX: error handling in __access_process_vm! // XXX: need to analyze possibility of race condition -- cgit