Hi Dimitry. I will probably be completely useless, but one of the things I would do is to compile the VM in debug mode (in fact, only the asserts is needed). <br>If you are compiling Cog with CMakeVMMaker just use a debug config. The important flags are DNDEBUG and DDEBUGVM. For more details read: <br>
<br><a href="http://forum.world.st/DNDEBUG-0-and-DDEBUGVM-1-td3447587.html">http://forum.world.st/DNDEBUG-0-and-DDEBUGVM-1-td3447587.html</a><br>
<br>My guess is that the VM is crashing as you said because of a corrupted stack, so when it crash you don&#39;t have any useful information. So...once you build a VM with debug you will also have the asserts. So run the VM from command line, and all those assert that fails will be shown in the console and they will show the value of the variables involved in the assert.<br>
With this, you can see as soon as a assert fails (which may be much before the crash) and could point you to something interesting :)<br><br>Good luck.<br><br><div class="gmail_quote">On Mon, Jul 18, 2011 at 5:55 AM, Dimitry Golubovsky <span dir="ltr">&lt;<a href="mailto:golubovsky@gmail.com" target="_blank">golubovsky@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Hi,<br>
<br>
My variant of Cog still keeps crashing in GC, but now it seems I made<br>
those crashes more &quot;consistent&quot;. Now I am posting my code to better<br>
illustrate the problem, maybe this helps.<br>
<br>
Fileout of the class which implements my variant of VM.<br>
<br>
<a href="http://pastebin.com/WJKtXVk5" target="_blank">http://pastebin.com/WJKtXVk5</a><br>
<br>
It overrides few methods of its parent classes to implement the<br>
event-driven VM. Most important changes are in methods interpret,<br>
wakeHighestPriority, and transferTo.<br>
<br>
The crash log (output of printOop inserted at each entry of markAndTrace)<br>
<br>
<a href="http://pastebin.com/sHSyHqHE" target="_blank">http://pastebin.com/sHSyHqHE</a><br>
<br>
It shows the debug output from the last entry in the interpreter after<br>
which GC happens which crashes.<br>
<br>
The host program runs the interpreter like this:<br>
<br>
------------------------------------------------------<br>
  if (runInterpreter) {<br>
    interpret();<br>
    while(1) {<br>
      int rc;<br>
      if(!aioPoll(1000)) continue;<br>
      heartbeat();<br>
      printf(&quot;enter interpreter\n&quot;);<br>
      rc = interpret();<br>
      printf(&quot;exit interpreter: %d\n&quot;, rc);<br>
      if(rc == 1) break;<br>
    }<br>
  }<br>
------------------------------------------------------<br>
<br>
and heartbeat() is reduced to<br>
<br>
------------------------------------------------------<br>
void<br>
heartbeat()<br>
{<br>
        int saved_errno = errno;<br>
printf(&quot;heartbeat\n&quot;);<br>
        updateMicrosecondClock();<br>
        if (get64(frequencyMeasureStart) == 0) {<br>
                set64(frequencyMeasureStart,utcMicrosecondClock);<br>
                heartbeats = 0;<br>
        }<br>
        else<br>
                heartbeats += 1;<br>
        forceInterruptCheckFromHeartbeat();<br>
<br>
        errno = saved_errno;<br>
}<br>
------------------------------------------------------<br>
<br>
In order to put the VM into event-driven mode, the following is<br>
executed in a workspace:<br>
<br>
(ProcessorScheduler classPool at: #BackgroundProcess) terminate.<br>
<br>
VM continues working, interpreter is entered on any mouse move or<br>
click, I could open World menu for example. First GC crashes.<br>
<br>
It is my understanding that longjmp I use to exit the interpreter<br>
somehow does not unwind the native stack properly thus corrupting the<br>
heap which crashes GC. What could it be?<br>
<br>
Thanks for any ideas.<br>
<font color="#888888"><br>
--<br>
Dimitry Golubovsky<br>
<br>
Anywhere on the Web<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>