e8082d8a5d5d38ea7bdf332cc98d53ef1735f28c
[deliverable/binutils-gdb.git] / gdb / compile / compile-c.h
1 /* Header file for GDB compile C-language support.
2 Copyright (C) 2014-2021 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 COMPILE_COMPILE_C_H
18 #define COMPILE_COMPILE_C_H
19
20 #include "gdbsupport/enum-flags.h"
21 #include "gcc-c-plugin.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 class compile_c_instance : public compile_instance
39 {
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 }
47
48 /* Convert a gdb type, TYPE, to a GCC type.
49
50 The new GCC type is returned. */
51 gcc_type convert_type (struct type *type);
52
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;
62 };
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 std::vector<bool>
70 generate_c_for_variable_locations
71 (compile_instance *compiler,
72 string_file *stream,
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
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
95 #endif /* COMPILE_COMPILE_C_H */
This page took 0.031155 seconds and 3 git commands to generate.