From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8661 invoked by alias); 14 Dec 2002 19:55:09 -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 8615 invoked from network); 14 Dec 2002 19:55:08 -0000 Received: from unknown (HELO mail.cdt.org) (206.112.85.61) by sources.redhat.com with SMTP; 14 Dec 2002 19:55:08 -0000 Received: from dberlin.org (h-69-3-5-6.MCLNVA23.covad.net [69.3.5.6]) by mail.cdt.org (Postfix) with ESMTP id 462AB4900FF; Sat, 14 Dec 2002 14:52:29 -0500 (EST) Received: from [192.168.1.2] (HELO dberlin.org) by dberlin.org (CommuniGate Pro SMTP 4.0.2) with ESMTP-TLS id 1830746; Sat, 14 Dec 2002 14:55:04 -0500 Date: Sat, 14 Dec 2002 11:55:00 -0000 From: Daniel Berlin To: Daniel Jacobowitz Cc: Jacques Le Normand , "" Subject: Re: casting in gdb In-Reply-To: <20021214073526.GA26547@nevyn.them.org> Message-ID: References: <002301c2a270$e82f3540$c11ffea9@ehville> <2ADB5EBD-0EB0-11D7-8880-000393575BCC@dberlin.org> <20021213164713.GA20018@nevyn.them.org> <001301c2a2df$e2a42490$c11ffea9@ehville> <20021214073526.GA26547@nevyn.them.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-12/txt/msg00208.txt.bz2 On Sat, 14 Dec 2002, Daniel Jacobowitz wrote: > On Fri, Dec 13, 2002 at 02:43:17PM -0500, Jacques Le Normand wrote: > > here you go, thanks for lending a hand... > > > > [countchocula@chocoland countchocula]$ g++ -ggdb test.cpp -o test.o > > [countchocula@chocoland countchocula]$ gdb test.o > > GNU gdb Red Hat Linux (5.2.1-4) > > Copyright 2002 Free Software Foundation, Inc. > > GDB is free software, covered by the GNU General Public License, and you are > > welcome to change it and/or distribute copies of it under certain > > conditions. > > Type "show copying" to see the conditions. > > There is absolutely no warranty for GDB. Type "show warranty" for details. > > This GDB was configured as "i386-redhat-linux"... > > (gdb) b 10 > > Breakpoint 1 at 0x80486f5: file test.cpp, line 10. > > (gdb) r > > Starting program: /home/countchocula/test.o > > > > Breakpoint 1, main () at test.cpp:10 > > 10 a.push_back(2); > > (gdb) p a[0] > > One of the arguments you tried to pass to operator[] could not be converted > > to w > > hat the function wants. > > (gdb) > > This one's pretty simple once you figure it out. The error message is > really bad; I'll hold on to this and try to improve it. Hey now I added that error message, because it was horrible before that. Ahh, here we go: 2542c2542 < error ("Argument list of %s mismatch with component in the structure.", name); --- > error ("One of the arguments you tried to pass to %s could not be converted to what the function wants.", name); I remember i had a patch that added a seperate error message for the case where the operator wasn't existing, but it's quite invasive. Look at where that error message pops up. You'll note you'd need to make search_struct_method take another argument so we can tell if we couldn't *find* it, or we had a mismatch. > > Your program doesn't _use_ operator[]. So it doesn't get compiled into > the program, and GDB can't call it to figure out what to do. > > What happens if you add a call to the operator? > > [I noticed some other quirks; for instance, if your program only uses > the mutable version and GDB finds the const version first, it may get > confused...] > > -- > Daniel Jacobowitz > MontaVista Software Debian GNU/Linux Developer >