Thread overview
[Issue 3368] New: GDB 6.8 cannot list code (sometimes)
Oct 06, 2009
MIURA Masahiro
[Issue 3368] gdb: cannot list code (sometimes)
Oct 12, 2009
Leandro Lucarella
Oct 12, 2009
Leandro Lucarella
Oct 12, 2009
Leandro Lucarella
October 06, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3368

           Summary: GDB 6.8 cannot list code (sometimes)
           Product: D
           Version: 2.033
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: echochamber@gmail.com


--- Comment #0 from MIURA Masahiro <echochamber@gmail.com> 2009-10-05 23:24:58 PDT ---
---- cut here ----
% cat -n foo.d
     1  import std.stdio;
     2
     3  void main()
     4  {
     5      *(cast(ubyte*)0) = 0;       // intentional SEGV
     6      // writefln("hello");
     7  }
% dmd -gc foo.d; /usr/bin/gdb --quiet ./foo
(gdb) run
Starting program: /home/miura/work/foo
[Thread debugging using libthread_db enabled]
[New Thread 0xb7dde6f0 (LWP 12300)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7dde6f0 (LWP 12300)]
0x08049239 in _Dmain () at foo.d:5
5           *(cast(ubyte*)0) = 0;       // intentional SEGV
(gdb) list
1       import std.stdio;
2
3       void main()
4       {
5           *(cast(ubyte*)0) = 0;       // intentional SEGV
6           // writefln("hello");
7       }
(gdb) backtrace
#0  0x08049239 in _Dmain () at foo.d:5
#1  0x08049514 in _D2rt6dmain24mainUiPPaZi7runMainMFZv ()
#2  0x0804931d in _D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv ()
#3  0x08049556 in _D2rt6dmain24mainUiPPaZi6runAllMFZv ()
#4  0x0804931d in _D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv ()
#5  0x080492c8 in main ()
(gdb)
---- cut here ----

Uncomment the line 6, and gdb is now unable to list code:

---- cut here ----
% dmd -gc foo.d; /usr/bin/gdb --quiet ./foo
(gdb) run
Starting program: /home/miura/work/foo
[Thread debugging using libthread_db enabled]
[New Thread 0xb7d696f0 (LWP 12311)]
Dwarf Error: Cannot find DIE at 0x846 referenced from DIE at 0x165 [in module
/home/miura/work/foo]
(gdb) list
1       // Written in the D programming language.
2
3       /**
4       Standard I/O functions that extend $(B std.c.stdio).  $(B std.c.stdio)
5       is $(D_PARAM public)ally imported when importing $(B std.stdio).
6
7       Macros:
8       WIKI=Phobos/StdStdio
9
10      Copyright: Copyright Digital Mars 2007 - 2009.
Dwarf Error: Cannot find DIE at 0x846 referenced from DIE at 0x165 [in module
/home/miura/work/foo]
(gdb) backtrace
Dwarf Error: Cannot find DIE at 0x846 referenced from DIE at 0x165 [in module
/home/miura/work/foo]
Dwarf Error: Cannot find DIE at 0x846 referenced from DIE at 0x165 [in module
/home/miura/work/foo]
(gdb)
---- cut here ----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 12, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3368


Leandro Lucarella <llucax@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |llucax@gmail.com
            Summary|GDB 6.8 cannot list code    |gdb: cannot list code
                   |(sometimes)                 |(sometimes)
           Severity|normal                      |regression


--- Comment #1 from Leandro Lucarella <llucax@gmail.com> 2009-10-12 14:28:54 PDT ---
I can confirm this using DMD 1.034 and GDB 7.0 with D patches, but here it can never list code. This is the GDB error message:

-----
(gdb) run
Starting program: /tmp/dmd2/linux/bin/bug3368
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x08049239 in D main ()
Current language:  auto
The current source language is "auto; currently asm".
(gdb) list
1    /tmp/cct0i4at.s: No such file or directory.
    in /tmp/cct0i4at.s
-----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 12, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3368



--- Comment #2 from Leandro Lucarella <llucax@gmail.com> 2009-10-12 16:13:41 PDT ---
(In reply to comment #1)
> I can confirm this using DMD 1.034 and GDB 7.0 with D patches, but here it can never list code. This is the GDB error message:
> 
> -----
> (gdb) run
> Starting program: /tmp/dmd2/linux/bin/bug3368
> [Thread debugging using libthread_db enabled]
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x08049239 in D main ()
> Current language:  auto
> The current source language is "auto; currently asm".
> (gdb) list
> 1    /tmp/cct0i4at.s: No such file or directory.
>     in /tmp/cct0i4at.s
> -----

Please, ignore this. I forgot to add -gc when compiling. I see the exact same problem reported in the original description, using DMD 2.034 and GDB 7.0 patched with D support. DMD 1.049 works fine.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 12, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3368


Leandro Lucarella <llucax@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #3 from Leandro Lucarella <llucax@gmail.com> 2009-10-12 16:21:55 PDT ---
Looks like a reincarnation of bug 1079.

*** This issue has been marked as a duplicate of issue 1079 ***

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