Giter Club home page Giter Club logo

sdb's Introduction

SDB: Mono Soft Debugger Client

SDB is a command line client for Mono's soft debugger, a cooperative debugger that is part of the Mono VM. It tries to be similar in command syntax to tools such as GDB and LLDB.

Building

Building and using SDB requires a basic POSIX-like environment, a Bash-like shell, the libedit library (or an API/ABI-compatible replacement), and an installed Mono framework.

First, clone the submodules:

$ git submodule update --init --recursive

To build, run:

$ make

If the build succeeds, you can install SDB with:

$ make install

(You may need to invoke it with sudo or some such command.)

You can also run SDB from within the build directory by appending it to PATH and invoking sdb-dev. This is mainly intended for development of SDB itself. An example:

$ export PATH=`pwd`/bin:$PATH
$ sdb-dev
Welcome to the Mono soft debugger (sdb 1.0.5058.39468)
Type 'help' for a list of commands or 'quit' to exit

(sdb)

You can run the SDB test suite with:

$ make check

(This requires an F# installation.)

The following variables can be set in your environment or on the make command line to affect the build:

  • CAT: Path to the cat POSIX utility.
  • CD: Path to the cd POSIX utility.
  • CHMOD: Path to the chmod POSIX utility.
  • CP: Path to the cp POSIX utility.
  • ECHO: Path to the echo POSIX utility.
  • FSHARPC: Which F# compiler executable to use.
  • FSHARPC_FLAGS: Flags to pass to the F# compiler.
  • FSHARPC_TEST_FLAGS: Flags to pass to the F# compiler for tests.
  • GENDARME: Which Gendarme executable to use (optional).
  • GENDARME_FLAGS: Flags to pass to Gendarme.
  • INSTALL: Path to the install POSIX utility.
  • MCS: Which C# compiler executable to use.
  • MCS_FLAGS: Flags to pass to the C# compiler.
  • MCS_TEST_FLAGS: Flags to pass to the C# compiler for tests.
  • MKDIR: Path to the mkdir POSIX utility.
  • NUGET: Which NuGet executable to use.
  • PKG_CONFIG: Path to the pkg-config utility.
  • RM: Path to the rm POSIX utility.
  • SED: Path to the sed POSIX utility.
  • TAR: Path to the tar POSIX utility.
  • MSBUILD: Which MSBuild executable to use.
  • MSBUILD_FLAGS: Flags to pass to MSBuild.

Additionally, MODE can be set to Debug (default) or Release to indicate the kind of build desired. PREFIX can be set to specify the path that the install and uninstall targets should operate within (defaults to /usr/local).

Finally, MONO_PREFIX and MONO_BINARY can be set to tell the check target which Mono executable should be used. See the description of RuntimePrefix and RuntimeExecutable further down for more information.

Usage

Running a program is simple:

$ cat test.cs
using System;
using System.Diagnostics;

static class Program
{
    static void Main()
    {
        var str = "Foo!";

        Foo(str);
    }

    static void Foo(string str)
    {
        Console.WriteLine(str);

        Bar();
    }

    static void Bar()
    {
        Debugger.Break();
    }
}
$ mcs -debug test.cs
$ sdb
Welcome to the Mono soft debugger (sdb 1.0.5060.15368)
Type 'help' for a list of commands or 'quit' to exit

(sdb) r test.exe
Inferior process '5234' ('test.exe') started
Foo!
Inferior process '5234' ('test.exe') suspended
#0 [0x00000001] Program.Bar at /home/alexrp/Projects/tests/cs/test.cs:22
        Debugger.Break();

A stack trace can be generated with bt:

(sdb) bt
#0 [0x00000001] Program.Bar at /home/alexrp/Projects/tests/cs/test.cs:22
        Debugger.Break();
#1 [0x00000007] Program.Foo at /home/alexrp/Projects/tests/cs/test.cs:17
        Bar();
#2 [0x00000008] Program.Main at /home/alexrp/Projects/tests/cs/test.cs:10
        Foo(str);

We can select a frame and inspect locals:

(sdb) f up
#1 [0x00000007] Program.Foo at /home/alexrp/Projects/tests/cs/test.cs:17
        Bar();
(sdb) p str
string it = "Foo!"

Or globals:

(sdb) p Environment.CommandLine
string it = "/home/alexrp/Projects/tests/cs/test.exe"

To continue execution, do:

(sdb) c
Inferior process '5234' ('test.exe') resumed
Inferior process '5234' ('test.exe') exited
(sdb)

We can then exit SDB:

(sdb) q
Bye

For more commands, consult help in SDB.

Options

SDB has a few command line options that are useful for automation. For the full list, issue sdb --help.

First of all, all non-option arguments passed to SDB are treated as commands that SDB will execute at startup. For instance:

$ sdb "run test.exe"

Or:

$ sdb "args --foo --bar baz" "run test.exe"

This starts SDB and immediately executes test.exe with the given arguments.

The first option is -f. This option specifies files that SDB should read commands from. These commands are executed before any commands specified as non-option arguments. This option is useful for longer command sequences that are easier to maintain in a separate file. Example:

$ cat cmds.txt
args --foo --bar baz
run test.exe
$ sdb -f cmds.txt

The second option is -b. This runs SDB in batch mode; that is, it will exit as soon as all commands have finished and no inferior process is running. This goes well with -f for running programs regularly under SDB.

Settings

One configuration element that you almost certainly need to alter is the RuntimePrefix string value. It is set to /usr by default, regardless of OS, which is probably not desirable everywhere. For example, on Windows, you will want to set it to something like C:\Program Files (x86)\Mono-3.0.10. Or if you have Mono in some other directory, you might set it to e.g. /opt/mono.

The RuntimeExecutable element is another way to specify which Mono executable to use. If RuntimePrefix is empty, then RuntimeExecutable is taken as the full path to the Mono executable. If both elements are non-empty, they are combined as Path.Combine(RuntimePrefix, "bin", RuntimeExecutable). This configuration element is useful for switching between mono32 and mono64 on OS X in particular.

You may want to set DisableColors to true if you don't want the fancy ANSI color codes that SDB emits.

Finally, three useful settings for debugging SDB itself exist: DebugLogging can be set to true to make SDB spew a bunch of diagnostic information. LogInternalErrors can be set to true to log any internal errors that are encountered in the Mono debugging libraries. LogRuntimeSpew can be set to true to log all messages from the Mono VM.

Paths

When configuration elements are changed with config set, SDB will store the configuration data in ~/.sdb.cfg. The content of the file is the .NET binary serialization of the Mono.Debugger.Client.Configuration class. This file is read on startup if it exists.

At startup, SDB will scan the ~/.sdb directory for plugin assemblies. It will attempt to load all command definitions.

Finally, SDB will read ~/.sdb.rc and execute any commands (one per line) from it. This is useful if you prefer to change your settings with commands that you write down manually, rather than storing the data in a binary file.

Environment

The SDB_COLORS variable can be set to disable to tell SDB to not use colors in output. Normally, SDB will not use colors if it detects that stdout has been redirected, that TERM is set to dumb (or not set at all), or if the DisableColors configuration element is true.

SDB_CFG can be set to a specific configuration file to use instead of the default ~/.sdb.cfg. If set to the empty string (i.e. SDB_CFG="" sdb), SDB will not load any configuration file at all, and changed configuration values will not be saved.

The SDB_PATH variable can be set to a list of additional directories that SDB will scan for plugin assemblies in. Each directory should be separated by a semicolon (Windows) or a colon (POSIX).

SDB_DEBUG can be set to enable to make SDB print diagnostic information while debugging. This may be useful to debug SDB itself.

Plugins

At the moment, SDB has one extension point which is the Mono.Debugger.Client.Command class and the related Mono.Debugger.Client.CommandAttribute class. A class implementing Command that is tagged with CommandAttribute will be instantiated at startup time and put into the root command list.

For SDB to find custom commands, they should be compiled into .dll assemblies and put in ~/.sdb (or some other directory specified in SDB_PATH). Plugin assemblies can also be loaded manually with the plugin command.

Here's an example of compiling and using a test plugin:

$ cat test.cs
using Mono.Debugger.Client;

[Command]
public sealed class MyCommand : Command
{
    public override string[] Names
    {
        get { return new[] { "mycmd" }; }
    }

    public override string Summary
    {
        get { return "Performs magic."; }
    }

    public override string Syntax
    {
        get { return "mycmd"; }
    }

    public override string Help
    {
        get { return "Some sort of detailed help text goes here."; }
    }

    public override void Process(string args)
    {
        Log.Info("Hello! I received: {0}", args);
    }
}
$ mcs -debug -t:library test.cs -r:$(dirname $(which sdb))/../lib/sdb/sdb.exe -out:$HOME/.sdb/test.dll
$ sdb
Welcome to the Mono soft debugger (sdb 1.0.5061.14716)
Type 'help' for a list of commands or 'quit' to exit

(sdb) h mycmd

  mycmd

Some sort of detailed help text goes here.

(sdb) mycmd foo bar baz
Hello! I received: foo bar baz

You can look at SDB's own command classes for some examples of things that you can do in your commands.

sdb's People

Contributors

akihikodaki avatar akoeplinger avatar alexrp avatar cannorin avatar elbeardmorez avatar gturri avatar razzmatazz avatar terrajobst avatar vperus avatar xmcclure avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdb's Issues

Make configuration extensible

Basically, plugins should be able to declare configuration variables which are stored in a dictionary on Configuration. The cfg commands should be able to work with these.

Does not work on windows because of Mono.Posix dependency

Hey I'm trying to use sdb on windows but it started screaming about that it couldn't load assembly Mono.Posix. So I tried installing gtksharp and copied its Mono.Posix.dll to the directory with sdb.exe. However this didn't work either and is now screaming at me like this:


Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at Mono.Debugger.Client.Program.Main(String[] args)

How to use SDB?

Could someone please explain how to use this debugger. I am failing very miserably and I am stuck on trying to put a breakpoint. I can't find any information at all. Thanks

I want to set the break-point at bar function. (^_^)/

Hello! I'm callmekohei!.

Problems summary

I want to set the break-point at `bar` function. (^_^)/

system

$ sw_vers 
ProductName:	Mac OS X
ProductVersion:	10.12.6
BuildVersion:	16G29

$ sdb --version
Mono soft debugger (sdb) 1.5.6503.20649

$ mono --version
Mono JIT compiler version 5.0.1.1 (2017-02/5077205 Wed May 31 14:47:04 BST 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen (concurrent by default)

code

let bar() = 
    stdout.WriteLine("abc")   // <--- I want to set break-point at this line!

let foo (str:string) =
    stdout.WriteLine(str)
    bar()

[<EntryPointAttribute>]
let main _ =
    let s = "Foo!"
    foo s
    stdout.WriteLine("callmekohei")
    0

debugging

$ sdb
Welcome to the Mono soft debugger (sdb 1.5.6503.20649)
Type 'help' for a list of commands or 'quit' to exit

(sdb) bp add at test.fs 2
Breakpoint '0' added at '/Users/callmekohei/tmp/test.fs:2'
(sdb) bp add at test.fs 12
Breakpoint '1' added at '/Users/callmekohei/tmp/test.fs:12'
(sdb) bp
#0 '/Users/callmekohei/tmp/test.fs:2'
#1 '/Users/callmekohei/tmp/test.fs:12'
(sdb) r test.exe
Inferior process '1627' ('test.exe') started
Event: 'TargetReady'
[Mono] Loaded assembly: /Users/callmekohei/tmp/test.exe
[Mono] Loaded assembly: /usr/local/Cellar/mono/5.0.1.1/lib/mono/gac/FSharp.Core/4.4.1.0__b03f5f7f11d50a3a/FSharp.Core.dll
[Mono] Resolved pending breakpoint at 'test.fs:2,1' to void Test.bar () [0x00000].
[Mono] Resolved pending breakpoint at 'test.fs:12,1' to int Test.main (string[] _arg1) [0x0001f].
Foo!
abc
Hit breakpoint at '/Users/callmekohei/tmp/test.fs:12'
#0 [0x0000001F] Test.main at /Users/callmekohei/tmp/test.fs:12
    stdout.WriteLine("callmekohei")
Event: 'TargetHitBreakpoint'
(sdb) c
Inferior process '1627' ('test.exe') resumed
callmekohei
Inferior process '1627' ('test.exe') exited with code '0'
Event: 'TargetExited'

Remote debugging in sdb

Hello,

Does sdb support remote debugging ?
I can't find any info about such a feature.

Thanks in advance for your answer.

Installation issue ( git not working, make missing a project file )

Hello,

I apologize if this is way stupid, but I am new to Linux, new to programming and C# in particular. On the flip side I don't like MonoDevelop at all and I wish to compile and debug manually. So many many thanks to all of you smart people making this possible, however I have an installation problem. I can not understand how to properly use the 'git' command and this is ( I presume ) causing make to yell that it is missing Project file "debugger-libs.sln". Would you mind to help out?

Thanks,
Alex

sdb doesn't seem to build on Windows

TL;DR:

  • Following the instruction in the README, I fail to build sbt because of the error Too many project files specified
  • I can bypass this error if I remove /nologo from the switches, but it seems I build a corrupted executable since it fails make check and outputs Failed to connect to 'test.exe' whenever I try to use it

I'm trying to build sdb on my Windows [1].

If I run make just after cloning the repo and the submodules, I get

mkdir -p bin                                                                                                       
cp LICENSE bin/LICENSE                                                                                             
mkdir -p bin                                                                                                       
cp README.md bin/README                                                                                            
cd dep/debugger-libs && xbuild /verbosity:quiet /nologo /property:Configuration=net_4_0_Debug debugger-libs.sln    
MSBUILD: error MSBUILD0004: Too many project files specified                                                       
make: *** [bin/ICSharpCode.NRefactory.dll] Erreur 1                                                                

using msbuild instead, with make XBUILD=msbuild.exe yields a similar error:

MSBUILD : error MSB1008: Only one project can be specified. 
Switch: debugger-libs.sln                                   

(I get the same error if I run the following commands manually

cd dep/debugger-libs
msbuild.exe /verbosity:quiet /nologo /property:Configuration=net_4_0_Debug debugger-libs.sln   

)

It appears I can bypass this issue if I remove /nologo from the switches. I have no idea why it fixes the issue, but running make XBUILD_FLAGS='/property:Configuration=net_4_0_Debug /verbosity:quiet' successfully builds

(It might be worth noticing that when it builds dep/debugger-libs, it outputs the warning

warning CS1685: The predefined type `System.Runtime.CompilerServices.ExtensionAttribute' is defined multiple times. Using definition from `mscorlib.dll' 

)

However, running the tests (make check FSHARPC=fsc) fails, with the errors (which I'm unable to output in English) :

fsc --debug+ --nologo --warnaserror --keyfile:mono.snk --out:chk/check.exe --target:exe chk/check.fs

error FS0082: Il existe une diffรฉrence entre l'architecture de processeur du projet en cours de gรฉnรฉration "MSIL" et l'architecture de processeur de rรฉfรฉrence "mscorlib.dll", "x86". Cette diffรฉrence peut entraรฎner des problรจmes de runtime. Veuillez modifier l'architecture de processeur ciblรฉe de votre projet ร  l'aide du gestionnaire de configuration de faรงon ร  aligner les architectures de processeur entre votre projet et les rรฉfรฉrences, ou prendre une dรฉpendance sur les rรฉfรฉrences avec une architecture de processeur correspondant ร  l'architecture de processeur ciblรฉe de votre projet. (Code=MSB3270)

error FS0082: Il existe une diffรฉrence entre l'architecture de processeur du projet en cours de gรฉnรฉration "MSIL" et l'architecture de processeur de rรฉfรฉrence "System.Data.dll", "x86". Cette diffรฉrence peut entraรฎner des problรจmes de runtime. Veuillez modifier l'architecture de processeur ciblรฉe de votre projet ร  l'aide du gestionnaire de configuration de faรงon ร  aligner les architectures de processeur entre votre projet et les rรฉfรฉrences, ou prendre une dรฉpendance sur les rรฉfรฉrences avec une architecture de processeur correspondant ร  l'architecture de processeur ciblรฉe de votre projet. (Code=MSB3270)

error FS0082: Il existe une diffรฉrence entre l'architecture de processeur du projet en cours de gรฉnรฉration "MSIL" et l'architecture de processeur de rรฉfรฉrence "System.Web.dll", "x86". Cette diffรฉrence peut entraรฎner des problรจmes de runtime. Veuillez modifier l'architecture de processeur ciblรฉe de votre projet ร  l'aide du gestionnaire de configuration de faรงon ร  aligner les architectures de processeur entre votre projet et les rรฉfรฉrences, ou prendre une dรฉpendance sur les rรฉfรฉrences avec une architecture de processeur correspondant ร  l'architecture de processeur ciblรฉe de votre projet. (Code=MSB3270)

error FS0082: Il existe une diffรฉrence entre l'architecture de processeur du projet en cours de gรฉnรฉration "MSIL" et l'architecture de processeur de rรฉfรฉrence "mscorlib.dll", "x86". Cette diffรฉrence peut entraรฎner des problรจmes de runtime. Veuillez modifier l'architecture de processeur ciblรฉe de votre projet ร  l'aide du gestionnaire de configuration de faรงon ร  aligner les architectures de processeur entre votre projet et les rรฉfรฉrences, ou prendre une dรฉpendance sur les rรฉfรฉrences avec une architecture de processeur correspondant ร  l'architecture de processeur ciblรฉe de votre projet. (Code=MSB3270)

error FS0082: Il existe une diffรฉrence entre l'architecture de processeur du projet en cours de gรฉnรฉration "MSIL" et l'architecture de processeur de rรฉfรฉrence "System.Data.dll", "x86". Cette diffรฉrence peut entraรฎner des problรจmes de runtime. Veuillez modifier l'architecture de processeur ciblรฉe de votre projet ร  l'aide du gestionnaire de configuration de faรงon ร  aligner les architectures de processeur entre votre projet et les rรฉfรฉrences, ou prendre une dรฉpendance sur les rรฉfรฉrences avec une architecture de processeur correspondant ร  l'architecture de processeur ciblรฉe de votre projet. (Code=MSB3270)

error FS0082: Il existe une diffรฉrence entre l'architecture de processeur du projet en cours de gรฉnรฉration "MSIL" et l'architecture de processeur de rรฉfรฉrence "System.Web.dll", "x86". Cette diffรฉrence peut entraรฎner des problรจmes de runtime. Veuillez modifier l'architecture de processeur ciblรฉe de votre projet ร  l'aide du gestionnaire de configuration de faรงon ร  aligner les architectures de processeur entre votre projet et les rรฉfรฉrences, ou prendre une dรฉpendance sur les rรฉfรฉrences avec une architecture de processeur correspondant ร  l'architecture de processeur ciblรฉe de votre projet. (Code=MSB3270)
make: *** [chk/check.exe] Erreur 1

and running the test example on the README gives:

$ sdb
Welcome to the Mono soft debugger (sdb 1.4.5485.17430)
Type 'help' for a list of commands or 'quit' to exit

(sdb) r test.exe
Failed to connect to 'test.exe'

[1] : Windows 7, make 3.81, mono 3.3.0, msbuild version 4.0.30319.17929 , Microsoft .NET Framework, version 4.0.30319.18063

Support an aliases mapping

It would be nice to be able to map aliasesโ€”even a simple linefeed delimited file like so would be good:

so: step over
si: step in
sout: step out

Suspending after having stepped thru code does not work well

I was trying to set a break point after having stepped thru code. I used Ctrl-c. SDB told me teh process was supsended but did not give the usual prompt. Pressing Ctrl-C again gives a warning and the prompt. However any command i type in does not get executed by SDB.

Cannot debug fsharp program

Sorry for writing a question, but I couldn't figure this out, I'm trying to debug a fsharp program or a dotnet core application but I cannot get it working, I read this two issues:
#42
and
#51

But I always get the same result nothing, this is my setup:

fsharp/learn-fsharp/RpnCalculator via .NET 2.2.300 took 35m 3s
โžœ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.14.5
BuildVersion:	18F132

fsharp/learn-fsharp/RpnCalculator via .NET 2.2.300
โžœ sdb --version
Mono soft debugger (sdb) 1.6.7116.16617

fsharp/learn-fsharp/RpnCalculator via .NET 2.2.300
โžœ mono --version
Mono JIT compiler version 5.20.1.19 (2018-10/886c4901747 Tue Apr  9 12:37:29 EDT 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug
	Interpreter:   yes
	LLVM:          yes(600)
	Suspend:       hybrid
	GC:            sgen (concurrent by default)

fsharp/learn-fsharp/RpnCalculator via .NET 2.2.300
โžœ which mono
/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono

And then I create a fsharp file like:

functional-programming/fsharp/temp took 11s
โžœ cat Program.fs
namespace ABC
module DEF =
    let bar() =
        stdout.WriteLine("abc")

    let foo (str:string) =
        stdout.WriteLine(str)
        bar()

    [<EntryPointAttribute>]
    let main _ =
        let s = "Foo!"
        foo s
        stdout.WriteLine("callmekohei")
        0
functional-programming/fsharp/temp
โžœ fsharpc --debug+ Program.fs
Microsoft (R) F# Compiler version 4.1
Copyright (c) Microsoft Corporation. All Rights Reserved.

functional-programming/fsharp/temp took 3s
โžœ ls
FSharp.Core.dll Program.exe     Program.exe.mdb Program.fs

and then try to run sdb:

functional-programming/fsharp/temp
โžœ fsharpc --debug+ Program.fs
Microsoft (R) F# Compiler version 4.1
Copyright (c) Microsoft Corporation. All Rights Reserved.

functional-programming/fsharp/temp took 3s
โžœ ls
FSharp.Core.dll Program.exe     Program.exe.mdb Program.fs

functional-programming/fsharp/temp
โžœ sdb
Welcome to the Mono soft debugger (sdb 1.6.7116.16617)
Type 'help' for a list of commands or 'quit' to exit

(sdb) cfg s RuntimePrefix /Library/Frameworks/Mono.framework/Versions/Current/Commands/
'RuntimePrefix' = '/Library/Frameworks/Mono.framework/Versions/Current/Commands/' (was '/Library/Frameworks/Mono.framework/Versions/Current/Commands/')
(sdb) bp add func ABC.DEF.foo
Breakpoint '0' added for method 'ABC.DEF.foo'
(sdb) r Program.exe
Failed to connect to 'Program.exe'
(sdb)

I do not know what to do now, or where to go,

Instruction stepping steps multiple instructions

I'm not sure if this is a bug in this project or this one, but instruction single stepping (using step into instruction or step over instruction) works unreliably for me. Often, it will skip over multiple instructions instead. For example, here SDB skips an entire call to System.Type:GetTypeFromHandle and instead jumps into System.Reflection.Assembly.GetAssembly:

Inferior process '14779' ('CampRE.dll') started
Hit method breakpoint on 'CampRE.Program.Main'
#0 [0x00000000] CampRE.Program.Main (no source)
    nop
(sdb) disassemble
0x00000000    nop
0x00000001    ldtoken CampRE.Program
0x00000006    call Type System.Type:GetTypeFromHandle (RuntimeTypeHandle)
0x0000000B    call Assembly System.Reflection.Assembly:GetAssembly (Type)
0x00000010    callvirt String System.Reflection.Assembly:get_Location ()
0x00000015    call Byte[] System.IO.File:ReadAllBytes (String)
0x0000001A    stloc.0
0x0000001B    ldc.i4.0
0x0000001C    stloc.1
0x0000001D    br 0000013c
0x00000022    nop
0x00000023    call MD5 System.Security.Cryptography.MD5:Create ()
0x00000028    stloc.2
0x00000029    call Encoding System.Text.Encoding:get_ASCII ()
0x0000002E    ldstr "i="
0x00000033    ldloca.s 1
0x00000035    call String System.Int32:ToString ()
0x0000003A    call String System.String:Concat (String, String)
0x0000003F    callvirt Byte[] System.Text.Encoding:GetBytes (String)
0x00000044    stloc.3
(sdb) step into instruction
Inferior process '14779' ('CampRE.dll') resumed
Inferior process '14779' ('CampRE.dll') suspended
#0 [0x00000001] CampRE.Program.Main (no source)
    ldtoken CampRE.Program
(sdb) step into instruction
Inferior process '14779' ('CampRE.dll') resumed
Inferior process '14779' ('CampRE.dll') suspended
#0 [0x00000000] System.Reflection.Assembly.GetAssembly at /Users/builder/jenkins/workspace/build-package-osx-mono/2019-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.Reflection/Assembly.cs:462 (no source)
    ldarg.0
(sdb) backtrace
#0 [0x00000000] System.Reflection.Assembly.GetAssembly at /Users/builder/jenkins/workspace/build-package-osx-mono/2019-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.Reflection/Assembly.cs:462 (no source)
    ldarg.0
#1 [0x0000000B] CampRE.Program.Main (no source)
    call Assembly System.Reflection.Assembly:GetAssembly (Type)

Am I doing something wrong here, or is there any reason SDB might be behaving this way? The number of instructions it skips seems to be a random number (especially if the next instruction is a call or callvirt) as well so I'm not sure what's going on.

watch command displays duplicate

Hello! I'm callmekohei!

Problems summary

watch command displays duplicate

(sdb) watch
#0 's': string it = "aaa"
#0 's': string it = "aaa"

like this
untitled

Expected

watch command display properly.

(sdb) watch
#0 's': string it = "aaa"

Environment Information

sdb vrsion

$ sdb --version
Mono soft debugger (sdb) 1.5.6548.37600

OSX version

$ sw_vers 
ProductName:	Mac OS X
ProductVersion:	10.13.2
BuildVersion:	17C88

mono version

$ mono --version
Mono JIT compiler version 5.4.1.6 (tarball Mon Dec 11 14:59:42 GMT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen (concurrent by default)

I want to use addCommand (^_^)/

Hello! I'm callmekohei!

Problem

I can not use addCommand.

Expected behavior

I can use addCommand

Like this

[<Sealed; Command>]
type MyCommand() =
    inherit Command()
    override __.Names   = [|"mycmd"|]
    override __.Summary = "aaa bbb ccc"
    override __.Syntax  = "ddd eee fff"
    override __.Help    = "Help Help Help"
    override __.Process(args) =

        AddCommand<StepOverCommand>()  // <---- step over

        // run my code after running step over
        Log.Info("hello world")

work around

(sdb) do , step over , mycmd

reason

  1. Take time to input when we use sdb on command-line.

  2. Flickering screen

like this

untitled

Xamarin + sdb samples

Would it be possible to show how to debug xamarin apps with sdb?

Noticed this was Xamarin + sdb #8

Building an iOS or Android app should give relevant .exe and .mdb files but I'm not sure how to connect the dots to get it working end to end.

Thanks!

Invalid string to bash in env

I'm not really sure what is the reason but here's what's happening:

  1. cloned the repo
  2. make && sudo make install
  3. run sdb

Then I get the following

/usr/bin/env: โ€˜bash\rโ€™: No such file or directory

I'm using mono on Linux Mint and my suspicion is that this is a problem with line endings, given Windows's \r\n and Unix's \n.

Using sdb with Emacs GUD

Hi,

I would like to use sdb together with Emacs (25.1.1) in GUD mode. When I run sdb on the command line, the debugger starts up fine. However, when I start GUD with sdb as command, I see the following exception:

Welcome to the Mono soft debugger (sdb 1.5.6151.25963)
Type 'help' for a list of commands or 'quit' to exit

(sdb)  
Unhandled Exception:
System.DivideByZeroException: Attempted to divide by zero.
  at Mono.Terminal.LineEditor.UpdateHomeRow (System.Int32 screenpos) [0x00007] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Terminal.LineEditor.Render () [0x00091] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Terminal.LineEditor.InitText (System.String initial) [0x00023] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Terminal.LineEditor.Edit (System.String prompt, System.String initial) [0x0004a] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Debugger.Client.CommandLine.Run (System.Version ver, System.Boolean batch, System.Boolean rc, System.Collections.Generic.IEnumerable`1[T] commands, System.Collections.Generic.IEnumerable`1[T] files) [0x00188] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Debugger.Client.Program.Main (System.String[] args) [0x0014c] in <a502775e267945eaa32716c6aef8ad60>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.DivideByZeroException: Attempted to divide by zero.
  at Mono.Terminal.LineEditor.UpdateHomeRow (System.Int32 screenpos) [0x00007] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Terminal.LineEditor.Render () [0x00091] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Terminal.LineEditor.InitText (System.String initial) [0x00023] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Terminal.LineEditor.Edit (System.String prompt, System.String initial) [0x0004a] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Debugger.Client.CommandLine.Run (System.Version ver, System.Boolean batch, System.Boolean rc, System.Collections.Generic.IEnumerable`1[T] commands, System.Collections.Generic.IEnumerable`1[T] files) [0x00188] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Debugger.Client.Program.Main (System.String[] args) [0x0014c] in <a502775e267945eaa32716c6aef8ad60>:0 

Debugger exited abnormally with code 1

Unfortunately, there is not much information out there documenting this setup. Is there any way to make sbd and Emacs play nice with each other?

Thanks,

Karsten

Extra space after sdb prompt

Hi! There's a usability issue I'm having that's making it rather impossible to use sdb: the cursor has a bunch of spaces between it and the (sdb) prompt. This is a critical problem because if I arrow up, the space is not added and the characters displayed don't match up with the ones I'm editing.

Here is a screenshot of the misbehaviour, from konsole (though it's also shown up in alacritty):

image

image

I just built this sdb from the master branch today, 7a408a0. I'm running this mono version on Arch Linux:

dev/sdb - [master] ยป mono --version
Mono JIT compiler version 6.12.0 (makepkg/a22ed3f094e Tue Dec 22 06:01:50 PM -03 2020)
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 
        Interpreter:   yes
        LLVM:          supported, not enabled.
        Suspend:       hybrid
        GC:            sgen (concurrent by default)

drop sdb when resize window

Hello again! I'm callmekohei!

see also : mono/mono#6442 (comment)

Steps to Reproduce

  1. start vim8
  2. start sdb in vim8's terminal
  3. move window pane

like this

untitled

Current Behavior

drop mono debugger client

Expected Behavior

not drop mono debugger client

On which platforms did you notice this

[ -> ] macOS
[ ] Linux
[ ] Windows

macOS version

$ sw_vers 
ProductName:	Mac OS X
ProductVersion:	10.13.2
BuildVersion:	17C88

vim version

$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan  5 2018 05:32:36)
macOS version
Included patches: 1-1428
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    -gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          -toolbar
+cindent           +insert_expand     +path_extra        +user_commands
-clientserver      +job               +perl              +vertsplit
+clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           -python            +vreplace
+conceal           +linebreak         +python3           +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       -lua               +ruby              -X11
+dialog_con        +menu              +scrollbind        -xfontset
+diff              +mksession         +signs             -xim
+digraphs          +modify_fname      +smartindent       -xpm
-dnd               +mouse             +startuptime       -xsmp
-ebcdic            -mouseshape        +statusline        -xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              -mouse_gpm         +syntax            
+ex_extra          -mouse_jsbterm     +tag_binary        
+extra_search      +mouse_netterm     +tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: clang   -L.             -L /BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/libressl/lib -L/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/lib  -L/usr/local/lib -o vim        -lm  -lncurses -liconv -framework AppKit   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl  -L/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin -lpython3.6m -framework CoreFoundation  -lruby.2.3.0 -lobjc  

mono version

$ mono --version
Mono JIT compiler version 5.4.1.6 (tarball Mon Dec 11 14:59:42 GMT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen (concurrent by default)

Stacktrace

Welcome to the Mono soft debugger (sdb 1.5.6548.37600)
Type 'help' for a list of commands or 'quit' to exit

(sdb) Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) Mono.Debugger.Client.LibEdit.ReadLine (string) [0x00013] in <1cbda40764ea421d9f191fd773578
e5a>:0
  at Mono.Debugger.Client.CommandLine.Run (System.Version,bool,bool,System.Collections.Generic.IEnumerable`1<string>,System
.Collections.Generic.IEnumerable`1<string>) [0x001a7] in <1cbda40764ea421d9f191fd773578e5a>:0
  at Mono.Debugger.Client.Program.Main (string[]) [0x00173] in <1cbda40764ea421d9f191fd773578e5a>:0
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) [0x00057] in <1cbda40764ea42
1d9f191fd773578e5a>:0

Native stacktrace:

        0   mono                                0x00000001092e705e mono_handle_native_crash + 242
        1   mono                                0x000000010934619b altstack_handle_and_restore + 70
        2   ???                                 0xffffffffffffffff 0x0 + 18446744073709551615
        3   ???                                 0x00007faf354123b0 0x0 + 140390489465776
        4   libedit.3.dylib                     0x00007fff54dceb9e el_wgetc + 105
        5   libedit.3.dylib                     0x00007fff54dced53 el_wgets + 108
        6   libedit.3.dylib                     0x00007fff54dda995 el_gets + 37
        7   libedit.3.dylib                     0x00007fff54dcf7dd readline + 231
        8   ???                                 0x000000010e6d43d9 0x0 + 4537009113
        9   ???                                 0x0000000109729633 0x0 + 4453471795
        10  ???                                 0x000000010972984d 0x0 + 4453472333
        11  mono                                0x000000010925c183 mono_jit_runtime_invoke + 1264
        12  mono                                0x000000010940bb79 do_runtime_invoke + 88
        13  mono                                0x000000010940e815 do_exec_main_checked + 90
        14  mono                                0x00000001092b52a6 mono_jit_exec + 305
        15  mono                                0x00000001092b7638 mono_main + 8077
        16  mono                                0x000000010924e855 main + 245
        17  libdyld.dylib                       0x00007fff563e7115 start + 1
        18  ???                                 0x0000000000000003 0x0 + 3

Debug info from gdb:

(lldb) command source -s 0 '/tmp/mono-gdb-commands.vV7Gwz'
Executing commands in '/tmp/mono-gdb-commands.vV7Gwz'.
(lldb) process attach --pid 1594
Process 1594 stopped
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00007fff56537502 libsystem_kernel.dylib`__wait4 + 10
libsystem_kernel.dylib`__wait4:
->  0x7fff56537502 <+10>: jae    0x7fff5653750c            ; <+20>
    0x7fff56537504 <+12>: movq   %rax, %rdi
    0x7fff56537507 <+15>: jmp    0x7fff5652e0dd            ; cerror
    0x7fff5653750c <+20>: retq   
Target 0: (mono) stopped.

Executable module set to "/usr/local/bin/mono".
Architecture set to: x86_64h-apple-macosx.
(lldb) thread list
Process 1594 stopped
* thread #1: tid = 0xcc24, 0x00007fff56537502 libsystem_kernel.dylib`__wait4 + 10, name = 'tid_307', queue = 'com.apple.mai
n-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0xcc29, 0x00007fff56536cee libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
  thread #3: tid = 0xcc2a, 0x00007fff56536cee libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
  thread #4: tid = 0xcc2b, 0x00007fff5652d7fe libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'Finalizer'
  thread #5: tid = 0xcc2c, 0x00007fff56537562 libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #6: tid = 0xcc2d, 0x00007fff56537562 libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #7: tid = 0xcc30, 0x00007fff56537562 libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #8: tid = 0xcc31, 0x0000000000000000
  thread #9: tid = 0xcc39, 0x00007fff56538372 libsystem_kernel.dylib`poll + 10, name = 'tid_1a07'
(lldb) thread backtrace all
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00007fff56537502 libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x00000001092e70eb mono`mono_handle_native_crash + 383
    frame #2: 0x000000010934619b mono`altstack_handle_and_restore + 70
  frame #3: 0xffffffffffffffff 
  thread #2, name = 'SGen worker'
    frame #0: 0x00007fff56536cee libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff56673662 libsystem_pthread.dylib`_pthread_cond_wait + 732
    frame #2: 0x000000010946f07f mono`thread_func + 628
    frame #3: 0x00007fff566726c1 libsystem_pthread.dylib`_pthread_body + 340
    frame #4: 0x00007fff5667256d libsystem_pthread.dylib`_pthread_start + 377
    frame #5: 0x00007fff56671c5d libsystem_pthread.dylib`thread_start + 13
  thread #3, name = 'SGen worker'
    frame #0: 0x00007fff56536cee libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff56673662 libsystem_pthread.dylib`_pthread_cond_wait + 732
    frame #2: 0x000000010946f062 mono`thread_func + 599
    frame #3: 0x00007fff566726c1 libsystem_pthread.dylib`_pthread_body + 340
    frame #4: 0x00007fff5667256d libsystem_pthread.dylib`_pthread_start + 377
    frame #5: 0x00007fff56671c5d libsystem_pthread.dylib`thread_start + 13
  thread #4, name = 'Finalizer'
    frame #0: 0x00007fff5652d7fe libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x0000000109404aa6 mono`finalizer_thread + 293
    frame #2: 0x00000001093dfdc8 mono`start_wrapper + 605
    frame #3: 0x00007fff566726c1 libsystem_pthread.dylib`_pthread_body + 340
    frame #4: 0x00007fff5667256d libsystem_pthread.dylib`_pthread_start + 377
    frame #5: 0x00007fff56671c5d libsystem_pthread.dylib`thread_start + 13
  thread #5
    frame #0: 0x00007fff56537562 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff5667206a libsystem_pthread.dylib`_pthread_wqthread + 1035
    frame #2: 0x00007fff56671c4d libsystem_pthread.dylib`start_wqthread + 13
  thread #6
    frame #0: 0x00007fff56537562 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff5667206a libsystem_pthread.dylib`_pthread_wqthread + 1035
    frame #2: 0x00007fff56671c4d libsystem_pthread.dylib`start_wqthread + 13
  thread #7
    frame #0: 0x00007fff56537562 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff5667226f libsystem_pthread.dylib`_pthread_wqthread + 1552
    frame #2: 0x00007fff56671c4d libsystem_pthread.dylib`start_wqthread + 13
  thread #8
    frame #0: 0x0000000000000000
  thread #9, name = 'tid_1a07'
    frame #0: 0x00007fff56538372 libsystem_kernel.dylib`poll + 10
    frame #1: 0x000000010e5e5758 libMonoPosixHelper.dylib`Mono_Unix_UnixSignal_WaitAny + 612
    frame #2: 0x000000010e6d19af
(lldb) detach

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

(lldb) quit
Process 1594 detached

Additional breakpoint features

I frequently use breakpoints, coupled with expression evaluation features, in other debuggers to alter control flow. I was trying to do the same thing in SDB but couldn't figure out how to do soโ€“I'm not sure if SDB has these features or if I just can't find them. One way I do something like this is by setting breakpoints on individual instructions and then evaluating expressions (to change condition variables) and resuming execution. Does SDB support doing things like this? (Specifically, can I set a breakpoint on a specific instruction in a method and add debugger commands to it that run whenever it gets hit?)

Won't compile using parallel make (-j9)

I detected this while adding mono/sdb to my buildroot setup. It seems that there's some dependency problem if make is executed using multiple jobs (HEAD: b8b3296):

[tmp] $git clone https://github.com/mono/sdb.git
Cloning into 'sdb'...
remote: Counting objects: 1009, done.
remote: Total 1009 (delta 0), reused 0 (delta 0), pack-reused 1009
Receiving objects: 100% (1009/1009), 273.91 KiB | 345.00 KiB/s, done.
Resolving deltas: 100% (747/747), done.
[tmp] $cd sdb/
>>> entered git repo 'sdb.git' <<<
[sdb] (master) $git submodule init
Submodule 'dep/cecil' (git://github.com/mono/cecil.git) registered for path 'dep/cecil'
Submodule 'dep/debugger-libs' (git://github.com/mono/debugger-libs) registered for path 'dep/debugger-libs'
Submodule 'dep/nrefactory' (git://github.com/icsharpcode/NRefactory.git) registered for path 'dep/nrefactory'
[sdb] (master) $git submodule update
Cloning into '/tmp/sdb/dep/cecil'...
Cloning into '/tmp/sdb/dep/debugger-libs'...
Cloning into '/tmp/sdb/dep/nrefactory'...
Submodule path 'dep/cecil': checked out 'cd2ff63081bd9f65cb293689fa9697cf25ae8c95'
Submodule path 'dep/debugger-libs': checked out '4a74b2cc980df13e5c4076266e66d305ada41cb3'
Submodule path 'dep/nrefactory': checked out '1463cf299d05a80d1056ad6608c375688629f006'
[sdb] (master) $make -j9
cd dep/debugger-libs && xbuild /nologo /property:Configuration=net_4_0_Debug /verbosity:quiet debugger-libs.sln
cd dep/debugger-libs && xbuild /nologo /property:Configuration=net_4_0_Debug /verbosity:quiet debugger-libs.sln
cd dep/debugger-libs && xbuild /nologo /property:Configuration=net_4_0_Debug /verbosity:quiet debugger-libs.sln
cd dep/debugger-libs && xbuild /nologo /property:Configuration=net_4_0_Debug /verbosity:quiet debugger-libs.sln
cd dep/debugger-libs && xbuild /nologo /property:Configuration=net_4_0_Debug /verbosity:quiet debugger-libs.sln
cd dep/debugger-libs && xbuild /nologo /property:Configuration=net_4_0_Debug /verbosity:quiet debugger-libs.sln
cd dep/debugger-libs && xbuild /nologo /property:Configuration=net_4_0_Debug /verbosity:quiet debugger-libs.sln
mkdir -p bin
mkdir -p bin
cp sdb.exe.config bin/sdb.exe.config
sed -e s+__LIB_PATH_EXTRA__+/../lib/sdb+ -e s+__MONO_OPTIONS_EXTRA__+--debug+ sdb.in > bin/sdb
mkdir -p bin
chmod +x bin/sdb
sed -e s+__LIB_PATH_EXTRA__++ -e s+__MONO_OPTIONS_EXTRA__+--debug+ sdb.in > bin/sdb-dev
chmod +x bin/sdb-dev
debugger-libs.sln: error : /tmp/sdb/dep/debugger-libs/debugger-libs.sln: Unexpected end of file while parsing Name has occurred. Line
648, position 168.
debugger-libs.sln: error : Could not find file "/tmp/sdb/dep/debugger-libs/debugger-libs.sln.proj".

Unhandled Exception:
System.IO.FileNotFoundException: Could not find file "/tmp/sdb/dep/debugger-libs/debugger-libs.sln.proj".
File name: '/tmp/sdb/dep/debugger-libs/debugger-libs.sln.proj'
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share,
System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0021a] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share,
System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath,
System.Boolean checkHost) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileSha
re,int,System.IO.FileOptions,string,bool,bool,bool)
  at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks,
 System.Int32 bufferSize, System.Boolean checkHost) [0x00079] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks,
 System.Int32 bufferSize) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.IO.StreamReader..ctor (System.String path, System.Boolean detectEncodingFromByteOrderMarks) [0x0000d] in <dca3b561b8ad4f9f
b10141d81b39ff45>:0
  at System.IO.StreamReader..ctor (System.String path) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at (wrapper remoting-invoke-with-check) System.IO.StreamReader:.ctor (string)
  at Microsoft.Build.BuildEngine.Project.Load (System.String projectFileName, Microsoft.Build.BuildEngine.ProjectLoadSettings settings
) [0x000f4] in <29ed228a0f8e4d039e4eda81cff6d54b>:0
  at Microsoft.Build.BuildEngine.Project.Load (System.String projectFileName) [0x00000] in <29ed228a0f8e4d039e4eda81cff6d54b>:0
  at Microsoft.Build.BuildEngine.Engine.BuildProjectFileInternal (System.String projectFile, System.String[] targetNames, Microsoft.Bu
ild.BuildEngine.BuildPropertyGroup globalProperties, System.Collections.IDictionary targetOutputs, Microsoft.Build.BuildEngine.BuildSe
ttings buildFlags, System.String toolsVersion) [0x000b9] in <29ed228a0f8e4d039e4eda81cff6d54b>:0
  at Microsoft.Build.BuildEngine.Engine.BuildProjectFile (System.String projectFile, System.String[] targetNames, Microsoft.Build.Buil
dEngine.BuildPropertyGroup globalProperties, System.Collections.IDictionary targetOutputs, Microsoft.Build.BuildEngine.BuildSettings b
uildFlags, System.String toolsVersion) [0x00008] in <29ed228a0f8e4d039e4eda81cff6d54b>:0
make: *** [Makefile:163: bin/Mono.Cecil.dll] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Makefile:163: bin/ICSharpCode.NRefactory.dll] Error 1
debugger-libs.sln: error : Could not find file "/tmp/sdb/dep/debugger-libs/debugger-libs.sln.proj".

Unhandled Exception:
System.IO.FileNotFoundException: Could not find file "/tmp/sdb/dep/debugger-libs/debugger-libs.sln.proj".
File name: '/tmp/sdb/dep/debugger-libs/debugger-libs.sln.proj'
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share,
System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0021a] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share,
System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath,
System.Boolean checkHost) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileSha
re,int,System.IO.FileOptions,string,bool,bool,bool)
  at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks,
 System.Int32 bufferSize, System.Boolean checkHost) [0x00079] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks,
 System.Int32 bufferSize) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.IO.StreamReader..ctor (System.String path, System.Boolean detectEncodingFromByteOrderMarks) [0x0000d] in <dca3b561b8ad4f9f
b10141d81b39ff45>:0
  at System.IO.StreamReader..ctor (System.String path) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at (wrapper remoting-invoke-with-check) System.IO.StreamReader:.ctor (string)
  at Microsoft.Build.BuildEngine.Project.Load (System.String projectFileName, Microsoft.Build.BuildEngine.ProjectLoadSettings settings
) [0x000f4] in <29ed228a0f8e4d039e4eda81cff6d54b>:0
  at Microsoft.Build.BuildEngine.Project.Load (System.String projectFileName) [0x00000] in <29ed228a0f8e4d039e4eda81cff6d54b>:0
  at Microsoft.Build.BuildEngine.Engine.BuildProjectFileInternal (System.String projectFile, System.String[] targetNames, Microsoft.Bu
ild.BuildEngine.BuildPropertyGroup globalProperties, System.Collections.IDictionary targetOutputs, Microsoft.Build.BuildEngine.BuildSe
ttings buildFlags, System.String toolsVersion) [0x000b9] in <29ed228a0f8e4d039e4eda81cff6d54b>:0
  at Microsoft.Build.BuildEngine.Engine.BuildProjectFile (System.String projectFile, System.String[] targetNames, Microsoft.Build.Buil
dEngine.BuildPropertyGroup globalProperties, System.Collections.IDictionary targetOutputs, Microsoft.Build.BuildEngine.BuildSettings b
uildFlags, System.String toolsVersion) [0x00008] in <29ed228a0f8e4d039e4eda81cff6d54b>:0
make: *** [Makefile:163: bin/ICSharpCode.NRefactory.CSharp.dll] Error 1
debugger-libs.sln: error : /tmp/sdb/dep/debugger-libs/debugger-libs.sln: There is an unclosed literal string. Line 795, position 32.
debugger-libs.sln: error : Could not find file "/tmp/sdb/dep/debugger-libs/debugger-libs.sln.proj".

Unhandled Exception:
System.IO.FileNotFoundException: Could not find file "/tmp/sdb/dep/debugger-libs/debugger-libs.sln.proj".
File name: '/tmp/sdb/dep/debugger-libs/debugger-libs.sln.proj'
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share,
System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0021a] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share,
System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath,
System.Boolean checkHost) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileSha
re,int,System.IO.FileOptions,string,bool,bool,bool)
  at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks,
 System.Int32 bufferSize, System.Boolean checkHost) [0x00079] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.IO.StreamReader..ctor (System.String path, System.Boolean detectEncodingFromByteOrderMarks) [0x0000d] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at System.IO.StreamReader..ctor (System.String path) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
  at (wrapper remoting-invoke-with-check) System.IO.StreamReader:.ctor (string)
  at Microsoft.Build.BuildEngine.Project.Load (System.String projectFileName, Microsoft.Build.BuildEngine.ProjectLoadSettings settings) [0x000f4] in <29ed228a0f8e4d039e4eda81cff6d54b>:0
  at Microsoft.Build.BuildEngine.Project.Load (System.String projectFileName) [0x00000] in <29ed228a0f8e4d039e4eda81cff6d54b>:0
  at Microsoft.Build.BuildEngine.Engine.BuildProjectFileInternal (System.String projectFile, System.String[] targetNames, Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties, System.Collections.IDictionary targetOutputs, Microsoft.Build.BuildEngine.BuildSettings buildFlags, System.String toolsVersion) [0x000b9] in <29ed228a0f8e4d039e4eda81cff6d54b>:0
  at Microsoft.Build.BuildEngine.Engine.BuildProjectFile (System.String projectFile, System.String[] targetNames, Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties, System.Collections.IDictionary targetOutputs, Microsoft.Build.BuildEngine.BuildSettings buildFlags, System.String toolsVersion) [0x00008] in <29ed228a0f8e4d039e4eda81cff6d54b>:0
make: *** [Makefile:163: bin/Mono.Debugger.Soft.dll] Error 1
make: *** [Makefile:163: bin/Mono.Debugging.Soft.dll] Error 1
TypeSystem/IType.cs(50,19): warning CS1580: Invalid type for parameter `1' in XML comment cref attribute `IEquatable<IType>.Equals(IType)'
TypeSystem/IType.cs(50,19): warning CS1574: XML comment on `ICSharpCode.NRefactory.TypeSystem.IType' has cref attribute `IEquatable<IType>.Equals(IType)' that could not be resolved
TypeSystem/ReflectionHelper.cs(211,32): warning CS1574: XML comment on `ICSharpCode.NRefactory.TypeSystem.ReflectionHelper.ParseReflectionName(string)' has cref attribute `FullTypeName(string)' that could not be resolved
TypeSystem/IType.cs(50,19): warning CS1580: Invalid type for parameter `1' in XML comment cref attribute `IEquatable<IType>.Equals(IType)'
TypeSystem/IType.cs(50,19): warning CS1574: XML comment on `ICSharpCode.NRefactory.TypeSystem.IType' has cref attribute `IEquatable<IType>.Equals(IType)' that could not be resolved
TypeSystem/ReflectionHelper.cs(211,32): warning CS1574: XML comment on `ICSharpCode.NRefactory.TypeSystem.ReflectionHelper.ParseReflectionName(string)' has cref attribute `FullTypeName(string)' that could not be resolved
TypeSystem/Implementation/DefaultUnresolvedTypeParameter.cs(41,15): warning CS0649: Field `ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultUnresolvedTypeParameter.flags' is never assigned to, and will always have its default value
TypeSystem/Implementation/DefaultUnresolvedTypeParameter.cs(41,15): warning CS0649: Field `ICSharpCode.NRefactory.TypeSystem.Implementation.DefaultUnresolvedTypeParameter.flags' is never assigned to, and will always have its default value
Main.cs(51,12): warning CS0219: The variable `dec' is assigned but its value is never used
Main.cs(57,6): warning CS0219: The variable `c' is assigned but its value is never used
Main.cs(58,6): warning CS0219: The variable `b' is assigned but its value is never used
Main.cs(59,6): warning CS0219: The variable `a' is assigned but its value is never used
Main.cs(61,22): warning CS0219: The variable `withDisplayString' is assigned but its value is never used
Main.cs(62,14): warning CS0219: The variable `withProxy' is assigned but its value is never used
Main.cs(63,17): warning CS0219: The variable `withToString' is assigned but its value is never used
Main.cs(65,12): warning CS0219: The variable `numbersArrays' is assigned but its value is never used
Main.cs(66,12): warning CS0219: The variable `numbersMulti' is assigned but its value is never used
Main.cs(68,8): warning CS0219: The variable `dict' is assigned but its value is never used
Main.cs(69,8): warning CS0219: The variable `dictArray' is assigned but its value is never used
Main.cs(70,8): warning CS0219: The variable `thing' is assigned but its value is never used
Main.cs(71,8): warning CS0219: The variable `done' is assigned but its value is never used
Main.cs(78,10): warning CS0219: The variable `c' is assigned but its value is never used
Main.cs(44,17): warning CS0414: The private field `UnitTests.TestApp.MainClass.staticString' is assigned but its value is never used
Main.cs(45,10): warning CS0414: The private field `UnitTests.TestApp.MainClass.someString' is assigned but its value is never used
Main.cs(46,12): warning CS0414: The private field `UnitTests.TestApp.MainClass.numbers' is assigned but its value is never used
Main.cs(51,12): warning CS0219: The variable `dec' is assigned but its value is never used
Main.cs(57,6): warning CS0219: The variable `c' is assigned but its value is never used
Main.cs(58,6): warning CS0219: The variable `b' is assigned but its value is never used
Main.cs(59,6): warning CS0219: The variable `a' is assigned but its value is never used
Main.cs(61,22): warning CS0219: The variable `withDisplayString' is assigned but its value is never used
Main.cs(62,14): warning CS0219: The variable `withProxy' is assigned but its value is never used
Main.cs(63,17): warning CS0219: The variable `withToString' is assigned but its value is never used
Main.cs(65,12): warning CS0219: The variable `numbersArrays' is assigned but its value is never used
Main.cs(66,12): warning CS0219: The variable `numbersMulti' is assigned but its value is never used
Main.cs(68,8): warning CS0219: The variable `dict' is assigned but its value is never used
Main.cs(69,8): warning CS0219: The variable `dictArray' is assigned but its value is never used
Main.cs(70,8): warning CS0219: The variable `thing' is assigned but its value is never used
Main.cs(71,8): warning CS0219: The variable `done' is assigned but its value is never used
Main.cs(78,10): warning CS0219: The variable `c' is assigned but its value is never used
Main.cs(44,17): warning CS0414: The private field `UnitTests.TestApp.MainClass.staticString' is assigned but its value is never used
Main.cs(45,10): warning CS0414: The private field `UnitTests.TestApp.MainClass.someString' is assigned but its value is never used
Main.cs(46,12): warning CS0414: The private field `UnitTests.TestApp.MainClass.numbers' is assigned but its value is never used
Mono.Debugger.Soft/Connection.cs(1500,14): warning CS0219: The variable `watch' is assigned but its value is never used
Mono.Debugger.Soft/Connection.cs(1500,14): warning CS0219: The variable `watch' is assigned but its value is never used
Mono.Debugger.Soft/Connection.cs(409,14): warning CS0169: The private field `Mono.Debugger.Soft.Connection.ConnectionId' is never used
Mono.Debugger.Soft/VirtualMachine.cs(157,10): warning CS0414: The private field `Mono.Debugger.Soft.VirtualMachine.threadCacheLocker' is assigned but its value is never used
Mono.Debugger.Soft/Connection.cs(409,14): warning CS0169: The private field `Mono.Debugger.Soft.Connection.ConnectionId' is never used
Mono.Debugger.Soft/VirtualMachine.cs(157,10): warning CS0414: The private field `Mono.Debugger.Soft.VirtualMachine.threadCacheLocker' is assigned but its value is never used
Parser/mcs/cs-tokenizer.cs(1712,9): warning CS0219: The variable `hasLeadingDot' is assigned but its value is never used
Parser/mcs/cs-tokenizer.cs(3215,4): warning CS0162: Unreachable code detected
Parser/mcs/cs-tokenizer.cs(1712,9): warning CS0219: The variable `hasLeadingDot' is assigned but its value is never used
Parser/mcs/cs-tokenizer.cs(3215,4): warning CS0162: Unreachable code detected
Completion/CSharpCompletionEngine.cs(886,17): warning CS0219: The variable `parameterDefinition' is assigned but its value is never used
Completion/CSharpCompletionEngine.cs(886,17): warning CS0219: The variable `parameterDefinition' is assigned but its value is never used
Mono.Debugging.Evaluation/NRefactoryExpressionEvaluatorVisitor.cs(1097,63): warning CS0618: `ICSharpCode.NRefactory.CSharp.EmptyExpression' is obsolete: `This class is obsolete. Remove all referencing code.'
Mono.Debugging.Evaluation/NRefactoryExpressionEvaluatorVisitor.cs(1097,63): warning CS0618: `ICSharpCode.NRefactory.CSharp.EmptyExpression' is obsolete: `This class is obsolete. Remove all referencing code.'
mkdir -p bin
cp dep/nrefactory/bin/Debug/ICSharpCode.NRefactory.dll \
	bin/ICSharpCode.NRefactory.dll
cp dep/nrefactory/bin/Debug/ICSharpCode.NRefactory.CSharp.dll \
	bin/ICSharpCode.NRefactory.CSharp.dll
cp dep/cecil/bin/net_4_0_Debug/Mono.Cecil.dll \
	bin/Mono.Cecil.dll
cp dep/cecil/bin/net_4_0_Debug/Mono.Cecil.Mdb.dll \
	bin/Mono.Cecil.Mdb.dll
cp dep/debugger-libs/Mono.Debugger.Soft/bin/Debug/Mono.Debugger.Soft.dll \
	bin/Mono.Debugger.Soft.dll
cp dep/debugger-libs/Mono.Debugging/bin/Debug/Mono.Debugging.dll \
	bin/Mono.Debugging.dll
cp dep/debugger-libs/Mono.Debugging.Soft/bin/Debug/Mono.Debugging.Soft.dll \
	bin/Mono.Debugging.Soft.dll
mkdir -p bin
cp dep/nrefactory/bin/Debug/ICSharpCode.NRefactory.dll \
	bin/ICSharpCode.NRefactory.dll
cp dep/nrefactory/bin/Debug/ICSharpCode.NRefactory.CSharp.dll \
	bin/ICSharpCode.NRefactory.CSharp.dll
cp dep/cecil/bin/net_4_0_Debug/Mono.Cecil.dll \
	bin/Mono.Cecil.dll
cp dep/cecil/bin/net_4_0_Debug/Mono.Cecil.Mdb.dll \
	bin/Mono.Cecil.Mdb.dll
cp dep/debugger-libs/Mono.Debugger.Soft/bin/Debug/Mono.Debugger.Soft.dll \
	bin/Mono.Debugger.Soft.dll
cp dep/debugger-libs/Mono.Debugging/bin/Debug/Mono.Debugging.dll \
	bin/Mono.Debugging.dll
cp dep/debugger-libs/Mono.Debugging.Soft/bin/Debug/Mono.Debugging.Soft.dll \
	bin/Mono.Debugging.Soft.dll```


Workaround in buildroot package: `MONO_SDB_MAKE=$(MAKE1)`

Cannot build on Linux Mint

I must be doing something wrong, but I'm new to Mono and can't seem to get sdb to build.

I've tried googling for the error messages, but come up empty. Am I missing some kind of dependency?

$ git clone https://github.com/mono/sdb.git
$ cd sdb
$ git submodule update --init --recursive
$ make

cd dep/debugger-libs && nuget restore debugger-libs.sln && msbuild /nologo /property:Configuration=Debug /verbosity:quiet debugger-libs.sln
WARNING: Error: SendFailure (Error writing headers)
WARNING: Error: SendFailure (Error writing headers)
WARNING: Error: SendFailure (Error writing headers)
WARNING: Error: SendFailure (Error writing headers)
WARNING: Error: SendFailure (Error writing headers)
WARNING: Error: SendFailure (Error writing headers)
WARNING: Error: SendFailure (Error writing headers)
WARNING: Error: SendFailure (Error writing headers)
WARNING: Error: SendFailure (Error writing headers)
WARNING: Error: SendFailure (Error writing headers)
WARNING: Error: SendFailure (Error writing headers)
WARNING: Error: SendFailure (Error writing headers)
WARNING: Error: SendFailure (Error writing headers)
Unable to find version '0.10.0-beta6' of package 'Mono.Cecil'.
Unable to find version '1.3.2' of package 'Microsoft.CodeAnalysis'.
Unable to find version '1.1.0' of package 'Microsoft.CodeAnalysis.Analyzers'.
Unable to find version '1.3.2' of package 'Microsoft.CodeAnalysis.Common'.
Unable to find version '1.3.2' of package 'Microsoft.CodeAnalysis.CSharp'.
Unable to find version '1.3.2' of package 'Microsoft.CodeAnalysis.CSharp.Workspaces'.
Unable to find version '1.3.2' of package 'Microsoft.CodeAnalysis.VisualBasic'.
Unable to find version '1.3.2' of package 'Microsoft.CodeAnalysis.VisualBasic.Workspaces'.
Unable to find version '1.3.2' of package 'Microsoft.CodeAnalysis.Workspaces.Common'.
Unable to find version '1.0.27' of package 'Microsoft.Composition'.
Unable to find version '1.3.1' of package 'System.Collections.Immutable'.
Unable to find version '1.4.2' of package 'System.Reflection.Metadata'.
Unable to find version '4.3.1' of package 'System.ValueTuple'.
Makefile:178: recipe for target 'bin/ICSharpCode.NRefactory.dll' failed
make: *** [bin/ICSharpCode.NRefactory.dll] Error 1

I'm running Linux Mint 18 64-bit, if that helps.

Readline() not work well (sdb plugin)

Hello! I'm callmekohei!

screen shot 2018-01-13 at 14 44 25

Problesm

Readline() not work well.

like this

(sdb) mycmd foo.exe
....
(sdb)                  // <--- I can not watch input strings (^_^;;;

repro

  1. wirte code
open Mono.Debugger.Client
open Mono.Debugging.Client

open System.IO

[<Sealed; Command>]
type MyCommand() =
    inherit Command()
    override __.Names   = [|"mycmd"|]
    override __.Summary = "aaa bbb ccc"
    override __.Syntax  = "ddd eee fff"
    override __.Help    = "Help Help Help"
    override __.Process(args) =

        let file = new FileInfo(args)
        Debugger.Run(file)

        let width = System.Console.WindowWidth
        Log.Info(String.replicate width "โ”€" )

02 compile and move dll

$ fsharpc -a -r:$(dirname $(which sdb))/../lib/sdb/sdb.exe test.fsx
$ mv test.dll ../.sdb/

03 launch sdb and run

$ sdb
(sdb) mycmd foo.exe
...
(sdb)                  // <--- I can not watch input strings (^_^;;;

Fails to build from the source

With e6f697f and fresh update of submodules I get this.

matej@mitmanek: sdb (master)$ make
mkdir -p bin
cp LICENSE bin/LICENSE
mkdir -p bin
cp README.md bin/README
cd dep/debugger-libs && xbuild /verbosity:quiet /property:Configuration=net_4_0_Debug debugger-libs.sln
XBuild Engine Version 2.10.8.0
Mono, Version 2.10.8.0
Copyright (C) Marek Sieradzki 2005-2008, Novell 2008-2011.
Editor/IDocument.cs(98,30): warning CS0419: Ambiguous reference in cref attribute `GetOffset'. Assuming `ICSharpCode.NRefactory.Editor.IDocument.GetOffset(int, int)' but other overloads including `ICSharpCode.NRefactory.Editor.IDocument.GetOffset(ICSharpCode.NRefactory.TextLocation)' have also matched
PatternMatching/INode.cs(51,37): warning CS1574: XML comment on `ICSharpCode.NRefactory.PatternMatching.PatternExtensions.Match(this ICSharpCode.NRefactory.PatternMatching.INode, ICSharpCode.NRefactory.PatternMatching.INode)' has cref attribute `PatternMatching.Match.Success' that could not be resolved
TextLocation.cs(35,23): warning CS0419: Ambiguous reference in cref attribute `Editor.IDocument.GetOffset'. Assuming `ICSharpCode.NRefactory.Editor.IDocument.GetOffset(int, int)' but other overloads including `ICSharpCode.NRefactory.Editor.IDocument.GetOffset(ICSharpCode.NRefactory.TextLocation)' have also matched
TypeSystem/FullTypeName.cs(87,24): warning CS0419: Ambiguous reference in cref attribute `ReflectionHelper.ParseReflectionName'. Assuming `ICSharpCode.NRefactory.TypeSystem.ReflectionHelper.ParseReflectionName(string)' but other overloads including `ICSharpCode.NRefactory.TypeSystem.ReflectionHelper.ParseReflectionName(string, ref int)' have also matched
TypeSystem/INamedElement.cs(59,24): warning CS0419: Ambiguous reference in cref attribute `ReflectionHelper.ParseReflectionName'. Assuming `ICSharpCode.NRefactory.TypeSystem.ReflectionHelper.ParseReflectionName(string)' but other overloads including `ICSharpCode.NRefactory.TypeSystem.ReflectionHelper.ParseReflectionName(string, ref int)' have also matched
TypeSystem/IType.cs(50,26): warning CS1584: XML comment on `ICSharpCode.NRefactory.TypeSystem.IType' has syntactically incorrect cref attribute `IEquatable{IType}.Equals(IType)'
TypeSystem/IType.cs(319,38): warning CS1580: Invalid type for parameter `1' in XML comment cref attribute `GetMethods(Predicate{IUnresolvedMethod}, GetMemberOptions)'
TypeSystem/TypeKind.cs(61,17): warning CS1580: Invalid type for parameter `1' in XML comment cref attribute `IType.GetNestedTypes(Predicate{ITypeDefinition}, GetMemberOptions)'
TypeSystem/SpecialType.cs(50,52): warning CS1580: Invalid type for parameter `1' in XML comment cref attribute `IType.GetNestedTypes(Predicate{ITypeDefinition}, GetMemberOptions)'
Main.cs(51,33): warning CS0219: The variable `dec' is assigned but its value is never used
Main.cs(57,27): warning CS0219: The variable `c' is assigned but its value is never used
Main.cs(58,27): warning CS0219: The variable `b' is assigned but its value is never used
Main.cs(59,27): warning CS0219: The variable `a' is assigned but its value is never used
Main.cs(61,43): warning CS0219: The variable `withDisplayString' is assigned but its value is never used
Main.cs(62,35): warning CS0219: The variable `withProxy' is assigned but its value is never used
Main.cs(63,38): warning CS0219: The variable `withToString' is assigned but its value is never used
Main.cs(65,33): warning CS0219: The variable `numbersArrays' is assigned but its value is never used
Main.cs(66,33): warning CS0219: The variable `numbersMulti' is assigned but its value is never used
Main.cs(68,29): warning CS0219: The variable `dict' is assigned but its value is never used
Main.cs(69,29): warning CS0219: The variable `dictArray' is assigned but its value is never used
Main.cs(70,29): warning CS0219: The variable `thing' is assigned but its value is never used
Main.cs(71,29): warning CS0219: The variable `done' is assigned but its value is never used
Main.cs(78,31): warning CS0219: The variable `c' is assigned but its value is never used
Main.cs(44,31): warning CS0414: The private field `UnitTests.TestApp.MainClass.staticString' is assigned but its value is never used
Main.cs(45,24): warning CS0414: The private field `UnitTests.TestApp.MainClass.someString' is assigned but its value is never used
Main.cs(46,26): warning CS0414: The private field `UnitTests.TestApp.MainClass.numbers' is assigned but its value is never used
Refactoring/Script.cs(110,45): warning CS0419: Ambiguous reference in cref attribute `Replace'. Assuming `ICSharpCode.NRefactory.CSharp.Refactoring.Script.Replace(int, int, string)' but other overloads including `ICSharpCode.NRefactory.CSharp.Refactoring.Script.Replace(ICSharpCode.NRefactory.CSharp.AstNode, ICSharpCode.NRefactory.CSharp.AstNode)' have also matched
IndentEngine/CSharpIndentEngine.cs(229,31): warning CS0419: Ambiguous reference in cref attribute `char.IsWhiteSpace'. Assuming `char.IsWhiteSpace(char)' but other overloads including `char.IsWhiteSpace(string, int)' have also matched
Parser/mcs/cs-tokenizer.cs(1719,30): warning CS0219: The variable `hasLeadingDot' is assigned but its value is never used
Parser/mcs/cs-tokenizer.cs(3180,39): warning CS0162: Unreachable code detected
Resolver/ResolveVisitor.cs(576,37): warning CS0219: The variable `nsName' is assigned but its value is never used
Completion/CSharpCompletionEngine.cs(886,80): warning CS0219: The variable `parameterDefinition' is assigned but its value is never used
Mono.Debugging.Evaluation/NRefactoryExpressionEvaluatorVisitor.cs(1073,61): warning CS0618: `ICSharpCode.NRefactory.CSharp.EmptyExpression' is obsolete: `This class is obsolete. Remove all referencing code.'
SoftDebuggerSession.cs(56,45): error CS0433: The imported type `Mono.CompilerServices.SymbolWriter.MonoSymbolFile' is defined multiple times
make: *** [bin/ICSharpCode.NRefactory.dll] Error 1
matej@mitmanek: sdb (master)$

Implement decompilation

Ideally, we'd use ICSharpCode.Decompiler if/when it's separated into its own Git repository.

Failure to inspect global variables while suspended in unmanaged

public static void Main (string[] args) { while (true) Thread.Sleep (1000); }
Running this code under sdb and forcing a stop (Ctrl C). If we are in the top frame we fail to inspect global variables ex : print System.Environment.CommandLine. Failing with Result is unrepresentable (Unknown, ReadOnly)

Probably unrelated, I can also get exceptions Mono.Debugger.Soft.VMNotSuspendedException: The vm is not suspended. when suspended in other unmanaged code (like Monitor.Enter)

Create a csproj/sln file

I think there should be a csproj/sln file associated with this project so that tools such as omnisharp can be used for code completion.

Stdout in sdb plugin

Hello, I'm callmekohei!

Problem

I want to display app's stdout in sdb plugin.

code

open Mono.Debugger.Client
open Mono.Debugging.Client

open System.IO

[<Sealed; Command>]
type MyCommand() =
    inherit Command()
    override __.Names   = [|"mycmd"|]
    override __.Summary = "aaa bbb ccc"
    override __.Syntax  = "ddd eee fff"
    override __.Help    = "Help Help Help"
    override __.Process(args) =

    Log.Info("-----------------")

    /// I want to display app's stdout!
    ????

    Log.Info("-----------------")

I'm happy to have a tip (^_^)/

Cannot use `make` to build sdb library [Question]

Hi,
In the README.md you write:

First, clone the submodules:
$ git submodule update --init --recursive
To build, run:
$ make

I have problems running the make - command prompt says the make command doesn't exist.
Perhaps I am missing something fundamental, would be appreciated if someone could help me so I can use the debuggin tools.
Thanks in advance,
Alexander

Is it possible to debug NUnit tests?

I tried to do so under Ubuntu with the following command:

sdb "args debug-test.dll" "run nunit3-console.exe"

I put a System.Diagnostics.Debugger.Break() inside a test, but it does not break there. NUnit runs successfully to the end instead. I surely missed something here or isn't it possible at all?

Can I change a variable value?

Hello! I'm callmekohei!

Problems summary

So I want to change a valiable value daynamically.

Repro step

sample9$ cat foo.cs 
using System;
namespace HelloWorld
{
    class Hello
    {
        static void Main()
        {
            string s = "Hello World!";
            Console.WriteLine(s);

        }
    }
}

sample9$ mcs -debug foo.cs 

sample9$ sdb 'run foo.exe'
Welcome to the Mono soft debugger (sdb 1.5.6548.37600)
Type 'help' for a list of commands or 'quit' to exit

Inferior process '4040' ('foo.exe') started
Hello World!
Inferior process '4040' ('foo.exe') exited with code '0'

(sdb) bp add at foo.cs 8
Breakpoint '0' added at '/Users/callmekohei/tmp/sample9/foo.cs:8'

(sdb) r
Inferior process '4041' ('foo.exe') started
Hit breakpoint at '/Users/callmekohei/tmp/sample9/foo.cs:8'
#0 [0x00000001] HelloWorld.Hello.Main at /Users/callmekohei/tmp/sample9/foo.cs:8
            string s = "Hello World!";

(sdb) env set s abc

(sdb) env
's' = 'abc'

(sdb) s
Inferior process '4041' ('foo.exe') resumed
Inferior process '4041' ('foo.exe') suspended
#0 [0x00000007] HelloWorld.Hello.Main at /Users/callmekohei/tmp/sample9/foo.cs:9
            Console.WriteLine(s);

(sdb) p s
string it = "Hello World!"

(sdb) kill
Inferior process '4041' ('foo.exe') exited with code '0'

(sdb) q
Bye

sample9$ 

Expected

(sdb) p s
string it = "Hello World!"

(sdb) env set s abc
(sdb) env 
's' = 'abc'

(sdb) p s
string it = "abc"

Actual

(sdb) p s
string it = "Hello World!"

(sdb) env set s abc
(sdb) env 
's' = 'abc'

(sdb) p s
string it = "abc"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.