From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18726 invoked by alias); 12 Oct 2011 15:31:56 -0000 Received: (qmail 18710 invoked by uid 22791); 12 Oct 2011 15:31:54 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Oct 2011 15:31:40 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RE0mR-0000Vj-Li from pedro_alves@mentor.com ; Wed, 12 Oct 2011 08:31:39 -0700 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 12 Oct 2011 16:31:36 +0100 From: Pedro Alves To: Kevin Pouget Subject: Re: [RFC][Python] gdbpy_frame_stop_reason_string bug Date: Wed, 12 Oct 2011 15:31:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-11-generic; KDE/4.7.1; x86_64; ; ) Cc: pmuldoon@redhat.com, gdb-patches@sourceware.org References: <201110121552.29096.pedro@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201110121631.35701.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00357.txt.bz2 On Wednesday 12 October 2011 16:17:32, Kevin Pouget wrote: > On Wed, Oct 12, 2011 at 4:52 PM, Pedro Alves wrote: > > On Wednesday 12 October 2011 15:02:20, Kevin Pouget wrote: > > > >> I wanted to discuss the best way to solve this bug before going any > >> further in the development: > >> > >> > (gdb) py print gdb.frame_stop_reason_string(2) > >> > /home/kevin/travail/git/gdb/gdb/frame.c:2372: internal-error: Invalid frame stop reason > >> > A problem internal to GDB has been detected,further debugging may prove unreliable. > >> > >> > >> I prepared the attached patch, which requires to change > >> 'internal_error' to a simple 'error' (I assume that it can't break > >> anything because it ends up calling `exit()', but I didn't check yet), > >> > >> but "Frame.unwind_stop_reason ()" easily returns 'invalid frame stop > >> reason', for instance > > > > 2 == UNWIND_OUTERMOST. Why would that be invalid? > > frame_stop_reason_string isn't handling this, nor UNWIND_NO_REASON. > > Is there a reason for that? I think something like the below > > patch would be much better. This _is_ an internal error / bug after > > all. (We could leave UNWIND_FIRST_ERROR as part of the enum with > > `UNWIND_UNAVAILABLE = UNWIND_FIRST_ERROR', I don't have that > > a strong preference.) Better yet could be to define the > > values/strings in the same place in a .def file. > > > > Where do magical the numbers come from? I hope we've not > > blessed them as stable. > yes, makes perfectly sense, thanks > > the numbers come from there: > http://sourceware.org/gdb/onlinedocs/gdb/Frames-In-Python.html#index-unwind_005fstop_005freason-on-Frame-1870 Yeah, that much I had found, but I got stuck looking for the enum versions of those. > ... I don't know if changing these numbers would be considered as a > backward incompatibility ... ? Sigh, I hope not. > From: Phil Muldoon > > Why not use the supplied gdb constants in this case? "2" does not map > > to any enum. > > IE gdb.FRAME_UNWIND_NO_REASON > > it looks like these enums are not documented, are they? I can't grep > 'FRAME_UNWIND_NO_REASON' in gdb.texinfo Yeah. > > ('2' was a bad example, but the reason why I first used '0' was > because it was returned by Frame.unwind_stop_reason(), as depicted in > the first mail) > by the way, python print > gdb.frame_stop_reason_string(gdb.FRAME_UNWIND_FIRST_ERROR) crashes the > same way, there is certainly a few more lines to fix on the Python > side The patch I posted supposedly fixes that, my making FRAME_UNWIND_FIRST_ERROR an internal alias for a real value (..._UNAVAILABLE), so that there are no "holes" in the enum values. -- Pedro Alves