microsoft / vscode-mono-debug

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

Debugging with mono and building with xbuild breaks debugging! #29

Open weinand opened 7 years ago

weinand commented 7 years ago

From @chncy on April 15, 2017 16:56

Steps to Reproduce:

  1. Use mono in launch.json and xbuild for building
  2. Try to debug program: Code execution pauses at breakpoint but i cant see variables, watch them or even see where the code is currently paused at.

launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "mono",
            "request": "launch",
            "program": "${workspaceRoot}/SteamBot/bin/Debug/SteamBot.exe",
            "args": ["getrightsucks", "Sk1ns7Pur"],
            "cwd": "${workspaceRoot}/SteamBot/bin/Debug/",
            "preLaunchTask": "build",
            "runtimeExecutable": null,
            "env": {}
        },
        {
            "name": "Attach",
            "type": "mono",
            "request": "attach",
            "address": "localhost",
            "port": 55555
        }
    ]
}

tasks.json:

{
    "version": "0.1.0",
    "command": "xbuild",
    "args": [
        "/property:GenerateFullPaths=true /debug:full /debug+"
    ],
    "taskSelector": "/t:",
    "showOutput": "silent",
    "tasks": [
        {
            "taskName": "build",
            "showOutput": "silent",
            "problemMatcher": "$msCompile"
        }
    ]
}

Copied from original issue: Microsoft/vscode#24831

weinand commented 7 years ago

@chncy What version of mono-debug are you using? If you are not using the latest (0.15.5), please upgrade and try with the latest.

chncy commented 7 years ago

@weinand I am using the latest update, i updated it from vscode directly

DanOlivier commented 6 years ago

I have this too, kind of. Running Ubuntu 17.04. Everything works (i.e. breakpoints are hit and call stack looks accurate), except that not all variables are available/visible, but I don't yet see the pattern.

VSCode Version:

Version 1.16.1
Commit 27492b6bf3acb0775d82d2f87b25a93490673c6d
Date 2017-09-14T16:26:20.018Z
Shell 1.7.3
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

OS, mono, xbuild:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 17.04
Release:        17.04
Codename:       zesty

$ mono -V
Mono JIT compiler version 4.6.2 (Debian 4.6.2.7+dfsg-1ubuntu1)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

$ xbuild /version
XBuild Engine Version 14.0
Mono, Version 4.6.2.0
Copyright (C) 2005-2013 Various Mono authors

These are some of the dependencies I'm installing:

DotNet also installed, using these steps:

url https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-zesty-prod zesty main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update
sudo apt-get install dotnet-sdk-2.0.0

Compilation step:

$ xbuild MyProject.csproj /property:Configuration="Debug" /verbosity:quiet /nologo

Note: here is the relevant configuration in the csproj file:

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <OutputPath>..\..\..\Binaries\DotNET\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <Optimize>false</Optimize>
    <DebugType>full</DebugType>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <ErrorReport>prompt</ErrorReport>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>

Contents of 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": "MyProject",
            "type": "mono",
            "request": "launch",
            "program": "${workspaceRoot}/Engine/Binaries/DotNET/MyProject.exe",
            "args": [ "-verbose" ],
            "cwd": "${workspaceRoot}",
            "stopAtEntry": true,
            "console": "internalConsole"
        }
    ]
}