[Issue 19747] New: No debug line info for code in scope(exit)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 17 14:37:13 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19747
Issue ID: 19747
Summary: No debug line info for code in scope(exit)
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Keywords: symdeb
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: r.sagitario at gmx.de
Compiling this code for COFF with "dmd -m64 -g":
module dbgi;
__gshared int recurse;
int foo(int n)
{
recurse++;
scope(exit)
{
recurse--;
if (recurse < 0)
assert(false);
}
int r = n + n;
int s = r + 2;
return r;
}
void main()
{
int x = foo(7);
}
yields missing debug line information for the code in scope(exit), e.g.
disassembly in VS looks like this:
5: int foo(int n)
00007FF797F0BF80 push rbp
00007FF797F0BF81 mov rbp,rsp
00007FF797F0BF84 sub rsp,18h
00007FF797F0BF88 push rbx
00007FF797F0BF89 mov dword ptr [n],ecx
6: {
7: recurse++;
00007FF797F0BF8C inc dword ptr [dbgi.recurse (07FF79800A4A0h)]
8: scope(exit)
9: {
10: recurse--;
11: if (recurse < 0)
12: assert(false);
13: }
14: int r = n + n;
00007FF797F0BF92 mov eax,dword ptr [n]
8: scope(exit)
9: {
10: recurse--;
11: if (recurse < 0)
12: assert(false);
13: }
14: int r = n + n;
00007FF797F0BF95 mov ecx,eax
00007FF797F0BF97 lea edx,[rax+rcx]
00007FF797F0BF9A mov dword ptr [r],edx
15: int s = r + 2;
00007FF797F0BF9D lea ebx,[rdx+2]
00007FF797F0BFA0 mov dword ptr [s],ebx
00007FF797F0BFA3 mov eax,edx
00007FF797F0BFA5 mov qword ptr [rbp-10h],rax
00007FF797F0BFA9 sub rsp,8
00007FF797F0BFAD call dbgi.foo+4Fh (07FF797F0BFCFh)
00007FF797F0BFB2 add rsp,8
00007FF797F0BFB6 mov rax,qword ptr [rbp-10h]
00007FF797F0BFBA pop rbx
00007FF797F0BFBB mov rsp,rbp
00007FF797F0BFBE pop rbp
00007FF797F0BFBF ret
00007FF797F0BFC0 sub rsp,8
00007FF797F0BFC4 call dbgi.foo+4Fh (07FF797F0BFCFh)
00007FF797F0BFC9 add rsp,8
00007FF797F0BFCD jmp dbgi.foo+76h (07FF797F0BFF6h)
00007FF797F0BFCF dec dword ptr [dbgi.recurse (07FF79800A4A0h)]
00007FF797F0BFD5 cmp dword ptr [dbgi.recurse (07FF79800A4A0h)],0
00007FF797F0BFDC jns dbgi.foo+75h (07FF797F0BFF5h)
00007FF797F0BFDE mov edx,0Ch
00007FF797F0BFE3 lea rcx,[__a6_646267692e64 (07FF797FF7E20h)]
00007FF797F0BFEA sub rsp,20h
00007FF797F0BFEE call _d_assertp (07FF797F0643Dh)
00007FF797F0BFF3 ud2
00007FF797F0BFF5 ret
16: return r;
17: }
00007FF797F0BFF6 pop rbx
16: return r;
17: }
00007FF797F0BFF7 mov rsp,rbp
00007FF797F0BFFA pop rbp
00007FF797F0BFFB ret
This prevents setting breakpoints in the scope(exit)-code or stepping through
the code.
--
More information about the Digitalmars-d-bugs
mailing list