1 #ifndef __MONO_DEBUG_SYMFILE_H__
2 #define __MONO_DEBUG_SYMFILE_H__
5 #include <mono/metadata/class.h>
6 #include <mono/metadata/reflection.h>
8 typedef struct MonoDebugSymbolFile MonoDebugSymbolFile;
9 typedef struct MonoDebugSymbolFileSection MonoDebugSymbolFileSection;
10 typedef struct MonoDebugMethodInfo MonoDebugMethodInfo;
11 typedef struct MonoDebugVarInfo MonoDebugVarInfo;
12 typedef struct MonoDebugILOffsetInfo MonoDebugILOffsetInfo;
13 typedef struct MonoDebugLineNumberBlock MonoDebugLineNumberBlock;
15 /* Machine dependent information about a method.
17 * This structure is created by the MonoDebugMethodInfoFunc callback of
18 * mono_debug_update_symbol_file (). */
19 struct MonoDebugMethodInfo {
24 MonoDebugVarInfo *this_var;
25 MonoDebugVarInfo *params;
27 MonoDebugVarInfo *locals;
28 guint32 num_il_offsets;
29 MonoDebugILOffsetInfo *il_offsets;
31 guint32 epilogue_begin;
36 * These bits of the MonoDebugLocalInfo's "index" field are flags specifying
37 * where the variable is actually stored.
39 * See relocate_variable() in debug-symfile.c for more info.
41 #define MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS 0xf0000000
43 /* If "index" is zero, the variable is at stack offset "offset". */
44 #define MONO_DEBUG_VAR_ADDRESS_MODE_STACK 0
46 /* The variable is in the register whose number is contained in bits 0..4 of the
47 * "index" field plus an offset of "offset" (which can be zero).
49 #define MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER 0x10000000
51 /* The variables in in the two registers whose numbers are contained in bits 0..4
52 * and 5..9 of the "index" field plus an offset of "offset" (which can be zero).
54 #define MONO_DEBUG_VAR_ADDRESS_MODE_TWO_REGISTERS 0x20000000
56 struct MonoDebugVarInfo {
63 struct MonoDebugILOffsetInfo {
68 struct MonoDebugLineNumberBlock {
70 const char *source_file;
75 struct MonoDebugSymbolFile {
79 /* Pointer to the mmap()ed contents of the file. */
81 size_t raw_contents_size;
82 /* Array of MONO_DEBUG_SYMBOL_SECTION_MAX elements. */
83 MonoDebugSymbolFileSection *section_offsets;
84 GHashTable *line_number_table;
86 MonoClass **type_table;
90 struct MonoDebugSymbolFileSection {
96 #define MONO_DEBUG_SYMBOL_FILE_VERSION 15
98 /* Keep in sync with Mono.CSharp.Debugger.MonoDwarfFileWriter.Section */
99 #define MONO_DEBUG_SYMBOL_SECTION_DEBUG_INFO 0x01
100 #define MONO_DEBUG_SYMBOL_SECTION_DEBUG_ABBREV 0x02
101 #define MONO_DEBUG_SYMBOL_SECTION_DEBUG_LINE 0x03
102 #define MONO_DEBUG_SYMBOL_SECTION_MONO_RELOC_TABLE 0x04
103 #define MONO_DEBUG_SYMBOL_SECTION_MONO_LINE_NUMBERS 0x05
104 #define MONO_DEBUG_SYMBOL_SECTION_MONO_SYMBOL_TABLE 0x06
106 #define MONO_DEBUG_SYMBOL_SECTION_MAX 0x07
108 /* Tries to load `filename' as a debugging information file, if `emit_warnings" is set,
109 * use g_warning() to signal error messages on failure, otherwise silently return NULL. */
110 MonoDebugSymbolFile *mono_debug_open_symbol_file (MonoImage *image,
111 const char *filename,
112 gboolean emit_warnings);
114 /* This callback function needs to return a MonoDebugMethodInfo structure containing the
115 * machine-dependent information about method associated with the metadata_token.
116 * It's highly recommended to cache the generated data since this function can be called
117 * several times per method. */
118 typedef MonoDebugMethodInfo * (*MonoDebugMethodInfoFunc) (MonoDebugSymbolFile *symbol_file,
119 guint32 metadata_token,
122 void mono_debug_update_symbol_file (MonoDebugSymbolFile *symbol_file,
123 MonoDebugMethodInfoFunc method_info_func,
126 void mono_debug_close_symbol_file (MonoDebugSymbolFile *symbol_file);
129 mono_debug_find_source_location (MonoDebugSymbolFile *symfile, MonoMethod *method, guint32 offset,
130 guint32 *line_number);
133 #endif /* __MONO_DEBUG_SYMFILE_H__ */