This is the mail archive of the gdb-prs@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]

gdb/538: GDB prints type of expression incorrectly



>Number:         538
>Category:       gdb
>Synopsis:       GDB prints type of expression incorrectly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 10 10:58:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     jimb@redhat.com
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
The GDB command "ptype &*"foo" gives the wrong result:

>   (gdb) ptype &*"foo"
>   type = char [4]

The result should be "char *".
>How-To-Repeat:
$ cat trivial.c
#include <stdlib.h>
#include <stdio.h>

int
main (int argc, char **argv)
{
  char *str = malloc (10);
  strcpy (str, "Hello!");
  puts (str);
}
$ cc trivial.c -g -o trivial
$ $D6/gdb/gdb -nw trivial
GNU gdb 2002-05-10-cvs
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 "i686-pc-linux-gnu"...
(gdb) break main
Breakpoint 1 at 0x80484b6: file trivial.c, line 7.
(gdb) run
Starting program: /home/jimb/play/trivial 

Breakpoint 1, main (argc=1, argv=0xbfffc984) at trivial.c:7
7         char *str = malloc (10);
(gdb) ptype &*"foo"
type = char [4]
(gdb) 
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="trivial.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="trivial.c"

I2luY2x1ZGUgPHN0ZGxpYi5oPgojaW5jbHVkZSA8c3RkaW8uaD4KCmludAptYWluIChpbnQgYXJn
YywgY2hhciAqKmFyZ3YpCnsKICBjaGFyICpzdHIgPSBtYWxsb2MgKDEwKTsKICBzdHJjcHkgKHN0
ciwgIkhlbGxvISIpOwogIHB1dHMgKHN0cik7Cn0K


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