不能使用单声道软调试器远程调试,因为“调试程序代理:DWP握手失败”错误 [英] Can't use Mono Soft Debugger Remote Debugging because 'debugger-agent: DWP handshake failed' error

查看:225
本文介绍了不能使用单声道软调试器远程调试,因为“调试程序代理:DWP握手失败”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序嵌入单。该应用程序是一个支持插件控制台应用程序。插件是.NET程序集。所有工作的伟大,但我想他们调试。要启用调试在我的C code,我有:

I've embedded mono in my application. The application is console application that supports plug-ins. Plug-ins are .NET assemblies. All work great, but i want to debug them. To enable debugging in my C-code i have:

mono_set_dirs (ASSEMBLIES_DIR_NAME, ASSEMBLIES_DIR_NAME);
assembly_add_to_bundle(API_ASSEMBLY);

soft_debug = getenv("MYAPP_SOFT_DEBUG");
if (soft_debug != NULL) {
   char *options; 
   options = malloc(17 + strlen(soft_debug));
   sprintf(options, "--debugger-agent=%s", soft_debug); 

   mono_jit_parse_options (1, &options); 
   free (options); 

   mono_debug_init (MONO_DEBUG_FORMAT_MONO);
}

domain = JIT_INIT();

...

在code以上inits单声道运行时,这就是我对我所做的启用调试。 要启用调试在MonoDevelop的身边,我已经创建了一个加载项并实施必要的类。而其中,开始调试从RemoteSoftDebuggerSession来源。这是我的OnRun方式:

The code above inits mono runtime and it's all i've done to enable debugging. To enable debugging at MonoDevelop side i've created an Add-in and implemented necessary classes. The one that starts debugging is derived from RemoteSoftDebuggerSession. Here is my OnRun method:

protected override void OnRun (DebuggerStartInfo startInfo)
{
   var dsi = (MyAppDebuggerStartInfo) startInfo;
   var procStartInfo = new ProcessStartInfo(@"C:\MyApp\myapp.exe") {                
    UseShellExecute = false,
    RedirectStandardOutput = true,
    RedirectStandardError = true,
    WorkingDirectory = @"C:\MyApp",
    Arguments = dsi.AppName
   };

   procStartInfo.EnvironmentVariables.Add("MYAPP_SOFT_DEBUG",                       
      String.Format("transport=dt_socket,address={0}:{1}", 
         dsi.Address, dsi.DebugPort));

   this._myapp = Process.Start(procStartInfo);
   this._runner.EnableRaisingEvents = true;
   base.ConnectOutput(this._runner.StandardOutput, false);
   base.ConnectOutput(this._runner.StandardError, true);

   this._runner.Exited += delegate { this.EndSession(); };
   base.StartListening(dsi);
}

现在的问题是,当我开始调试的myapp打印调试代理:DWP握手失败和调试结束。 所有我能想出的是,正好13个字节发送到MYAPP.EXE和13字节:收到。

The problem is when i start debugging myapp prints "debugger-agent: DWP handshake failed" and debugging ends. All i could figure out is that exactly 13 bytes are sent to myapp.exe and 13 bytes are recieved (the number of chars in "DWP-Handshake").

Anybady知道水木清华这个问题?

Anybady know smth about this issue?

推荐答案

问题就解决了​​。麻烦的是VirtualMachineManager.ListenInternal(2)在该行方式:

Problem is solved. The trouble was in VirtualMachineManager.ListenInternal(2) method in this lines:

dbg_sock.Disconnect (false);
dbg_sock.Close ();

出于某种原因,这是未处理的异常(上断开)在这里。的try-catch解决了这个问题。现在,所有的伟大工程!

For some reason it was unhandled exception (on Disconnect) here. try-catch solved the problem. Now all works great!

这篇关于不能使用单声道软调试器远程调试,因为“调试程序代理:DWP握手失败”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆