From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3394 invoked by alias); 7 Dec 2007 04:18:01 -0000 Received: (qmail 3377 invoked by uid 71); 7 Dec 2007 04:18:01 -0000 Resent-Date: 7 Dec 2007 04:18:01 -0000 Resent-Message-ID: <20071207041801.3376.qmail@sourceware.org> Resent-From: gdb-gnats@sources.redhat.com (GNATS Filer) Resent-To: nobody@sources.redhat.com Resent-Cc: gdb-prs@sources.redhat.com Resent-Reply-To: gdb-gnats@sources.redhat.com, mblythester@gmail.com Received: (qmail 1800 invoked by uid 48); 7 Dec 2007 04:14:55 -0000 Message-Id: <20071207041455.1799.qmail@sourceware.org> Date: Fri, 07 Dec 2007 04:18:00 -0000 From: mblythester@gmail.com Reply-To: mblythester@gmail.com To: gdb-gnats@sources.redhat.com X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/2378: print displays incorrect value when using a format on a variable passed by reference Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2007-q4/txt/msg00146.txt.bz2 >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: