2004-01-04 Daniel Morgan <danielmorgan@verizon.net>
[mono.git] / doc / jit-debug
1 * Debugging information
2
3         Compile your programs using the `-g' flag in MCS, that will all a special
4         resource containing debugging information to your executable.
5
6         To get stack traces with line number information, you need to run your 
7         program like this:
8
9         <b>
10         mono --debug program.exe
11         </b>
12
13         Notice that the program will need to be compiled with the -g
14         flag and that running with --debug will slow down the execution.
15
16 * Debugging with GDB
17
18         If you use GDB to debug your mono process, you can use the function
19         print_method_from_ip(void *address) to obtain the name of a method
20         given an address.
21
22         For example:
23
24         <pre>
25 (gdb) where
26 #0  ves_icall_System_String_GetHashCode (me=0x80795d0) at string-icalls.c:861
27 #1  0x0817f490 in ?? ()
28 #2  0x0817f42a in ?? ()
29 #3  0x0817f266 in ?? ()
30 #4  0x0817f1a5 in ?? ()
31 </pre>
32
33         You can now use:
34
35 <pre>
36 (gdb) p print_method_from_ip (0x0817f490)
37 IP 0x817f490 at offset 0x28 of method (wrapper managed-to-native) System.String:GetHashCode () (0x817f468 0x817f4a4)
38 $1 = void
39 (gdb) p print_method_from_ip (0x0817f42a)
40 IP 0x817f42a at offset 0x52 of method System.Collections.Hashtable:GetHash (object) (0x817f3d8 0x817f43b)
41 $2 = void
42 </pre>
43
44 * Mono Debugger 
45
46         The Mono debugger is written in C# and can debug both managed
47         and unmanaged applications, support for multiple-threaded
48         applications and should be relatively easy to port to new
49         platforms.
50
51         Details of the release are available in <a
52         href="http://lists.ximian.com/archives/public/mono-list/2003-January/011415.html">post</a>. 
53         
54         The debugger contains both Gtk# and command line interfaces.
55         The debugging file format used in Dwarf (its already supported
56         by our class libraries and the Mono C# compiler; To debug C
57         applications, you need a recent GCC, or to pass the -gdwarf-2
58         flag to gcc).
59
60         The debugger is available now, you can get it from <a
61         href="http://primates.ximian.com/~martin/debugger/mono-debugger-0.2.0.tar.gz">here</a>
62
63
64
65
66         
67         
68
69