Issue 19719 - Debugging string mixins using -mixin doesn't work
Summary: Debugging string mixins using -mixin doesn't work
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All Windows
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2019-03-06 07:57 UTC by Rainer Schuetze
Modified: 2019-04-05 14:23 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Rainer Schuetze 2019-03-06 07:57:33 UTC
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
Comment 1 Dlang Bot 2019-03-19 08:27:12 UTC
@rainers created dlang/dmd pull request #9464 "fix Issue 19719 - Debugging string mixins using -mixin doesn't work" fixing this issue:

- fix Issue 19719 - Debugging string mixins using -mixin doesn't work
  
  COFF: extend line number info to allow multiple segments in different source files
  ensure empty line after mixin expansion

https://github.com/dlang/dmd/pull/9464
Comment 2 Dlang Bot 2019-04-05 14:23:09 UTC
dlang/dmd pull request #9464 "fix Issue 19719 - Debugging string mixins using -mixin doesn't work" was merged into master:

- 51dfe6b91872002418e5889cd2a90110cbb144b7 by Rainer Schuetze:
  fix Issue 19719 - Debugging string mixins using -mixin doesn't work
  
  COFF: extend line number info to allow multiple segments in different source files
  ensure empty line after mixin expansion

https://github.com/dlang/dmd/pull/9464