<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hi Javier,<br></div><div><br>On Feb 14, 2018, at 5:32 PM, Javier Pimás <<a href="mailto:elpochodelagente@gmail.com">elpochodelagente@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><span></span></div></blockquote><blockquote type="cite"><div><div dir="ltr">I've been debugging squeaknos running (crashing) inside a system vm. I think the simulator cannot be used in this case so I guess my next best choice <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">will be </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">a gdb debug stub</span>.</div></div></blockquote><div><br></div><div>That's an interesting question.  I think both approaches can help.  But I would defend burley start with the simulator:</div><div><br></div><div>The simulator goes to some effort to make sure that jitted code is run under similar constraints during simulation as it does in the real system.  When a call is made into the runtime (the rest of the interpreter) registers are smashed according to the ABI's caller & caller saved register conventions.  All variables outside of machine code that are accessed from <span style="background-color: rgba(255, 255, 255, 0);">machine code are given illegal addresses so that the machine code sequence that accesses them is the same as in the real system but causes an access violation and an exception handler handles the trap, looking up the illegal address in a mapping dictionary.</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">So you could add to the simulator a simulation of a hardware interrupt and see that the system could respond correctly while executing machine code.  Further, the simulator allows one to single step machine code so you could test that the system can handle a hardware interrupt at every instruction during the execution of some code, instead of simply interrupting at random and trying to fix isolated cases.</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">So yes, I would definitely start with the simulator.  I wouldn't waste my time debugging the real system until I'd demonstrated to myself that simulated hardware interrupts can be handled reliably during a broad range of execution, say every instruction during the bootstrap of a small image.</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">HTH</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">and this is really exciting!  It'll be fantastic to have SqueakNOS and Spur and Cog working together.</span></div><div><br></div><blockquote type="cite"><div dir="ltr"><div>Cheers!</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 14, 2018 at 3:26 PM, Eliot Miranda <span dir="ltr"><<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><div dir="ltr">Hi Javier,<div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 14, 2018 at 6:32 AM, Javier Pimás <span dir="ltr"><<a href="mailto:elpochodelagente@gmail.com" target="_blank">elpochodelagente@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <br><div dir="ltr">For debugging aid, I'd like to know if there is any cheatsheet with things like frame layout in the native stack (offset of the compiled method, the receiver, temporaries) and shape of the code (i.e. how to detect where a method starts and ends). </div></blockquote><div><br></div><div>The first choice is how you're going to debug. You can debug the generated C code.  There are several printing and debug functions included in the generated source, and it is set up to be compiled in three variants, production, assert and debug.  See any of the HowToBuild files under the build directories.  But debugging at the C level is much more difficult and less productive than using the development environment, "the simulator".</div><div><br></div><div>The VM is best understood, developed and debugged in Smalltalk.  You can create a VMMaker image containing the full environment using the image/buildspurtrunkvmmaker[64<wbr>]image.sh scripts (32-bit or 64-bit, 64-bit is faster for 64-bit development).  A workspace in the image (the contents of image/VM Simulation Workspace.text) contains launch expressions for the simulator.  The simulator has three windows, the top for the Smalltalk display, the bottom left for a transcript, and the bottom right for commands.  The bottom right pane has a menu with an extensive set of debug commands.</div><div><br></div><div>One useful thing is to browse all methods beginning with print local to VMMaker, especially those in the Cogit hierarchy (the JIT), the StackInterpreter hierarchy (the Interpreter) and the SpurMemoryManager hierarchy (the memory manager/GC).</div><div><br></div><div>Perhaps you could tell us a little bit about what you're trying to do and we can try and provide some more specific information.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Cheers,<br></div><div>Pocho<br clear="all"><div><br></div>-- <br><div class="m_-8291278337207178982m_1686983336665660573gmail-m_-8385752085661601495gmail_signature"><div dir="ltr">Javier Pimás<br>Ciudad de Buenos Aires</div></div></div></div></blockquote></div><br><div class="m_-8291278337207178982m_1686983336665660573gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div></div></blockquote></div>-- <br><div class="m_-8291278337207178982gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Javier Pimás<br>Ciudad de Buenos Aires</div></div>
</div></div>
</blockquote></body></html>