[Mono-list] Debugging mono

Dan Smithers dsmithers at talktalk.net
Fri Feb 22 06:54:17 EST 2008


Can anyone suggest how I can use a debugger with mono? I have looked at
http://www.mono-project.com/Debugging and have followed the instructions
with GDB.

My first problem is that step does not work. I get the response "(gdb) s
Cannot find bounds of current function"

I have a simple test programme that uses one library file I have
compiled with the -debug option:

dwhs1 at gloin:~$ gmcs -debug -target:library static_test.cs
dwhs1 at gloin:~$ gmcs -debug -target:exe -reference:static_test.dll
static_main.cs


I then run gdb:
dwhs1 at gloin:~$ gdb mono
GNU gdb 6.6-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(gdb) run --debug --break 'CMain:Main' static_main.exe foobar
Starting program: /usr/local/bin/mono --debug --break 'CMain:Main'
static_main.exe foobar
[Thread debugging using libthread_db enabled]
[New Thread -1210861872 (LWP 13980)]
[New Thread -1222812784 (LWP 13983)]
[New Thread -1222960240 (LWP 13984)]

Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread -1210861872 (LWP 13980)]
0xb7738258 in ?? ()
(gdb) call mono_pmip($eip)
$1 = 0x8293f28 " CMain:Main (string[]) + 0x8 (0xb7738250 0xb77382b5)
[0x21f00 - static_main.exe]"
(gdb) call mono_debug_print_vars($eip,1)
Arg args (0) in memory: base register %ebp + 8
(gdb) call mono_object_describe(*(char**)($ebp+8))
System.String[] at 0x29f48, rank: 1, length: 1
(gdb) call mono_object_describe($ebx)
(null)
(gdb) s
Cannot find bounds of current function

I have also tried to use ddd, but that can't see the C# source code.

Are there any better ways of doing this?

thanks

dan


More information about the Mono-list mailing list