forked from Imagelibrary/binutils-gdb
Compare commits
42 Commits
users/jema
...
users/sima
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd787f5e65 | ||
|
|
fb113f4f48 | ||
|
|
5b75b03006 | ||
|
|
bd6776c1f7 | ||
|
|
d8ec15198c | ||
|
|
7d58fe1431 | ||
|
|
a3ddd1a46c | ||
|
|
d4b0ea1629 | ||
|
|
f4a3bd8117 | ||
|
|
5b9cfc4c6d | ||
|
|
a35610c98b | ||
|
|
df7a679852 | ||
|
|
2a651b1f4a | ||
|
|
bd3914c780 | ||
|
|
c8b42195c2 | ||
|
|
2a2b2a782d | ||
|
|
caca6f5b4e | ||
|
|
7b9424e488 | ||
|
|
a2ffabb61b | ||
|
|
a03eab7536 | ||
|
|
d2634098f3 | ||
|
|
30677c82cd | ||
|
|
9e575d411d | ||
|
|
e734976f6c | ||
|
|
6174efd6a4 | ||
|
|
d4ea1c4e01 | ||
|
|
68a44194a5 | ||
|
|
4132873d03 | ||
|
|
9fb9ca853d | ||
|
|
bf1c1db5b2 | ||
|
|
1d2852ed0a | ||
|
|
89b41af1b1 | ||
|
|
acd2b91adf | ||
|
|
b574ecffd1 | ||
|
|
63ed5b5889 | ||
|
|
35f1c44ab7 | ||
|
|
60684704c1 | ||
|
|
a309b520ba | ||
|
|
93f68a2429 | ||
|
|
1b9f401923 | ||
|
|
db8d868ffa | ||
|
|
9b3670b5bb |
@@ -583,7 +583,8 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
|
||||
unsigned int addr_size,
|
||||
const gdb_byte *op_ptr, const gdb_byte *op_end,
|
||||
CORE_ADDR *initial,
|
||||
struct dwarf2_per_cu_data *per_cu)
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile)
|
||||
{
|
||||
/* We keep a counter so that labels and other objects we create have
|
||||
unique names. */
|
||||
@@ -719,7 +720,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
|
||||
index, not an address. We don't support things like
|
||||
branching between the address and the TLS op. */
|
||||
if (op_ptr >= op_end || *op_ptr != DW_OP_GNU_push_tls_address)
|
||||
uoffset += per_cu->text_offset ();
|
||||
uoffset += per_objfile->objfile->text_section_offset ();
|
||||
push (indent, stream, uoffset);
|
||||
break;
|
||||
|
||||
@@ -896,7 +897,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
|
||||
sym, pc,
|
||||
arch, registers_used, addr_size,
|
||||
datastart, datastart + datalen,
|
||||
NULL, per_cu);
|
||||
NULL, per_cu, per_objfile);
|
||||
|
||||
pushf (indent, stream, "%s + %s", fb_name, hex_string (offset));
|
||||
}
|
||||
@@ -1077,7 +1078,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
|
||||
sym, pc, arch, registers_used,
|
||||
addr_size,
|
||||
cfa_start, cfa_end,
|
||||
&text_offset, per_cu);
|
||||
&text_offset, per_cu, per_objfile);
|
||||
pushf (indent, stream, "%s", cfa_name);
|
||||
}
|
||||
}
|
||||
@@ -1123,11 +1124,12 @@ compile_dwarf_expr_to_c (string_file *stream, const char *result_name,
|
||||
struct gdbarch *arch, unsigned char *registers_used,
|
||||
unsigned int addr_size,
|
||||
const gdb_byte *op_ptr, const gdb_byte *op_end,
|
||||
struct dwarf2_per_cu_data *per_cu)
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile)
|
||||
{
|
||||
do_compile_dwarf_expr_to_c (2, stream, GCC_UINTPTR, result_name, sym, pc,
|
||||
arch, registers_used, addr_size, op_ptr, op_end,
|
||||
NULL, per_cu);
|
||||
NULL, per_cu, per_objfile);
|
||||
}
|
||||
|
||||
/* See compile.h. */
|
||||
@@ -1140,9 +1142,11 @@ compile_dwarf_bounds_to_c (string_file *stream,
|
||||
struct gdbarch *arch, unsigned char *registers_used,
|
||||
unsigned int addr_size,
|
||||
const gdb_byte *op_ptr, const gdb_byte *op_end,
|
||||
struct dwarf2_per_cu_data *per_cu)
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile)
|
||||
{
|
||||
do_compile_dwarf_expr_to_c (2, stream, "unsigned long ", result_name,
|
||||
sym, pc, arch, registers_used,
|
||||
addr_size, op_ptr, op_end, NULL, per_cu);
|
||||
addr_size, op_ptr, op_end, NULL, per_cu,
|
||||
per_objfile);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
struct ui_file;
|
||||
struct gdbarch;
|
||||
struct dwarf2_per_cu_data;
|
||||
struct dwarf2_per_objfile;
|
||||
struct symbol;
|
||||
struct dynamic_prop;
|
||||
|
||||
@@ -53,6 +54,9 @@ extern void eval_compile_command (struct command_line *cmd,
|
||||
OPT_PTR and OP_END are the bounds of the DWARF expression.
|
||||
|
||||
PER_CU is the per-CU object used for looking up various other
|
||||
things.
|
||||
|
||||
PER_OBJFILE is the per-objfile object also used for looking up various other
|
||||
things. */
|
||||
|
||||
extern void compile_dwarf_expr_to_c (string_file *stream,
|
||||
@@ -64,7 +68,8 @@ extern void compile_dwarf_expr_to_c (string_file *stream,
|
||||
unsigned int addr_size,
|
||||
const gdb_byte *op_ptr,
|
||||
const gdb_byte *op_end,
|
||||
struct dwarf2_per_cu_data *per_cu);
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile);
|
||||
|
||||
/* Compile a DWARF bounds expression to C, suitable for use by the
|
||||
compiler.
|
||||
@@ -88,6 +93,9 @@ extern void compile_dwarf_expr_to_c (string_file *stream,
|
||||
OPT_PTR and OP_END are the bounds of the DWARF expression.
|
||||
|
||||
PER_CU is the per-CU object used for looking up various other
|
||||
things.
|
||||
|
||||
PER_OBJFILE is the per-objfile object also used for looking up various other
|
||||
things. */
|
||||
|
||||
extern void compile_dwarf_bounds_to_c (string_file *stream,
|
||||
@@ -99,7 +107,8 @@ extern void compile_dwarf_bounds_to_c (string_file *stream,
|
||||
unsigned int addr_size,
|
||||
const gdb_byte *op_ptr,
|
||||
const gdb_byte *op_end,
|
||||
struct dwarf2_per_cu_data *per_cu);
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile);
|
||||
|
||||
extern void compile_print_value (struct value *val, void *data_voidp);
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "dwarf2.h"
|
||||
#include "dwarf2/expr.h"
|
||||
#include "dwarf2/loc.h"
|
||||
#include "dwarf2/read.h"
|
||||
#include "gdbsupport/underlying.h"
|
||||
#include "gdbarch.h"
|
||||
|
||||
@@ -88,17 +89,17 @@ dwarf_expr_context::address_type () const
|
||||
|
||||
/* Create a new context for the expression evaluator. */
|
||||
|
||||
dwarf_expr_context::dwarf_expr_context ()
|
||||
dwarf_expr_context::dwarf_expr_context (dwarf2_per_objfile *per_objfile)
|
||||
: gdbarch (NULL),
|
||||
addr_size (0),
|
||||
ref_addr_size (0),
|
||||
offset (0),
|
||||
recursion_depth (0),
|
||||
max_recursion_depth (0x100),
|
||||
location (DWARF_VALUE_MEMORY),
|
||||
len (0),
|
||||
data (NULL),
|
||||
initialized (0)
|
||||
initialized (0),
|
||||
per_objfile (per_objfile)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -631,7 +632,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
|
||||
index, not an address. We don't support things like
|
||||
branching between the address and the TLS op. */
|
||||
if (op_ptr >= op_end || *op_ptr != DW_OP_GNU_push_tls_address)
|
||||
result += this->offset;
|
||||
result += this->per_objfile->objfile->text_section_offset ();
|
||||
result_val = value_from_ulongest (address_type, result);
|
||||
break;
|
||||
|
||||
@@ -639,7 +640,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
|
||||
case DW_OP_GNU_addr_index:
|
||||
op_ptr = safe_read_uleb128 (op_ptr, op_end, &uoffset);
|
||||
result = this->get_addr_index (uoffset);
|
||||
result += this->offset;
|
||||
result += this->per_objfile->objfile->text_section_offset ();
|
||||
result_val = value_from_ulongest (address_type, result);
|
||||
break;
|
||||
case DW_OP_GNU_const_index:
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "leb128.h"
|
||||
#include "gdbtypes.h"
|
||||
|
||||
struct dwarf2_per_objfile;
|
||||
|
||||
/* The location of a value. */
|
||||
enum dwarf_value_location
|
||||
{
|
||||
@@ -117,7 +119,7 @@ struct dwarf_stack_value
|
||||
its current state and its callbacks. */
|
||||
struct dwarf_expr_context
|
||||
{
|
||||
dwarf_expr_context ();
|
||||
dwarf_expr_context (dwarf2_per_objfile *per_objfile);
|
||||
virtual ~dwarf_expr_context () = default;
|
||||
|
||||
void push_address (CORE_ADDR value, bool in_stack_memory);
|
||||
@@ -139,10 +141,6 @@ struct dwarf_expr_context
|
||||
context and operations depending on DW_FORM_ref_addr are not allowed. */
|
||||
int ref_addr_size;
|
||||
|
||||
/* Offset used to relocate DW_OP_addr, DW_OP_addrx, and
|
||||
DW_OP_GNU_addr_index arguments. */
|
||||
CORE_ADDR offset;
|
||||
|
||||
/* The current depth of dwarf expression recursion, via DW_OP_call*,
|
||||
DW_OP_fbreg, DW_OP_push_object_address, etc., and the maximum
|
||||
depth we'll tolerate before raising an error. */
|
||||
@@ -185,6 +183,9 @@ struct dwarf_expr_context
|
||||
two cases need to be handled separately.) */
|
||||
std::vector<dwarf_expr_piece> pieces;
|
||||
|
||||
/* We evaluate the expression in the context of this objfile. */
|
||||
dwarf2_per_objfile *per_objfile;
|
||||
|
||||
/* Return the value of register number REGNUM (a DWARF register number),
|
||||
read as an address. */
|
||||
virtual CORE_ADDR read_addr_from_reg (int regnum) = 0;
|
||||
|
||||
@@ -166,8 +166,8 @@ struct comp_unit
|
||||
auto_obstack obstack;
|
||||
};
|
||||
|
||||
static struct dwarf2_fde *dwarf2_frame_find_fde (CORE_ADDR *pc,
|
||||
CORE_ADDR *out_offset);
|
||||
static struct dwarf2_fde *dwarf2_frame_find_fde
|
||||
(CORE_ADDR *pc, dwarf2_per_objfile **out_per_objfile);
|
||||
|
||||
static int dwarf2_frame_adjust_regnum (struct gdbarch *gdbarch, int regnum,
|
||||
int eh_frame_p);
|
||||
@@ -237,7 +237,11 @@ register %s (#%d) at %s"),
|
||||
|
||||
class dwarf_expr_executor : public dwarf_expr_context
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
dwarf_expr_executor (dwarf2_per_objfile *per_objfile)
|
||||
: dwarf_expr_context (per_objfile)
|
||||
{}
|
||||
|
||||
struct frame_info *this_frame;
|
||||
|
||||
@@ -311,19 +315,18 @@ class dwarf_expr_executor : public dwarf_expr_context
|
||||
|
||||
static CORE_ADDR
|
||||
execute_stack_op (const gdb_byte *exp, ULONGEST len, int addr_size,
|
||||
CORE_ADDR offset, struct frame_info *this_frame,
|
||||
CORE_ADDR initial, int initial_in_stack_memory)
|
||||
struct frame_info *this_frame, CORE_ADDR initial,
|
||||
int initial_in_stack_memory, dwarf2_per_objfile *per_objfile)
|
||||
{
|
||||
CORE_ADDR result;
|
||||
|
||||
dwarf_expr_executor ctx;
|
||||
dwarf_expr_executor ctx (per_objfile);
|
||||
scoped_value_mark free_values;
|
||||
|
||||
ctx.this_frame = this_frame;
|
||||
ctx.gdbarch = get_frame_arch (this_frame);
|
||||
ctx.addr_size = addr_size;
|
||||
ctx.ref_addr_size = -1;
|
||||
ctx.offset = offset;
|
||||
|
||||
ctx.push_address (initial, initial_in_stack_memory);
|
||||
ctx.eval (exp, len);
|
||||
@@ -883,14 +886,16 @@ dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
|
||||
const gdb_byte **cfa_end_out)
|
||||
{
|
||||
struct dwarf2_fde *fde;
|
||||
CORE_ADDR text_offset;
|
||||
dwarf2_per_objfile *per_objfile;
|
||||
CORE_ADDR pc1 = pc;
|
||||
|
||||
/* Find the correct FDE. */
|
||||
fde = dwarf2_frame_find_fde (&pc1, &text_offset);
|
||||
fde = dwarf2_frame_find_fde (&pc1, &per_objfile);
|
||||
if (fde == NULL)
|
||||
error (_("Could not compute CFA; needed to translate this expression"));
|
||||
|
||||
gdb_assert (per_objfile != nullptr);
|
||||
|
||||
dwarf2_frame_state fs (pc1, fde->cie);
|
||||
|
||||
/* Check for "quirks" - known bugs in producers. */
|
||||
@@ -898,14 +903,15 @@ dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
|
||||
|
||||
/* First decode all the insns in the CIE. */
|
||||
execute_cfa_program (fde, fde->cie->initial_instructions,
|
||||
fde->cie->end, gdbarch, pc, &fs, text_offset);
|
||||
fde->cie->end, gdbarch, pc, &fs,
|
||||
per_objfile->objfile->text_section_offset ());
|
||||
|
||||
/* Save the initialized register set. */
|
||||
fs.initial = fs.regs;
|
||||
|
||||
/* Then decode the insns in the FDE up to our target PC. */
|
||||
execute_cfa_program (fde, fde->instructions, fde->end, gdbarch, pc, &fs,
|
||||
text_offset);
|
||||
per_objfile->objfile->text_section_offset ());
|
||||
|
||||
/* Calculate the CFA. */
|
||||
switch (fs.regs.cfa_how)
|
||||
@@ -923,7 +929,7 @@ dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
|
||||
}
|
||||
|
||||
case CFA_EXP:
|
||||
*text_offset_out = text_offset;
|
||||
*text_offset_out = per_objfile->objfile->text_section_offset ();
|
||||
*cfa_start_out = fs.regs.cfa_exp;
|
||||
*cfa_end_out = fs.regs.cfa_exp + fs.regs.cfa_exp_len;
|
||||
return 0;
|
||||
@@ -956,8 +962,8 @@ struct dwarf2_frame_cache
|
||||
/* Target address size in bytes. */
|
||||
int addr_size;
|
||||
|
||||
/* The .text offset. */
|
||||
CORE_ADDR text_offset;
|
||||
/* The dwarf2_per_objfile from which this frame description came. */
|
||||
dwarf2_per_objfile *per_objfile;
|
||||
|
||||
/* If not NULL then this frame is the bottom frame of a TAILCALL_FRAME
|
||||
sequence. If NULL then it is a normal case with no TAILCALL_FRAME
|
||||
@@ -1003,8 +1009,9 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
CORE_ADDR pc1 = get_frame_address_in_block (this_frame);
|
||||
|
||||
/* Find the correct FDE. */
|
||||
fde = dwarf2_frame_find_fde (&pc1, &cache->text_offset);
|
||||
fde = dwarf2_frame_find_fde (&pc1, &cache->per_objfile);
|
||||
gdb_assert (fde != NULL);
|
||||
gdb_assert (cache->per_objfile != nullptr);
|
||||
|
||||
/* Allocate and initialize the frame state. */
|
||||
struct dwarf2_frame_state fs (pc1, fde->cie);
|
||||
@@ -1018,7 +1025,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
execute_cfa_program (fde, fde->cie->initial_instructions,
|
||||
fde->cie->end, gdbarch,
|
||||
get_frame_address_in_block (this_frame), &fs,
|
||||
cache->text_offset);
|
||||
cache->per_objfile->objfile->text_section_offset ());
|
||||
|
||||
/* Save the initialized register set. */
|
||||
fs.initial = fs.regs;
|
||||
@@ -1034,8 +1041,9 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
&& entry_pc < fde->initial_location + fde->address_range)
|
||||
{
|
||||
/* Decode the insns in the FDE up to the entry PC. */
|
||||
instr = execute_cfa_program (fde, fde->instructions, fde->end, gdbarch,
|
||||
entry_pc, &fs, cache->text_offset);
|
||||
instr = execute_cfa_program
|
||||
(fde, fde->instructions, fde->end, gdbarch, entry_pc, &fs,
|
||||
cache->per_objfile->objfile->text_section_offset ());
|
||||
|
||||
if (fs.regs.cfa_how == CFA_REG_OFFSET
|
||||
&& (dwarf_reg_to_regnum (gdbarch, fs.regs.cfa_reg)
|
||||
@@ -1051,7 +1059,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
/* Then decode the insns in the FDE up to our target PC. */
|
||||
execute_cfa_program (fde, instr, fde->end, gdbarch,
|
||||
get_frame_address_in_block (this_frame), &fs,
|
||||
cache->text_offset);
|
||||
cache->per_objfile->objfile->text_section_offset ());
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1069,8 +1077,8 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||
case CFA_EXP:
|
||||
cache->cfa =
|
||||
execute_stack_op (fs.regs.cfa_exp, fs.regs.cfa_exp_len,
|
||||
cache->addr_size, cache->text_offset,
|
||||
this_frame, 0, 0);
|
||||
cache->addr_size, this_frame, 0, 0,
|
||||
cache->per_objfile);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1270,8 +1278,9 @@ dwarf2_frame_prev_register (struct frame_info *this_frame, void **this_cache,
|
||||
case DWARF2_FRAME_REG_SAVED_EXP:
|
||||
addr = execute_stack_op (cache->reg[regnum].loc.exp.start,
|
||||
cache->reg[regnum].loc.exp.len,
|
||||
cache->addr_size, cache->text_offset,
|
||||
this_frame, cache->cfa, 1);
|
||||
cache->addr_size,
|
||||
this_frame, cache->cfa, 1,
|
||||
cache->per_objfile);
|
||||
return frame_unwind_got_memory (this_frame, regnum, addr);
|
||||
|
||||
case DWARF2_FRAME_REG_SAVED_VAL_OFFSET:
|
||||
@@ -1281,8 +1290,9 @@ dwarf2_frame_prev_register (struct frame_info *this_frame, void **this_cache,
|
||||
case DWARF2_FRAME_REG_SAVED_VAL_EXP:
|
||||
addr = execute_stack_op (cache->reg[regnum].loc.exp.start,
|
||||
cache->reg[regnum].loc.exp.len,
|
||||
cache->addr_size, cache->text_offset,
|
||||
this_frame, cache->cfa, 1);
|
||||
cache->addr_size,
|
||||
this_frame, cache->cfa, 1,
|
||||
cache->per_objfile);
|
||||
return frame_unwind_got_constant (this_frame, regnum, addr);
|
||||
|
||||
case DWARF2_FRAME_REG_UNSPECIFIED:
|
||||
@@ -1650,7 +1660,7 @@ set_comp_unit (struct objfile *objfile, struct comp_unit *unit)
|
||||
initial location associated with it into *PC. */
|
||||
|
||||
static struct dwarf2_fde *
|
||||
dwarf2_frame_find_fde (CORE_ADDR *pc, CORE_ADDR *out_offset)
|
||||
dwarf2_frame_find_fde (CORE_ADDR *pc, dwarf2_per_objfile **out_per_objfile)
|
||||
{
|
||||
for (objfile *objfile : current_program_space->objfiles ())
|
||||
{
|
||||
@@ -1682,8 +1692,9 @@ dwarf2_frame_find_fde (CORE_ADDR *pc, CORE_ADDR *out_offset)
|
||||
if (it != fde_table->end ())
|
||||
{
|
||||
*pc = (*it)->initial_location + offset;
|
||||
if (out_offset)
|
||||
*out_offset = offset;
|
||||
if (out_per_objfile != nullptr)
|
||||
*out_per_objfile = get_dwarf2_per_objfile (objfile);
|
||||
|
||||
return *it;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile)
|
||||
|
||||
/* Get build id of dwz file, if present. */
|
||||
gdb::optional<std::string> dwz_build_id_str;
|
||||
const dwz_file *dwz = dwarf2_get_dwz_file (dwarf2_per_objfile);
|
||||
const dwz_file *dwz = dwarf2_get_dwz_file (dwarf2_per_objfile->per_bfd);
|
||||
const char *dwz_build_id_ptr = NULL;
|
||||
|
||||
if (dwz != nullptr)
|
||||
|
||||
@@ -961,17 +961,17 @@ private:
|
||||
: m_abfd (dwarf2_per_objfile->objfile->obfd),
|
||||
m_dwarf2_per_objfile (dwarf2_per_objfile)
|
||||
{
|
||||
dwarf2_per_objfile->str.read (dwarf2_per_objfile->objfile);
|
||||
if (dwarf2_per_objfile->str.buffer == NULL)
|
||||
dwarf2_per_objfile->per_bfd->str.read (dwarf2_per_objfile->objfile);
|
||||
if (dwarf2_per_objfile->per_bfd->str.buffer == NULL)
|
||||
return;
|
||||
for (const gdb_byte *data = dwarf2_per_objfile->str.buffer;
|
||||
data < (dwarf2_per_objfile->str.buffer
|
||||
+ dwarf2_per_objfile->str.size);)
|
||||
for (const gdb_byte *data = dwarf2_per_objfile->per_bfd->str.buffer;
|
||||
data < (dwarf2_per_objfile->per_bfd->str.buffer
|
||||
+ dwarf2_per_objfile->per_bfd->str.size);)
|
||||
{
|
||||
const char *const s = reinterpret_cast<const char *> (data);
|
||||
const auto insertpair
|
||||
= m_str_table.emplace (c_str_view (s),
|
||||
data - dwarf2_per_objfile->str.buffer);
|
||||
data - dwarf2_per_objfile->per_bfd->str.buffer);
|
||||
if (!insertpair.second)
|
||||
complaint (_("Duplicate string \"%s\" in "
|
||||
".debug_str section [in module %s]"),
|
||||
@@ -988,7 +988,7 @@ private:
|
||||
const auto it = m_str_table.find (c_str_view (s));
|
||||
if (it != m_str_table.end ())
|
||||
return it->second;
|
||||
const size_t offset = (m_dwarf2_per_objfile->str.size
|
||||
const size_t offset = (m_dwarf2_per_objfile->per_bfd->str.size
|
||||
+ m_str_add_buf.size ());
|
||||
m_str_table.emplace (c_str_view (s), offset);
|
||||
m_str_add_buf.append_cstr0 (s);
|
||||
@@ -1296,12 +1296,12 @@ private:
|
||||
static bool
|
||||
check_dwarf64_offsets (struct dwarf2_per_objfile *dwarf2_per_objfile)
|
||||
{
|
||||
for (dwarf2_per_cu_data *per_cu : dwarf2_per_objfile->all_comp_units)
|
||||
for (dwarf2_per_cu_data *per_cu : dwarf2_per_objfile->per_bfd->all_comp_units)
|
||||
{
|
||||
if (to_underlying (per_cu->sect_off) >= (static_cast<uint64_t> (1) << 32))
|
||||
return true;
|
||||
}
|
||||
for (const signatured_type *sigtype : dwarf2_per_objfile->all_type_units)
|
||||
for (const signatured_type *sigtype : dwarf2_per_objfile->per_bfd->all_type_units)
|
||||
{
|
||||
const dwarf2_per_cu_data &per_cu = sigtype->per_cu;
|
||||
|
||||
@@ -1321,7 +1321,7 @@ static size_t
|
||||
psyms_seen_size (struct dwarf2_per_objfile *dwarf2_per_objfile)
|
||||
{
|
||||
size_t psyms_count = 0;
|
||||
for (dwarf2_per_cu_data *per_cu : dwarf2_per_objfile->all_comp_units)
|
||||
for (dwarf2_per_cu_data *per_cu : dwarf2_per_objfile->per_bfd->all_comp_units)
|
||||
{
|
||||
partial_symtab *psymtab = per_cu->v.psymtab;
|
||||
|
||||
@@ -1414,7 +1414,7 @@ write_gdbindex (struct dwarf2_per_objfile *dwarf2_per_objfile, FILE *out_file,
|
||||
in the index file). This will later be needed to write the address
|
||||
table. */
|
||||
psym_index_map cu_index_htab;
|
||||
cu_index_htab.reserve (dwarf2_per_objfile->all_comp_units.size ());
|
||||
cu_index_htab.reserve (dwarf2_per_objfile->per_bfd->all_comp_units.size ());
|
||||
|
||||
/* The CU list is already sorted, so we don't need to do additional
|
||||
work here. Also, the debug_types entries do not appear in
|
||||
@@ -1422,10 +1422,10 @@ write_gdbindex (struct dwarf2_per_objfile *dwarf2_per_objfile, FILE *out_file,
|
||||
|
||||
std::unordered_set<partial_symbol *> psyms_seen
|
||||
(psyms_seen_size (dwarf2_per_objfile));
|
||||
for (int i = 0; i < dwarf2_per_objfile->all_comp_units.size (); ++i)
|
||||
for (int i = 0; i < dwarf2_per_objfile->per_bfd->all_comp_units.size (); ++i)
|
||||
{
|
||||
struct dwarf2_per_cu_data *per_cu
|
||||
= dwarf2_per_objfile->all_comp_units[i];
|
||||
= dwarf2_per_objfile->per_bfd->all_comp_units[i];
|
||||
partial_symtab *psymtab = per_cu->v.psymtab;
|
||||
|
||||
if (psymtab != NULL)
|
||||
@@ -1453,15 +1453,15 @@ write_gdbindex (struct dwarf2_per_objfile *dwarf2_per_objfile, FILE *out_file,
|
||||
|
||||
/* Write out the .debug_type entries, if any. */
|
||||
data_buf types_cu_list;
|
||||
if (dwarf2_per_objfile->signatured_types)
|
||||
if (dwarf2_per_objfile->per_bfd->signatured_types)
|
||||
{
|
||||
signatured_type_index_data sig_data (types_cu_list,
|
||||
psyms_seen);
|
||||
|
||||
sig_data.objfile = objfile;
|
||||
sig_data.symtab = &symtab;
|
||||
sig_data.cu_index = dwarf2_per_objfile->all_comp_units.size ();
|
||||
htab_traverse_noresize (dwarf2_per_objfile->signatured_types.get (),
|
||||
sig_data.cu_index = dwarf2_per_objfile->per_bfd->all_comp_units.size ();
|
||||
htab_traverse_noresize (dwarf2_per_objfile->per_bfd->signatured_types.get (),
|
||||
write_one_signatured_type, &sig_data);
|
||||
}
|
||||
|
||||
@@ -1505,9 +1505,9 @@ write_debug_names (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
||||
dwarf5_byte_order);
|
||||
std::unordered_set<partial_symbol *>
|
||||
psyms_seen (psyms_seen_size (dwarf2_per_objfile));
|
||||
for (int i = 0; i < dwarf2_per_objfile->all_comp_units.size (); ++i)
|
||||
for (int i = 0; i < dwarf2_per_objfile->per_bfd->all_comp_units.size (); ++i)
|
||||
{
|
||||
const dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->all_comp_units[i];
|
||||
const dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->per_bfd->all_comp_units[i];
|
||||
partial_symtab *psymtab = per_cu->v.psymtab;
|
||||
|
||||
/* CU of a shared file from 'dwz -m' may be unused by this main
|
||||
@@ -1525,7 +1525,7 @@ write_debug_names (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
||||
|
||||
/* Write out the .debug_type entries, if any. */
|
||||
data_buf types_cu_list;
|
||||
if (dwarf2_per_objfile->signatured_types)
|
||||
if (dwarf2_per_objfile->per_bfd->signatured_types)
|
||||
{
|
||||
debug_names::write_one_signatured_type_data sig_data (nametable,
|
||||
signatured_type_index_data (types_cu_list, psyms_seen));
|
||||
@@ -1534,7 +1534,7 @@ write_debug_names (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
||||
/* It is used only for gdb_index. */
|
||||
sig_data.info.symtab = nullptr;
|
||||
sig_data.info.cu_index = 0;
|
||||
htab_traverse_noresize (dwarf2_per_objfile->signatured_types.get (),
|
||||
htab_traverse_noresize (dwarf2_per_objfile->per_bfd->signatured_types.get (),
|
||||
debug_names::write_one_signatured_type,
|
||||
&sig_data);
|
||||
}
|
||||
@@ -1574,12 +1574,12 @@ write_debug_names (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
||||
|
||||
/* comp_unit_count - The number of CUs in the CU list. */
|
||||
header.append_uint (4, dwarf5_byte_order,
|
||||
dwarf2_per_objfile->all_comp_units.size ());
|
||||
dwarf2_per_objfile->per_bfd->all_comp_units.size ());
|
||||
|
||||
/* local_type_unit_count - The number of TUs in the local TU
|
||||
list. */
|
||||
header.append_uint (4, dwarf5_byte_order,
|
||||
dwarf2_per_objfile->all_type_units.size ());
|
||||
dwarf2_per_objfile->per_bfd->all_type_units.size ());
|
||||
|
||||
/* foreign_type_unit_count - The number of TUs in the foreign TU
|
||||
list. */
|
||||
@@ -1676,10 +1676,10 @@ write_psymtabs_to_index (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
||||
{
|
||||
struct objfile *objfile = dwarf2_per_objfile->objfile;
|
||||
|
||||
if (dwarf2_per_objfile->using_index)
|
||||
if (dwarf2_per_objfile->per_bfd->using_index)
|
||||
error (_("Cannot use an index to create the index"));
|
||||
|
||||
if (dwarf2_per_objfile->types.size () > 1)
|
||||
if (dwarf2_per_objfile->per_bfd->types.size () > 1)
|
||||
error (_("Cannot make an index when the file has multiple .debug_types sections"));
|
||||
|
||||
if (!objfile->partial_symtabs->psymtabs
|
||||
@@ -1761,7 +1761,8 @@ save_gdb_index_command (const char *arg, int from_tty)
|
||||
try
|
||||
{
|
||||
const char *basename = lbasename (objfile_name (objfile));
|
||||
const dwz_file *dwz = dwarf2_get_dwz_file (dwarf2_per_objfile);
|
||||
const dwz_file *dwz
|
||||
= dwarf2_get_dwz_file (dwarf2_per_objfile->per_bfd);
|
||||
const char *dwz_basename = NULL;
|
||||
|
||||
if (dwz != NULL)
|
||||
|
||||
289
gdb/dwarf2/loc.c
289
gdb/dwarf2/loc.c
@@ -47,23 +47,22 @@
|
||||
#include "gdbsupport/underlying.h"
|
||||
#include "gdbsupport/byte-vector.h"
|
||||
|
||||
static struct value *dwarf2_evaluate_loc_desc_full (struct type *type,
|
||||
struct frame_info *frame,
|
||||
const gdb_byte *data,
|
||||
size_t size,
|
||||
struct dwarf2_per_cu_data *per_cu,
|
||||
struct type *subobj_type,
|
||||
LONGEST subobj_byte_offset);
|
||||
static struct value *dwarf2_evaluate_loc_desc_full
|
||||
(struct type *type, struct frame_info *frame, const gdb_byte *data,
|
||||
size_t size, dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile,
|
||||
struct type *subobj_type, LONGEST subobj_byte_offset);
|
||||
|
||||
static struct call_site_parameter *dwarf_expr_reg_to_entry_parameter
|
||||
(struct frame_info *frame,
|
||||
enum call_site_parameter_kind kind,
|
||||
union call_site_parameter_u kind_u,
|
||||
struct dwarf2_per_cu_data **per_cu_return);
|
||||
dwarf2_per_cu_data **per_cu_return,
|
||||
dwarf2_per_objfile **per_objfile_return);
|
||||
|
||||
static struct value *indirect_synthetic_pointer
|
||||
(sect_offset die, LONGEST byte_offset,
|
||||
struct dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile,
|
||||
struct frame_info *frame,
|
||||
struct type *type, bool resolve_abstract_p = false);
|
||||
|
||||
@@ -163,7 +162,8 @@ decode_debug_loc_addresses (const gdb_byte *loc_ptr, const gdb_byte *buf_end,
|
||||
The result indicates the kind of entry found. */
|
||||
|
||||
static enum debug_loc_kind
|
||||
decode_debug_loclists_addresses (struct dwarf2_per_cu_data *per_cu,
|
||||
decode_debug_loclists_addresses (dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile,
|
||||
const gdb_byte *loc_ptr,
|
||||
const gdb_byte *buf_end,
|
||||
const gdb_byte **new_ptr,
|
||||
@@ -184,14 +184,14 @@ decode_debug_loclists_addresses (struct dwarf2_per_cu_data *per_cu,
|
||||
loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64);
|
||||
if (loc_ptr == NULL)
|
||||
return DEBUG_LOC_BUFFER_OVERFLOW;
|
||||
*high = dwarf2_read_addr_index (per_cu, u64);
|
||||
*high = dwarf2_read_addr_index (per_cu, per_objfile, u64);
|
||||
*new_ptr = loc_ptr;
|
||||
return DEBUG_LOC_BASE_ADDRESS;
|
||||
case DW_LLE_startx_length:
|
||||
loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64);
|
||||
if (loc_ptr == NULL)
|
||||
return DEBUG_LOC_BUFFER_OVERFLOW;
|
||||
*low = dwarf2_read_addr_index (per_cu, u64);
|
||||
*low = dwarf2_read_addr_index (per_cu, per_objfile, u64);
|
||||
*high = *low;
|
||||
loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64);
|
||||
if (loc_ptr == NULL)
|
||||
@@ -253,7 +253,8 @@ decode_debug_loclists_addresses (struct dwarf2_per_cu_data *per_cu,
|
||||
The result indicates the kind of entry found. */
|
||||
|
||||
static enum debug_loc_kind
|
||||
decode_debug_loc_dwo_addresses (struct dwarf2_per_cu_data *per_cu,
|
||||
decode_debug_loc_dwo_addresses (dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile,
|
||||
const gdb_byte *loc_ptr,
|
||||
const gdb_byte *buf_end,
|
||||
const gdb_byte **new_ptr,
|
||||
@@ -275,25 +276,25 @@ decode_debug_loc_dwo_addresses (struct dwarf2_per_cu_data *per_cu,
|
||||
loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &high_index);
|
||||
if (loc_ptr == NULL)
|
||||
return DEBUG_LOC_BUFFER_OVERFLOW;
|
||||
*high = dwarf2_read_addr_index (per_cu, high_index);
|
||||
*high = dwarf2_read_addr_index (per_cu, per_objfile, high_index);
|
||||
*new_ptr = loc_ptr;
|
||||
return DEBUG_LOC_BASE_ADDRESS;
|
||||
case DW_LLE_GNU_start_end_entry:
|
||||
loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &low_index);
|
||||
if (loc_ptr == NULL)
|
||||
return DEBUG_LOC_BUFFER_OVERFLOW;
|
||||
*low = dwarf2_read_addr_index (per_cu, low_index);
|
||||
*low = dwarf2_read_addr_index (per_cu, per_objfile, low_index);
|
||||
loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &high_index);
|
||||
if (loc_ptr == NULL)
|
||||
return DEBUG_LOC_BUFFER_OVERFLOW;
|
||||
*high = dwarf2_read_addr_index (per_cu, high_index);
|
||||
*high = dwarf2_read_addr_index (per_cu, per_objfile, high_index);
|
||||
*new_ptr = loc_ptr;
|
||||
return DEBUG_LOC_START_END;
|
||||
case DW_LLE_GNU_start_length_entry:
|
||||
loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &low_index);
|
||||
if (loc_ptr == NULL)
|
||||
return DEBUG_LOC_BUFFER_OVERFLOW;
|
||||
*low = dwarf2_read_addr_index (per_cu, low_index);
|
||||
*low = dwarf2_read_addr_index (per_cu, per_objfile, low_index);
|
||||
if (loc_ptr + 4 > buf_end)
|
||||
return DEBUG_LOC_BUFFER_OVERFLOW;
|
||||
*high = *low;
|
||||
@@ -317,13 +318,14 @@ const gdb_byte *
|
||||
dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton,
|
||||
size_t *locexpr_length, CORE_ADDR pc)
|
||||
{
|
||||
struct objfile *objfile = baton->per_cu->objfile ();
|
||||
dwarf2_per_objfile *per_objfile = baton->per_objfile;
|
||||
struct objfile *objfile = per_objfile->objfile;
|
||||
struct gdbarch *gdbarch = objfile->arch ();
|
||||
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
|
||||
unsigned int addr_size = baton->per_cu->addr_size ();
|
||||
int signed_addr_p = bfd_get_sign_extend_vma (objfile->obfd);
|
||||
/* Adjust base_address for relocatable objects. */
|
||||
CORE_ADDR base_offset = baton->per_cu->text_offset ();
|
||||
CORE_ADDR base_offset = baton->per_objfile->objfile->text_section_offset ();
|
||||
CORE_ADDR base_address = baton->base_address + base_offset;
|
||||
const gdb_byte *loc_ptr, *buf_end;
|
||||
|
||||
@@ -339,6 +341,7 @@ dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton,
|
||||
|
||||
if (baton->per_cu->version () < 5 && baton->from_dwo)
|
||||
kind = decode_debug_loc_dwo_addresses (baton->per_cu,
|
||||
baton->per_objfile,
|
||||
loc_ptr, buf_end, &new_ptr,
|
||||
&low, &high, byte_order);
|
||||
else if (baton->per_cu->version () < 5)
|
||||
@@ -348,6 +351,7 @@ dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton,
|
||||
signed_addr_p);
|
||||
else
|
||||
kind = decode_debug_loclists_addresses (baton->per_cu,
|
||||
baton->per_objfile,
|
||||
loc_ptr, buf_end, &new_ptr,
|
||||
&low, &high, byte_order,
|
||||
addr_size, signed_addr_p);
|
||||
@@ -470,7 +474,7 @@ locexpr_get_frame_base (struct symbol *framefunc, struct frame_info *frame)
|
||||
SYMBOL_BLOCK_OPS (framefunc)->find_frame_base_location
|
||||
(framefunc, get_frame_pc (frame), &start, &length);
|
||||
result = dwarf2_evaluate_loc_desc (type, frame, start, length,
|
||||
dlbaton->per_cu);
|
||||
dlbaton->per_cu, dlbaton->per_objfile);
|
||||
|
||||
/* The DW_AT_frame_base attribute contains a location description which
|
||||
computes the base address itself. However, the call to
|
||||
@@ -527,7 +531,7 @@ loclist_get_frame_base (struct symbol *framefunc, struct frame_info *frame)
|
||||
SYMBOL_BLOCK_OPS (framefunc)->find_frame_base_location
|
||||
(framefunc, get_frame_pc (frame), &start, &length);
|
||||
result = dwarf2_evaluate_loc_desc (type, frame, start, length,
|
||||
dlbaton->per_cu);
|
||||
dlbaton->per_cu, dlbaton->per_objfile);
|
||||
|
||||
/* The DW_AT_frame_base attribute contains a location description which
|
||||
computes the base address itself. However, the call to
|
||||
@@ -576,11 +580,11 @@ get_frame_pc_for_per_cu_dwarf_call (void *baton)
|
||||
|
||||
static void
|
||||
per_cu_dwarf_call (struct dwarf_expr_context *ctx, cu_offset die_offset,
|
||||
struct dwarf2_per_cu_data *per_cu)
|
||||
dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile)
|
||||
{
|
||||
struct dwarf2_locexpr_baton block;
|
||||
|
||||
block = dwarf2_fetch_die_loc_cu_off (die_offset, per_cu,
|
||||
block = dwarf2_fetch_die_loc_cu_off (die_offset, per_cu, per_objfile,
|
||||
get_frame_pc_for_per_cu_dwarf_call,
|
||||
ctx);
|
||||
|
||||
@@ -596,9 +600,11 @@ per_cu_dwarf_call (struct dwarf_expr_context *ctx, cu_offset die_offset,
|
||||
|
||||
static struct value *
|
||||
sect_variable_value (struct dwarf_expr_context *ctx, sect_offset sect_off,
|
||||
struct dwarf2_per_cu_data *per_cu)
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile)
|
||||
{
|
||||
struct type *die_type = dwarf2_fetch_die_type_sect_off (sect_off, per_cu);
|
||||
struct type *die_type
|
||||
= dwarf2_fetch_die_type_sect_off (sect_off, per_cu, per_objfile);
|
||||
|
||||
if (die_type == NULL)
|
||||
error (_("Bad DW_OP_GNU_variable_value DIE."));
|
||||
@@ -611,12 +617,16 @@ sect_variable_value (struct dwarf_expr_context *ctx, sect_offset sect_off,
|
||||
|
||||
struct type *type = lookup_pointer_type (die_type);
|
||||
struct frame_info *frame = get_selected_frame (_("No frame selected."));
|
||||
return indirect_synthetic_pointer (sect_off, 0, per_cu, frame, type, true);
|
||||
return indirect_synthetic_pointer (sect_off, 0, per_cu, per_objfile, frame,
|
||||
type, true);
|
||||
}
|
||||
|
||||
class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
||||
{
|
||||
public:
|
||||
public:
|
||||
dwarf_evaluate_loc_desc (dwarf2_per_objfile *per_objfile)
|
||||
: dwarf_expr_context (per_objfile)
|
||||
{}
|
||||
|
||||
struct frame_info *frame;
|
||||
struct dwarf2_per_cu_data *per_cu;
|
||||
@@ -642,9 +652,7 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
||||
current thread's thread-local storage with offset OFFSET. */
|
||||
CORE_ADDR get_tls_address (CORE_ADDR offset) override
|
||||
{
|
||||
struct objfile *objfile = per_cu->objfile ();
|
||||
|
||||
return target_translate_tls_address (objfile, offset);
|
||||
return target_translate_tls_address (per_objfile->objfile, offset);
|
||||
}
|
||||
|
||||
/* Helper interface of per_cu_dwarf_call for
|
||||
@@ -652,7 +660,7 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
||||
|
||||
void dwarf_call (cu_offset die_offset) override
|
||||
{
|
||||
per_cu_dwarf_call (this, die_offset, per_cu);
|
||||
per_cu_dwarf_call (this, die_offset, per_cu, per_objfile);
|
||||
}
|
||||
|
||||
/* Helper interface of sect_variable_value for
|
||||
@@ -660,12 +668,12 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
||||
|
||||
struct value *dwarf_variable_value (sect_offset sect_off) override
|
||||
{
|
||||
return sect_variable_value (this, sect_off, per_cu);
|
||||
return sect_variable_value (this, sect_off, per_cu, per_objfile);
|
||||
}
|
||||
|
||||
struct type *get_base_type (cu_offset die_offset, int size) override
|
||||
{
|
||||
struct type *result = dwarf2_get_die_type (die_offset, per_cu);
|
||||
struct type *result = dwarf2_get_die_type (die_offset, per_cu, per_objfile);
|
||||
if (result == NULL)
|
||||
error (_("Could not find type for DW_OP_const_type"));
|
||||
if (size != 0 && TYPE_LENGTH (result) != size)
|
||||
@@ -678,7 +686,7 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
||||
|
||||
CORE_ADDR get_addr_index (unsigned int index) override
|
||||
{
|
||||
return dwarf2_read_addr_index (per_cu, index);
|
||||
return dwarf2_read_addr_index (per_cu, per_objfile, index);
|
||||
}
|
||||
|
||||
/* Callback function for get_object_address. Return the address of the VLA
|
||||
@@ -704,7 +712,8 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
||||
int deref_size) override
|
||||
{
|
||||
struct frame_info *caller_frame;
|
||||
struct dwarf2_per_cu_data *caller_per_cu;
|
||||
dwarf2_per_cu_data *caller_per_cu;
|
||||
dwarf2_per_objfile *caller_per_objfile;
|
||||
struct call_site_parameter *parameter;
|
||||
const gdb_byte *data_src;
|
||||
size_t size;
|
||||
@@ -712,10 +721,13 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
||||
caller_frame = get_prev_frame (frame);
|
||||
|
||||
parameter = dwarf_expr_reg_to_entry_parameter (frame, kind, kind_u,
|
||||
&caller_per_cu);
|
||||
&caller_per_cu,
|
||||
&caller_per_objfile);
|
||||
data_src = deref_size == -1 ? parameter->value : parameter->data_value;
|
||||
size = deref_size == -1 ? parameter->value_size : parameter->data_value_size;
|
||||
|
||||
gdb_assert (this->per_objfile == caller_per_objfile);
|
||||
|
||||
/* DEREF_SIZE size is not verified here. */
|
||||
if (data_src == NULL)
|
||||
throw_error (NO_ENTRY_VALUE_ERROR,
|
||||
@@ -729,11 +741,9 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
||||
(CORE_ADDR) 0);
|
||||
|
||||
scoped_restore save_arch = make_scoped_restore (&this->gdbarch);
|
||||
this->gdbarch = per_cu->objfile ()->arch ();
|
||||
this->gdbarch = this->per_objfile->objfile->arch ();
|
||||
scoped_restore save_addr_size = make_scoped_restore (&this->addr_size);
|
||||
this->addr_size = per_cu->addr_size ();
|
||||
scoped_restore save_offset = make_scoped_restore (&this->offset);
|
||||
this->offset = per_cu->text_offset ();
|
||||
|
||||
this->eval (data_src, size);
|
||||
}
|
||||
@@ -859,7 +869,8 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
|
||||
caller_core_addr_type = builtin_type (caller_arch)->builtin_func_ptr;
|
||||
val = dwarf2_evaluate_loc_desc (caller_core_addr_type, caller_frame,
|
||||
dwarf_block->data, dwarf_block->size,
|
||||
dwarf_block->per_cu);
|
||||
dwarf_block->per_cu,
|
||||
dwarf_block->per_objfile);
|
||||
/* DW_AT_call_target is a DWARF expression, not a DWARF location. */
|
||||
if (VALUE_LVAL (val) == lval_memory)
|
||||
return value_address (val);
|
||||
@@ -1280,7 +1291,8 @@ static struct call_site_parameter *
|
||||
dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
|
||||
enum call_site_parameter_kind kind,
|
||||
union call_site_parameter_u kind_u,
|
||||
struct dwarf2_per_cu_data **per_cu_return)
|
||||
dwarf2_per_cu_data **per_cu_return,
|
||||
dwarf2_per_objfile **per_objfile_return)
|
||||
{
|
||||
CORE_ADDR func_addr, caller_pc;
|
||||
struct gdbarch *gdbarch;
|
||||
@@ -1371,6 +1383,7 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
|
||||
}
|
||||
|
||||
*per_cu_return = call_site->per_cu;
|
||||
*per_objfile_return = call_site->per_objfile;
|
||||
return parameter;
|
||||
}
|
||||
|
||||
@@ -1388,7 +1401,8 @@ static struct value *
|
||||
dwarf_entry_parameter_to_value (struct call_site_parameter *parameter,
|
||||
CORE_ADDR deref_size, struct type *type,
|
||||
struct frame_info *caller_frame,
|
||||
struct dwarf2_per_cu_data *per_cu)
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile)
|
||||
{
|
||||
const gdb_byte *data_src;
|
||||
gdb_byte *data;
|
||||
@@ -1409,7 +1423,8 @@ dwarf_entry_parameter_to_value (struct call_site_parameter *parameter,
|
||||
memcpy (data, data_src, size);
|
||||
data[size] = DW_OP_stack_value;
|
||||
|
||||
return dwarf2_evaluate_loc_desc (type, caller_frame, data, size + 1, per_cu);
|
||||
return dwarf2_evaluate_loc_desc (type, caller_frame, data, size + 1, per_cu,
|
||||
per_objfile);
|
||||
}
|
||||
|
||||
/* VALUE must be of type lval_computed with entry_data_value_funcs. Perform
|
||||
@@ -1483,14 +1498,17 @@ value_of_dwarf_reg_entry (struct type *type, struct frame_info *frame,
|
||||
struct frame_info *caller_frame = get_prev_frame (frame);
|
||||
struct value *outer_val, *target_val, *val;
|
||||
struct call_site_parameter *parameter;
|
||||
struct dwarf2_per_cu_data *caller_per_cu;
|
||||
dwarf2_per_cu_data *caller_per_cu;
|
||||
dwarf2_per_objfile *caller_per_objfile;
|
||||
|
||||
parameter = dwarf_expr_reg_to_entry_parameter (frame, kind, kind_u,
|
||||
&caller_per_cu);
|
||||
&caller_per_cu,
|
||||
&caller_per_objfile);
|
||||
|
||||
outer_val = dwarf_entry_parameter_to_value (parameter, -1 /* deref_size */,
|
||||
type, caller_frame,
|
||||
caller_per_cu);
|
||||
caller_per_cu,
|
||||
caller_per_objfile);
|
||||
|
||||
/* Check if DW_AT_call_data_value cannot be used. If it should be
|
||||
used and it is not available do not fall back to OUTER_VAL - dereferencing
|
||||
@@ -1504,7 +1522,8 @@ value_of_dwarf_reg_entry (struct type *type, struct frame_info *frame,
|
||||
target_val = dwarf_entry_parameter_to_value (parameter,
|
||||
TYPE_LENGTH (target_type),
|
||||
target_type, caller_frame,
|
||||
caller_per_cu);
|
||||
caller_per_cu,
|
||||
caller_per_objfile);
|
||||
|
||||
val = allocate_computed_value (type, &entry_data_value_funcs,
|
||||
release_value (target_val).release ());
|
||||
@@ -1552,6 +1571,9 @@ struct piece_closure
|
||||
/* Reference count. */
|
||||
int refc = 0;
|
||||
|
||||
/* The objfile from which this closure's expression came. */
|
||||
dwarf2_per_objfile *per_objfile = nullptr;
|
||||
|
||||
/* The CU from which this closure's expression came. */
|
||||
struct dwarf2_per_cu_data *per_cu = NULL;
|
||||
|
||||
@@ -1567,13 +1589,16 @@ struct piece_closure
|
||||
PIECES. */
|
||||
|
||||
static struct piece_closure *
|
||||
allocate_piece_closure (struct dwarf2_per_cu_data *per_cu,
|
||||
allocate_piece_closure (dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile,
|
||||
std::vector<dwarf_expr_piece> &&pieces,
|
||||
struct frame_info *frame)
|
||||
{
|
||||
struct piece_closure *c = new piece_closure;
|
||||
|
||||
c->refc = 1;
|
||||
/* We must capture this here due to sharing of DWARF state. */
|
||||
c->per_objfile = per_objfile;
|
||||
c->per_cu = per_cu;
|
||||
c->pieces = std::move (pieces);
|
||||
if (frame == NULL)
|
||||
@@ -1815,8 +1840,7 @@ rw_pieced_value (struct value *v, struct value *from)
|
||||
break;
|
||||
}
|
||||
|
||||
struct objfile *objfile = c->per_cu->objfile ();
|
||||
struct gdbarch *objfile_gdbarch = objfile->arch ();
|
||||
gdbarch *objfile_gdbarch = c->per_objfile->objfile->arch ();
|
||||
ULONGEST stack_value_size_bits
|
||||
= 8 * TYPE_LENGTH (value_type (p->v.value));
|
||||
|
||||
@@ -1951,7 +1975,8 @@ get_frame_address_in_block_wrapper (void *baton)
|
||||
|
||||
static struct value *
|
||||
fetch_const_value_from_synthetic_pointer (sect_offset die, LONGEST byte_offset,
|
||||
struct dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile,
|
||||
struct type *type)
|
||||
{
|
||||
struct value *result = NULL;
|
||||
@@ -1959,7 +1984,8 @@ fetch_const_value_from_synthetic_pointer (sect_offset die, LONGEST byte_offset,
|
||||
LONGEST len;
|
||||
|
||||
auto_obstack temp_obstack;
|
||||
bytes = dwarf2_fetch_constant_bytes (die, per_cu, &temp_obstack, &len);
|
||||
bytes = dwarf2_fetch_constant_bytes (die, per_cu, per_objfile,
|
||||
&temp_obstack, &len);
|
||||
|
||||
if (bytes != NULL)
|
||||
{
|
||||
@@ -1982,18 +2008,20 @@ fetch_const_value_from_synthetic_pointer (sect_offset die, LONGEST byte_offset,
|
||||
|
||||
static struct value *
|
||||
indirect_synthetic_pointer (sect_offset die, LONGEST byte_offset,
|
||||
struct dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile,
|
||||
struct frame_info *frame, struct type *type,
|
||||
bool resolve_abstract_p)
|
||||
{
|
||||
/* Fetch the location expression of the DIE we're pointing to. */
|
||||
struct dwarf2_locexpr_baton baton
|
||||
= dwarf2_fetch_die_loc_sect_off (die, per_cu,
|
||||
= dwarf2_fetch_die_loc_sect_off (die, per_cu, per_objfile,
|
||||
get_frame_address_in_block_wrapper, frame,
|
||||
resolve_abstract_p);
|
||||
|
||||
/* Get type of pointed-to DIE. */
|
||||
struct type *orig_type = dwarf2_fetch_die_type_sect_off (die, per_cu);
|
||||
struct type *orig_type = dwarf2_fetch_die_type_sect_off (die, per_cu,
|
||||
per_objfile);
|
||||
if (orig_type == NULL)
|
||||
invalid_synthetic_pointer ();
|
||||
|
||||
@@ -2003,11 +2031,12 @@ indirect_synthetic_pointer (sect_offset die, LONGEST byte_offset,
|
||||
if (baton.data != NULL)
|
||||
return dwarf2_evaluate_loc_desc_full (orig_type, frame, baton.data,
|
||||
baton.size, baton.per_cu,
|
||||
baton.per_objfile,
|
||||
TYPE_TARGET_TYPE (type),
|
||||
byte_offset);
|
||||
else
|
||||
return fetch_const_value_from_synthetic_pointer (die, byte_offset, per_cu,
|
||||
type);
|
||||
per_objfile, type);
|
||||
}
|
||||
|
||||
/* An implementation of an lval_funcs method to indirect through a
|
||||
@@ -2084,7 +2113,7 @@ indirect_pieced_value (struct value *value)
|
||||
|
||||
return indirect_synthetic_pointer (piece->v.ptr.die_sect_off,
|
||||
byte_offset, c->per_cu,
|
||||
frame, type);
|
||||
c->per_objfile, frame, type);
|
||||
}
|
||||
|
||||
/* Implementation of the coerce_ref method of lval_funcs for synthetic C++
|
||||
@@ -2111,7 +2140,7 @@ coerce_pieced_ref (const struct value *value)
|
||||
return indirect_synthetic_pointer
|
||||
(closure->pieces[0].v.ptr.die_sect_off,
|
||||
closure->pieces[0].v.ptr.offset,
|
||||
closure->per_cu, frame, type);
|
||||
closure->per_cu, closure->per_objfile, frame, type);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2167,12 +2196,12 @@ static const struct lval_funcs pieced_value_funcs = {
|
||||
static struct value *
|
||||
dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
|
||||
const gdb_byte *data, size_t size,
|
||||
struct dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile,
|
||||
struct type *subobj_type,
|
||||
LONGEST subobj_byte_offset)
|
||||
{
|
||||
struct value *retval;
|
||||
struct objfile *objfile = per_cu->objfile ();
|
||||
|
||||
if (subobj_type == NULL)
|
||||
{
|
||||
@@ -2185,17 +2214,16 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
|
||||
if (size == 0)
|
||||
return allocate_optimized_out_value (subobj_type);
|
||||
|
||||
dwarf_evaluate_loc_desc ctx;
|
||||
dwarf_evaluate_loc_desc ctx (per_objfile);
|
||||
ctx.frame = frame;
|
||||
ctx.per_cu = per_cu;
|
||||
ctx.obj_address = 0;
|
||||
|
||||
scoped_value_mark free_values;
|
||||
|
||||
ctx.gdbarch = objfile->arch ();
|
||||
ctx.gdbarch = per_objfile->objfile->arch ();
|
||||
ctx.addr_size = per_cu->addr_size ();
|
||||
ctx.ref_addr_size = per_cu->ref_addr_size ();
|
||||
ctx.offset = per_cu->text_offset ();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -2234,7 +2262,8 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
|
||||
if (bit_size > 8 * TYPE_LENGTH (type))
|
||||
invalid_synthetic_pointer ();
|
||||
|
||||
c = allocate_piece_closure (per_cu, std::move (ctx.pieces), frame);
|
||||
c = allocate_piece_closure (per_cu, per_objfile, std::move (ctx.pieces),
|
||||
frame);
|
||||
/* We must clean up the value chain after creating the piece
|
||||
closure but before allocating the result. */
|
||||
free_values.free_to_mark ();
|
||||
@@ -2315,7 +2344,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
|
||||
size_t n = TYPE_LENGTH (value_type (value));
|
||||
size_t len = TYPE_LENGTH (subobj_type);
|
||||
size_t max = TYPE_LENGTH (type);
|
||||
struct gdbarch *objfile_gdbarch = objfile->arch ();
|
||||
gdbarch *objfile_gdbarch = per_objfile->objfile->arch ();
|
||||
|
||||
if (subobj_byte_offset + len > max)
|
||||
invalid_synthetic_pointer ();
|
||||
@@ -2378,10 +2407,11 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
|
||||
struct value *
|
||||
dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame,
|
||||
const gdb_byte *data, size_t size,
|
||||
struct dwarf2_per_cu_data *per_cu)
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile)
|
||||
{
|
||||
return dwarf2_evaluate_loc_desc_full (type, frame, data, size, per_cu,
|
||||
NULL, 0);
|
||||
per_objfile, NULL, 0);
|
||||
}
|
||||
|
||||
/* A specialization of dwarf_evaluate_loc_desc that is used by
|
||||
@@ -2392,6 +2422,10 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame,
|
||||
|
||||
struct evaluate_for_locexpr_baton : public dwarf_evaluate_loc_desc
|
||||
{
|
||||
evaluate_for_locexpr_baton (dwarf2_per_objfile *per_objfile)
|
||||
: dwarf_evaluate_loc_desc (per_objfile)
|
||||
{}
|
||||
|
||||
/* The data that was passed in. */
|
||||
gdb::array_view<const gdb_byte> data_view;
|
||||
|
||||
@@ -2437,12 +2471,11 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
|
||||
CORE_ADDR *valp,
|
||||
bool push_initial_value)
|
||||
{
|
||||
struct objfile *objfile;
|
||||
|
||||
if (dlbaton == NULL || dlbaton->size == 0)
|
||||
return 0;
|
||||
|
||||
evaluate_for_locexpr_baton ctx;
|
||||
dwarf2_per_objfile *per_objfile = dlbaton->per_objfile;
|
||||
evaluate_for_locexpr_baton ctx (per_objfile);
|
||||
|
||||
ctx.frame = frame;
|
||||
ctx.per_cu = dlbaton->per_cu;
|
||||
@@ -2454,12 +2487,9 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
|
||||
ctx.data_view = addr_stack->valaddr;
|
||||
}
|
||||
|
||||
objfile = dlbaton->per_cu->objfile ();
|
||||
|
||||
ctx.gdbarch = objfile->arch ();
|
||||
ctx.gdbarch = per_objfile->objfile->arch ();
|
||||
ctx.addr_size = dlbaton->per_cu->addr_size ();
|
||||
ctx.ref_addr_size = dlbaton->per_cu->ref_addr_size ();
|
||||
ctx.offset = dlbaton->per_cu->text_offset ();
|
||||
|
||||
if (push_initial_value)
|
||||
ctx.push_address (ctx.obj_address, false);
|
||||
@@ -2582,7 +2612,8 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
|
||||
if (data != NULL)
|
||||
{
|
||||
val = dwarf2_evaluate_loc_desc (baton->property_type, frame, data,
|
||||
size, baton->loclist.per_cu);
|
||||
size, baton->loclist.per_cu,
|
||||
baton->loclist.per_objfile);
|
||||
if (!value_optimized_out (val))
|
||||
{
|
||||
*value = value_as_address (val);
|
||||
@@ -2642,13 +2673,15 @@ dwarf2_compile_property_to_c (string_file *stream,
|
||||
= (struct dwarf2_property_baton *) prop->data.baton;
|
||||
const gdb_byte *data;
|
||||
size_t size;
|
||||
struct dwarf2_per_cu_data *per_cu;
|
||||
dwarf2_per_cu_data *per_cu;
|
||||
dwarf2_per_objfile *per_objfile;
|
||||
|
||||
if (prop->kind == PROP_LOCEXPR)
|
||||
{
|
||||
data = baton->locexpr.data;
|
||||
size = baton->locexpr.size;
|
||||
per_cu = baton->locexpr.per_cu;
|
||||
per_objfile = baton->locexpr.per_objfile;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2656,12 +2689,13 @@ dwarf2_compile_property_to_c (string_file *stream,
|
||||
|
||||
data = dwarf2_find_location_expression (&baton->loclist, &size, pc);
|
||||
per_cu = baton->loclist.per_cu;
|
||||
per_objfile = baton->loclist.per_objfile;
|
||||
}
|
||||
|
||||
compile_dwarf_bounds_to_c (stream, result_name, prop, sym, pc,
|
||||
gdbarch, registers_used,
|
||||
per_cu->addr_size (),
|
||||
data, data + size, per_cu);
|
||||
data, data + size, per_cu, per_objfile);
|
||||
}
|
||||
|
||||
|
||||
@@ -2669,7 +2703,10 @@ dwarf2_compile_property_to_c (string_file *stream,
|
||||
|
||||
class symbol_needs_eval_context : public dwarf_expr_context
|
||||
{
|
||||
public:
|
||||
public:
|
||||
symbol_needs_eval_context (dwarf2_per_objfile *per_objfile)
|
||||
: dwarf_expr_context (per_objfile)
|
||||
{}
|
||||
|
||||
enum symbol_needs_kind needs;
|
||||
struct dwarf2_per_cu_data *per_cu;
|
||||
@@ -2733,7 +2770,7 @@ class symbol_needs_eval_context : public dwarf_expr_context
|
||||
|
||||
void dwarf_call (cu_offset die_offset) override
|
||||
{
|
||||
per_cu_dwarf_call (this, die_offset, per_cu);
|
||||
per_cu_dwarf_call (this, die_offset, per_cu, per_objfile);
|
||||
}
|
||||
|
||||
/* Helper interface of sect_variable_value for
|
||||
@@ -2741,7 +2778,7 @@ class symbol_needs_eval_context : public dwarf_expr_context
|
||||
|
||||
struct value *dwarf_variable_value (sect_offset sect_off) override
|
||||
{
|
||||
return sect_variable_value (this, sect_off, per_cu);
|
||||
return sect_variable_value (this, sect_off, per_cu, per_objfile);
|
||||
}
|
||||
|
||||
/* DW_OP_entry_value accesses require a caller, therefore a
|
||||
@@ -2779,21 +2816,20 @@ class symbol_needs_eval_context : public dwarf_expr_context
|
||||
|
||||
static enum symbol_needs_kind
|
||||
dwarf2_loc_desc_get_symbol_read_needs (const gdb_byte *data, size_t size,
|
||||
struct dwarf2_per_cu_data *per_cu)
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile)
|
||||
{
|
||||
int in_reg;
|
||||
struct objfile *objfile = per_cu->objfile ();
|
||||
|
||||
scoped_value_mark free_values;
|
||||
|
||||
symbol_needs_eval_context ctx;
|
||||
symbol_needs_eval_context ctx (per_objfile);
|
||||
|
||||
ctx.needs = SYMBOL_NEEDS_NONE;
|
||||
ctx.per_cu = per_cu;
|
||||
ctx.gdbarch = objfile->arch ();
|
||||
ctx.gdbarch = per_objfile->objfile->arch ();
|
||||
ctx.addr_size = per_cu->addr_size ();
|
||||
ctx.ref_addr_size = per_cu->ref_addr_size ();
|
||||
ctx.offset = per_cu->text_offset ();
|
||||
|
||||
ctx.eval (data, size);
|
||||
|
||||
@@ -2947,7 +2983,8 @@ static void
|
||||
dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
|
||||
unsigned int addr_size, const gdb_byte *op_ptr,
|
||||
const gdb_byte *op_end,
|
||||
struct dwarf2_per_cu_data *per_cu)
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile)
|
||||
{
|
||||
gdbarch *arch = expr->gdbarch;
|
||||
std::vector<int> dw_labels, patches;
|
||||
@@ -3034,7 +3071,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
|
||||
index, not an address. We don't support things like
|
||||
branching between the address and the TLS op. */
|
||||
if (op_ptr >= op_end || *op_ptr != DW_OP_GNU_push_tls_address)
|
||||
uoffset += per_cu->text_offset ();
|
||||
uoffset += per_objfile->objfile->text_section_offset ();
|
||||
ax_const_l (expr, uoffset);
|
||||
break;
|
||||
|
||||
@@ -3225,7 +3262,8 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
|
||||
|
||||
op_ptr = safe_read_sleb128 (op_ptr, op_end, &offset);
|
||||
dwarf2_compile_expr_to_ax (expr, loc, addr_size, datastart,
|
||||
datastart + datalen, per_cu);
|
||||
datastart + datalen, per_cu,
|
||||
per_objfile);
|
||||
if (loc->kind == axs_lvalue_register)
|
||||
require_rvalue (expr, loc);
|
||||
|
||||
@@ -3451,7 +3489,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
|
||||
/* Another expression. */
|
||||
ax_const_l (expr, text_offset);
|
||||
dwarf2_compile_expr_to_ax (expr, loc, addr_size, cfa_start,
|
||||
cfa_end, per_cu);
|
||||
cfa_end, per_cu, per_objfile);
|
||||
}
|
||||
|
||||
loc->kind = axs_lvalue_memory;
|
||||
@@ -3569,14 +3607,15 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
|
||||
op_ptr += size;
|
||||
|
||||
cu_offset cuoffset = (cu_offset) uoffset;
|
||||
block = dwarf2_fetch_die_loc_cu_off (cuoffset, per_cu,
|
||||
block = dwarf2_fetch_die_loc_cu_off (cuoffset, per_cu, per_objfile,
|
||||
get_ax_pc, expr);
|
||||
|
||||
/* DW_OP_call_ref is currently not supported. */
|
||||
gdb_assert (block.per_cu == per_cu);
|
||||
|
||||
dwarf2_compile_expr_to_ax (expr, loc, addr_size, block.data,
|
||||
block.data + block.size, per_cu);
|
||||
block.data + block.size, per_cu,
|
||||
per_objfile);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3612,7 +3651,8 @@ locexpr_read_variable (struct symbol *symbol, struct frame_info *frame)
|
||||
struct value *val;
|
||||
|
||||
val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, dlbaton->data,
|
||||
dlbaton->size, dlbaton->per_cu);
|
||||
dlbaton->size, dlbaton->per_cu,
|
||||
dlbaton->per_objfile);
|
||||
|
||||
return val;
|
||||
}
|
||||
@@ -3641,7 +3681,8 @@ locexpr_get_symbol_read_needs (struct symbol *symbol)
|
||||
= (struct dwarf2_locexpr_baton *) SYMBOL_LOCATION_BATON (symbol);
|
||||
|
||||
return dwarf2_loc_desc_get_symbol_read_needs (dlbaton->data, dlbaton->size,
|
||||
dlbaton->per_cu);
|
||||
dlbaton->per_cu,
|
||||
dlbaton->per_objfile);
|
||||
}
|
||||
|
||||
/* Return true if DATA points to the end of a piece. END is one past
|
||||
@@ -3683,11 +3724,12 @@ locexpr_regname (struct gdbarch *gdbarch, int dwarf_regnum)
|
||||
|
||||
static const gdb_byte *
|
||||
locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
|
||||
CORE_ADDR addr, struct objfile *objfile,
|
||||
struct dwarf2_per_cu_data *per_cu,
|
||||
CORE_ADDR addr, dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile,
|
||||
const gdb_byte *data, const gdb_byte *end,
|
||||
unsigned int addr_size)
|
||||
{
|
||||
objfile *objfile = per_objfile->objfile;
|
||||
struct gdbarch *gdbarch = objfile->arch ();
|
||||
size_t leb128_size;
|
||||
|
||||
@@ -3826,7 +3868,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
|
||||
uint64_t offset;
|
||||
|
||||
data = safe_read_uleb128 (data + 1, end, &offset);
|
||||
offset = dwarf2_read_addr_index (per_cu, offset);
|
||||
offset = dwarf2_read_addr_index (per_cu, per_objfile, offset);
|
||||
fprintf_filtered (stream,
|
||||
_("a thread-local variable at offset 0x%s "
|
||||
"in the thread-local storage for `%s'"),
|
||||
@@ -3859,7 +3901,8 @@ disassemble_dwarf_expression (struct ui_file *stream,
|
||||
int offset_size, const gdb_byte *start,
|
||||
const gdb_byte *data, const gdb_byte *end,
|
||||
int indent, int all,
|
||||
struct dwarf2_per_cu_data *per_cu)
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile)
|
||||
{
|
||||
while (data < end
|
||||
&& (all
|
||||
@@ -4119,7 +4162,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
|
||||
|
||||
data = safe_read_uleb128 (data, end, &ul);
|
||||
cu_offset offset = (cu_offset) ul;
|
||||
type = dwarf2_get_die_type (offset, per_cu);
|
||||
type = dwarf2_get_die_type (offset, per_cu, per_objfile);
|
||||
fprintf_filtered (stream, "<");
|
||||
type_print (type, "", stream, -1);
|
||||
fprintf_filtered (stream, " [0x%s]> %d",
|
||||
@@ -4135,7 +4178,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
|
||||
|
||||
data = safe_read_uleb128 (data, end, &ul);
|
||||
cu_offset type_die = (cu_offset) ul;
|
||||
type = dwarf2_get_die_type (type_die, per_cu);
|
||||
type = dwarf2_get_die_type (type_die, per_cu, per_objfile);
|
||||
fprintf_filtered (stream, "<");
|
||||
type_print (type, "", stream, -1);
|
||||
fprintf_filtered (stream, " [0x%s]>",
|
||||
@@ -4159,7 +4202,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
|
||||
data = safe_read_uleb128 (data, end, &ul);
|
||||
cu_offset type_die = (cu_offset) ul;
|
||||
|
||||
type = dwarf2_get_die_type (type_die, per_cu);
|
||||
type = dwarf2_get_die_type (type_die, per_cu, per_objfile);
|
||||
fprintf_filtered (stream, "<");
|
||||
type_print (type, "", stream, -1);
|
||||
fprintf_filtered (stream, " [0x%s]> [$%s]",
|
||||
@@ -4182,7 +4225,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
|
||||
{
|
||||
struct type *type;
|
||||
|
||||
type = dwarf2_get_die_type (type_die, per_cu);
|
||||
type = dwarf2_get_die_type (type_die, per_cu, per_objfile);
|
||||
fprintf_filtered (stream, "<");
|
||||
type_print (type, "", stream, -1);
|
||||
fprintf_filtered (stream, " [0x%s]>",
|
||||
@@ -4197,7 +4240,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
|
||||
fputc_filtered ('\n', stream);
|
||||
disassemble_dwarf_expression (stream, arch, addr_size, offset_size,
|
||||
start, data, data + ul, indent + 2,
|
||||
all, per_cu);
|
||||
all, per_cu, per_objfile);
|
||||
data += ul;
|
||||
continue;
|
||||
|
||||
@@ -4210,12 +4253,12 @@ disassemble_dwarf_expression (struct ui_file *stream,
|
||||
case DW_OP_addrx:
|
||||
case DW_OP_GNU_addr_index:
|
||||
data = safe_read_uleb128 (data, end, &ul);
|
||||
ul = dwarf2_read_addr_index (per_cu, ul);
|
||||
ul = dwarf2_read_addr_index (per_cu, per_objfile, ul);
|
||||
fprintf_filtered (stream, " 0x%s", phex_nz (ul, addr_size));
|
||||
break;
|
||||
case DW_OP_GNU_const_index:
|
||||
data = safe_read_uleb128 (data, end, &ul);
|
||||
ul = dwarf2_read_addr_index (per_cu, ul);
|
||||
ul = dwarf2_read_addr_index (per_cu, per_objfile, ul);
|
||||
fprintf_filtered (stream, " %s", pulongest (ul));
|
||||
break;
|
||||
|
||||
@@ -4252,11 +4295,13 @@ static void
|
||||
locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr,
|
||||
struct ui_file *stream,
|
||||
const gdb_byte *data, size_t size,
|
||||
struct objfile *objfile, unsigned int addr_size,
|
||||
int offset_size, struct dwarf2_per_cu_data *per_cu)
|
||||
unsigned int addr_size,
|
||||
int offset_size, dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile)
|
||||
{
|
||||
const gdb_byte *end = data + size;
|
||||
int first_piece = 1, bad = 0;
|
||||
objfile *objfile = per_objfile->objfile;
|
||||
|
||||
while (data < end)
|
||||
{
|
||||
@@ -4271,7 +4316,7 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr,
|
||||
if (!dwarf_always_disassemble)
|
||||
{
|
||||
data = locexpr_describe_location_piece (symbol, stream,
|
||||
addr, objfile, per_cu,
|
||||
addr, per_cu, per_objfile,
|
||||
data, end, addr_size);
|
||||
/* If we printed anything, or if we have an empty piece,
|
||||
then don't disassemble. */
|
||||
@@ -4288,7 +4333,7 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr,
|
||||
addr_size, offset_size, data,
|
||||
data, end, 0,
|
||||
dwarf_always_disassemble,
|
||||
per_cu);
|
||||
per_cu, per_objfile);
|
||||
}
|
||||
|
||||
if (data < end)
|
||||
@@ -4348,14 +4393,13 @@ locexpr_describe_location (struct symbol *symbol, CORE_ADDR addr,
|
||||
{
|
||||
struct dwarf2_locexpr_baton *dlbaton
|
||||
= (struct dwarf2_locexpr_baton *) SYMBOL_LOCATION_BATON (symbol);
|
||||
struct objfile *objfile = dlbaton->per_cu->objfile ();
|
||||
unsigned int addr_size = dlbaton->per_cu->addr_size ();
|
||||
int offset_size = dlbaton->per_cu->offset_size ();
|
||||
|
||||
locexpr_describe_location_1 (symbol, addr, stream,
|
||||
dlbaton->data, dlbaton->size,
|
||||
objfile, addr_size, offset_size,
|
||||
dlbaton->per_cu);
|
||||
addr_size, offset_size,
|
||||
dlbaton->per_cu, dlbaton->per_objfile);
|
||||
}
|
||||
|
||||
/* Describe the location of SYMBOL as an agent value in VALUE, generating
|
||||
@@ -4373,7 +4417,8 @@ locexpr_tracepoint_var_ref (struct symbol *symbol, struct agent_expr *ax,
|
||||
value->optimized_out = 1;
|
||||
else
|
||||
dwarf2_compile_expr_to_ax (ax, value, addr_size, dlbaton->data,
|
||||
dlbaton->data + dlbaton->size, dlbaton->per_cu);
|
||||
dlbaton->data + dlbaton->size, dlbaton->per_cu,
|
||||
dlbaton->per_objfile);
|
||||
}
|
||||
|
||||
/* symbol_computed_ops 'generate_c_location' method. */
|
||||
@@ -4394,7 +4439,7 @@ locexpr_generate_c_location (struct symbol *sym, string_file *stream,
|
||||
compile_dwarf_expr_to_c (stream, result_name,
|
||||
sym, pc, gdbarch, registers_used, addr_size,
|
||||
dlbaton->data, dlbaton->data + dlbaton->size,
|
||||
dlbaton->per_cu);
|
||||
dlbaton->per_cu, dlbaton->per_objfile);
|
||||
}
|
||||
|
||||
/* The set of location functions used with the DWARF-2 expression
|
||||
@@ -4427,7 +4472,7 @@ loclist_read_variable (struct symbol *symbol, struct frame_info *frame)
|
||||
|
||||
data = dwarf2_find_location_expression (dlbaton, &size, pc);
|
||||
val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, data, size,
|
||||
dlbaton->per_cu);
|
||||
dlbaton->per_cu, dlbaton->per_objfile);
|
||||
|
||||
return val;
|
||||
}
|
||||
@@ -4485,14 +4530,15 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr,
|
||||
struct dwarf2_loclist_baton *dlbaton
|
||||
= (struct dwarf2_loclist_baton *) SYMBOL_LOCATION_BATON (symbol);
|
||||
const gdb_byte *loc_ptr, *buf_end;
|
||||
struct objfile *objfile = dlbaton->per_cu->objfile ();
|
||||
dwarf2_per_objfile *per_objfile = dlbaton->per_objfile;
|
||||
struct objfile *objfile = per_objfile->objfile;
|
||||
struct gdbarch *gdbarch = objfile->arch ();
|
||||
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
|
||||
unsigned int addr_size = dlbaton->per_cu->addr_size ();
|
||||
int offset_size = dlbaton->per_cu->offset_size ();
|
||||
int signed_addr_p = bfd_get_sign_extend_vma (objfile->obfd);
|
||||
/* Adjust base_address for relocatable objects. */
|
||||
CORE_ADDR base_offset = dlbaton->per_cu->text_offset ();
|
||||
CORE_ADDR base_offset = objfile->text_section_offset ();
|
||||
CORE_ADDR base_address = dlbaton->base_address + base_offset;
|
||||
int done = 0;
|
||||
|
||||
@@ -4511,6 +4557,7 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr,
|
||||
|
||||
if (dlbaton->per_cu->version () < 5 && dlbaton->from_dwo)
|
||||
kind = decode_debug_loc_dwo_addresses (dlbaton->per_cu,
|
||||
dlbaton->per_objfile,
|
||||
loc_ptr, buf_end, &new_ptr,
|
||||
&low, &high, byte_order);
|
||||
else if (dlbaton->per_cu->version () < 5)
|
||||
@@ -4520,6 +4567,7 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr,
|
||||
signed_addr_p);
|
||||
else
|
||||
kind = decode_debug_loclists_addresses (dlbaton->per_cu,
|
||||
dlbaton->per_objfile,
|
||||
loc_ptr, buf_end, &new_ptr,
|
||||
&low, &high, byte_order,
|
||||
addr_size, signed_addr_p);
|
||||
@@ -4572,8 +4620,8 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr,
|
||||
|
||||
/* Now describe this particular location. */
|
||||
locexpr_describe_location_1 (symbol, low, stream, loc_ptr, length,
|
||||
objfile, addr_size, offset_size,
|
||||
dlbaton->per_cu);
|
||||
addr_size, offset_size,
|
||||
dlbaton->per_cu, dlbaton->per_objfile);
|
||||
|
||||
fprintf_filtered (stream, "\n");
|
||||
|
||||
@@ -4598,7 +4646,7 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct agent_expr *ax,
|
||||
value->optimized_out = 1;
|
||||
else
|
||||
dwarf2_compile_expr_to_ax (ax, value, addr_size, data, data + size,
|
||||
dlbaton->per_cu);
|
||||
dlbaton->per_cu, dlbaton->per_objfile);
|
||||
}
|
||||
|
||||
/* symbol_computed_ops 'generate_c_location' method. */
|
||||
@@ -4622,7 +4670,8 @@ loclist_generate_c_location (struct symbol *sym, string_file *stream,
|
||||
compile_dwarf_expr_to_c (stream, result_name,
|
||||
sym, pc, gdbarch, registers_used, addr_size,
|
||||
data, data + size,
|
||||
dlbaton->per_cu);
|
||||
dlbaton->per_cu,
|
||||
dlbaton->per_objfile);
|
||||
}
|
||||
|
||||
/* The set of location functions used with the DWARF-2 expression
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "dwarf2/expr.h"
|
||||
|
||||
struct symbol_computed_ops;
|
||||
struct objfile;
|
||||
struct dwarf2_per_objfile;
|
||||
struct dwarf2_per_cu_data;
|
||||
struct dwarf2_loclist_baton;
|
||||
struct agent_expr;
|
||||
@@ -61,7 +61,8 @@ struct value *dwarf2_evaluate_loc_desc (struct type *type,
|
||||
struct frame_info *frame,
|
||||
const gdb_byte *data,
|
||||
size_t size,
|
||||
struct dwarf2_per_cu_data *per_cu);
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile);
|
||||
|
||||
/* A chain of addresses that might be needed to resolve a dynamic
|
||||
property. */
|
||||
@@ -146,6 +147,9 @@ struct dwarf2_locexpr_baton
|
||||
directly. */
|
||||
bool is_reference;
|
||||
|
||||
/* The objfile that was used when creating this. */
|
||||
dwarf2_per_objfile *per_objfile;
|
||||
|
||||
/* The compilation unit containing the symbol whose location
|
||||
we're computing. */
|
||||
struct dwarf2_per_cu_data *per_cu;
|
||||
@@ -163,6 +167,9 @@ struct dwarf2_loclist_baton
|
||||
/* Length of the location list. */
|
||||
size_t size;
|
||||
|
||||
/* The objfile that was used when creating this. */
|
||||
dwarf2_per_objfile *per_objfile;
|
||||
|
||||
/* The compilation unit containing the symbol whose location
|
||||
we're computing. */
|
||||
struct dwarf2_per_cu_data *per_cu;
|
||||
|
||||
@@ -507,14 +507,14 @@ dwarf_decode_macro_bytes (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
||||
|| section_is_dwz)
|
||||
{
|
||||
struct dwz_file *dwz
|
||||
= dwarf2_get_dwz_file (dwarf2_per_objfile);
|
||||
= dwarf2_get_dwz_file (dwarf2_per_objfile->per_bfd);
|
||||
|
||||
body = dwz->read_string (objfile, str_offset);
|
||||
}
|
||||
else
|
||||
body = dwarf2_per_objfile->str.read_string (objfile,
|
||||
str_offset,
|
||||
"DW_FORM_strp");
|
||||
body = dwarf2_per_objfile->per_bfd->str.read_string (objfile,
|
||||
str_offset,
|
||||
"DW_FORM_strp");
|
||||
}
|
||||
|
||||
is_define = (macinfo_type == DW_MACRO_define
|
||||
@@ -644,7 +644,8 @@ dwarf_decode_macro_bytes (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
||||
|
||||
if (macinfo_type == DW_MACRO_import_sup)
|
||||
{
|
||||
struct dwz_file *dwz = dwarf2_get_dwz_file (dwarf2_per_objfile);
|
||||
struct dwz_file *dwz
|
||||
= dwarf2_get_dwz_file (dwarf2_per_objfile->per_bfd);
|
||||
|
||||
dwz->macro.read (objfile);
|
||||
|
||||
|
||||
2494
gdb/dwarf2/read.c
2494
gdb/dwarf2/read.c
File diff suppressed because it is too large
Load Diff
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <queue>
|
||||
#include <unordered_map>
|
||||
#include "dwarf2/comp-unit.h"
|
||||
#include "dwarf2/index-cache.h"
|
||||
#include "dwarf2/section.h"
|
||||
#include "filename-seen-cache.h"
|
||||
@@ -42,18 +43,22 @@ struct tu_stats
|
||||
int nr_all_type_units_reallocs;
|
||||
};
|
||||
|
||||
struct dwarf2_cu;
|
||||
struct dwarf2_debug_sections;
|
||||
struct dwarf2_per_cu_data;
|
||||
struct mapped_index;
|
||||
struct mapped_debug_names;
|
||||
struct signatured_type;
|
||||
struct type_unit_group;
|
||||
|
||||
/* One item on the queue of compilation units to read in full symbols
|
||||
for. */
|
||||
struct dwarf2_queue_item
|
||||
{
|
||||
dwarf2_queue_item (dwarf2_per_cu_data *cu, enum language lang)
|
||||
dwarf2_queue_item (dwarf2_per_cu_data *cu, dwarf2_per_objfile *per_objfile,
|
||||
enum language lang)
|
||||
: per_cu (cu),
|
||||
per_objfile (per_objfile),
|
||||
pretend_language (lang)
|
||||
{
|
||||
}
|
||||
@@ -62,36 +67,39 @@ struct dwarf2_queue_item
|
||||
|
||||
DISABLE_COPY_AND_ASSIGN (dwarf2_queue_item);
|
||||
|
||||
struct dwarf2_per_cu_data *per_cu;
|
||||
dwarf2_per_cu_data *per_cu;
|
||||
dwarf2_per_objfile *per_objfile;
|
||||
enum language pretend_language;
|
||||
};
|
||||
|
||||
/* Collection of data recorded per objfile.
|
||||
This hangs off of dwarf2_objfile_data_key. */
|
||||
/* Some DWARF data can be shared across objfiles who share the same BFD,
|
||||
this data is stored in this object.
|
||||
|
||||
struct dwarf2_per_objfile
|
||||
Two dwarf2_per_objfile objects representing objfiles sharing the same BFD
|
||||
will point to the same instance of dwarf2_per_bfd, unless the BFD requires
|
||||
relocation. */
|
||||
|
||||
struct dwarf2_per_bfd
|
||||
{
|
||||
/* Construct a dwarf2_per_objfile for OBJFILE. NAMES points to the
|
||||
/* Construct a dwarf2_per_bfd for OBFD. NAMES points to the
|
||||
dwarf2 section names, or is NULL if the standard ELF names are
|
||||
used. CAN_COPY is true for formats where symbol
|
||||
interposition is possible and so symbol values must follow copy
|
||||
relocation rules. */
|
||||
dwarf2_per_objfile (struct objfile *objfile,
|
||||
const dwarf2_debug_sections *names,
|
||||
bool can_copy);
|
||||
dwarf2_per_bfd (bfd *obfd, const dwarf2_debug_sections *names, bool can_copy);
|
||||
|
||||
~dwarf2_per_objfile ();
|
||||
~dwarf2_per_bfd ();
|
||||
|
||||
DISABLE_COPY_AND_ASSIGN (dwarf2_per_objfile);
|
||||
DISABLE_COPY_AND_ASSIGN (dwarf2_per_bfd);
|
||||
|
||||
/* Return the CU/TU given its index.
|
||||
|
||||
This is intended for loops like:
|
||||
|
||||
for (i = 0; i < (dwarf2_per_objfile->n_comp_units
|
||||
+ dwarf2_per_objfile->n_type_units); ++i)
|
||||
for (i = 0; i < (dwarf2_per_bfd->n_comp_units
|
||||
+ dwarf2_per_bfd->n_type_units); ++i)
|
||||
{
|
||||
dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cutu (i);
|
||||
dwarf2_per_cu_data *per_cu = dwarf2_per_bfd->get_cutu (i);
|
||||
|
||||
...;
|
||||
}
|
||||
@@ -108,15 +116,20 @@ struct dwarf2_per_objfile
|
||||
TU. */
|
||||
signatured_type *get_tu (int index);
|
||||
|
||||
/* Free all cached compilation units. */
|
||||
void free_cached_comp_units ();
|
||||
/* A convenience function to allocate a dwarf2_per_cu_data. The
|
||||
returned object has its "index" field set properly. The object
|
||||
is allocated on the dwarf2_per_bfd obstack. */
|
||||
dwarf2_per_cu_data *allocate_per_cu ();
|
||||
|
||||
/* Return pointer to string at .debug_line_str offset as read from BUF.
|
||||
BUF is assumed to be in a compilation unit described by CU_HEADER.
|
||||
Return *BYTES_READ_PTR count of bytes read from BUF. */
|
||||
const char *read_line_string (const gdb_byte *buf,
|
||||
const struct comp_unit_head *cu_header,
|
||||
unsigned int *bytes_read_ptr);
|
||||
/* A convenience function to allocate a signatured_type. The
|
||||
returned object has its "index" field set properly. The object
|
||||
is allocated on the dwarf2_per_bfd obstack. */
|
||||
signatured_type *allocate_signatured_type ();
|
||||
|
||||
/* Return the number of partial symtabs allocated with allocate_per_cu
|
||||
and allocate_signatured_type so far. */
|
||||
int num_psymtabs () const
|
||||
{ return m_num_psymtabs; }
|
||||
|
||||
private:
|
||||
/* This function is mapped across the sections and remembers the
|
||||
@@ -126,6 +139,14 @@ private:
|
||||
const dwarf2_debug_sections &names);
|
||||
|
||||
public:
|
||||
/* The corresponding BFD. */
|
||||
bfd *obfd;
|
||||
|
||||
/* Objects that can be shared across objfiles are stored in this
|
||||
obstack or on the psymtab obstack, while objects that are
|
||||
objfile-specific are stored on the objfile obstack. */
|
||||
auto_obstack obstack;
|
||||
|
||||
dwarf2_section_info info {};
|
||||
dwarf2_section_info abbrev {};
|
||||
dwarf2_section_info line {};
|
||||
@@ -147,9 +168,6 @@ public:
|
||||
|
||||
std::vector<dwarf2_section_info> types;
|
||||
|
||||
/* Back link. */
|
||||
struct objfile *objfile = NULL;
|
||||
|
||||
/* Table of all the compilation units. This is used to locate
|
||||
the target compilation unit of a particular reference. */
|
||||
std::vector<dwarf2_per_cu_data *> all_comp_units;
|
||||
@@ -169,10 +187,6 @@ public:
|
||||
are doing. */
|
||||
struct tu_stats tu_stats {};
|
||||
|
||||
/* A chain of compilation units that are currently read in, so that
|
||||
they can be freed later. */
|
||||
dwarf2_per_cu_data *read_in_chain = NULL;
|
||||
|
||||
/* A table mapping DW_AT_dwo_name values to struct dwo_file objects.
|
||||
This is NULL if the table hasn't been allocated yet. */
|
||||
htab_up dwo_files;
|
||||
@@ -217,11 +231,6 @@ public:
|
||||
symbols. */
|
||||
bool reading_partial_symbols = false;
|
||||
|
||||
/* Table mapping type DIEs to their struct type *.
|
||||
This is NULL if not allocated yet.
|
||||
The mapping is done via (CU/TU + DIE offset) -> type. */
|
||||
htab_up die_type_hash;
|
||||
|
||||
/* The CUs we recently read. */
|
||||
std::vector<dwarf2_per_cu_data *> just_read_cus;
|
||||
|
||||
@@ -244,6 +253,146 @@ public:
|
||||
|
||||
/* CUs that are queued to be read. */
|
||||
std::queue<dwarf2_queue_item> queue;
|
||||
|
||||
/* We keep a separate reference to the partial symtabs, in case we
|
||||
are sharing them between objfiles. This is only set after
|
||||
partial symbols have been read the first time. */
|
||||
std::shared_ptr<psymtab_storage> partial_symtabs;
|
||||
|
||||
private:
|
||||
|
||||
/* The total number of per_cu and signatured_type objects that have
|
||||
been created so far for this reader. */
|
||||
size_t m_num_psymtabs = 0;
|
||||
};
|
||||
|
||||
/* This is the per-objfile data associated with a type_unit_group. */
|
||||
|
||||
struct type_unit_group_unshareable
|
||||
{
|
||||
/* The compunit symtab.
|
||||
Type units in a group needn't all be defined in the same source file,
|
||||
so we create an essentially anonymous symtab as the compunit symtab. */
|
||||
struct compunit_symtab *compunit_symtab = nullptr;
|
||||
|
||||
/* The number of symtabs from the line header.
|
||||
The value here must match line_header.num_file_names. */
|
||||
unsigned int num_symtabs = 0;
|
||||
|
||||
/* The symbol tables for this TU (obtained from the files listed in
|
||||
DW_AT_stmt_list).
|
||||
WARNING: The order of entries here must match the order of entries
|
||||
in the line header. After the first TU using this type_unit_group, the
|
||||
line header for the subsequent TUs is recreated from this. This is done
|
||||
because we need to use the same symtabs for each TU using the same
|
||||
DW_AT_stmt_list value. Also note that symtabs may be repeated here,
|
||||
there's no guarantee the line header doesn't have duplicate entries. */
|
||||
struct symtab **symtabs = nullptr;
|
||||
};
|
||||
|
||||
/* Collection of data recorded per objfile.
|
||||
This hangs off of dwarf2_objfile_data_key.
|
||||
|
||||
Some DWARF data cannot (currently) be shared across objfiles. Such
|
||||
data is stored in this object. */
|
||||
|
||||
struct dwarf2_per_objfile
|
||||
{
|
||||
dwarf2_per_objfile (struct objfile *objfile, dwarf2_per_bfd *per_bfd)
|
||||
: objfile (objfile), per_bfd (per_bfd)
|
||||
{}
|
||||
|
||||
~dwarf2_per_objfile ();
|
||||
|
||||
/* Return pointer to string at .debug_line_str offset as read from BUF.
|
||||
BUF is assumed to be in a compilation unit described by CU_HEADER.
|
||||
Return *BYTES_READ_PTR count of bytes read from BUF. */
|
||||
const char *read_line_string (const gdb_byte *buf,
|
||||
const struct comp_unit_head *cu_header,
|
||||
unsigned int *bytes_read_ptr);
|
||||
|
||||
/* Resize the M_SYMTABS vector to the needed size (the number of partial
|
||||
symtabs allocated by the per-bfd). */
|
||||
void resize_symtabs ()
|
||||
{
|
||||
/* The symtabs vector should only grow, not shrink. */
|
||||
gdb_assert (per_bfd->num_psymtabs () >= m_symtabs.size ());
|
||||
|
||||
m_symtabs.resize (per_bfd->num_psymtabs ());
|
||||
}
|
||||
|
||||
/* Return true if the symtab corresponding to PER_CU has been set,
|
||||
false otherwise. */
|
||||
bool symtab_set_p (const dwarf2_per_cu_data *per_cu) const;
|
||||
|
||||
/* Return the compunit_symtab associated to PER_CU, if it has been created. */
|
||||
compunit_symtab *get_symtab (const dwarf2_per_cu_data *per_cu) const;
|
||||
|
||||
/* Set the compunit_symtab associated to PER_CU. */
|
||||
void set_symtab (const dwarf2_per_cu_data *per_cu, compunit_symtab *symtab);
|
||||
|
||||
/* Get the type_unit_group_unshareable corresponding to TU_GROUP. If one
|
||||
does not exist, create it. */
|
||||
type_unit_group_unshareable *get_type_unit_group_unshareable
|
||||
(type_unit_group *tu_group);
|
||||
|
||||
struct type *get_type_for_signatured_type (signatured_type *sig_type) const;
|
||||
|
||||
void set_type_for_signatured_type (signatured_type *sig_type,
|
||||
struct type *type);
|
||||
|
||||
/* Find an integer type SIZE_IN_BYTES bytes in size and return it.
|
||||
UNSIGNED_P controls if the integer is unsigned or not. */
|
||||
struct type *int_type (int size_in_bytes, bool unsigned_p) const;
|
||||
|
||||
/* Get the dwarf2_cu matching PER_CU for this objfile. */
|
||||
dwarf2_cu *get_cu (dwarf2_per_cu_data *per_cu);
|
||||
|
||||
/* Set the dwarf2_cu matching PER_CU for this objfile. */
|
||||
void set_cu (dwarf2_per_cu_data *per_cu, dwarf2_cu *cu);
|
||||
|
||||
/* Remove/free the dwarf2_cu matching PER_CU for this objfile. */
|
||||
void remove_cu (dwarf2_per_cu_data *per_cu);
|
||||
|
||||
/* Free all cached compilation units. */
|
||||
void remove_all_cus ();
|
||||
|
||||
/* Increase the age counter on each CU compilation unit and free
|
||||
any that are too old. */
|
||||
void age_comp_units ();
|
||||
|
||||
/* Back link. */
|
||||
struct objfile *objfile;
|
||||
|
||||
/* Pointer to the data that is (possibly) shared between this objfile and
|
||||
other objfiles backed by the same BFD. */
|
||||
struct dwarf2_per_bfd *per_bfd;
|
||||
|
||||
/* Table mapping type DIEs to their struct type *.
|
||||
This is nullptr if not allocated yet.
|
||||
The mapping is done via (CU/TU + DIE offset) -> type. */
|
||||
htab_up die_type_hash;
|
||||
|
||||
private:
|
||||
/* Hold the corresponding compunit_symtab for each CU or TU. This
|
||||
is indexed by dwarf2_per_cu_data::index. A NULL value means
|
||||
that the CU/TU has not been expanded yet. */
|
||||
std::vector<compunit_symtab *> m_symtabs;
|
||||
|
||||
/* Map from a type unit group to the corresponding unshared
|
||||
structure. */
|
||||
typedef std::unique_ptr<type_unit_group_unshareable>
|
||||
type_unit_group_unshareable_up;
|
||||
|
||||
std::unordered_map<type_unit_group *, type_unit_group_unshareable_up>
|
||||
m_type_units;
|
||||
|
||||
/* Map from signatured types to the corresponding struct type. */
|
||||
std::unordered_map<signatured_type *, struct type *> m_type_map;
|
||||
|
||||
/* Map from the objfile-independent dwarf2_per_cu_data instances to the
|
||||
corresponding objfile-dependent dwarf2_cu instances. */
|
||||
std::unordered_map<dwarf2_per_cu_data *, dwarf2_cu *> m_dwarf2_cus;
|
||||
};
|
||||
|
||||
/* Get the dwarf2_per_objfile associated to OBJFILE. */
|
||||
@@ -251,17 +400,19 @@ public:
|
||||
dwarf2_per_objfile *get_dwarf2_per_objfile (struct objfile *objfile);
|
||||
|
||||
/* A partial symtab specialized for DWARF. */
|
||||
struct dwarf2_psymtab : public standard_psymtab
|
||||
struct dwarf2_psymtab : public partial_symtab
|
||||
{
|
||||
dwarf2_psymtab (const char *filename, struct objfile *objfile,
|
||||
dwarf2_per_cu_data *per_cu)
|
||||
: standard_psymtab (filename, objfile, 0),
|
||||
: partial_symtab (filename, objfile, 0),
|
||||
per_cu_data (per_cu)
|
||||
{
|
||||
}
|
||||
|
||||
void read_symtab (struct objfile *) override;
|
||||
void expand_psymtab (struct objfile *) override;
|
||||
bool readin_p (struct objfile *) const override;
|
||||
compunit_symtab *get_compunit_symtab (struct objfile *) const override;
|
||||
|
||||
struct dwarf2_per_cu_data *per_cu_data;
|
||||
};
|
||||
@@ -317,26 +468,39 @@ struct dwarf2_per_cu_data
|
||||
This flag is only valid if is_debug_types is true. */
|
||||
unsigned int tu_read : 1;
|
||||
|
||||
/* Our index in the unshared "symtabs" vector. */
|
||||
unsigned index;
|
||||
|
||||
/* The section this CU/TU lives in.
|
||||
If the DIE refers to a DWO file, this is always the original die,
|
||||
not the DWO file. */
|
||||
struct dwarf2_section_info *section;
|
||||
|
||||
/* Set to non-NULL iff this CU is currently loaded. When it gets freed out
|
||||
of the CU cache it gets reset to NULL again. This is left as NULL for
|
||||
dummy CUs (a CU header, but nothing else). */
|
||||
struct dwarf2_cu *cu;
|
||||
|
||||
/* The unit type of this CU. */
|
||||
enum dwarf_unit_type unit_type;
|
||||
|
||||
/* The language of this CU. */
|
||||
enum language lang;
|
||||
|
||||
/* The corresponding dwarf2_per_objfile. */
|
||||
struct dwarf2_per_objfile *dwarf2_per_objfile;
|
||||
/* Backlink to the owner of this. */
|
||||
dwarf2_per_bfd *per_bfd;
|
||||
|
||||
/* When dwarf2_per_objfile->using_index is true, the 'quick' field
|
||||
/* DWARF header of this CU. Note that dwarf2_cu reads its own version of the
|
||||
header, which may differ from this one, since it may pass rcuh_kind::TYPE
|
||||
to read_comp_unit_head, whereas for dwarf2_per_cu_data we always pass
|
||||
rcuh_kind::COMPILE.
|
||||
|
||||
Don't access this field directly, use the get_header method instead. It
|
||||
should be private, but we can't make it private at the moment. */
|
||||
mutable comp_unit_head m_header;
|
||||
|
||||
/* True if HEADER has been read in.
|
||||
|
||||
Don't access this field directly. It should be private, but we can't make
|
||||
it private at the moment. */
|
||||
mutable bool m_header_read_in;
|
||||
|
||||
/* When dwarf2_per_bfd::using_index is true, the 'quick' field
|
||||
is active. Otherwise, the 'psymtab' field is active. */
|
||||
union
|
||||
{
|
||||
@@ -405,10 +569,8 @@ struct dwarf2_per_cu_data
|
||||
imported_symtabs = nullptr;
|
||||
}
|
||||
|
||||
/* Return the OBJFILE associated with this compilation unit. If
|
||||
this compilation unit came from a separate debuginfo file, then
|
||||
the master objfile is returned. */
|
||||
struct objfile *objfile () const;
|
||||
/* Get the header of this per_cu, reading it if necessary. */
|
||||
const comp_unit_head *get_header () const;
|
||||
|
||||
/* Return the address size given in the compilation unit header for
|
||||
this CU. */
|
||||
@@ -422,26 +584,6 @@ struct dwarf2_per_cu_data
|
||||
header for this CU. */
|
||||
int ref_addr_size () const;
|
||||
|
||||
/* Return the text offset of the CU. The returned offset comes from
|
||||
this CU's objfile. If this objfile came from a separate
|
||||
debuginfo file, then the offset may be different from the
|
||||
corresponding offset in the parent objfile. */
|
||||
CORE_ADDR text_offset () const;
|
||||
|
||||
/* Return a type that is a generic pointer type, the size of which
|
||||
matches the address size given in the compilation unit header for
|
||||
this CU. */
|
||||
struct type *addr_type () const;
|
||||
|
||||
/* Find an integer type SIZE_IN_BYTES bytes in size and return it.
|
||||
UNSIGNED_P controls if the integer is unsigned or not. */
|
||||
struct type *int_type (int size_in_bytes, bool unsigned_p) const;
|
||||
|
||||
/* Find an integer type the same size as the address size given in
|
||||
the compilation unit header for this CU. UNSIGNED_P controls if
|
||||
the integer is unsigned or not. */
|
||||
struct type *addr_sized_int_type (bool unsigned_p) const;
|
||||
|
||||
/* Return DWARF version number of this CU. */
|
||||
short version () const
|
||||
{
|
||||
@@ -485,11 +627,6 @@ struct signatured_type
|
||||
can share them. This points to the containing symtab. */
|
||||
struct type_unit_group *type_unit_group;
|
||||
|
||||
/* The type.
|
||||
The first time we encounter this type we fully read it in and install it
|
||||
in the symbol tables. Subsequent times we only need the type. */
|
||||
struct type *type;
|
||||
|
||||
/* Containing DWO unit.
|
||||
This field is valid iff per_cu.reading_dwo_directly. */
|
||||
struct dwo_unit *dwo_unit;
|
||||
@@ -499,14 +636,14 @@ struct signatured_type
|
||||
there is no .gnu_debugaltlink section in the file. Error if there
|
||||
is such a section but the file cannot be found. */
|
||||
|
||||
extern struct dwz_file *dwarf2_get_dwz_file
|
||||
(struct dwarf2_per_objfile *dwarf2_per_objfile);
|
||||
extern dwz_file *dwarf2_get_dwz_file (dwarf2_per_bfd *per_bfd);
|
||||
|
||||
/* Return the type of the DIE at DIE_OFFSET in the CU named by
|
||||
PER_CU. */
|
||||
|
||||
struct type *dwarf2_get_die_type (cu_offset die_offset,
|
||||
struct dwarf2_per_cu_data *per_cu);
|
||||
dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile);
|
||||
|
||||
/* Given an index in .debug_addr, fetch the value.
|
||||
NOTE: This can be called during dwarf expression evaluation,
|
||||
@@ -514,6 +651,7 @@ struct type *dwarf2_get_die_type (cu_offset die_offset,
|
||||
may no longer exist. */
|
||||
|
||||
CORE_ADDR dwarf2_read_addr_index (dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *dwarf2_per_objfile,
|
||||
unsigned int addr_index);
|
||||
|
||||
/* Return DWARF block referenced by DW_AT_location of DIE at SECT_OFF at PER_CU.
|
||||
@@ -523,6 +661,7 @@ CORE_ADDR dwarf2_read_addr_index (dwarf2_per_cu_data *per_cu,
|
||||
|
||||
struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_sect_off
|
||||
(sect_offset sect_off, dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile,
|
||||
CORE_ADDR (*get_frame_pc) (void *baton),
|
||||
void *baton, bool resolve_abstract_p = false);
|
||||
|
||||
@@ -531,6 +670,7 @@ struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_sect_off
|
||||
|
||||
struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_cu_off
|
||||
(cu_offset offset_in_cu, dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile,
|
||||
CORE_ADDR (*get_frame_pc) (void *baton),
|
||||
void *baton);
|
||||
|
||||
@@ -540,14 +680,16 @@ struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_cu_off
|
||||
does not have a DW_AT_const_value, return NULL. */
|
||||
|
||||
extern const gdb_byte *dwarf2_fetch_constant_bytes
|
||||
(sect_offset sect_off, dwarf2_per_cu_data *per_cu, obstack *obstack,
|
||||
(sect_offset sect_off, dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile, obstack *obstack,
|
||||
LONGEST *len);
|
||||
|
||||
/* Return the type of the die at SECT_OFF in PER_CU. Return NULL if no
|
||||
valid type for this die is found. */
|
||||
|
||||
struct type *dwarf2_fetch_die_type_sect_off
|
||||
(sect_offset sect_off, dwarf2_per_cu_data *per_cu);
|
||||
(sect_offset sect_off, dwarf2_per_cu_data *per_cu,
|
||||
dwarf2_per_objfile *per_objfile);
|
||||
|
||||
/* When non-zero, dump line number entries as they are read in. */
|
||||
extern unsigned int dwarf_line_debug;
|
||||
|
||||
@@ -58,6 +58,8 @@ struct field;
|
||||
struct block;
|
||||
struct value_print_options;
|
||||
struct language_defn;
|
||||
struct dwarf2_per_cu_data;
|
||||
struct dwarf2_per_objfile;
|
||||
|
||||
/* These declarations are DWARF-specific as some of the gdbtypes.h data types
|
||||
are already DWARF-specific. */
|
||||
@@ -1333,7 +1335,11 @@ struct call_site
|
||||
/* * CU of the function where the call is located. It gets used
|
||||
for DWARF blocks execution in the parameter array below. */
|
||||
|
||||
struct dwarf2_per_cu_data *per_cu;
|
||||
dwarf2_per_cu_data *per_cu;
|
||||
|
||||
/* objfile of the function where the call is located. */
|
||||
|
||||
dwarf2_per_objfile *per_objfile;
|
||||
|
||||
/* * Describe DW_TAG_call_site's DW_TAG_formal_parameter. */
|
||||
|
||||
|
||||
@@ -576,7 +576,7 @@ public:
|
||||
|
||||
/* The partial symbol tables. */
|
||||
|
||||
std::unique_ptr<psymtab_storage> partial_symtabs;
|
||||
std::shared_ptr<psymtab_storage> partial_symtabs;
|
||||
|
||||
/* The object file's BFD. Can be null if the objfile contains only
|
||||
minimal symbols, e.g. the run time common symbols for SunOS4. */
|
||||
|
||||
@@ -147,13 +147,16 @@ struct partial_symtab
|
||||
void expand_dependencies (struct objfile *);
|
||||
|
||||
/* Return true if the symtab corresponding to this psymtab has been
|
||||
readin. */
|
||||
virtual bool readin_p () const = 0;
|
||||
read in in the context of this objfile. */
|
||||
virtual bool readin_p (struct objfile *) const = 0;
|
||||
|
||||
/* Return a pointer to the compunit allocated for this source file.
|
||||
Return nullptr if !readin or if there was no symtab. */
|
||||
virtual struct compunit_symtab *get_compunit_symtab () const = 0;
|
||||
/* Return a pointer to the compunit allocated for this source file
|
||||
in the context of this objfile.
|
||||
|
||||
Return nullptr if the compunit was not read in or if there was no
|
||||
symtab. */
|
||||
virtual struct compunit_symtab *get_compunit_symtab
|
||||
(struct objfile *) const = 0;
|
||||
|
||||
/* Return the raw low text address of this partial_symtab. */
|
||||
CORE_ADDR raw_text_low () const
|
||||
@@ -319,14 +322,12 @@ struct standard_psymtab : public partial_symtab
|
||||
{
|
||||
}
|
||||
|
||||
bool readin_p () const override
|
||||
bool readin_p (struct objfile *) const override
|
||||
{
|
||||
return readin;
|
||||
}
|
||||
|
||||
/* Return a pointer to the compunit allocated for this source file.
|
||||
Return nullptr if !readin or if there was no symtab. */
|
||||
struct compunit_symtab *get_compunit_symtab () const override
|
||||
struct compunit_symtab *get_compunit_symtab (struct objfile *) const override
|
||||
{
|
||||
return compunit_symtab;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ partial_map_expand_apply (struct objfile *objfile,
|
||||
gdb_assert (pst->user == NULL);
|
||||
|
||||
/* Don't visit already-expanded psymtabs. */
|
||||
if (pst->readin_p ())
|
||||
if (pst->readin_p (objfile))
|
||||
return 0;
|
||||
|
||||
/* This may expand more than one symtab, and we want to iterate over
|
||||
@@ -384,7 +384,7 @@ psym_find_pc_sect_compunit_symtab (struct objfile *objfile,
|
||||
msymbol);
|
||||
if (ps != NULL)
|
||||
{
|
||||
if (warn_if_readin && ps->readin_p ())
|
||||
if (warn_if_readin && ps->readin_p (objfile))
|
||||
/* Might want to error() here (in case symtab is corrupt and
|
||||
will cause a core dump), but maybe we can successfully
|
||||
continue, so let's not. */
|
||||
@@ -392,7 +392,7 @@ psym_find_pc_sect_compunit_symtab (struct objfile *objfile,
|
||||
(Internal error: pc %s in read in psymtab, but not in symtab.)\n"),
|
||||
paddress (objfile->arch (), pc));
|
||||
psymtab_to_symtab (objfile, ps);
|
||||
return ps->get_compunit_symtab ();
|
||||
return ps->get_compunit_symtab (objfile);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -485,9 +485,9 @@ psym_lookup_symbol (struct objfile *objfile,
|
||||
|
||||
for (partial_symtab *ps : require_partial_symbols (objfile, true))
|
||||
{
|
||||
if (!ps->readin_p () && lookup_partial_symbol (objfile, ps,
|
||||
psym_lookup_name,
|
||||
psymtab_index, domain))
|
||||
if (!ps->readin_p (objfile)
|
||||
&& lookup_partial_symbol (objfile, ps, psym_lookup_name,
|
||||
psymtab_index, domain))
|
||||
{
|
||||
struct symbol *sym, *with_opaque = NULL;
|
||||
struct compunit_symtab *stab = psymtab_to_symtab (objfile, ps);
|
||||
@@ -535,7 +535,7 @@ psym_lookup_global_symbol_language (struct objfile *objfile, const char *name,
|
||||
for (partial_symtab *ps : require_partial_symbols (objfile, true))
|
||||
{
|
||||
struct partial_symbol *psym;
|
||||
if (ps->readin_p ())
|
||||
if (ps->readin_p (objfile))
|
||||
continue;
|
||||
|
||||
psym = lookup_partial_symbol (objfile, ps, lookup_name, 1, domain);
|
||||
@@ -748,11 +748,11 @@ psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
||||
pst = pst->user;
|
||||
|
||||
/* If it's been looked up before, return it. */
|
||||
if (pst->get_compunit_symtab ())
|
||||
return pst->get_compunit_symtab ();
|
||||
if (pst->get_compunit_symtab (objfile))
|
||||
return pst->get_compunit_symtab (objfile);
|
||||
|
||||
/* If it has not yet been read in, read it. */
|
||||
if (!pst->readin_p ())
|
||||
if (!pst->readin_p (objfile))
|
||||
{
|
||||
scoped_restore decrementer = increment_reading_symtab ();
|
||||
|
||||
@@ -766,7 +766,7 @@ psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
||||
pst->read_symtab (objfile);
|
||||
}
|
||||
|
||||
return pst->get_compunit_symtab ();
|
||||
return pst->get_compunit_symtab (objfile);
|
||||
}
|
||||
|
||||
/* Psymtab version of find_last_source_symtab. See its definition in
|
||||
@@ -789,7 +789,7 @@ psym_find_last_source_symtab (struct objfile *ofp)
|
||||
|
||||
if (cs_pst)
|
||||
{
|
||||
if (cs_pst->readin_p ())
|
||||
if (cs_pst->readin_p (ofp))
|
||||
{
|
||||
internal_error (__FILE__, __LINE__,
|
||||
_("select_source_symtab: "
|
||||
@@ -946,11 +946,11 @@ dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab,
|
||||
gdb_print_host_address (objfile, outfile);
|
||||
fprintf_filtered (outfile, ")\n");
|
||||
|
||||
if (psymtab->readin_p ())
|
||||
if (psymtab->readin_p (objfile))
|
||||
{
|
||||
fprintf_filtered (outfile,
|
||||
" Full symtab was read (at ");
|
||||
gdb_print_host_address (psymtab->get_compunit_symtab (), outfile);
|
||||
gdb_print_host_address (psymtab->get_compunit_symtab (objfile), outfile);
|
||||
fprintf_filtered (outfile, ")\n");
|
||||
}
|
||||
|
||||
@@ -1004,7 +1004,7 @@ psym_print_stats (struct objfile *objfile)
|
||||
i = 0;
|
||||
for (partial_symtab *ps : require_partial_symbols (objfile, true))
|
||||
{
|
||||
if (!ps->readin_p ())
|
||||
if (!ps->readin_p (objfile))
|
||||
i++;
|
||||
}
|
||||
printf_filtered (_(" Number of psym tables (not yet expanded): %d\n"), i);
|
||||
@@ -1047,7 +1047,7 @@ psym_expand_symtabs_for_function (struct objfile *objfile,
|
||||
|
||||
for (partial_symtab *ps : require_partial_symbols (objfile, true))
|
||||
{
|
||||
if (ps->readin_p ())
|
||||
if (ps->readin_p (objfile))
|
||||
continue;
|
||||
|
||||
if ((lookup_partial_symbol (objfile, ps, lookup_name, 1, VAR_DOMAIN)
|
||||
@@ -1102,7 +1102,7 @@ psym_map_symbol_filenames (struct objfile *objfile,
|
||||
{
|
||||
const char *fullname;
|
||||
|
||||
if (ps->readin_p ())
|
||||
if (ps->readin_p (objfile))
|
||||
continue;
|
||||
|
||||
/* We can skip shared psymtabs here, because any file name will be
|
||||
@@ -1182,7 +1182,7 @@ psym_map_matching_symbols
|
||||
for (partial_symtab *ps : require_partial_symbols (objfile, true))
|
||||
{
|
||||
QUIT;
|
||||
if (ps->readin_p ()
|
||||
if (ps->readin_p (objfile)
|
||||
|| match_partial_symbol (objfile, ps, global, name, domain,
|
||||
ordered_compare))
|
||||
{
|
||||
@@ -1315,7 +1315,7 @@ psym_expand_symtabs_matching
|
||||
{
|
||||
QUIT;
|
||||
|
||||
if (ps->readin_p ())
|
||||
if (ps->readin_p (objfile))
|
||||
continue;
|
||||
|
||||
/* We skip shared psymtabs because file-matching doesn't apply
|
||||
@@ -1717,7 +1717,7 @@ partial_symtab::expand_dependencies (struct objfile *objfile)
|
||||
{
|
||||
for (int i = 0; i < number_of_dependencies; ++i)
|
||||
{
|
||||
if (!dependencies[i]->readin_p ()
|
||||
if (!dependencies[i]->readin_p (objfile)
|
||||
&& dependencies[i]->user == NULL)
|
||||
{
|
||||
/* Inform about additional files to be read in. */
|
||||
@@ -2028,7 +2028,7 @@ maintenance_info_psymtabs (const char *regexp, int from_tty)
|
||||
host_address_to_string (psymtab));
|
||||
|
||||
printf_filtered (" readin %s\n",
|
||||
psymtab->readin_p () ? "yes" : "no");
|
||||
psymtab->readin_p (objfile) ? "yes" : "no");
|
||||
printf_filtered (" fullname %s\n",
|
||||
psymtab->fullname
|
||||
? psymtab->fullname : "(null)");
|
||||
@@ -2124,7 +2124,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
|
||||
/* We don't call psymtab_to_symtab here because that may cause symtab
|
||||
expansion. When debugging a problem it helps if checkers leave
|
||||
things unchanged. */
|
||||
cust = ps->get_compunit_symtab ();
|
||||
cust = ps->get_compunit_symtab (objfile);
|
||||
|
||||
/* First do some checks that don't require the associated symtab. */
|
||||
if (ps->text_high (objfile) < ps->text_low (objfile))
|
||||
|
||||
Reference in New Issue
Block a user