2010-04-16 Sebastien Pouliot <sebastien@ximian.com>
[mono/afaerber.git] / web / jit-debug
blob66b4411ff07d901618781294ddfce48e13eb31d4
1 * Debugging information
3         Compile your programs using the `-g' flag in MCS, that will all a special
4         resource containing debugging information to your executable.
6         To get stack traces with line number information, you need to run your 
7         program like this:
9         <b>
10         mono --debug program.exe
11         </b>
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.
16 * Debugging with GDB
18         If you use GDB to debug your mono process, you can use the function
19         mono_print_method_from_ip(void *address) to obtain the name of a method
20         given an address.
22         For example:
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>
33         You can now use:
35 <pre>
36 (gdb) p mono_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 mono_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>
44         Mono support libraries use a couple of signals internally that
45         confuse gdb, you might want to add this to your .gdbinit file:
47 <pre>
48         handle SIGPWR nostop noprint 
49         handle SIGXCPU nostop noprint 
50 </pre>
52 * Mono Debugger 
54         The Mono debugger is written in C# and can debug both managed
55         and unmanaged applications, support for multiple-threaded
56         applications and should be relatively easy to port to new
57         platforms.
59         Details of the release are available in <a
60         href="http://lists.ximian.com/archives/public/mono-list/2003-January/011415.html">post</a>. 
61         
62         The debugger contains both Gtk# and command line interfaces.
63         The debugging file format used in Dwarf (it's already supported
64         by our class libraries and the Mono C# compiler; To debug C
65         applications, you need a recent GCC, or to pass the -gdwarf-2
66         flag to gcc).
68         You can download the releases from <a
69         href="http://primates.ximian.com/~martin/debugger/">Martin Baulig's
70         home page.</a>
75         
76         
78