From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22350 invoked by alias); 12 Oct 2011 15:59:35 -0000 Received: (qmail 22335 invoked by uid 22791); 12 Oct 2011 15:59:33 -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:59:18 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RE1DB-0003cf-Mq from pedro_alves@mentor.com ; Wed, 12 Oct 2011 08:59:17 -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:59:14 +0100 From: Pedro Alves To: pmuldoon@redhat.com Subject: Re: [RFC][Python] gdbpy_frame_stop_reason_string bug Date: Wed, 12 Oct 2011 15:59:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-11-generic; KDE/4.7.1; x86_64; ; ) Cc: Kevin Pouget , gdb-patches@sourceware.org References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201110121659.13715.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/msg00360.txt.bz2 On Wednesday 12 October 2011 16:28:24, Phil Muldoon wrote: > Kevin Pouget writes: > > > > it looks like these enums are not documented, are they? I can't grep > > 'FRAME_UNWIND_NO_REASON' in gdb.texinfo > > Yeah, that at least is a bug for sure. > > > ('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 > > I can look at this, or you can hack on it. I don't mind. I found this: /* Note: These would probably be best exposed as class attributes of Frame, but I don't know how to do it except by messing with the type's dictionary. That seems too messy. */ PyModule_AddIntConstant (gdb_module, "NORMAL_FRAME", NORMAL_FRAME); PyModule_AddIntConstant (gdb_module, "DUMMY_FRAME", DUMMY_FRAME); PyModule_AddIntConstant (gdb_module, "INLINE_FRAME", INLINE_FRAME); PyModule_AddIntConstant (gdb_module, "TAILCALL_FRAME", TAILCALL_FRAME); PyModule_AddIntConstant (gdb_module, "SIGTRAMP_FRAME", SIGTRAMP_FRAME); PyModule_AddIntConstant (gdb_module, "ARCH_FRAME", ARCH_FRAME); PyModule_AddIntConstant (gdb_module, "SENTINEL_FRAME", SENTINEL_FRAME); PyModule_AddIntConstant (gdb_module, "FRAME_UNWIND_NO_REASON", UNWIND_NO_REASON); PyModule_AddIntConstant (gdb_module, "FRAME_UNWIND_NULL_ID", UNWIND_NULL_ID); PyModule_AddIntConstant (gdb_module, "FRAME_UNWIND_FIRST_ERROR", UNWIND_FIRST_ERROR); PyModule_AddIntConstant (gdb_module, "FRAME_UNWIND_INNER_ID", UNWIND_INNER_ID); PyModule_AddIntConstant (gdb_module, "FRAME_UNWIND_SAME_ID", UNWIND_SAME_ID); PyModule_AddIntConstant (gdb_module, "FRAME_UNWIND_NO_SAVED_PC", UNWIND_NO_SAVED_PC); We should definitely reimplement these enums in a table in a .def file. That's 2 places already that map the enums to something else. This one is missing UNWIND_UNAVAILABLE. And what do you think of making UNWIND_FIRST_ERROR an alias like in my patch? Do you think that's likely to break anything? -- Pedro Alves