Thread overview
[Issue 4013] New: Inconsistent codeview debug info for classes derived from IUnknown
Mar 27, 2010
Rainer Schuetze
Mar 27, 2010
Rainer Schuetze
Feb 07, 2011
Walter Bright
March 27, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4013

           Summary: Inconsistent codeview debug info for classes derived
                    from IUnknown
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: r.sagitario@gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario@gmx.de> 2010-03-27 01:14:34 PDT ---
IUnknown and any class derived from it have inconsistent codeview debug info:

dmd -g -c lib

module lib;
interface IUnknown
{
    void foo();
}

compiles to

$$TYPES    segment
00: LF_ARGLIST   argcount=0
01: LF_VTSHAPE   count=1 05
02: LF_CLASS     count=1 <typidx 1007> property=x0000 <dList 0000> <vshape
1001> length=x0000 lib.IUnknown
03: LF_CLASS     count=0 <typidx 0000> property=x0080 <dList 0000> <vshape
0000> length=x0000 IUnknown
04: LF_POINTER   <x000a > <typidx 1003>
...

and later referencing the incomplete type 1003. Please note that the class is called "lib.IUnknown" in one entry, but "IUnknown" in the other.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 27, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4013


Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch, wrong-code


--- Comment #1 from Rainer Schuetze <r.sagitario@gmx.de> 2010-03-27 01:16:14 PDT ---
This is caused by using sym->toPrettyChars() most of the time, but sometimes
not on cpp-interfaces. I think toPrettyChars() should always be used. Here's a
patch:

Index: toctype.c ===================================================================
--- toctype.c    (revision 419)
+++ toctype.c    (working copy)
@@ -381,8 +381,12 @@

     /* Need this symbol to do C++ name mangling
      */
-    const char *name = sym->isCPPinterface() ? sym->ident->toChars()
-                          : sym->toPrettyChars();
+    const char *name = sym->toPrettyChars();
     s = symbol_calloc(name);
     s->Sclass = SCstruct;
     s->Sstruct = struct_calloc();

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 07, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4013


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2011-02-07 15:29:36 PST ---
The name in both places should be just IUnknown. The reason is because that name is used for C++ name mangling, and has to line up with what the corresponding C++ compiler does with it.

https://github.com/D-Programming-Language/dmd/commit/411b1e5faf3a93149fa9b31c3f0946020f48ccd0

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