microsoft / vscode-mono-debug

A simple VS Code debug adapter for mono
Other
159 stars 173 forks source link

debugger disconnect on embed mono #74

Open johnson3d opened 3 years ago

johnson3d commented 3 years ago

I embed mono by options:

const char options[] = { "--soft-breakpoints", "--debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:55555,timeout=9999999" }; mono_jit_parse_options(sizeof(options) / sizeof(char), (char**)options);

mono_debug_init(MONO_DEBUG_FORMAT_MONO);

mono debug can accept this socket ,but debug thread will get a disconnect event soon, then thread will exit: res = transport_recv (header, HEADER_LENGTH);

    /* This will break if the socket is closed during shutdown too */
    if (res != HEADER_LENGTH) {
        PRINT_DEBUG_MSG (1, "[dbg] transport_recv () returned %d, expected %d.\n", res, HEADER_LENGTH);

this is the launch.json: { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Launch", "type": "mono", "request": "launch", "program": "F:/TProject/Module/CSharpTestMono/bin/Debug/CSharpTestMono.exe",//"${workspaceRoot}/program.exe", "cwd": "F:/TProject/Module/EmbedMono/x64/Debug"//"${workspaceRoot}"\ }, { "name": "Attach", "type": "mono", "request": "attach", "address": "localhost", "port": 55555, }, ] }

I can debug by Launch,But Attach is not ok now.