xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/compile/compile.h (revision 8b657b0747480f8989760d71343d6dd33f8d4cf9)
1 /* Header file for Compile and inject module.
2 
3    Copyright (C) 2014-2023 Free Software Foundation, Inc.
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17 
18 #ifndef COMPILE_COMPILE_H
19 #define COMPILE_COMPILE_H
20 
21 struct ui_file;
22 struct gdbarch;
23 struct dwarf2_per_cu_data;
24 struct dwarf2_per_objfile;
25 struct symbol;
26 struct dynamic_prop;
27 
28 /* Public function that is called from compile_control case in the
29    expression command.  GDB returns either a CMD, or a CMD_STRING, but
30    never both.  */
31 
32 extern void eval_compile_command (struct command_line *cmd,
33 				  const char *cmd_string,
34 				  enum compile_i_scope_types scope,
35 				  void *scope_data);
36 
37 /* Compile a DWARF location expression to C, suitable for use by the
38    compiler.
39 
40    STREAM is the stream where the code should be written.
41 
42    RESULT_NAME is the name of a variable in the resulting C code.  The
43    result of the expression will be assigned to this variable.
44 
45    SYM is the symbol corresponding to this expression.
46    PC is the location at which the expression is being evaluated.
47    ARCH is the architecture to use.
48 
49    REGISTERS_USED is an out parameter which is updated to note which
50    registers were needed by this expression.
51 
52    ADDR_SIZE is the DWARF address size to use.
53 
54    OPT_PTR and OP_END are the bounds of the DWARF expression.
55 
56    PER_CU is the per-CU object used for looking up various other
57    things.
58 
59    PER_OBJFILE is the per-objfile object also used for looking up various other
60    things.  */
61 
62 extern void compile_dwarf_expr_to_c (string_file *stream,
63 				     const char *result_name,
64 				     struct symbol *sym,
65 				     CORE_ADDR pc,
66 				     struct gdbarch *arch,
67 				     std::vector<bool> &registers_used,
68 				     unsigned int addr_size,
69 				     const gdb_byte *op_ptr,
70 				     const gdb_byte *op_end,
71 				     dwarf2_per_cu_data *per_cu,
72 				     dwarf2_per_objfile *per_objfile);
73 
74 /* Compile a DWARF bounds expression to C, suitable for use by the
75    compiler.
76 
77    STREAM is the stream where the code should be written.
78 
79    RESULT_NAME is the name of a variable in the resulting C code.  The
80    result of the expression will be assigned to this variable.
81 
82    PROP is the dynamic property for which we're compiling.
83 
84    SYM is the symbol corresponding to this expression.
85    PC is the location at which the expression is being evaluated.
86    ARCH is the architecture to use.
87 
88    REGISTERS_USED is an out parameter which is updated to note which
89    registers were needed by this expression.
90 
91    ADDR_SIZE is the DWARF address size to use.
92 
93    OPT_PTR and OP_END are the bounds of the DWARF expression.
94 
95    PER_CU is the per-CU object used for looking up various other
96    things.
97 
98    PER_OBJFILE is the per-objfile object also used for looking up various other
99    things.  */
100 
101 extern void compile_dwarf_bounds_to_c (string_file *stream,
102 				       const char *result_name,
103 				       const struct dynamic_prop *prop,
104 				       struct symbol *sym, CORE_ADDR pc,
105 				       struct gdbarch *arch,
106 				       std::vector<bool> &registers_used,
107 				       unsigned int addr_size,
108 				       const gdb_byte *op_ptr,
109 				       const gdb_byte *op_end,
110 				       dwarf2_per_cu_data *per_cu,
111 				       dwarf2_per_objfile *per_objfile);
112 
113 extern void compile_print_value (struct value *val, void *data_voidp);
114 
115 /* Command element for the 'compile' command.  */
116 extern cmd_list_element *compile_cmd_element;
117 
118 #endif /* COMPILE_COMPILE_H */
119