Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Berlin <dberlin@dberlin.org>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: Jacques Le Normand <jacqueslen@sympatico.ca>,
	"" <gdb@sources.redhat.com>
Subject: Re: casting in gdb
Date: Sat, 14 Dec 2002 11:55:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.50.0212141451420.110-100000@dberlin.org> (raw)
In-Reply-To: <20021214073526.GA26547@nevyn.them.org>



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
>


  reply	other threads:[~2002-12-14 19:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-20 12:22 dejagnu bemis
2002-11-20 20:37 ` dejagnu Andrew Cagney
2002-12-05 16:26   ` dejagnu Fernando Nasser
2002-12-05 16:58     ` dejagnu bemis
2002-12-05 17:08       ` dejagnu Fernando Nasser
2002-12-12 22:26         ` dejagnu Rob Savoye
2002-12-12 22:29           ` casting in gdb Jacques Le Normand
2002-12-13  7:33             ` *****SPAM***** " Daniel Berlin
2002-12-13  8:46               ` Daniel Jacobowitz
2002-12-13 11:43                 ` Jacques Le Normand
2002-12-13 23:34                   ` Daniel Jacobowitz
2002-12-14 11:55                     ` Daniel Berlin [this message]
2002-12-14 19:49 Jacques Le Normand
2002-12-14 19:59 ` Daniel Jacobowitz
2002-12-14 21:47 Michael Elizabeth Chastain
2002-12-14 22:48 ` Jacques Le Normand
2002-12-15  8:05 ` Daniel Jacobowitz
2003-01-15 18:47 ` David Carlton
     [not found] <1042721692.8268.ezmlm@sources.redhat.com>
2003-01-16 18:53 ` Jim Ingham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.50.0212141451420.110-100000@dberlin.org \
    --to=dberlin@dberlin.org \
    --cc=drow@mvista.com \
    --cc=gdb@sources.redhat.com \
    --cc=jacqueslen@sympatico.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox