Skip to content

Feature/Enhancement - Improve mono-sdb implementation to allow remote debugging instances #298

Open
@D-4-N

Description

@D-4-N

dnSpy's current mono sdb implementation makes assumptions that prevent remote debugging instances

The current implementation is as follows:

var ep = (IPEndPoint)vm.EndPoint;
var pid = NetUtils.GetProcessIdOfListener(ep.Address.MapToIPv4().GetAddressBytes(), (ushort)ep.Port);
Debug.Assert(expectedPid == -1 || expectedPid == pid);
if (pid is null)
throw new StartException(dnSpy_Debugger_DotNet_Mono_Resources.Error_CouldNotFindDebuggedProcess);
vmPid = pid.Value;
hProcess_debuggee = NativeMethods.OpenProcess(NativeMethods.PROCESS_QUERY_LIMITED_INFORMATION, false, (uint)vmPid);
dbgManager.WriteMessage(string.Format(dnSpy_Debugger_DotNet_Mono_Resources.MonoDebuggerConnectionMessage, ep, vm.Version.VMVersion, $"{vm.Version.MajorVersion}.{vm.Version.MinorVersion}"));
var eventThread = new Thread(MonoEventThread);
eventThread.IsBackground = true;
eventThread.Name = "MonoDebugEvent";
eventThread.Start();

While this works for local debugging instances, it fails to do so when attempting to attach to remote mono instances, showing the following message in the process.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions