From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24301 invoked by alias); 27 Mar 2003 15:20:30 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 24294 invoked from network); 27 Mar 2003 15:20:30 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 27 Mar 2003 15:20:30 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h2RFKUQ09885 for ; Thu, 27 Mar 2003 10:20:30 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h2RFKTQ12061 for ; Thu, 27 Mar 2003 10:20:29 -0500 Received: from cygbert.vinschen.de (vpn50-14.rdu.redhat.com [172.16.50.14]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id h2RFKR522157 for ; Thu, 27 Mar 2003 07:20:28 -0800 Received: (from corinna@localhost) by cygbert.vinschen.de (8.11.6/8.9.3/Linux sendmail 8.9.3) id h2RFKOW16447 for gdb@sources.redhat.com; Thu, 27 Mar 2003 16:20:24 +0100 Date: Thu, 27 Mar 2003 15:20:00 -0000 From: Corinna Vinschen To: gdb@sources.redhat.com Subject: Re: Problem with virtual function pointers Message-ID: <20030327152022.GL23762@cygbert.vinschen.de> Reply-To: gdb@sources.redhat.com Mail-Followup-To: gdb@sources.redhat.com References: <20030327142412.GK23762@cygbert.vinschen.de> <20030327145346.GA7253@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20030327145346.GA7253@nevyn.them.org> User-Agent: Mutt/1.4i X-SW-Source: 2003-03/txt/msg00371.txt.bz2 On Thu, Mar 27, 2003 at 09:53:46AM -0500, Daniel Jacobowitz wrote: > On Thu, Mar 27, 2003 at 03:24:12PM +0100, Corinna Vinschen wrote: > > Hi, > > > > I'm just investigating a problem which XStormy16 gets in > > gdb.c++/printmethod.exp: > > > > print theA->virt^M > > $1 = invalid pointer to member function^M > > FAIL: gdb.c++/printmethod.exp: print virtual method. > > > > It turned out that the error happens in xstormy16_pointer_to_address(). > > This function converts an address to a jump table entry into a pointer > > to the actual function. To do this, it calls a conversion routine, > > which is only called if the following condition applies: > > > > > > enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type)); > > > > if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD) > > convert(); > > > > Surprisingly (at least for me) this fails for the above case. Looking > > into type, I found that type is TYPE_CODE_PTR which is correct, but > > target_type is TYPE_CODE_VOID! Sure, the above virtual method is of > > type void but is that really ok? Shouldn't that be > > > > type: TYPE_CODE_PTR > > type->target_type: TYPE_CODE_METHOD > > type->target_type->target_type: TYPE_CODE_VOID > > > > ? > > Could you give me a backtrace? Sure. The situation is after calling `print theA->virt' and stepping into xstormy16_pointer_to_address(). (top-gdb) bt #0 xstormy16_pointer_to_address (type=0x848d628, buf=0x85f4348) at /home/corinna/src/gdb/xstormy16-tdep.c:966 #1 0x080fa69e in gdbarch_pointer_to_address (gdbarch=0x848ac90, type=0x848d628, buf=0x85f4348) at /home/corinna/src/gdb/gdbarch.c:4164 #2 0x080b3219 in extract_typed_address (buf=0x85f4348, type=0x848d628) at /home/corinna/src/gdb/findvar.c:197 #3 0x080bc1a3 in unpack_long (type=0x848d628, valaddr=0x85f4348 ":®") at /home/corinna/src/gdb/values.c:696 #4 0x080bc2a6 in unpack_pointer (type=0x848d628, valaddr=0x85f4348 ":®") at /home/corinna/src/gdb/values.c:775 #5 0x0813876e in cp_print_class_method (valaddr=0x85f4348 ":®", type=0x84aa064, stream=0x8490f08) at /home/corinna/src/gdb/cp-valprint.c:90 #6 0x08138184 in c_val_print (type=0x84a9814, valaddr=0x85f4160 "hA_\b\t ", embedded_offset=0, address=162698, stream=0x8490f08, format=0, deref_ref=1, recurse=0, pretty=Val_no_prettyprint) at /home/corinna/src/gdb/c-valprint.c:447 #7 0x080cc330 in val_print (type=0x84a9814, valaddr=0x85f4160 "hA_\b\t ", embedded_offset=0, address=162698, stream=0x8490f08, format=0, deref_ref=1, recurse=0, pretty=Val_no_prettyprint) at /home/corinna/src/gdb/valprint.c:152 #8 0x081386eb in c_value_print (val=0x85f4128, stream=0x8490f08, format=0, pretty=Val_pretty_default) at /home/corinna/src/gdb/c-valprint.c:596 #9 0x080cc39d in value_print (val=0x85f4128, stream=0x8490f08, format=0, pretty=Val_pretty_default) at /home/corinna/src/gdb/valprint.c:175 #10 0x080ce28f in print_formatted (val=0x85f4128, format=0, size=0, stream=0x8490f08) at /home/corinna/src/gdb/printcmd.c:328 #11 0x080cf2cf in print_command_1 (exp=0x846fd0a "theA->virt", inspect=0, voidprint=1) at /home/corinna/src/gdb/printcmd.c:931 #12 0x080cf33d in print_command (exp=0x846fd0a "theA->virt", from_tty=1) at /home/corinna/src/gdb/printcmd.c:952 [etc] Corinna -- Corinna Vinschen Cygwin Developer Red Hat, Inc. mailto:vinschen@redhat.com