Skip to content

Commit

Permalink
Support just setting program property
Browse files Browse the repository at this point in the history
- Update readme
- Update launch template
  • Loading branch information
cwensley committed Nov 13, 2020
1 parent b8a2113 commit dabb761
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 48 deletions.
56 changes: 18 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,46 @@
# VS Code Mono Debug
# VS Code Rhino Debug

A simple VS Code debugger extension for the Mono VM. Its implementation was inspired by the [SDB](https://github.com/mono/sdb) command line debugger.
A simple VS Code debugger extension for Rhinoceros based on [vscode-mono-debug](https://github.com/microsoft/vscode-mono-debug).

![Mono Debug](images/mono-debug.png)
## Using the extension

## Installing Mono

You can either download the latest Mono version for Linux, macOS, or Windows at the [Mono project website](https://www.mono-project.com/download/) or you can use your package manager.

* On OS X: `brew install mono`
* On Ubuntu, Debian, Raspbian: `sudo apt-get install mono-complete`
* On CentOS: `yum install mono-complete`
* On Fedora: `dnf install mono-complete`

## Enable Mono debugging

To enable debugging of Mono based C# (and F#) programs, you have to pass the `-debug` option to the compiler:

```bash
csc -debug Program.cs
```

If you want to attach the VS Code debugger to a Mono program, pass these additional arguments to the Mono runtime:

```bash
mono --debug --debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:55555 Program.exe
```

The corresponding attach `launch.json` configuration looks like this:
Use a `launch.json` with the following:

```json
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Mono",
"request": "attach",
"type": "mono",
"address": "localhost",
"port": 55555
"name": "Launch Rhinoceros",
"type": "rhino",
"request": "launch",
"runtimeExecutable": "/Applications/Rhinoceros.app/Contents/MacOS/Rhinoceros",
"env": {
// optional: register your plugin(s) to load
"RHINO_PLUGIN_PATH": "${workspaceFolder}/Path/To/MyPlugin.rhp",
"GRASSHOPPER_PLUGINS": "${workspaceFolder}/Path/To/MyGHPlugin.gha"
}
}
]
}
```

## Building the mono-debug extension

[![build status](https://github.com/microsoft/vscode-mono-debug/workflows/Extension%20CI/badge.svg)](https://github.com/microsoft/vscode-mono-debug/actions)
## Building the rhino-debug extension

Building and using VS Code mono-debug requires a basic POSIX-like environment, a Bash-like
Building and using VS Code rhino-debug requires a basic POSIX-like environment, a Bash-like
shell, and an installed Mono framework.

First, clone the mono-debug project:
First, clone the rhino-debug project:

```bash
$ git clone https://github.com/microsoft/vscode-mono-debug
$ git clone https://github.com/mcneel/vscode-rhino-debug
```

To build the extension vsix, run:

```bash
$ cd vscode-mono-debug
$ cd vscode-rhino-debug
$ npm install
$ make
```
17 changes: 7 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"debuggers": [
{
"type": "rhino",
"label": "C# Mono",
"label": "C# Rhinoceros",
"program": "./bin/Release/mono-debug.exe",
"osx": {
"runtime": "mono"
Expand All @@ -131,15 +131,12 @@
"name": "%mono.launch.config.name%",
"type": "rhino",
"request": "launch",
"program": "${command:derivedDataRoot}/Build/Products/Debug/Rhinoceros.app/Contents/MacOS/Rhinoceros",
"cwd": "${workspaceRoot}"
},
{
"name": "%mono.attach.config.name%",
"type": "rhino",
"request": "attach",
"address": "localhost",
"port": 55555
"runtimeExecutable": "/Applications/Rhinoceros.app/Contents/MacOS/Rhinoceros",
"passDebugOptionsViaEnvironmentVariable": true,
"env": {
"RHINO_PLUGIN_PATH": "${workspaceFolder}/Path/To/MyPlugin.rhp",
"GRASSHOPPER_PLUGINS": "${workspaceFolder}/Path/To/MyGHPlugin.gha"
}
}
],
"configurationAttributes": {
Expand Down
11 changes: 11 additions & 0 deletions src/csharp/MonoDebugSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,17 @@ public override async void Launch(Response response, dynamic args)
return;
}
}
else
{
// RHINO:
// Only use the runtime if the file is an .exe or .dll
var extension = Path.GetExtension(programPath).ToLowerInvariant();
if (extension != ".exe" && extension != ".dll")
{
runtimeExecutable = programPath;
programPath = null;
}
}


// validate argument 'env'
Expand Down

0 comments on commit dabb761

Please sign in to comment.