@@ -36,3 +36,42 @@ def test_sblock32():
3636 # Make sure we can read the proc and all its stack references
3737 assert len (parser .symbols ) == 1
3838 assert len (parser .symbols [0 ].stack_symbols ) == 8
39+
40+
41+ LDATA32_INSIDE_FUNCTION = """\
42+ (004368) S_GPROC32: [0001:00050A28], Cb: 000000B5, Type: 0x1010, GetCDPathFromPathsTxtFile
43+
44+ (0043AC) S_BPREL32: [00000008], Type: T_32PRCHAR(0470), pPath_name
45+ (0043C4) S_LDATA32: [0003:0000B3C4], Type: T_INT4(0074), got_it_already
46+ (0043E4) S_LDATA32: [0003:0003C488], Type: 0x100B, cd_pathname
47+
48+ (004400) S_END
49+ """
50+
51+
52+ def test_ldata32_inside_function ():
53+ """S_LDATA32 leaves inside of a function (S_GPROC32) are assumed to be
54+ static variables from that function."""
55+ parser = CvdumpSymbolsParser ()
56+ for line in LDATA32_INSIDE_FUNCTION .split ("\n " ):
57+ parser .read_line (line )
58+
59+ assert len (parser .symbols ) == 1
60+ assert len (parser .symbols [0 ].static_variables ) == 2
61+ assert [v .name for v in parser .symbols [0 ].static_variables ] == [
62+ "got_it_already" ,
63+ "cd_pathname" ,
64+ ]
65+
66+
67+ def test_ldata32_outside_function ():
68+ """Should ignore an S_LDATA32 leaf found outside a function.
69+ These appear to indicate const global variables and they should be
70+ repeated in the GLOBALS section."""
71+ parser = CvdumpSymbolsParser ()
72+ parser .read_line (
73+ "(00045C) S_LDATA32: [0003:0000E298], Type: 0x1060, TestVariable"
74+ )
75+
76+ # ignored... for now.
77+ assert len (parser .symbols ) == 0
0 commit comments