GDB (xrefs)
Loading...
Searching...
No Matches
compile-c.h
Go to the documentation of this file.
1/* Header file for GDB compile C-language support.
2 Copyright (C) 2014-2023 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 "compile/compile.h"
21#include "gdbsupport/enum-flags.h"
22#include "gcc-c-plugin.h"
23
24/* enum-flags wrapper. */
25
26DEF_ENUM_FLAGS_TYPE (enum gcc_qualifiers, gcc_qualifiers_flags);
27
28/* A callback suitable for use as the GCC C symbol oracle. */
29
30extern gcc_c_oracle_function gcc_convert_symbol;
31
32/* A callback suitable for use as the GCC C address oracle. */
33
34extern gcc_c_symbol_address_function gcc_symbol_address;
35
36/* A subclass of compile_instance that is specific to the C front
37 end. */
38
40{
41public:
42 explicit compile_c_instance (struct gcc_c_context *gcc_c)
43 : compile_instance (&gcc_c->base, m_default_cflags),
44 m_plugin (gcc_c)
45 {
47 }
48
49 /* Convert a gdb type, TYPE, to a GCC type.
50
51 The new GCC type is returned. */
52 gcc_type convert_type (struct type *type);
53
54 /* Return a handle for the GCC plug-in. */
56
57private:
58 /* Default compiler flags for C. */
59 static const char *m_default_cflags;
60
61 /* The GCC plug-in. */
63};
64
65/* Emit code to compute the address for all the local variables in
66 scope at PC in BLOCK. Returns a malloc'd vector, indexed by gdb
67 register number, where each element indicates if the corresponding
68 register is needed to compute a local variable. */
69
70extern std::vector<bool>
72 (compile_instance *compiler,
73 string_file *stream,
74 struct gdbarch *gdbarch,
75 const struct block *block,
76 CORE_ADDR pc);
77
78/* Get the GCC mode attribute value for a given type size. */
79
80extern const char *c_get_mode_for_size (int size);
81
82/* Given a dynamic property, return an xmallocd name that is used to
83 represent its size. The result must be freed by the caller. The
84 contents of the resulting string will be the same each time for
85 each call with the same argument. */
86
87struct dynamic_prop;
88extern std::string c_get_range_decl_name (const struct dynamic_prop *prop);
89
90/* Compute the name of the pointer representing a local symbol's
91 address. */
92
93extern gdb::unique_xmalloc_ptr<char>
95
96#endif /* COMPILE_COMPILE_C_H */
gcc_c_plugin & plugin()
Definition compile-c.h:55
compile_c_instance(struct gcc_c_context *gcc_c)
Definition compile-c.h:42
gcc_type convert_type(struct type *type)
static const char * m_default_cflags
Definition compile-c.h:59
gcc_c_plugin m_plugin
Definition compile-c.h:62
void set_callbacks(gcc_c_oracle_function *binding_oracle, gcc_c_symbol_address_function *address_oracle, void *datum)
DEF_ENUM_FLAGS_TYPE(enum gcc_qualifiers, gcc_qualifiers_flags)
gdb::unique_xmalloc_ptr< char > c_symbol_substitution_name(struct symbol *sym)
gcc_c_oracle_function gcc_convert_symbol
std::string c_get_range_decl_name(const struct dynamic_prop *prop)
gcc_c_symbol_address_function gcc_symbol_address
std::vector< bool > generate_c_for_variable_locations(compile_instance *compiler, string_file *stream, struct gdbarch *gdbarch, const struct block *block, CORE_ADDR pc)
const char * c_get_mode_for_size(int size)
size_t size
Definition go32-nat.c:239
Definition block.h:109