Mariano,<div><br></div><div>    here&#39;s a hint.  Look at the command-line argument breaksel and see where it is used.  This will call warning whenever a specific message is sent.  e.g.</div><div><br></div><div><div>McStalker.macbuild$ gdb Debug.app/</div>
<div>GNU gdb 6.3.50-20050815 (Apple version gdb-1515) (Sat Jan 15 08:33:48 UTC 2011)</div><div>Copyright 2004 Free Software Foundation, Inc.</div><div>GDB is free software, covered by the GNU General Public License, and you are</div>
<div>welcome to change it and/or distribute copies of it under certain conditions.</div><div>Type &quot;show copying&quot; to see the conditions.</div><div>There is absolutely no warranty for GDB.  Type &quot;show warranty&quot; for details.</div>
<div>This GDB was configured as &quot;x86_64-apple-darwin&quot;...Reading symbols for shared libraries ................ done</div><div><br></div><div>(gdb) break warning</div><div>Breakpoint 1 at 0x105e2b: file /Users/eliot/Cog/oscogvm/macbuild/../src/vm/gcc3x-cointerp.c, line 39.</div>
<div>(gdb) run -breaksel initialize ~/Squeak/Squeak4.2/trunk4.2.image </div><div>Starting program: /Users/eliot/Cog/oscogvm/macbuild/Debug.app/Contents/MacOS/Croquet -breaksel initialize ~/Squeak/Squeak4.2/trunk4.2.image</div>
<div>Reading symbols for shared libraries .+++++++++++++++..................................................................................... done</div><div>Reading symbols for shared libraries . done</div><div><br></div>
<div>Breakpoint 1, warning (s=0x16487c &quot;send breakpoint (heartbeat suppressed)&quot;) at /Users/eliot/Cog/oscogvm/macbuild/../src/vm/gcc3x-cointerp.c:39</div><div>39              printf(&quot;\n%s\n&quot;, s);</div><div>
(gdb) where 5</div><div>#0  warning (s=0x16487c &quot;send breakpoint (heartbeat suppressed)&quot;) at /Users/eliot/Cog/oscogvm/macbuild/../src/vm/gcc3x-cointerp.c:39</div><div>#1  0x0010b490 in interpret () at /Users/eliot/Cog/oscogvm/macbuild/../src/vm/gcc3x-cointerp.c:4747</div>
<div>#2  0x0011d521 in enterSmalltalkExecutiveImplementation () at /Users/eliot/Cog/oscogvm/macbuild/../src/vm/gcc3x-cointerp.c:14103</div><div>#3  0x00124bc7 in initStackPagesAndInterpret () at /Users/eliot/Cog/oscogvm/macbuild/../src/vm/gcc3x-cointerp.c:17731</div>
<div>#4  0x00105ec9 in interpret () at /Users/eliot/Cog/oscogvm/macbuild/../src/vm/gcc3x-cointerp.c:1933</div><div>(More stack frames follow...)</div><br><div class="gmail_quote">On Thu, Apr 28, 2011 at 5:26 AM, Mariano Martinez Peck <span dir="ltr">&lt;<a href="mailto:marianopeck@gmail.com">marianopeck@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 Eliot. I am fighting since several hours with something in Cog and I cannot realize it. I am blind. <br><br>I need to intercept all messages sent to an object. I have already done this for Interpreter VM and for StackVM. Now,  I am trying latest CogMTVM, and there is something I am not sying...I have this test:<br>



<br>testBlah<br><br>    ClassWith1Var new fooLong.<br>    ClassWith1Var new fooLong.<br>    ClassWith1Var new fooLong.<br>    <br><br>ClassWith1Var &gt;&gt; fooLong<br>    | aaa |<br>    Object new.<br>    self foo.<br><br>



<br>Now, I modified <br><br>CoInterpreter &gt;&gt; commonSend<br>    &quot;Send a message, starting lookup with the receiver&#39;s class.&quot;<br>    &quot;Assume: messageSelector and argumentCount have been set, and that <br>



    the receiver and arguments have been pushed onto the stack,&quot;<br>    &quot;Note: This method is inlined into the interpreter dispatch loop.&quot;<br>    &lt;sharedCodeNamed: &#39;commonSend&#39; inCase: 131&gt;<br>



    self sendBreak: messageSelector + BaseHeaderSize<br>        point: (objectMemory lengthOf: messageSelector)<br>        receiver: (self internalStackValue: argumentCount).<br>    cogit recordSendTrace ifTrue:<br>        [self recordTrace: lkupClass thing: messageSelector source: TraceIsFromInterpreter].<br>



    self internalFindNewMethod.<br>   <span style="background-color:rgb(255, 255, 51)"> self print: &#39;called: &#39;; printStringOf: messageSelector; cr.</span><br>    self internalExecuteNewMethod.<br>    self fetchNextBytecode<br>



<br><br>And when running the VM from gdb, &#39;called: fooLong&#39;  doesn&#39;t appear at all!!!  why ?  <br>In addition, it appears &#39;called: foo&#39; which is correct because #fooLong sends #foo<br>but it appears only ONCE. <br>



<br>#fooLong as I can see is not a quick return method but instead it goes by #sendLiteralSelector0ArgsBytecode. But the same happens if I put the print in that method... (which makes sense).<br>I tried with a StackVM and the same....so it seems that #fooLong is going by another place than #commonSend. <br>

<br>As far as I understand, there is nothing related with PIC or Jitt. In any of those cases, as what I can see, the #commonSend is called anyways. <br><br>So...I am completly lost. <br><br>Thanks in advance for any help.<br>

<br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>
<br></blockquote></div><br></div>