Bug 1705 – CodeView: static variables in functions not assigned to procedure scope

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2007-12-01T12:33:40Z
Last change time
2024-12-13T17:48:02Z
Keywords
DebugInfo
Assigned to
No Owner
Creator
Jascha Wetzel
Moved to GitHub: dmd#17655 →

Comments

Comment #0 by jascha — 2007-12-01T12:33:40Z
in the following example, static_var should be in the scope of main() (_TMP0 probably, too). ---------------------------------------------------------------------- import std.stdio; void main() { static uint static_var = 3; uint local_var = static_var; writefln("%d", local_var); } ---------------------------------------------------------------------- $$SYMBOLS segment S_COMPILE 06 x008000 Z8.51.0 S_LDATA32 off = x0000, seg = x0000, typ = x0075 _D4main4mainFZv10static_vark segidx = 5 offset = 0018, lcfd = ec10, fd = 1, td = 2, targdisp = x0000 S_LDATA32 off = x0008, seg = x0000, typ = x1001 _TMP0 segidx = 5 offset = 0041, lcfd = ec10, fd = 1, td = 2, targdisp = x0000 S_GPROC32 par=x00000000 end=x00000000 next=x00000000 len=x002a debsta=x0004 debend=x0028 off=x0000 seg=x0000 proctyp=x1002 near _Dmain segidx = 5 offset = 006b, lcfd = ec12, fd = 1, td = 3, targdisp = x0000 S_ENDARG S_BPREL32 off = xfffffffc, typ = x0075 local_var S_RETURN 03 00 00 S_END S_GDATA32 off = x0000, seg = x0000, typ = x1004 D14TypeInfo_B3Aak6__initZ segidx = 5 offset = 00a2, lcfd = ec12, fd = 1, td = 4, targdisp = x0000
Comment #1 by r.sagitario — 2019-08-20T21:46:39Z
Indeed, C++ emits the static variable as part of the function locals, while dmd makes it a global symbol with full qualification. mago has a workaround that allows watching statics if the function has extern(D) mangling, so the fully qualified variable can be found. It doesn't show up as a local, though.
Comment #2 by robert.schadek — 2024-12-13T17:48:02Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17655 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB