<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>I don't want to have to recompile anything.<br>Ideally the overhead of the debug stuff is low enough that it is always on.<br>That is difficult. Or maybe everything is so fast these days that we can just be inefficient. Nobody noticed how bad cm3cg's codegen was, after all, or that it got better.<BR> <BR><br>I believe you need to make a function call for every line or "instruction".<br>That is the hook for stepping and breakpoints.<BR> <BR><br>You need function calls to the debugger for every assignment.<br>If you have something like "watch breakpoints"<br>("Break whenv variable x becomes 123.")<BR> <BR><br>On the assignment matter though, it could be done in the step/instruction call.<BR> <BR><br>There isn't necessarily a zero offset for parameters and locals..<br>well..a debug system probably creates one..homing all the parameters<br>and not enregistering everything..<BR>You should probably bundle up the data into a smaller number of linked structures,<br>in order to pass fewer parameters to DebugProcEntry.<BR> <BR> <BR>Beware module globals also.<br>Even in my upcoming C backend work, they don't work well. <br>I think that needs frontend work. :(<BR> <BR><br> - Jay<br><br><br><br> <BR><div><div id="SkyDrivePlaceholder"></div>> From: darko@darko.org<br>> Date: Tue, 2 Apr 2013 10:51:48 -0700<br>> To: m3devel@elegosoft.com<br>> Subject: [M3devel] Internal debugging - a simple design<br>> <br>> Here's an idea for how simple internal debugging might work.<br>> <br>> A command line option is created that turns on debug code generation globally. A pragma is created, <*DEBUG*> which turns on debugging for all of the procedures within the scope that the pragma precedes, being an implementation module or a possibly nested procedure. Both must be done for debugging code to actually be generated for a procedure.<br>> <br>> For each procedure within a debugging scope the following declaration is inserted (the offsets are byte offsets):<br>> <br>> CONST<br>> ProcName: TEXT = "Module.ProcName";<br>> ProcType: CARDINAL = 12345678;<br>> ProcAdr: ADDRESS = 123456;<br>> ParamNames = ARRAY OF TEXT{"param1", "param2", "param3"};<br>> ParamTypes = ARRAY OF CARDINAL{1, 2, 3};<br>> ParamOffs = ARRAY OF INTEGER{0, 4, 8, 16);<br>> ReturnType: CARDINAL = 12345678;<br>> ReturnOffs: INTEGER = 32;<br>> LocalNames = ARRAY OF TEXT{"local1", "local2", "local3"};<br>> LocalTypes = ARRAY OF CARDINAL{1, 2, 3};<br>> LocalOffs = ARRAY OF INTEGER{20, 24, 28, 36);<br>> <br>> Extra calls are inserted into a procedure within a debugging scope so that whenever the procedure is called DebugProcEntry is called first. DebugProcEntry must be declared or imported in the procedure's module. DebugProcEntry passes all the above constant declarations as parameters, plus an extra parameter which gives the address of the zero offset for the parameters and local variables:<br>> <br>> PROCEDURE DebugProcEntry(<br>> READONLY frame: ADDRESS;<br>> READONLY procName: ProcName;<br>> READONLY procType: ProcType;<br>> READONLY procAdr: ProcAdr;<br>> READONLY paramNames: ParamNames;<br>> READONLY paramTypes: ParamTypes;<br>> READONLY paramOffs: ParamOffs;<br>> READONLY returnType: ReturnType;<br>> READONLY returnOffs: ReturnOffs;<br>> READONLY localNames: LocalNames;<br>> READONLY localTypes: LocalTypes;<br>> READONLY localOffs: LocalOffs<br>> );<br>> <br>> Whenever a procedure returns a procedure called DebugProcExit is called just before it exits, with the same parameters as DebugProcEntry.<br>> <br>> - Darko<br>> <br></div> </div></body>
</html>