Thread overview
[Issue 4372] New: type of enumerator values reduced to base type in debug info
Jun 23, 2010
Rainer Schuetze
Jun 23, 2010
Rainer Schuetze
Apr 28, 2011
Aldo Nunez
Apr 28, 2011
Aldo Nunez
Apr 28, 2011
Aldo Nunez
June 23, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4372

           Summary: type of enumerator values reduced to base type in
                    debug info
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: r.sagitario@gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario@gmx.de> 2010-06-23 00:12:00 PDT ---
Variables with enumerator type show up in the debugger as their base types. Even though the enumerator type itself is written to the object file (at least for CodeView debug info), it is not referred to by the variables type.

compiling:

module test;
enum E { kEnum1, kEnum2 }
E e = E.kEnum1;

with "dmd -c -g test.d" and running the object file through obj2asm produces

----8<-----
...
S_GDATA32    off = x0000, seg = x0000, typ = x0074 _D4test1eE4test1E
segidx = 5 offset = 004e, lcfd = ec10, fd = 1, td = 8, targdisp = x0000
...
---->8-----

mapping test.e to type 74h (int).

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



--- Comment #1 from Rainer Schuetze <r.sagitario@gmx.de> 2010-06-23 00:18:10 PDT ---
Created an attachment (id=674)
Recoverer enumerator type for debug info

The type information is lost in toCType, but as the code generator probably relies on working with the base type, it seems dangerous to change it. Here's a patch that tunnels a reference to the D symbol through to the debug information output stage. This fix patches only the CodeView implementation.

The patch is for dmd2, svn rev 556.

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



--- Comment #2 from Aldo Nunez <aldonunez1@gmail.com> 2011-04-28 01:03:55 PDT ---
I think I have a simpler fix.

If we write a mostly blank LF_ENUM record with only the right name and the forward reference flag (128) in the property field, the linker merges it with the full LF_ENUM record written by EnumDeclaration::toDebug/cv4_Denum.

Only one LF_ENUM record for each enum will appear in the debug info, and all references will be right.

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


Aldo Nunez <aldonunez1@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #674 is|0                           |1
           obsolete|                            |


--- Comment #3 from Aldo Nunez <aldonunez1@gmail.com> 2011-04-28 01:05:28 PDT ---
Created an attachment (id=951)
Write a forward reference LF_ENUM record.

I believe this patch also fixes the bug and is simpler.

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


Aldo Nunez <aldonunez1@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #951 is|0                           |1
           obsolete|                            |


--- Comment #4 from Aldo Nunez <aldonunez1@gmail.com> 2011-04-28 01:10:24 PDT ---
Created an attachment (id=952)
Write a forward reference LF_ENUM record.

Let's try this again. I didn't mean for the patch to be in UTF-16.

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