From a781f4011250a7d6450025a92336250044ab46eb Mon Sep 17 00:00:00 2001 From: fche Date: Tue, 2 Aug 2005 18:03:17 +0000 Subject: 2005-08-02 Frank Ch. Eigler * loc2.c (emit_loc_address): Emit interleaved declaration into its own nested { } block. * tapsets.cxx (literal_stmt_for_local): Emit deref_fault block unconditionally. * tapset/builtin_hexstring.stp: New builtin. * testsuite/buildok/six.stp: New test. --- ChangeLog | 9 +++++++++ loc2c.c | 2 ++ tapset/builtin_hexstring.stp | 7 +++++++ tapsets.cxx | 18 ++++++++++-------- testsuite/buildok/six.stp | 5 +++++ 5 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 tapset/builtin_hexstring.stp create mode 100755 testsuite/buildok/six.stp diff --git a/ChangeLog b/ChangeLog index 84a26b9c..751f70ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-08-02 Frank Ch. Eigler + + * loc2.c (emit_loc_address): Emit interleaved declaration into + its own nested { } block. + * tapsets.cxx (literal_stmt_for_local): Emit deref_fault block + unconditionally. + * tapset/builtin_hexstring.stp: New builtin. + * testsuite/buildok/six.stp: New test. + 2005-08-02 Frank Ch. Eigler * tapsets.cxx (emit_registrations): Treat module_name="kernel" diff --git a/loc2c.c b/loc2c.c index e3cb3724..73f6ee32 100644 --- a/loc2c.c +++ b/loc2c.c @@ -1317,6 +1317,7 @@ emit_loc_address (FILE *out, struct location *loc, unsigned int indent, emit ("%s", loc->address.program); else { + emit ("{\n"); emit ("%*s%s " STACKFMT, (indent + 1) * 2, "", STACK_TYPE, 0); for (unsigned int i = 1; i < loc->address.stack_depth; ++i) emit (", " STACKFMT, i); @@ -1324,6 +1325,7 @@ emit_loc_address (FILE *out, struct location *loc, unsigned int indent, emit ("%s%*s%s = " STACKFMT ";\n", loc->address.program, (indent + 1) * 2, "", target, 0); + emit ("}\n"); } } diff --git a/tapset/builtin_hexstring.stp b/tapset/builtin_hexstring.stp new file mode 100644 index 00000000..c441bbc4 --- /dev/null +++ b/tapset/builtin_hexstring.stp @@ -0,0 +1,7 @@ +function _hexstring (num) %{ + sprintf (THIS->__retvalue, "%llx", (long long) THIS->num); +%} + +function hexstring (num) { + return "" . _hexstring (num + 0) +} diff --git a/tapsets.cxx b/tapsets.cxx index a51efad7..780f4c4f 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -581,15 +581,17 @@ dwflpp assert(memstream); bool deref = c_emit_location (memstream, head, 1); + fprintf(memstream, " goto out;\n"); - fprintf(memstream, "goto out;\n"); - if (deref) - { - fprintf(memstream, - "deref_fault:\n" - " c->errorcount++; \n" - " goto out;\n\n"); - } + // dummy use of deref_fault label, to disable warning if deref() not used + fprintf(memstream, "if (0) goto deref_fault;\n"); + + // XXX: deref flag not reliable; emit fault label unconditionally + if (deref) ; + fprintf(memstream, + "deref_fault:\n" + " c->errorcount++; \n" + " goto out;\n"); fclose (memstream); string result(buf); diff --git a/testsuite/buildok/six.stp b/testsuite/buildok/six.stp new file mode 100755 index 00000000..a63ad99b --- /dev/null +++ b/testsuite/buildok/six.stp @@ -0,0 +1,5 @@ +#! stap -p4 + +probe kernel.function("context_switch") { + log ("switch from=" . hexstring($prev) . " to=" . hexstring($next)) +} -- cgit