[Issue 4181] New: GDB print strange value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 12 14:51:05 PDT 2010


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 at puremagic.com
        ReportedBy: mihail.zenkov at gmail.com


--- Comment #0 from Mihail Zenkov <mihail.zenkov at 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: -------


More information about the Digitalmars-d-bugs mailing list