Merge pull request #4444 from lateralusX/jlorenss/windows-unwind-info
[mono.git] / mono / metadata / debug-mono-symfile.h
1 /*
2  * This header is only installed for use by the debugger:
3  * the structures and the API declared here are not supported.
4  * Copyright 2012 Xamarin Inc (http://www.xamarin.com)
5  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
6  */
7
8 #ifndef __MONO_DEBUG_MONO_SYMFILE_H__
9 #define __MONO_DEBUG_MONO_SYMFILE_H__
10
11 #include <glib.h>
12 #include <mono/metadata/class.h>
13 #include <mono/metadata/reflection.h>
14 #include <mono/metadata/mono-debug.h>
15 #include <mono/metadata/debug-internals.h>
16
17 typedef struct MonoSymbolFileOffsetTable        MonoSymbolFileOffsetTable;
18 typedef struct MonoSymbolFileLineNumberEntry    MonoSymbolFileLineNumberEntry;
19 typedef struct MonoSymbolFileMethodAddress      MonoSymbolFileMethodAddress;
20 typedef struct MonoSymbolFileDynamicTable       MonoSymbolFileDynamicTable;
21 typedef struct MonoSymbolFileSourceEntry        MonoSymbolFileSourceEntry;
22 typedef struct MonoSymbolFileMethodEntry        MonoSymbolFileMethodEntry;
23
24 /* Keep in sync with OffsetTable in mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs */
25 struct MonoSymbolFileOffsetTable {
26         uint32_t _total_file_size;
27         uint32_t _data_section_offset;
28         uint32_t _data_section_size;
29         uint32_t _compile_unit_count;
30         uint32_t _compile_unit_table_offset;
31         uint32_t _compile_unit_table_size;
32         uint32_t _source_count;
33         uint32_t _source_table_offset;
34         uint32_t _source_table_size;
35         uint32_t _method_count;
36         uint32_t _method_table_offset;
37         uint32_t _method_table_size;
38         uint32_t _type_count;
39         uint32_t _anonymous_scope_count;
40         uint32_t _anonymous_scope_table_offset;
41         uint32_t _anonymous_scope_table_size;
42         uint32_t _line_number_table_line_base;
43         uint32_t _line_number_table_line_range;
44         uint32_t _line_number_table_opcode_base;
45         uint32_t _is_aspx_source;
46 };
47
48 struct MonoSymbolFileSourceEntry {
49         uint32_t _index;
50         uint32_t _data_offset;
51 };
52
53 struct MonoSymbolFileMethodEntry {
54         uint32_t _token;
55         uint32_t _data_offset;
56         uint32_t _line_number_table;
57 };
58
59 struct MonoSymbolFileMethodAddress {
60         uint32_t size;
61         const uint8_t *start_address;
62         const uint8_t *end_address;
63         const uint8_t *method_start_address;
64         const uint8_t *method_end_address;
65         const uint8_t *wrapper_address;
66         uint32_t has_this;
67         uint32_t num_params;
68         uint32_t variable_table_offset;
69         uint32_t type_table_offset;
70         uint32_t num_line_numbers;
71         uint32_t line_number_offset;
72         uint8_t data [MONO_ZERO_LEN_ARRAY];
73 };
74
75 #define MONO_SYMBOL_FILE_MAJOR_VERSION          50
76 #define MONO_SYMBOL_FILE_MINOR_VERSION          0
77 #define MONO_SYMBOL_FILE_MAGIC                  0x45e82623fd7fa614ULL
78
79 MONO_BEGIN_DECLS
80
81 MONO_API MonoSymbolFile *
82 mono_debug_open_mono_symbols       (MonoDebugHandle          *handle,
83                                     const uint8_t            *raw_contents,
84                                     int                       size,
85                                     mono_bool                 in_the_debugger);
86
87 MONO_API void
88 mono_debug_close_mono_symbol_file  (MonoSymbolFile           *symfile);
89
90 MONO_API mono_bool
91 mono_debug_symfile_is_loaded       (MonoSymbolFile           *symfile);
92
93 MONO_API MonoDebugSourceLocation *
94 mono_debug_symfile_lookup_location (MonoDebugMethodInfo      *minfo,
95                                     uint32_t                  offset);
96
97 MONO_API void
98 mono_debug_symfile_free_location   (MonoDebugSourceLocation  *location);
99
100 MONO_API MonoDebugMethodInfo *
101 mono_debug_symfile_lookup_method   (MonoDebugHandle          *handle,
102                                     MonoMethod               *method);
103
104 MONO_API MonoDebugLocalsInfo*
105 mono_debug_symfile_lookup_locals (MonoDebugMethodInfo *minfo);
106
107 void
108 mono_debug_symfile_get_seq_points (MonoDebugMethodInfo *minfo, char **source_file, GPtrArray **source_file_list, int **source_files, MonoSymSeqPoint **seq_points, int *n_seq_points);
109
110 MONO_END_DECLS
111
112 #endif /* __MONO_SYMFILE_H__ */
113