This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
gdb/186: gdb have problems with C++ casting
- To: gdb-gnats at sources dot redhat dot com
- Subject: gdb/186: gdb have problems with C++ casting
- From: teg at redhat dot com
- Date: 30 Jul 2001 21:45:06 -0000
- Cc: jakub at redhat dot com
- Reply-To: teg at redhat dot com
>Number: 186
>Category: gdb
>Synopsis: gdb have problems with C++ casting
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 30 14:48:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: teg@redhat.com
>Release: unknown-1.0
>Organization:
>Environment:
Red Hat Linux 7.1 - problem verified with gcc 2.96RH and egcs 1.1.2. Compiler doesn't seem to be a significant factor.
gdb CVS as of 2001-07-30 15:00 EDT still had this problem
>Description:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=36625
When compiling the attached C++ program and running it, gdb gets in trouble when doing casting.
(gdb) b 27
Breakpoint 1 at 0x8048695: file jakub.C, line 27.
(gdb) r
Starting program: /home/devel/teg/jakub
Breakpoint 1, main () at jakub.C:27
27 z = (B *)x;
(gdb) n
28 }
(gdb) p *z
$1 = {<A> = {i = 1, _vptr. = 0x8048828 <A virtual table>}, j = 2, k = 3}
(gdb) p y
$2 = {<A> = {i = 1, _vptr. = 0x8048828 <A virtual table>}, j = 2, k = 3}
(gdb) p *(B *)x
$3 = {<A> = {i = 1, _vptr. = 0x8048828 <A virtual table>}, j = 0, k = 0}
(gdb)
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="jakub.C"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="jakub.C"
c3RydWN0IEEgewogIGludCBpOwogIHZpcnR1YWwgfkEoKTsKfTsKCnN0cnVjdCBCIDogcHVibGlj
IEEgewogIGludCBqLCBrOwogIHZpcnR1YWwgfkIoKTsKfTsKCkE6On5BKCkKewp9CgpCOjp+Qigp
CnsKfQoKaW50IG1haW4odm9pZCkKewogIEEgKng7CiAgQiB5LCAqejsKICB5LmkgPSAxOwogIHku
aiA9IDI7CiAgeS5rID0gMzsKICB4ID0gJnk7CiAgeiA9IChCICopeDsKfQoK