This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH] Add function name and file to semantic error messages for not found local variables.
- From: "Przemysław Pawełczyk" <przemyslaw at pawelczyk dot it>
- To: systemtap at sourceware dot org
- Date: Tue, 11 Nov 2008 01:57:49 +0100
- Subject: [PATCH] Add function name and file to semantic error messages for not found local variables.
Hi,
Few weeks ago I found out SystemTap and from that time I'm slowly
discovering its features. I've already joined discussion at
#systemtap.
I have a patch analogous to Mark Wielaard's commit 194c6687 (Add
function name and file to semantic error messages for $return).
Some background:
His patch was a side-effect of question about my simple script:
stap -e 'global errors = 0; probe syscall.*.return {if ($return < 0)
errors++} probe end {printf("Syscalls with errors: %d\n", errors);
delete errors}'
because I said that analysis had failed on compat_sys_recvmsg. Mark
noticed this also, but he asked me how I had found such information
and I pointed at stap -vv and comparing pc. Mark gave me also a link
to http://sourceware.org/bugzilla/show_bug.cgi?id=5890, which he
commented.
Day before that I had other problem, caused by script:
stap -e 'probe syscall.* {printf("%s(%s)\n", probefunc(), argstr)}' -c 'echo'
and Mark helped me then also (explanation:
http://sourceware.org/bugzilla/show_bug.cgi?id=5434#c2).
Couple of days later, writing strace-like script
(http://research.pawelczyk.it/systemtap/strace.stp) on clean systemtap
I spotted, that more meaningful error message in mentioned case would
be useful as well. I put some info on channel, but probably it was
overlooked. Now I'm trying more formal way.
If I forgot about something, please let me know. It's my first message here.
diff --git a/tapsets.cxx b/tapsets.cxx
index 5acf50c..fd81927 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -1690,6 +1690,8 @@ struct dwflpp
print_locals (scopes, alternatives);
throw semantic_error ("unable to find local '" + local + "'"
+ " near pc " + lex_cast_hex<string>(pc)
+ + " for " + dwarf_diename (scope_die)
+ + "(" + dwarf_diename (cu) + ")"
+ (alternatives.str() == "" ? "" : (" (alternatives:" +
alternatives.str () + ")")));
}
--
Przemysław Pawełczyk