soft debug

pierre <[email protected]> Tue, 27 Feb 2018 14:45:32 +0100
Newsgroups gmane.comp.gnome.mono.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============4961135727747112094==
Content-Type: multipart/alternative;
 boundary="------------64CC8A4159CCA251F132C48F"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------64CC8A4159CCA251F132C48F
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit

Hi,

Parsing the code of Mono.Debugger.Soft there is one thing I cannot 
figure out:

what is the expected reply when the debugger receives an event (command 
set: 64, command: 100)? The command packet contains a list of events, 
each with its own unique req_id (and there is an id in the header of the 
command packet).

If I reply with a  reply with no additional data with no error (and no 
attached data), the application crashes... and I am not using the req_id 
of each event.

Where can I find either the description of the reply I should send or 
the code that is doing it?

and I think there is a bug:

in the filemono <https://github.com/mono/mono>/mono 
<https://github.com/mono/mono/tree/master/mono>/mini 
<https://github.com/mono/mono/tree/master/mono/mini>/_debugger-agent.c_,  
in the function process_event, line 3747, there is:

case EVENT_KIND_VM_START:
      buffer_add_domainid (&buf, mono_get_root_domain ());
      break;


but in
mono <https://github.com/mono/mono>/mcs 
<https://github.com/mono/mono/tree/master/mcs>/class 
<https://github.com/mono/mono/tree/master/mcs/class>/Mono.Debugger.Soft 
<https://github.com/mono/mono/tree/master/mcs/class/Mono.Debugger.Soft>/Mono.Debugger.Soft 
<https://github.com/mono/mono/tree/master/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft>/Connection.cs, 
line 1318:
if (kind == EventKind.VM_START) {
    events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id };
    //EventHandler.VMStart (req_id, thread_id, null);*
*   }...

while it shouold be:

if (kind == EventKind.VM_START) {
   longid= r.ReadId ();
   events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id };
   ....

it is not causing trouble because the VM_START is always sent alone, but 
if this change, decoding the next events will have troubles....


thanks in advance,

Pierre




--------------64CC8A4159CCA251F132C48F
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi,</p>
    <p>Parsing the code of Mono.Debugger.Soft there is one thing I
      cannot figure out:</p>
    <p>what is the expected reply when the debugger receives an event
      (command set: 64, command: 100)? The command packet contains a
      list of events, each with its own unique req_id (and there is an
      id in the header of the command packet).</p>
    <p>If I reply with a  reply with no additional data with no error
      (and no attached data), the application crashes... and I am not
      using the req_id of each event. <br>
    </p>
    <p>Where can I find either the description of the reply I should
      send or the code that is doing it?</p>
    <p>and I think there is a bug:</p>
    <p>in the file<span class="repo-root js-repo-root"><span
          class="js-path-segment"><a href="https://github.com/mono/mono"
            data-pjax="true"><span> mono</span></a></span></span><span
        class="separator">/</span><span class="js-path-segment"><a
          href="https://github.com/mono/mono/tree/master/mono"
          data-pjax="true"><span>mono</span></a></span><span
        class="separator">/</span><span class="js-path-segment"><a
          href="https://github.com/mono/mono/tree/master/mono/mini"
          data-pjax="true"><span>mini</span></a></span><span
        class="separator">/</span><u><font color="#3366ff"><span
            class="final-path">debugger-agent.c</span></font></u>,  in
      the function <span class="pl-en">process_event, line 3747, there
        is:</span></p>
    <p><tt>case EVENT_KIND_VM_START:</tt><tt><br>
      </tt><tt>     buffer_add_domainid (&amp;buf, mono_get_root_domain
        ());</tt><tt><br>
      </tt><tt>     break;</tt><tt><br>
      </tt></p>
    <br>
    but in<br>
    <div class="breadcrumb js-zeroclipboard-target"> <span
        class="repo-root js-repo-root"><span class="js-path-segment"><a
            href="https://github.com/mono/mono" data-pjax="true"><span>mono</span></a></span></span><span
        class="separator">/</span><span class="js-path-segment"><a
          href="https://github.com/mono/mono/tree/master/mcs"
          data-pjax="true"><span>mcs</span></a></span><span
        class="separator">/</span><span class="js-path-segment"><a
          href="https://github.com/mono/mono/tree/master/mcs/class"
          data-pjax="true"><span>class</span></a></span><span
        class="separator">/</span><span class="js-path-segment"><a
href="https://github.com/mono/mono/tree/master/mcs/class/Mono.Debugger.Soft"
          data-pjax="true"><span>Mono.Debugger.Soft</span></a></span><span
        class="separator">/</span><span class="js-path-segment"><a
href="https://github.com/mono/mono/tree/master/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft"
          data-pjax="true"><span>Mono.Debugger.Soft</span></a></span><span
        class="separator">/</span><span class="final-path">Connection.cs,
        line 1318:</span> </div>
      <tt>if (kind == EventKind.VM_START) {</tt><tt><br>
    </tt><tt>   events [i] = new EventInfo (etype, req_id) { ThreadId =
      thread_id };</tt><tt><br>
    </tt><tt>   //EventHandler.VMStart (req_id, thread_id, null);</tt><b><br>
    </b>   }...<br>
    <br>
    while it shouold be:<br>
    <br>
    <tt>if (kind == EventKind.VM_START) {</tt><tt><br>
    </tt><tt><span class="pl-k">  long</span></tt><tt> </tt><tt><span
        class="pl-en">id</span></tt><tt> = r.ReadId ();</tt><tt><br>
    </tt><tt>  events [i] = new EventInfo (etype, req_id) { ThreadId =
      thread_id };</tt><br>
      ....<br>
    <br>
    it is not causing trouble because the VM_START is always sent alone,
    but if this change, decoding the next events will have troubles....<br>
    <br>
    <p><br>
    </p>
    <p>thanks in advance,</p>
    <p>Pierre</p>
    <p><br>
    </p>
    <p><br>
    </p>
  </body>
</html>

--------------64CC8A4159CCA251F132C48F--

--===============4961135727747112094==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KTW9uby1kZXZl
bC1saXN0IG1haWxpbmcgbGlzdApNb25vLWRldmVsLWxpc3RAbGlzdHMuZG90Lm5ldApodHRwOi8v
bGlzdHMuZG90Lm5ldC9tYWlsbWFuL2xpc3RpbmZvL21vbm8tZGV2ZWwtbGlzdAo=

--===============4961135727747112094==--