From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1800 invoked by alias); 28 Jun 2006 14:18:43 -0000 Received: (qmail 1790 invoked by uid 22791); 28 Jun 2006 14:18:43 -0000 X-Spam-Check-By: sourceware.org Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 28 Jun 2006 14:18:41 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 12638544001; Wed, 28 Jun 2006 16:18:39 +0200 (CEST) Date: Wed, 28 Jun 2006 14:18:00 -0000 From: Corinna Vinschen To: gdb-patches@sourceware.org Subject: [PATCH] m32c-tdep.c: Don't choke on virtual functions in push_dummy_call Message-ID: <20060628141839.GA29012@calimero.vinschen.de> Reply-To: gdb-patches@sourceware.org Mail-Followup-To: gdb-patches@sourceware.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2i X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-06/txt/msg00390.txt.bz2 Hi, the below patch fixes a couple of GDB internal errors when calling virtual C++ methods. Virtual methods are not represented as type TYPE_CODE_METHOD, but as TYPE_CODE_PTR pointing to TYPE_CODE_METHOD. The m32c_push_dummy_call function only checks the function type for TYPE_CODE_FUNC or TYPE_CODE_METHOD, which results in a failed assertion in case of virtual methods. The below patch skips TYPE_CODE_PTR types until it points to the actual TYPE_CODE_METHOD to evaluate further necessary data. Ok to apply? Thanks, Corinna * m32c-tdep.c (m32c_push_dummy_call): Skip over virtual method pointer type. Index: m32c-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/m32c-tdep.c,v retrieving revision 1.1 diff -u -p -r1.1 m32c-tdep.c --- m32c-tdep.c 20 Apr 2006 23:18:48 -0000 1.1 +++ m32c-tdep.c 28 Jun 2006 14:14:11 -0000 @@ -2008,6 +2008,10 @@ m32c_push_dummy_call (struct gdbarch *gd { struct type *func_type = value_type (function); + /* Skip over virtual function pointers */ + while (TYPE_CODE (func_type) == TYPE_CODE_PTR) + func_type = TYPE_TARGET_TYPE (func_type); + gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC || TYPE_CODE (func_type) == TYPE_CODE_METHOD); -- Corinna Vinschen Cygwin Project Co-Leader Red Hat