public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: mblythester@gmail.com To: gdb-gnats@sources.redhat.com Subject: c++/2378: print displays incorrect value when using a format on a variable passed by reference Date: Fri, 07 Dec 2007 04:18:00 -0000 [thread overview] Message-ID: <20071207041455.1799.qmail@sourceware.org> (raw) >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:
reply other threads:[~2007-12-07 4:18 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20071207041455.1799.qmail@sourceware.org \ --to=mblythester@gmail.com \ --cc=gdb-gnats@sources.redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).