From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9300 invoked by alias); 1 Nov 2011 14:26:24 -0000 Received: (qmail 9256 invoked by uid 22791); 1 Nov 2011 14:26:18 -0000 X-SWARE-Spam-Status: No, hits=-7.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 Nov 2011 14:26:00 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pA1EPxqM024709 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 1 Nov 2011 10:26:00 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pA1EPwPP022557 for ; Tue, 1 Nov 2011 10:25:59 -0400 From: Phil Muldoon To: gdb-patches@sourceware.org Subject: [python] [patch] PR python/13363 Reply-to: pmuldoon@redhat.com X-URL: http://www.redhat.com Date: Tue, 01 Nov 2011 14:26:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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-11/txt/msg00009.txt.bz2 As part of a previous patch (to fix Python usage around TRY_CATCH blocks) I introduced a bug. I missed the fact that in this case, the functions returns from an exception handler. Obviously this is wrong. This patch addresses this. OK? Cheers, Phil -- 2011-11-01 Phil Muldoon PR Python/13363 * python/py-type.c (typy_lookup_type): Do not return a type in an exception handler. -- Index: python/py-type.c =================================================================== RCS file: /cvs/src/src/gdb/python/py-type.c,v retrieving revision 1.27 diff -u -r1.27 py-type.c --- python/py-type.c 27 Oct 2011 09:14:27 -0000 1.27 +++ python/py-type.c 1 Nov 2011 11:15:43 -0000 @@ -606,7 +606,7 @@ typy_lookup_type (struct demangle_component *demangled, const struct block *block) { - struct type *type; + struct type *type, *rtype = NULL; char *type_name = NULL; enum demangle_component_type demangled_type; volatile struct gdb_exception except; @@ -626,19 +626,25 @@ TRY_CATCH (except, RETURN_MASK_ALL) { + /* If the demangled_type matches with one of the types + below, run the corresponding function and save the type + to return later. We cannot just return here as we are in + an exception handler. */ switch (demangled_type) { case DEMANGLE_COMPONENT_REFERENCE: - return lookup_reference_type (type); + rtype = lookup_reference_type (type); + break; case DEMANGLE_COMPONENT_POINTER: - return lookup_pointer_type (type); + rtype = lookup_pointer_type (type); + break; case DEMANGLE_COMPONENT_CONST: - return make_cv_type (1, 0, type, NULL); + rtype = make_cv_type (1, 0, type, NULL); + break; case DEMANGLE_COMPONENT_VOLATILE: - return make_cv_type (0, 1, type, NULL); + rtype = make_cv_type (0, 1, type, NULL); + break; } - - type_name = cp_comp_to_string (demangled, 10); } if (except.reason < 0) { @@ -646,7 +652,14 @@ return NULL; } } - + + /* If we have a type from the switch statement above, just return + that. */ + if (rtype) + return rtype; + + /* We don't have a type, so lookup the type. */ + type_name = cp_comp_to_string (demangled, 10); type = typy_lookup_typename (type_name, block); xfree (type_name);