summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2009-04-17 09:27:56 -0500
committerDavid Smith <dsmith@redhat.com>2009-04-17 09:27:56 -0500
commit889c4638f741163395438aca60226ff8a5e2009e (patch)
treec2960f72c34bb12db5b5878c206ca6cae6985c61
parentee0dfa16f900396f4fd89d4d765e877daa8a2c19 (diff)
parent2a22df62a80d032e9450570c32009bfea4be7305 (diff)
downloadsystemtap-steved-889c4638f741163395438aca60226ff8a5e2009e.tar.gz
systemtap-steved-889c4638f741163395438aca60226ff8a5e2009e.tar.xz
systemtap-steved-889c4638f741163395438aca60226ff8a5e2009e.zip
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
-rw-r--r--buildrun.cxx24
-rwxr-xr-xdtrace58
-rw-r--r--runtime/unwind.c2
-rw-r--r--runtime/unwind/unwind.h4
-rw-r--r--testsuite/systemtap.base/static_uprobes.exp1
5 files changed, 44 insertions, 45 deletions
diff --git a/buildrun.cxx b/buildrun.cxx
index 82ac9d4e..aac0c356 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -391,6 +391,10 @@ make_tracequery(systemtap_session& s, string& name, const vector<string>& extra_
osrc << "#define DEFINE_TRACE(name, proto, args) \\" << endl;
osrc << " DECLARE_TRACE(name, TPPROTO(proto), TPARGS(args))" << endl;
+ // some headers may have been pulled in already indirectly, so we need this
+ // to ensure that they still use our definition
+ osrc << "#define TRACE_HEADER_MULTI_READ 1" << endl;
+
// PR9993: Add extra headers to work around undeclared types in individual
// include/trace/foo.h files
for (unsigned z=0; z<extra_headers.size(); z++)
@@ -398,22 +402,32 @@ make_tracequery(systemtap_session& s, string& name, const vector<string>& extra_
// dynamically pull in all tracepoint headers from include/trace/
glob_t trace_glob;
- string globs[2] = { "/include/trace/*.h", "/source/include/trace/*.h" };
- for (unsigned z=0; z<2; z++)
+ string globs[] = {
+ "/include/trace/*.h",
+ "/include/trace/events/*.h",
+ "/source/include/trace/*.h",
+ "/source/include/trace/events/*.h",
+ };
+ for (unsigned z = 0; z < sizeof(globs) / sizeof(globs[0]); z++)
{
string glob_str(s.kernel_build_tree + globs[z]);
glob(glob_str.c_str(), 0, NULL, &trace_glob);
for (unsigned i = 0; i < trace_glob.gl_pathc; ++i)
{
- string header(basename(trace_glob.gl_pathv[i]));
+ string header(trace_glob.gl_pathv[i]);
+ size_t root_pos = header.rfind("/include/");
+ assert(root_pos != string::npos);
+ header.erase(0, root_pos + 9);
// filter out a few known "internal-only" headers
- if (header == "trace_events.h")
+ if (header.find("/ftrace.h") != string::npos)
+ continue;
+ if (header.find("/trace_events.h") != string::npos)
continue;
if (header.find("_event_types.h") != string::npos)
continue;
- osrc << "#include <trace/" << header << ">" << endl;
+ osrc << "#include <" << header << ">" << endl;
}
globfree(&trace_glob);
}
diff --git a/dtrace b/dtrace
index ca95b678..a2b495b2 100755
--- a/dtrace
+++ b/dtrace
@@ -17,12 +17,11 @@ from subprocess import call
from tempfile import mkstemp
class provider:
- arglist = dict()
def open(self, provider, header):
have_provider = False
self.f = open(provider)
self.h = open(header,mode='w')
- self.h.write("// Generated by the Systemtap dtrace wrapper\n")
+ self.h.write("/* Generated by the Systemtap dtrace wrapper */\n")
self.h.write("\n#include <sys/sdt.h>\n\n")
in_comment = False
while (True):
@@ -49,7 +48,6 @@ class provider:
new_args = ""
i = 0
c = 0
- self.arglist[this_probe] = ""
while (i < len(args)):
if (args[i:i+1] == ","):
new_args = ('%s%s' % (new_args, args[i]))
@@ -57,41 +55,24 @@ class provider:
else:
new_args = new_args + args[i]
i += 1
- if (len(new_args) > 0):
- self.arglist[this_probe] = ('%s arg%d' % (new_args, c))
if (len(new_args) == 0):
- self.h.write ('#define %s() STAP_PROBE(provider,%s)\n' % (this_probe_canon, this_probe))
- elif (c == 0):
- self.h.write ('#define %s(arg1) STAP_PROBE%d(provider,%s,arg1)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 1):
- self.h.write ('#define %s(arg1,arg2) STAP_PROBE%d(provider,%s,arg1,arg2)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 2):
- self.h.write ('#define %s(arg1,arg2,arg3) STAP_PROBE%d(provider,%s,arg1,arg2,arg3)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 3):
- self.h.write ('#define %s(arg1,arg2,arg3,arg4) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 4):
- self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 5):
- self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 6):
- self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6,arg7) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6,arg7)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 7):
- self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 8):
- self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)\n' % (this_probe_canon, c+1, this_probe))
- elif (c == 9):
- self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)\n' % (this_probe_canon, c+1, this_probe))
+ c = 0
+ stap_str = "STAP_PROBE(provider,%s" % (this_probe)
+ else:
+ c += 1
+ stap_str = "STAP_PROBE%d(provider,%s" % (c,this_probe)
+ define_str = "#define %s(" % (this_probe_canon)
+ i = 1
+ while (i <= c):
+ if (i != 1):
+ define_str += ","
+ define_str = define_str + "arg%s" % (i);
+ stap_str = stap_str + ",arg%s" % (i);
+ i += 1
+ self.h.write ('/* %s (%s) */\n' % (this_probe_canon,new_args))
self.h.write ('#define %s_ENABLED() 1\n' % this_probe_canon)
-
- def get(self, arg):
- print arg
- if (arg in self.arglist):
- return self.arglist[arg]
- else:
- return ""
-########################################################################
-# main
-########################################################################
+ self.h.write (define_str + ") \\\n")
+ self.h.write (stap_str + ")\n\n")
def usage ():
print "Usage " + sys.argv[0] + " [-h | -G] -s File.d -o File {Files}"
@@ -107,6 +88,11 @@ def open_file (arg):
sys.exit(1)
return file
+
+########################################################################
+# main
+########################################################################
+
if (len (sys.argv) < 2):
usage()
diff --git a/runtime/unwind.c b/runtime/unwind.c
index f7b19def..41af72a7 100644
--- a/runtime/unwind.c
+++ b/runtime/unwind.c
@@ -345,7 +345,7 @@ static int processCFI(const u8 *start, const u8 *end, unsigned long targetLoc, s
state->label = NULL;
return 1;
}
- if (state->stackDepth >= MAX_STACK_DEPTH)
+ if (state->stackDepth >= STP_MAX_STACK_DEPTH)
return 0;
state->stack[state->stackDepth++] = ptr.p8;
break;
diff --git a/runtime/unwind/unwind.h b/runtime/unwind/unwind.h
index 78a4bfef..3b6d0de0 100644
--- a/runtime/unwind/unwind.h
+++ b/runtime/unwind/unwind.h
@@ -23,7 +23,7 @@
#error "Unsupported dwarf unwind architecture"
#endif
-#define MAX_STACK_DEPTH 8
+#define STP_MAX_STACK_DEPTH 8
#ifndef BUILD_BUG_ON_ZERO
#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
@@ -135,7 +135,7 @@ struct unwind_state {
unsigned stackDepth:8;
unsigned version:8;
const u8 *label;
- const u8 *stack[MAX_STACK_DEPTH];
+ const u8 *stack[STP_MAX_STACK_DEPTH];
};
static const struct cfa badCFA = { ARRAY_SIZE(reg_info), 1 };
diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp
index 07ff83e9..1e53d5d3 100644
--- a/testsuite/systemtap.base/static_uprobes.exp
+++ b/testsuite/systemtap.base/static_uprobes.exp
@@ -93,7 +93,6 @@ if {[installtest_p]} {
if {[catch {exec $dtrace -h -s $sup_dpath} res]} {
verbose -log "unable to run $dtrace: $res"
}
-catch {exec rm -f $sup_dpath}
if {[file exists $sup_hpath]} then {
pass "$test dtrace"
} else {