set $argv = *argv@100

Kevin Buettner kevinb@redhat.com
Mon Feb 11 22:22:00 GMT 2002


On Feb 12, 12:47am, Andrew Cagney wrote:

> Consider the sequence:
> 
> (top-gdb) print argv
> $4 = (char **) 0xbfbfd3cc
> (top-gdb) set $argv = *argv@100
> (top-gdb) print $argv
> $5 = (char **) 0xbfbfd3cc
> (top-gdb) print sizeof ($argv)
> $6 = 0x4
> (top-gdb) print sizeof (*argv@100)
> $7 = 0x190
> 
> should $argv have been assigned the contents of *argv@100 or just the 
> address?

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



More information about the Gdb mailing list