GDB (API)
|
00001 /* DWARF 2 location expression support for GDB. 00002 00003 Copyright (C) 2003-2013 Free Software Foundation, Inc. 00004 00005 This file is part of GDB. 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00019 00020 #if !defined (DWARF2LOC_H) 00021 #define DWARF2LOC_H 00022 00023 #include "dwarf2expr.h" 00024 00025 struct symbol_computed_ops; 00026 struct objfile; 00027 struct dwarf2_per_cu_data; 00028 struct dwarf2_loclist_baton; 00029 struct agent_expr; 00030 struct axs_value; 00031 00032 /* This header is private to the DWARF-2 reader. It is shared between 00033 dwarf2read.c and dwarf2loc.c. */ 00034 00035 /* `set debug entry-values' setting. */ 00036 extern unsigned int entry_values_debug; 00037 00038 /* Return the OBJFILE associated with the compilation unit CU. If CU 00039 came from a separate debuginfo file, then the master objfile is 00040 returned. */ 00041 struct objfile *dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *cu); 00042 00043 /* Return the address size given in the compilation unit header for CU. */ 00044 int dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *cu); 00045 00046 /* Return the DW_FORM_ref_addr size given in the compilation unit header for 00047 CU. */ 00048 int dwarf2_per_cu_ref_addr_size (struct dwarf2_per_cu_data *cu); 00049 00050 /* Return the offset size given in the compilation unit header for CU. */ 00051 int dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *cu); 00052 00053 /* Return the text offset of the CU. The returned offset comes from 00054 this CU's objfile. If this objfile came from a separate debuginfo 00055 file, then the offset may be different from the corresponding 00056 offset in the parent objfile. */ 00057 CORE_ADDR dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *cu); 00058 00059 /* Find a particular location expression from a location list. */ 00060 const gdb_byte *dwarf2_find_location_expression 00061 (struct dwarf2_loclist_baton *baton, 00062 size_t *locexpr_length, 00063 CORE_ADDR pc); 00064 00065 struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_sect_off 00066 (sect_offset offset_in_cu, struct dwarf2_per_cu_data *per_cu, 00067 CORE_ADDR (*get_frame_pc) (void *baton), 00068 void *baton); 00069 00070 struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_cu_off 00071 (cu_offset offset_in_cu, struct dwarf2_per_cu_data *per_cu, 00072 CORE_ADDR (*get_frame_pc) (void *baton), 00073 void *baton); 00074 00075 extern const gdb_byte *dwarf2_fetch_constant_bytes (sect_offset, 00076 struct dwarf2_per_cu_data *, 00077 struct obstack *, 00078 LONGEST *); 00079 00080 struct type *dwarf2_get_die_type (cu_offset die_offset, 00081 struct dwarf2_per_cu_data *per_cu); 00082 00083 /* Evaluate a location description, starting at DATA and with length 00084 SIZE, to find the current location of variable of TYPE in the context 00085 of FRAME. */ 00086 00087 struct value *dwarf2_evaluate_loc_desc (struct type *type, 00088 struct frame_info *frame, 00089 const gdb_byte *data, 00090 size_t size, 00091 struct dwarf2_per_cu_data *per_cu); 00092 00093 CORE_ADDR dwarf2_read_addr_index (struct dwarf2_per_cu_data *per_cu, 00094 unsigned int addr_index); 00095 00096 /* The symbol location baton types used by the DWARF-2 reader (i.e. 00097 SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). "struct 00098 dwarf2_locexpr_baton" is for a symbol with a single location 00099 expression; "struct dwarf2_loclist_baton" is for a symbol with a 00100 location list. */ 00101 00102 struct dwarf2_locexpr_baton 00103 { 00104 /* Pointer to the start of the location expression. Valid only if SIZE is 00105 not zero. */ 00106 const gdb_byte *data; 00107 00108 /* Length of the location expression. For optimized out expressions it is 00109 zero. */ 00110 size_t size; 00111 00112 /* The compilation unit containing the symbol whose location 00113 we're computing. */ 00114 struct dwarf2_per_cu_data *per_cu; 00115 }; 00116 00117 struct dwarf2_loclist_baton 00118 { 00119 /* The initial base address for the location list, based on the compilation 00120 unit. */ 00121 CORE_ADDR base_address; 00122 00123 /* Pointer to the start of the location list. */ 00124 const gdb_byte *data; 00125 00126 /* Length of the location list. */ 00127 size_t size; 00128 00129 /* The compilation unit containing the symbol whose location 00130 we're computing. */ 00131 struct dwarf2_per_cu_data *per_cu; 00132 00133 /* Non-zero if the location list lives in .debug_loc.dwo. 00134 The format of entries in this section are different. */ 00135 unsigned char from_dwo; 00136 }; 00137 00138 extern const struct symbol_computed_ops dwarf2_locexpr_funcs; 00139 extern const struct symbol_computed_ops dwarf2_loclist_funcs; 00140 00141 extern const struct symbol_block_ops dwarf2_block_frame_base_locexpr_funcs; 00142 extern const struct symbol_block_ops dwarf2_block_frame_base_loclist_funcs; 00143 00144 /* Compile a DWARF location expression to an agent expression. 00145 00146 EXPR is the agent expression we are building. 00147 LOC is the agent value we modify. 00148 ARCH is the architecture. 00149 ADDR_SIZE is the size of addresses, in bytes. 00150 OP_PTR is the start of the location expression. 00151 OP_END is one past the last byte of the location expression. 00152 00153 This will throw an exception for various kinds of errors -- for 00154 example, if the expression cannot be compiled, or if the expression 00155 is invalid. */ 00156 00157 extern void dwarf2_compile_expr_to_ax (struct agent_expr *expr, 00158 struct axs_value *loc, 00159 struct gdbarch *arch, 00160 unsigned int addr_size, 00161 const gdb_byte *op_ptr, 00162 const gdb_byte *op_end, 00163 struct dwarf2_per_cu_data *per_cu); 00164 00165 /* Determined tail calls for constructing virtual tail call frames. */ 00166 00167 struct call_site_chain 00168 { 00169 /* Initially CALLERS == CALLEES == LENGTH. For partially ambiguous result 00170 CALLERS + CALLEES < LENGTH. */ 00171 int callers, callees, length; 00172 00173 /* Variably sized array with LENGTH elements. Later [0..CALLERS-1] contain 00174 top (GDB "prev") sites and [LENGTH-CALLEES..LENGTH-1] contain bottom 00175 (GDB "next") sites. One is interested primarily in the PC field. */ 00176 struct call_site *call_site[1]; 00177 }; 00178 00179 struct call_site_stuff; 00180 extern struct call_site_chain *call_site_find_chain (struct gdbarch *gdbarch, 00181 CORE_ADDR caller_pc, 00182 CORE_ADDR callee_pc); 00183 00184 #endif /* dwarf2loc.h */