public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* c++/2378: print displays incorrect value when using a format on a variable passed by reference
@ 2007-12-07 4:18 mblythester
0 siblings, 0 replies; only message in thread
From: mblythester @ 2007-12-07 4:18 UTC (permalink / raw)
To: gdb-gnats
>Number: 2378
>Category: c++
>Synopsis: print displays incorrect value when using a format on a variable passed by reference
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Dec 07 04:18:01 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator: Matt Blythe
>Release: unknown-1.0
>Organization:
>Environment:
Linux/2.6.18 i686
GNU gdb 6.6.90.20070912-debian
This GDB was configured as "i486-linux-gnu".
>Description:
I have a function like "foo(unsigned int &temp)"
I want to display temp in hex or binary, so here's what I do:
(gdb) print temp
$36 = (unsigned int &) @0xb7fd117c: 4294966271
(gdb) print /x temp
$37 = 0xb7fd117c
(gdb) print /x *temp
Cannot access memory at address 0xfffffbff
(gdb) print /x &temp
$38 = 0xb7fd117c
(gdb) print /t temp
$39 = 10110111111111010001000101111100
(gdb) print /t *temp
Cannot access memory at address 0xfffffbff
(gdb) print /t &temp
$40 = 10110111111111010001000101111100
Whenever I try to "print /? temp" it displays the address of temp, not the value. By that logic, I should be able to dereference temp in the statement to print the value. Not so: it tries to dereference the value, not the address as expected. I threw "print /? &temp" in just to see what it would do, and it printed the address, acting as if "temp" and "&temp" are the same thing.
If this isn't a "bug," then the behavior is at least inconsistent. I expected the following:
(gdb) print temp
$36 = (unsigned int &) @0xb7fd117c: 4294966271
(gdb) print /x temp
$37 = 0xfffffbff
(gdb) print /x *temp
Cannot access memory at address 0xfffffbff
(gdb) print /x &temp
$38 = 0xb7fd117c
(gdb) print /t temp
$39 = 1111 1111 1111 1111 1000 1111 1111 (spaces added for my own benefit...not part of the bug, nor what I expect)
(gdb) print /t *temp
Cannot access memory at address 0xfffffbff
(gdb) print /t &temp
$40 = 10110111111111010001000101111100
I haven't tried this on a recent build, sorry. I can in a few days (project deadlines are fast approaching)
>How-To-Repeat:
see Description
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-12-07 4:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-07 4:18 c++/2378: print displays incorrect value when using a format on a variable passed by reference mblythester
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).