March 06, 2019
https://issues.dlang.org/show_bug.cgi?id=19719

          Issue ID: 19719
           Summary: Debugging string mixins using -mixin doesn't work
           Product: D
           Version: D2
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: r.sagitario@gmx.de

Stepping through mixin code in the debugger using -mixin doesn't work on Windows.

For COFF, no debug line info is emitted if it is from a different file than the one containing the function declaration.

For OMF, there are instructions without any source code when switching from one file to another causing the VS debugger to not show any code or step out of the function. For example, this function

void fun()
{
    mixin("int a = 0;
           int z = 1;
           int y = a + z;
           a = y + z;");
}

disssembles as

void fun()
0040224c  enter 0xc, 0x0
--- No source file
-------------------------------------------------------------
00402250  push ebx
--- C:\test\WindowsApp1.mixin 
// expansion at WindowsApp1.d(14)
int a = 0;
00402251  xor eax, eax
00402253  mov [ebp-0xc], eax
                  int z = 1;
00402256  mov ecx, 0x1
0040225b  mov [ebp-0x8], ecx
                  int y = a + z;
0040225e  lea edx, [eax+ecx]
00402261  mov [ebp-0x4], edx
                  a = y + z;
00402264  lea ebx, [edx+ecx]
--- No source file
-------------------------------------------------------------
00402267  mov [ebp-0xc], ebx
--- C:\test\WindowsApp1.d ---------
}

void fun()
{
        mixin("int a = 0;
                  int z = 1;
                  int y = a + z;
                  a = y + z;");
}
0040226a  pop ebx
--- No source file
-------------------------------------------------------------
0040226b  leave 0040226c  ret 0040226d  int3 0040226e  int3 0040226f  int3

--