<div>Hi!</div><div><br /></div><div><br /></div><div> For Win x64 and 32bit we can use x64dbg.</div><div>It' free.</div><div><br /></div><div> Or debugger features of IDA Pro.</div><div><br /></div><div>Best regards, Victor Miasnikov</div><div><br /></div><div>20.03.2021, 02:57, "Jay K" <jayk123@hotmail.com>:</div><blockquote><div dir="ltr">
<div style="color:rgb( 0 , 0 , 0 );font-family:'calibri' , 'helvetica' , sans-serif;font-size:12pt">
When there is code like:
<div><br />
</div>
<div>// global</div>
<div>VAR</div>
<div> traceInit := FALSE</div>
<div><br />
</div>
<div><br />
</div>
<div>PROCEDURE TraceModule(s: TEXT; m: RT0.ModulePtr) =</div>
<div> BEGIN</div>
<div> IF NOT traceInit THEN RETURN END; <==</div>
<div> RTIO.PutText(s);</div>
<div> OutModuleName(m);</div>
<div> RTIO.PutText("\r\n");</div>
<div> RTIO.Flush();</div>
<div> END TraceModule;</div>
<div><br />
</div>
<div><br />
</div>
<div>we get code like:</div>
<div><br />
</div>
<div>0:000:x86> u cm3!RTLinker__TraceModule</div>
<div>cm3!RTLinker__TraceModule [C:\s\cm3\m3-libs\m3core\src\runtime\common\RTLinker.m3 @ 519]:</div>
<div>00ab19d0 55 push ebp</div>
<div>00ab19d1 8bec mov ebp,esp</div>
<div>00ab19d3 51 push ecx</div>
<div>00ab19d4 8d45fc lea eax,[ebp-4]</div>
<div>00ab19d7 8945fc mov dword ptr [ebp-4],eax</div>
<div>00ab19da 0fb60d34f2ba00 movzx ecx,byte ptr [cm3!M_RTLinker_L_48+0x34 (00baf234)] <==</div>
<div>00ab19e1 85c9 test ecx,ecx</div>
<div>00ab19e3 7402 je cm3!RTLinker__TraceModule+0x17 (00ab19e7)</div>
<div><br />
</div>
<div><br />
</div>
<div>but in any other programming environment, this would be more like:</div>
<div><br />
</div>
<div>00ab19da 0fb60d34f2ba00 movzx ecx,byte ptr [cm3!RTLinker_traceInit] <==</div>
<div>or</div>
<div>00ab19da 0fb60d34f2ba00 movzx ecx,byte ptr [cm3!traceInit] <==</div>
<div><br />
</div>
<div>i.e. better symbols and debugging.</div>
<div><br />
</div>
<div>(maybe m3gdb knows about this? But m3gdb is missing on many platforms: NT, Darwin, HPUX).</div>
<div><br />
</div>
<div>The thing is, cm3 puts all of a module's globals in two segments, readonly and writable,</div>
<div>and then access them via offsets from the start, like a struct.</div>
<div><br />
</div>
<div>There might be reasons for this.</div>
<div><br />
</div>
<div> - To the extent that the variables are traced references, maybe the offsets are recorded somewhere</div>
<div> so garbage collector can move and fixup?</div>
<div> This could be replaced with pointers, albeit that'd be more/double the data.</div>
<div><br />
</div>
<div> - It gives a sort of fast portable linking semantic. You get more all-or-nothing type linking behavior.</div>
<div> But that also means the linker cannot remove unused data. So you get larger binaries.</div>
<div><br />
</div>
<div> - It obviates the need to discern file-level static from extern, as the number of symbols</div>
<div> is reduced. They are basically all static.</div>
<div><br />
</div>
<div>I propose that at least to the extent that the variables are not traced references,</div>
<div>they be moved into their own "segments". That extern vs. static be managed and informed to the backends.</div>
<div>Presumably this is representable to them.</div>
<div><br />
</div>
<div>It could be for C backend only if there is a problem, or really, so I don't have to investigate.</div>
<div><br />
</div>
<div>And do people know answers to the implied questions:</div>
<div>Why was it done this way?<br />
Do we use the offsets otherwise? I should be able to figure that out.</div>
<div><br />
</div>
<div> - Jay</div>
<br />
</div>
</div>
,<p>_______________________________________________<br />M3devel mailing list<br /><a href="mailto:M3devel@elegosoft.com" target="_blank">M3devel@elegosoft.com</a><br /><a href="https://m3lists.elegosoft.com/mailman/listinfo/m3devel" target="_blank">https://m3lists.elegosoft.com/mailman/listinfo/m3devel</a><br /></p></blockquote>