www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4181] New: GDB print strange value

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4181

           Summary: GDB print strange value
           Product: D
           Version: future
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: mihail.zenkov gmail.com


--- Comment #0 from Mihail Zenkov <mihail.zenkov gmail.com> 2010-05-12 14:51:01
PDT ---
GDB print strange value if source compiled with dmd -g (with dmd -gc it print
correct value).

# cat test.d
import std.stdio: writefln;

int x;

struct STest {
        static int y;
}

void dummy() {}

int main() {
        x = 11;
        STest.y = 22;
        writefln("x=%d STest.y=%d", x, STest.y);
        dummy();

        return 0;
}


# dmd -g test.d
# gdb test
GNU gdb (GDB) 7.1.50.20100430-cvs
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /mnt/work/source/dgdb/test1/test...done.
(gdb) break 'test.dummy'
Breakpoint 1 at 0x8049a94: file test.d, line 9.
(gdb) run
Starting program: /mnt/work/source/dgdb/test1/test
[Thread debugging using libthread_db enabled]
x=11 STest.y=22

Breakpoint 1, test.dummy () at test.d:9
9       void dummy() {}
(gdb) p 'test.x'
$1 = 11
(gdb) p 'test.STest.y'
$2 = 11

I also have more complex example that have p 'test.x' incorrect too.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 12 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4181


Martin Krejcirik <mk krej.cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mk krej.cz


--- Comment #1 from Martin Krejcirik <mk krej.cz> 2012-04-04 14:18:58 PDT ---
I should add to this report, that all thread-local variables are shown with
wrong value (init value instead of changed value) in gdb (tested gdb 7.3, 7.4,
dmd 2.058) when compiled with -g.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 04 2012