This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[patch] For avoid stap output error message of un-defined variable twice
- From: "Zhaolei" <zhaolei at cn dot fujitsu dot com>
- To: <systemtap at sourceware dot org>
- Cc: "Zhaolei" <zhaolei at cn dot fujitsu dot com>
- Date: Fri, 17 Aug 2007 15:54:25 +0900
- Subject: [patch] For avoid stap output error message of un-defined variable twice
- References: <010c01c7dfa6$b121b550$85697c0a@guest004>
Hi, everyone
I tried using un-defined variable in print function as mentioned in CaiFei's
mail in Fri, 17 Aug 2007 10:39:07 +0900.
And I found that error message had been displayed twice.
#cat a.stp
probe begin {
print("str")
print(wd)
}
# stap -v a.stp
Pass 1: parsed user script and 54 library script(s) in 391usr/4sys/395real ms.
semantic error: probe_1525 with unresolved type for identifier 'wd' at a.stp:3:8
semantic error: probe_1525 with unresolved type for identifier 'wd' at a.stp:3:8
semantic error: probe_1525 with unresolved type for identifier 'print' at a.stp:3:2
Pass 2: analyzed script: 1 probe(s), 0 function(s), 0 embed(s), 0 global(s) in 9usr/0sys/8real ms.
Pass 2: analysis failed. Try again with more '-v' (verbose) options.
It can be fixed by the following patch:
Signed-off-by: "Zhaolei" zhaolei@cn.fujitsu.com
--- elaborate.cxx.old 2007-06-27 04:36:26.000000000 +0900
+++ elaborate.cxx 2007-08-17 15:33:13.000000000 +0900
@@ -2675,7 +2675,8 @@ typeresolution_info::visit_print_format
e->args[i]->visit (this);
if (e->args[i]->type == pe_unknown)
{
- unresolved (e->args[i]->tok);
+// unresolved (e->args[i]->tok);
+ num_still_unresolved ++;
++unresolved_args;
}
}
Here is result of patched output:
#stap -v a.stp
Pass 1: parsed user script and 54 library script(s) in 390usr/6sys/396real ms.
semantic error: probe_1525 with unresolved type for identifier 'wd' at a.stp:3:8
semantic error: probe_1525 with unresolved type for identifier 'print' at a.stp:3:2
Pass 2: analyzed script: 1 probe(s), 0 function(s), 0 embed(s), 0 global(s) in 9usr/0sys/10real ms.
Pass 2: analysis failed. Try again with more '-v' (verbose) options.
Regards
Zhaolei