burner / bugzilla_migration_test

0 stars 0 forks source link

CodeView: static variables in functions not assigned to procedure scope #21

Open burner opened 16 years ago

burner commented 16 years ago

jascha reported this on 2007-12-01T12:33:40Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=1705

CC List

Description

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

burner commented 5 years ago

r.sagitario commented on 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.