1 * A debugging session using a dynamically generated symbol file.
3 Let's assume we have the following C# application which we want to debug:
10 public struct MyStruct {
16 public static void Main ()
24 my_struct.c = 23323.5235;
29 First of all, we need to compile it and create the .il files:
33 $ monodis /home/export/martin/MONO-LINUX/lib/corlib.dll > corlib.il
34 $ monodis Foo.exe > Foo.il
37 Now we can start the JIT in the debugger:
40 $ gdb ~/monocvs/mono/mono/jit/mono
41 (gdb) r --dwarf --debug Foo:Main ./Foo.exe
42 Starting program: /home/martin/monocvs/mono/mono/jit/mono --dwarf --debug Foo:Main ./Foo.exe
44 (gdb) call mono_debug_make_symbols ()
45 (gdb) add-symbol-file /tmp/Foo.o
46 Reading symbols from /tmp/Foo.o...done.
47 Current language: auto; currently c++
49 #0 Foo.Main () at Foo.il:26
52 Foo.Main () at Foo.il:38
59 37 valuetype MyStruct V_2)
62 40 IL_0002: ldc.i4 512
65 43 IL_0009: ldloca.s 2
67 45 IL_000c: stfld int32 .MyStruct::a
68 46 IL_0011: ldloca.s 2
70 48 IL_0014: stfld int64 .MyStruct::b
71 49 IL_0019: ldloca.s 2
72 50 IL_001b: ldc.r8 23323.5
73 51 IL_0024: stfld float64 .MyStruct::c
76 Foo.Main () at Foo.il:53
81 V_2 = {a = 5, b = 512, c = 23323.523499999999}
84 As you see in this example, you need to know IL code to use this debugging method - but
85 it may be the only way to debug a library.