Fri Mar 29 18:09:08 CET 2002 Paolo Molaro <lupus@ximian.com>
[mono.git] / mono / metadata / debug-symfile.h
1 #ifndef __MONO_DEBUG_SYMFILE_H__
2 #define __MONO_DEBUG_SYMFILE_H__
3
4 #include <glib.h>
5 #include <mono/metadata/class.h>
6 #include <mono/metadata/reflection.h>
7
8 typedef struct MonoDebugSymbolFile              MonoDebugSymbolFile;
9 typedef struct MonoDebugSymbolFileSection       MonoDebugSymbolFileSection;
10 typedef struct MonoDebugMethodInfo              MonoDebugMethodInfo;
11 typedef struct MonoDebugILOffsetInfo            MonoDebugILOffsetInfo;
12
13 /* Machine dependent information about a method.
14  *
15  * This structure is created by the MonoDebugMethodInfoFunc callback of
16  * mono_debug_update_symbol_file (). */
17 struct MonoDebugMethodInfo {
18         MonoMethod *method;
19         gpointer code_start;
20         guint32 code_size;
21         guint32 num_params;
22         guint32 this_offset;
23         guint32 *param_offsets;
24         guint32 num_locals;
25         guint32 *local_offsets;
26         guint32 num_il_offsets;
27         MonoDebugILOffsetInfo *il_offsets;
28         gpointer _priv;
29 };
30
31 struct MonoDebugILOffsetInfo {
32         guint32 offset;
33         guint32 address;
34 };
35
36 struct MonoDebugSymbolFile {
37         int fd;
38         char *file_name;
39         MonoImage *image;
40         /* Pointer to the mmap()ed contents of the file. */
41         void *raw_contents;
42         size_t raw_contents_size;
43         /* Array of MONO_DEBUG_SYMBOL_SECTION_MAX elements. */
44         MonoDebugSymbolFileSection *section_offsets;
45         gpointer user_data;
46 };
47
48 struct MonoDebugSymbolFileSection {
49         int type;
50         gulong file_offset;
51         gulong size;
52 };
53
54 #define MONO_DEBUG_SYMBOL_FILE_VERSION                  7
55
56 /* Keep in sync with Mono.CSharp.Debugger.MonoDwarfFileWriter.Section */
57 #define MONO_DEBUG_SYMBOL_SECTION_DEBUG_INFO            0x01
58 #define MONO_DEBUG_SYMBOL_SECTION_DEBUG_ABBREV          0x02
59 #define MONO_DEBUG_SYMBOL_SECTION_DEBUG_LINE            0x03
60 #define MONO_DEBUG_SYMBOL_SECTION_MONO_RELOC_TABLE      0x04
61
62 #define MONO_DEBUG_SYMBOL_SECTION_MAX                   0x05
63
64 /* Tries to load `filename' as a debugging information file, if `emit_warnings" is set,
65  * use g_warning() to signal error messages on failure, otherwise silently return NULL. */
66 MonoDebugSymbolFile *mono_debug_open_symbol_file   (MonoImage                 *image,
67                                                     const char                *filename,
68                                                     gboolean                   emit_warnings);
69
70 /* This callback function needs to return a MonoDebugMethodInfo structure containing the
71  * machine-dependent information about method associated with the metadata_token.
72  * It's highly recommended to cache the generated data since this function can be called
73  * several times per method. */
74 typedef MonoDebugMethodInfo * (*MonoDebugMethodInfoFunc) (MonoDebugSymbolFile *symbol_file,
75                                                           guint32              metadata_token,
76                                                           gpointer             user_data);
77
78 void    mono_debug_update_symbol_file (MonoDebugSymbolFile      *symbol_file,
79                                        MonoDebugMethodInfoFunc   method_info_func,
80                                        gpointer                  user_data);
81
82 void    mono_debug_close_symbol_file  (MonoDebugSymbolFile      *symbol_file);
83
84 MonoReflectionType *
85 ves_icall_Debugger_MonoSymbolWriter_get_local_type_from_sig (MonoReflectionAssembly *assembly,
86                                                              MonoArray *signature);
87
88 MonoReflectionMethod *
89 ves_icall_Debugger_MonoSymbolWriter_method_from_token (MonoReflectionAssembly *assembly,
90                                                        guint32 token);
91
92 guint32
93 ves_icall_Debugger_DwarfFileWriter_get_type_token (MonoReflectionType *type);
94
95
96 #endif /* __MONO_DEBUG_SYMFILE_H__ */
97