diff options
author | Martin Baulig <martin@novell.com> | 2002-03-29 12:56:40 +0300 |
---|---|---|
committer | Martin Baulig <martin@novell.com> | 2002-03-29 12:56:40 +0300 |
commit | e09cc97a750466f4497eba6aa89c49d26a11a922 (patch) | |
tree | 3d2777fbdf2fb16676d25e13017339b0a7063ac6 /web/jit-debug-sample2 | |
parent | b1a7c0e3f741e868d902c6d07cf27f7cee1da82f (diff) |
2002-03-29 Martin Baulig <martin@gnome.org>
* doc/jit-debug, docs/jit-debug-sample, docs/jit-debug-sample2:
New files, added documentation for the debugging code.
* doc/web/commands: Added the debugging pages.
* docs/jit-debug: Removed, this is now on the web site.
svn path=/trunk/mono/; revision=3493
Diffstat (limited to 'web/jit-debug-sample2')
-rw-r--r-- | web/jit-debug-sample2 | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/web/jit-debug-sample2 b/web/jit-debug-sample2 new file mode 100644 index 00000000000..ae75ceed591 --- /dev/null +++ b/web/jit-debug-sample2 @@ -0,0 +1,70 @@ +* A debugging session using a symbol file which has been created by MCS. + + Let's assume we have the following C# application which we want to debug: + + <pre> + using System; + + public class Foo + { + public struct MyStruct { + int a; + long b; + double c; + } + + public static void Main () + { + Int32 value = 5; + long test = 512; + + MyStruct my_struct; + my_struct.a = 5; + my_struct.b = test; + my_struct.c = 23323.5235; + } + } + </pre> + + First of all, we need to compile it with MCS, assemble the generated .s file and + create the .il files for all referenced assemblies which were not compiled with MCS: + + <pre> + $ mcs -g ./Foo.cs + $ as -o Foo-debug.o Foo-debug.s + $ monodis /home/export/martin/MONO-LINUX/lib/corlib.dll > corlib.il + </pre> + + Now we can start the JIT in the debugger: + + <pre> + $ gdb ~/monocvs/mono/mono/jit/mono + (gdb) r --dwarf-plus --debug Foo:Main ./Foo.exe + Starting program: /home/martin/monocvs/mono/mono/jit/mono --dwarf-plus --debug Foo:Main ./Foo.exe + Program received signal SIGTRAP, Trace/breakpoint trap. + 0x081e8681 in ?? () + (gdb) call mono_debug_make_symbols () + (gdb) add-symbol-file Foo-debug.o + (gdb) add-symbol-file /tmp/corlib.o +` (gdb) frame + #0 Main () at ./Foo.cs:11 + 11 public static void Main () + (gdb) n + Main () at ./Foo.cs:13 + 13 Int32 value = 5; + (gdb) + 14 long test = 512; + (gdb) + 17 my_struct.a = 5; + (gdb) + 18 my_struct.b = test; + (gdb) + 19 my_struct.c = 23323.5235; + (gdb) + 20 } + (gdb) info locals + value = 5 + test = 512 + my_struct = { a = 5, b = 512, c = 23323.5235 } + </pre> + |