[Mono-dev] How to get mdb to work as installed with the Mono 1.1.12 Linux installer

Hans Kratz kratz at omnicore.com
Wed Dec 21 12:42:20 EST 2005


I tried to use mdb for some Mono.Debugger library testing and 
encountered some some problems with the way it is shipped in the Mono 
1.1.12 Linux installer.

I used the installer to install mono in my home directory on Debian 

The problems:

1) mdb does not start.

hans at gna:~$ cat ~/mono-1.1.12/bin/mdb
mono --debug /usr/lib/mono/1.0/mdb.exe $*

As you can see the assembly path is wrong causing mdb to fail on 
startup. Furthermore exec should be used and the full path to the mono 
binary should be specified (as is done e.g. in the mcs shell script).

2) Starting mdb using the correct path does not work either.

hans at gna:~$ ~/mono-1.1.12/bin/mono ~/mono-1.1.12/lib/mono/1.0/mdb.exe

Unhandled Exception: System.TypeInitializationException: An exception 
was thrown by the type initializer for 
Mono.Debugger.Frontend.CommandLineInterpreter ---> 
System.DllNotFoundException: monodebuggerserver
in (wrapper managed-to-native) 
in <0x00007> Mono.Debugger.Frontend.CommandLineInterpreter:.cctor ()--- 
End of inner exception stack trace ---

I am not sure how this is supposed to work. Setting the LD_LIBRARY_PATH 
helped however:

hans at gna:~$ export LD_LIBRARY_PATH=~/mono-1.1.12/lib/
hans at gna:~$ ~/mono-1.1.12/bin/mono ~/mono-1.1.12/lib/mono/1.0/mdb.exe
Mono Debugger

3) Even then mdb can not be used for actual debugging.

hans at gna:/tmp/Debug$ ~/mono-1.1.12/bin/mono 
~/mono-1.1.12/lib/mono/1.0/mdb.exe ConsoleApplication70.exe
Mono Debugger
(mdb) run
Starting program: ConsoleApplication70.exe
Corlib not in sync with this runtime: expected corlib version 45, found 41.
Download a newer corlib or a newer runtime at http://www.go-mono.com/daily.

Here mdb tries to use /usr/lib/mono/1.0/mscorlib.dll. I assume this is 
because mdb starts the child process using mono-debugger-mini-wrapper 
and mono-debugger-mini-wrapper is not recognized in mono/os/unix/util.c 
which is responsible for the correct setup via mono_set_dirs.

Setting MONO_PATH and MONO_CFG_DIR manually seems to resolve this:

hans at gna:/tmp/Debug$ export MONO_PATH=~/mono-1.1.12/lib/mono/1.0/
hans at gna:/tmp/Debug$ export MONO_CFG_DIR=~/mono-1.1.12/etc/
hans at gna:/tmp/Debug$ ~/mono-1.1.12/bin/mono 
~/mono-1.1.12/lib/mono/1.0/mdb.exe ConsoleApplication70.exe
Mono Debugger
(mdb) run
Starting program: ConsoleApplication70.exe
Process @4 stopped at #0: 0xb789f73b in 
ConsoleApplication70.Program.Main(System.String[])+0xb at 
   11                    Console.WriteLine("Hello world!");

I hope this analysis helps to improve the mdb and mdb packaging.

Best regards,

Hans Kratz
Omnicore Software

More information about the Mono-devel-list mailing list