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