public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/17161] New: gdb confused about variable address in a nested function
@ 2014-07-16  6:05 gdb at dima dot secretsauce.net
  2015-05-29  0:54 ` [Bug gdb/17161] " gdb at dima dot secretsauce.net
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gdb at dima dot secretsauce.net @ 2014-07-16  6:05 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17161

            Bug ID: 17161
           Summary: gdb confused about variable address in a nested
                    function
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: gdb at dima dot secretsauce.net

I have this C program:

int main(void)
{
    int v = 0;

    int b(void)
    {
        return v;
    }

    int a(void)
    {
        return b();
    }

    return a();
}

I build like this:

$ gcc-4.9 -g -std=gnu11 -o tst tst.c

The program runs without surprises. What IS surprising is what gdb thinks is
the value of v and &v at various points. At "return a()" and inside b() gdb is
correct:


(gdb) p v
$32 = 0

(gdb) p &v
$33 = (int *) 0x7fffffffe450

However inside a(), gdb is confused about the address and the value of v:

(gdb) s
a () at tst.c:12

(gdb) p v
$34 = 5658608

(gdb) p &v
$35 = (int *) 0x7fffffffe430


This causes unnecessary confusion, I think. I'm using Debian/sid on an amd64
box. The gdb Debian package is version 7.7.1-2, although I was seeing this with
7.6 as well.

Thanks
dima

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/17161] gdb confused about variable address in a nested function
  2014-07-16  6:05 [Bug gdb/17161] New: gdb confused about variable address in a nested function gdb at dima dot secretsauce.net
@ 2015-05-29  0:54 ` gdb at dima dot secretsauce.net
  2015-05-29 11:09 ` palves at redhat dot com
  2020-04-05 23:47 ` ssbssa at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: gdb at dima dot secretsauce.net @ 2015-05-29  0:54 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17161

Dima Kogan <gdb at dima dot secretsauce.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|7.7                         |7.9

--- Comment #1 from Dima Kogan <gdb at dima dot secretsauce.net> ---
Hi. This is a gentle ping. I just hit this bug again, and spent an hour making
a nice test case for the report, only to realize that this bug has already been
reported, by me of all people. The new 7.9.1 release is affected as well.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/17161] gdb confused about variable address in a nested function
  2014-07-16  6:05 [Bug gdb/17161] New: gdb confused about variable address in a nested function gdb at dima dot secretsauce.net
  2015-05-29  0:54 ` [Bug gdb/17161] " gdb at dima dot secretsauce.net
@ 2015-05-29 11:09 ` palves at redhat dot com
  2020-04-05 23:47 ` ssbssa at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: palves at redhat dot com @ 2015-05-29 11:09 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17161

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |palves at redhat dot com

--- Comment #2 from Pedro Alves <palves at redhat dot com> ---
There's a patch pending to address this:

  https://sourceware.org/ml/gdb-patches/2015-03/msg00627.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/17161] gdb confused about variable address in a nested function
  2014-07-16  6:05 [Bug gdb/17161] New: gdb confused about variable address in a nested function gdb at dima dot secretsauce.net
  2015-05-29  0:54 ` [Bug gdb/17161] " gdb at dima dot secretsauce.net
  2015-05-29 11:09 ` palves at redhat dot com
@ 2020-04-05 23:47 ` ssbssa at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: ssbssa at sourceware dot org @ 2020-04-05 23:47 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17161

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |7.11
                 CC|                            |ssbssa at sourceware dot org
             Status|NEW                         |RESOLVED

--- Comment #3 from Hannes Domani <ssbssa at sourceware dot org> ---
I can reproduce this problem with gdb versions up to 7.10.1, but it's fixed
since 7.11.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-05 23:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-16  6:05 [Bug gdb/17161] New: gdb confused about variable address in a nested function gdb at dima dot secretsauce.net
2015-05-29  0:54 ` [Bug gdb/17161] " gdb at dima dot secretsauce.net
2015-05-29 11:09 ` palves at redhat dot com
2020-04-05 23:47 ` ssbssa at sourceware dot org

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).