From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9557 invoked by alias); 11 Nov 2008 10:15:29 -0000 Received: (qmail 9402 invoked by uid 22791); 11 Nov 2008 10:15:26 -0000 X-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,KAM_MX,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 11 Nov 2008 10:14:35 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id mABAEV60020827; Tue, 11 Nov 2008 05:14:31 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id mABAEU90005152; Tue, 11 Nov 2008 05:14:30 -0500 Received: from [10.32.4.23] (vpn-4-23.str.redhat.com [10.32.4.23]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id mABAES0A012629; Tue, 11 Nov 2008 05:14:29 -0500 Subject: Re: [PATCH] Add function name and file to semantic error messages for not found local variables. From: Mark Wielaard To: =?UTF-8?Q?Przemys=C5=82aw_Pawe=C5=82czyk?= Cc: systemtap@sourceware.org In-Reply-To: <40e92d5b0811101657r39178ec8ib2fde64e2ba6bfb9@mail.gmail.com> References: <40e92d5b0811101657r39178ec8ib2fde64e2ba6bfb9@mail.gmail.com> Content-Type: multipart/mixed; boundary="=-xcvtUImE2MQ7NlG2xpAW" Date: Tue, 11 Nov 2008 10:15:00 -0000 Message-Id: <1226398468.3420.9.camel@dijkstra.wildebeest.org> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 X-Virus-Checked: Checked by ClamAV on sourceware.org Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2008-q4/txt/msg00312.txt.bz2 --=-xcvtUImE2MQ7NlG2xpAW Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-length: 1450 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(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 --=-xcvtUImE2MQ7NlG2xpAW Content-Disposition: inline; filename=find_variable_and_frame_base.patch Content-Type: text/x-patch; name=find_variable_and_frame_base.patch; charset=utf-8 Content-Transfer-Encoding: 7bit Content-length: 899 diff --git a/tapsets.cxx b/tapsets.cxx index 8d371a8..f3b6d3f 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -1677,6 +1677,9 @@ struct dwflpp { throw semantic_error ("unable to find any scopes containing " + lex_cast_hex(pc) + + ((scope_die == NULL) ? "" + : (string (" in ") + dwarf_diename (scope_die) + + "(" + dwarf_diename (cu) + ")")) + " while searching for local '" + local + "'"); } @@ -1690,6 +1693,9 @@ struct dwflpp print_locals (scopes, alternatives); throw semantic_error ("unable to find local '" + local + "'" + " near pc " + lex_cast_hex(pc) + + ((scope_die == NULL) ? "" + : (string (" in ") + dwarf_diename (scope_die) + + "(" + dwarf_diename (cu) + ")")) + (alternatives.str() == "" ? "" : (" (alternatives:" + alternatives.str () + ")"))); } --=-xcvtUImE2MQ7NlG2xpAW--