This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: set $argv = *argv@100


On Feb 12, 10:32am, Andrew Cagney wrote:

> > I think the address is right.  The problem is that $argv isn't the right
> > type.  According to the above, it's ``char **'' when it should be
> > ``char *[100]''.
> > 
> > Try this:
> > 
> >     (top-gdb) set $argva = &(*argv@100)
> >     (top-gdb) print $argva
> >     $23 = (char *(*)[100]) 0xbffff99c
> >     (top-gdb) ptype $argva
> >     type = char *(*)[100]
> >     (top-gdb) ptype *$argva
> >     type = char *[100]
> > 
> > Kevin
> 
> Yes, C strikes again.  You can't copy an array, just its address :-(

I still think it'd be nice if we could somehow preserve the type
when doing set $argv = *argv@100...

    (top-gdb) set $argv = *argv@100
    (top-gdb) ptype $argv
    type = char **
    (top-gdb) ptype *argv@100
    type = char *[100]

I.e, it'd be nice if the types of $argv and *argv@100 were the same.

I haven't thought this through though.  It could be that a lot of other
stuff would break if we did this.

Kevin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]