From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10324 invoked by alias); 12 Oct 2011 15:18:20 -0000 Received: (qmail 10011 invoked by uid 22791); 12 Oct 2011 15:18:18 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-vx0-f169.google.com (HELO mail-vx0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Oct 2011 15:17:53 +0000 Received: by vcbfo14 with SMTP id fo14so820491vcb.0 for ; Wed, 12 Oct 2011 08:17:52 -0700 (PDT) Received: by 10.52.100.68 with SMTP id ew4mr24279836vdb.102.1318432672426; Wed, 12 Oct 2011 08:17:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.180.75 with HTTP; Wed, 12 Oct 2011 08:17:32 -0700 (PDT) In-Reply-To: <201110121552.29096.pedro@codesourcery.com> References: <201110121552.29096.pedro@codesourcery.com> From: Kevin Pouget Date: Wed, 12 Oct 2011 15:18:00 -0000 Message-ID: Subject: Re: [RFC][Python] gdbpy_frame_stop_reason_string bug To: Pedro Alves , pmuldoon@redhat.com Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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/msg00354.txt.bz2 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 prov= e 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 =3D=3D UNWIND_OUTERMOST. =A0Why would that be invalid? > frame_stop_reason_string isn't handling this, nor UNWIND_NO_REASON. > Is there a reason for that? =A0I think something like the below > patch would be much better. =A0This _is_ an internal error / bug after > all. =A0(We could leave UNWIND_FIRST_ERROR as part of the enum with > `UNWIND_UNAVAILABLE =3D UNWIND_FIRST_ERROR', I don't have that > a strong preference.) =A0Better yet could be to define the > values/strings in the same place in a .def file. > > Where do magical the numbers come from? =A0I hope we've not > blessed them as stable. > > -- > Pedro Alves 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 ... I don't know if changing these numbers would be considered as a backward incompatibility ... ? 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 ('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