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