This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH - v2] Fix for insn probe: Call arch_has_*_step() prior to calling utrace_control
- From: Maynard Johnson <maynardj at us dot ibm dot com>
- To: systemtap at sourceware dot org, "Frank Ch. Eigler" <fche at redhat dot com>
- Date: Wed, 01 Apr 2009 15:26:25 -0500
- Subject: [PATCH - v2] Fix for insn probe: Call arch_has_*_step() prior to calling utrace_control
The attached patch is version 2 for the problem I reported earlier today.
Frank, is this more what you had in mind? With this patch, there's no need for the user to look at the system log. Error messages are sent to stderr:
ERROR: insn probe init: arch does not support block step mode
ERROR: probe process("/test").function("doit1@/test.c:22").return registration error (rc -1)
-Maynard
diff -paur systemtap-0.9.5/tapsets.cxx systemtap-0.9.5-insn-fix/tapsets.cxx
--- systemtap-0.9.5/tapsets.cxx 2009-03-27 13:02:57.000000000 -0400
+++ systemtap-0.9.5-insn-fix/tapsets.cxx 2009-04-01 20:07:17.000000000 -0400
@@ -6507,6 +6507,22 @@ itrace_derived_probe_group::emit_module_
s.op->newline() << "for (i=0; i<" << num_probes << "; i++) {";
s.op->indent(1);
s.op->newline() << "struct stap_itrace_probe *p = &stap_itrace_probes[i];";
+
+ // 'arch_has_single_step' needs to be defined for either single step mode
+ // or branch mode.
+ s.op->newline() << "if (!arch_has_single_step()) {";
+ s.op->indent(1);
+ s.op->newline() << "_stp_error (\"insn probe init: arch does not support step mode\");";
+ s.op->newline() << "rc = -EPERM;";
+ s.op->newline() << "break;";
+ s.op->newline(-1) << "}";
+ s.op->newline() << "if (!p->single_step && !arch_has_block_step()) {";
+ s.op->indent(1);
+ s.op->newline() << "_stp_error (\"insn probe init: arch does not support block step mode\");";
+ s.op->newline() << "rc = -EPERM;";
+ s.op->newline() << "break;";
+ s.op->newline(-1) << "}";
+
s.op->newline() << "rc = stap_register_task_finder_target(&p->tgt);";
s.op->newline(-1) << "}";
}