Commit | Line | Data |
---|---|---|
b7dc48b4 | 1 | /* Header file for GDB compile C-language support. |
42a4f53d | 2 | Copyright (C) 2014-2019 Free Software Foundation, Inc. |
b7dc48b4 KS |
3 | |
4 | This program is free software; you can redistribute it and/or modify | |
5 | it under the terms of the GNU General Public License as published by | |
6 | the Free Software Foundation; either version 3 of the License, or | |
7 | (at your option) any later version. | |
8 | ||
9 | This program is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | GNU General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU General Public License | |
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
16 | ||
17 | #ifndef GDB_COMPILE_C_H | |
18 | #define GDB_COMPILE_C_H | |
19 | ||
20 | #include "common/enum-flags.h" | |
18cdc6d8 | 21 | #include "gcc-c-plugin.h" |
b7dc48b4 KS |
22 | |
23 | /* enum-flags wrapper. */ | |
24 | ||
25 | DEF_ENUM_FLAGS_TYPE (enum gcc_qualifiers, gcc_qualifiers_flags); | |
26 | ||
27 | /* A callback suitable for use as the GCC C symbol oracle. */ | |
28 | ||
29 | extern gcc_c_oracle_function gcc_convert_symbol; | |
30 | ||
31 | /* A callback suitable for use as the GCC C address oracle. */ | |
32 | ||
33 | extern gcc_c_symbol_address_function gcc_symbol_address; | |
34 | ||
35 | /* A subclass of compile_instance that is specific to the C front | |
36 | end. */ | |
37 | ||
9cdfd9a2 | 38 | class compile_c_instance : public compile_instance |
b7dc48b4 | 39 | { |
9cdfd9a2 KS |
40 | public: |
41 | explicit compile_c_instance (struct gcc_c_context *gcc_c) | |
42 | : compile_instance (&gcc_c->base, m_default_cflags), | |
43 | m_plugin (gcc_c) | |
44 | { | |
45 | m_plugin.set_callbacks (gcc_convert_symbol, gcc_symbol_address, this); | |
46 | } | |
b7dc48b4 | 47 | |
9cdfd9a2 | 48 | /* Convert a gdb type, TYPE, to a GCC type. |
b7dc48b4 | 49 | |
9cdfd9a2 KS |
50 | The new GCC type is returned. */ |
51 | gcc_type convert_type (struct type *type); | |
b7dc48b4 | 52 | |
9cdfd9a2 KS |
53 | /* Return a handle for the GCC plug-in. */ |
54 | gcc_c_plugin &plugin () { return m_plugin; } | |
55 | ||
56 | private: | |
57 | /* Default compiler flags for C. */ | |
58 | static const char *m_default_cflags; | |
59 | ||
60 | /* The GCC plug-in. */ | |
61 | gcc_c_plugin m_plugin; | |
18cdc6d8 | 62 | }; |
b7dc48b4 KS |
63 | |
64 | /* Emit code to compute the address for all the local variables in | |
65 | scope at PC in BLOCK. Returns a malloc'd vector, indexed by gdb | |
66 | register number, where each element indicates if the corresponding | |
67 | register is needed to compute a local variable. */ | |
68 | ||
69 | extern gdb::unique_xmalloc_ptr<unsigned char> | |
70 | generate_c_for_variable_locations | |
9cdfd9a2 | 71 | (compile_instance *compiler, |
d82b3862 | 72 | string_file *stream, |
b7dc48b4 KS |
73 | struct gdbarch *gdbarch, |
74 | const struct block *block, | |
75 | CORE_ADDR pc); | |
76 | ||
77 | /* Get the GCC mode attribute value for a given type size. */ | |
78 | ||
79 | extern const char *c_get_mode_for_size (int size); | |
80 | ||
81 | /* Given a dynamic property, return an xmallocd name that is used to | |
82 | represent its size. The result must be freed by the caller. The | |
83 | contents of the resulting string will be the same each time for | |
84 | each call with the same argument. */ | |
85 | ||
86 | struct dynamic_prop; | |
87 | extern std::string c_get_range_decl_name (const struct dynamic_prop *prop); | |
88 | ||
946d3d10 KS |
89 | /* Compute the name of the pointer representing a local symbol's |
90 | address. */ | |
91 | ||
92 | extern gdb::unique_xmalloc_ptr<char> | |
93 | c_symbol_substitution_name (struct symbol *sym); | |
94 | ||
b7dc48b4 | 95 | #endif /* GDB_COMPILE_C_H */ |