[PATCH] Add function name and file to semantic error messages for not found local variables.

Mark Wielaard mjw@redhat.com
Tue Nov 11 10:15:00 GMT 2008


Hi Przemysław,

On Tue, 2008-11-11 at 01:57 +0100, Przemysław Pawełczyk wrote:
> 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 () + ")")));
>        }

Thanks. I like patches that improve our error messages.

In this case we cannot always just print the diename of the scope we are
looking at since that might be NULL (see just above in the function). In
that case we are just looking for the scope by address. And while we are
improving the error message, lets also add the same for the other error
case just above it. So I think we want something like the attached. Does
that work for you?

Cheers,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: find_variable_and_frame_base.patch
Type: text/x-patch
Size: 899 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/systemtap/attachments/20081111/8b2e3aa4/attachment.bin>


More information about the Systemtap mailing list