Commit | Line | Data |
---|---|---|
b7dc48b4 KS |
1 | /* Header file for GDB compile C-language support. |
2 | Copyright (C) 2014-2018 Free Software Foundation, Inc. | |
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" | |
21 | #include "hashtab.h" | |
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 | ||
38 | struct compile_c_instance | |
39 | { | |
40 | /* Base class. Note that the base class vtable actually points to a | |
41 | gcc_c_fe_vtable. */ | |
42 | struct compile_instance base; | |
43 | ||
44 | /* Map from gdb types to gcc types. */ | |
45 | htab_t type_map; | |
46 | ||
47 | /* Map from gdb symbols to gcc error messages to emit. */ | |
48 | htab_t symbol_err_map; | |
49 | }; | |
50 | ||
51 | /* A helper macro that takes a compile_c_instance and returns its | |
52 | corresponding gcc_c_context. */ | |
53 | ||
54 | #define C_CTX(I) ((struct gcc_c_context *) ((I)->base.fe)) | |
55 | ||
56 | /* Emit code to compute the address for all the local variables in | |
57 | scope at PC in BLOCK. Returns a malloc'd vector, indexed by gdb | |
58 | register number, where each element indicates if the corresponding | |
59 | register is needed to compute a local variable. */ | |
60 | ||
61 | extern gdb::unique_xmalloc_ptr<unsigned char> | |
62 | generate_c_for_variable_locations | |
63 | (struct compile_c_instance *compiler, | |
64 | string_file &stream, | |
65 | struct gdbarch *gdbarch, | |
66 | const struct block *block, | |
67 | CORE_ADDR pc); | |
68 | ||
69 | /* Get the GCC mode attribute value for a given type size. */ | |
70 | ||
71 | extern const char *c_get_mode_for_size (int size); | |
72 | ||
73 | /* Given a dynamic property, return an xmallocd name that is used to | |
74 | represent its size. The result must be freed by the caller. The | |
75 | contents of the resulting string will be the same each time for | |
76 | each call with the same argument. */ | |
77 | ||
78 | struct dynamic_prop; | |
79 | extern std::string c_get_range_decl_name (const struct dynamic_prop *prop); | |
80 | ||
81 | #endif /* GDB_COMPILE_C_H */ |