mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-03 05:12:28 +08:00
gdb/
Remove excessive DWARF expressions memory duplication. * dwarf2loc.c (per_cu_dwarf_call): Remove variable back_to and its use for block.data. (indirect_pieced_value): Remove variable result. Remove variable back_to and its use for baton.data. (dwarf2_compile_expr_to_ax): Remove variable back_to and its use for block.data. * dwarf2read.c (dwarf2_fetch_die_location_block): Remove xmemdup. Update the function comment.
This commit is contained in:
@ -1,3 +1,15 @@
|
|||||||
|
2011-09-13 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
Remove excessive DWARF expressions memory duplication.
|
||||||
|
* dwarf2loc.c (per_cu_dwarf_call): Remove variable back_to and its use
|
||||||
|
for block.data.
|
||||||
|
(indirect_pieced_value): Remove variable result. Remove variable
|
||||||
|
back_to and its use for baton.data.
|
||||||
|
(dwarf2_compile_expr_to_ax): Remove variable back_to and its use for
|
||||||
|
block.data.
|
||||||
|
* dwarf2read.c (dwarf2_fetch_die_location_block): Remove xmemdup.
|
||||||
|
Update the function comment.
|
||||||
|
|
||||||
2011-09-13 Pedro Alves <pedro@codesourcery.com>
|
2011-09-13 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
* inferior.h (ALL_INFERIORS): New.
|
* inferior.h (ALL_INFERIORS): New.
|
||||||
|
@ -265,19 +265,14 @@ per_cu_dwarf_call (struct dwarf_expr_context *ctx, size_t die_offset,
|
|||||||
void *baton)
|
void *baton)
|
||||||
{
|
{
|
||||||
struct dwarf2_locexpr_baton block;
|
struct dwarf2_locexpr_baton block;
|
||||||
struct cleanup *back_to;
|
|
||||||
|
|
||||||
block = dwarf2_fetch_die_location_block (die_offset, per_cu,
|
block = dwarf2_fetch_die_location_block (die_offset, per_cu,
|
||||||
get_frame_pc, baton);
|
get_frame_pc, baton);
|
||||||
|
|
||||||
back_to = make_cleanup (xfree, (void *) block.data);
|
|
||||||
|
|
||||||
/* DW_OP_call_ref is currently not supported. */
|
/* DW_OP_call_ref is currently not supported. */
|
||||||
gdb_assert (block.per_cu == per_cu);
|
gdb_assert (block.per_cu == per_cu);
|
||||||
|
|
||||||
dwarf_expr_eval (ctx, block.data, block.size);
|
dwarf_expr_eval (ctx, block.data, block.size);
|
||||||
|
|
||||||
do_cleanups (back_to);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper interface of per_cu_dwarf_call for dwarf2_evaluate_loc_desc. */
|
/* Helper interface of per_cu_dwarf_call for dwarf2_evaluate_loc_desc. */
|
||||||
@ -969,9 +964,7 @@ indirect_pieced_value (struct value *value)
|
|||||||
struct dwarf2_locexpr_baton baton;
|
struct dwarf2_locexpr_baton baton;
|
||||||
int i, bit_offset, bit_length;
|
int i, bit_offset, bit_length;
|
||||||
struct dwarf_expr_piece *piece = NULL;
|
struct dwarf_expr_piece *piece = NULL;
|
||||||
struct value *result;
|
|
||||||
LONGEST byte_offset;
|
LONGEST byte_offset;
|
||||||
struct cleanup *back_to;
|
|
||||||
|
|
||||||
type = check_typedef (value_type (value));
|
type = check_typedef (value_type (value));
|
||||||
if (TYPE_CODE (type) != TYPE_CODE_PTR)
|
if (TYPE_CODE (type) != TYPE_CODE_PTR)
|
||||||
@ -1021,15 +1014,9 @@ indirect_pieced_value (struct value *value)
|
|||||||
get_frame_address_in_block_wrapper,
|
get_frame_address_in_block_wrapper,
|
||||||
frame);
|
frame);
|
||||||
|
|
||||||
back_to = make_cleanup (xfree, (void *) baton.data);
|
return dwarf2_evaluate_loc_desc_full (TYPE_TARGET_TYPE (type), frame,
|
||||||
|
baton.data, baton.size, baton.per_cu,
|
||||||
result = dwarf2_evaluate_loc_desc_full (TYPE_TARGET_TYPE (type), frame,
|
piece->v.ptr.offset + byte_offset);
|
||||||
baton.data, baton.size, baton.per_cu,
|
|
||||||
piece->v.ptr.offset + byte_offset);
|
|
||||||
|
|
||||||
do_cleanups (back_to);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
@ -2147,14 +2134,12 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
|
|||||||
{
|
{
|
||||||
struct dwarf2_locexpr_baton block;
|
struct dwarf2_locexpr_baton block;
|
||||||
int size = (op == DW_OP_call2 ? 2 : 4);
|
int size = (op == DW_OP_call2 ? 2 : 4);
|
||||||
struct cleanup *back_to;
|
|
||||||
|
|
||||||
uoffset = extract_unsigned_integer (op_ptr, size, byte_order);
|
uoffset = extract_unsigned_integer (op_ptr, size, byte_order);
|
||||||
op_ptr += size;
|
op_ptr += size;
|
||||||
|
|
||||||
block = dwarf2_fetch_die_location_block (uoffset, per_cu,
|
block = dwarf2_fetch_die_location_block (uoffset, per_cu,
|
||||||
get_ax_pc, expr);
|
get_ax_pc, expr);
|
||||||
back_to = make_cleanup (xfree, (void *) block.data);
|
|
||||||
|
|
||||||
/* DW_OP_call_ref is currently not supported. */
|
/* DW_OP_call_ref is currently not supported. */
|
||||||
gdb_assert (block.per_cu == per_cu);
|
gdb_assert (block.per_cu == per_cu);
|
||||||
@ -2162,8 +2147,6 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
|
|||||||
dwarf2_compile_expr_to_ax (expr, loc, arch, addr_size,
|
dwarf2_compile_expr_to_ax (expr, loc, arch, addr_size,
|
||||||
block.data, block.data + block.size,
|
block.data, block.data + block.size,
|
||||||
per_cu);
|
per_cu);
|
||||||
|
|
||||||
do_cleanups (back_to);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -13854,9 +13854,9 @@ follow_die_ref (struct die_info *src_die, struct attribute *attr,
|
|||||||
return die;
|
return die;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return DWARF block and its CU referenced by OFFSET at PER_CU. Returned
|
/* Return DWARF block referenced by DW_AT_location of DIE at OFFSET at PER_CU.
|
||||||
value is intended for DW_OP_call*. You must call xfree on returned
|
Returned value is intended for DW_OP_call*. Returned
|
||||||
dwarf2_locexpr_baton->data. */
|
dwarf2_locexpr_baton->data has lifetime of PER_CU->OBJFILE. */
|
||||||
|
|
||||||
struct dwarf2_locexpr_baton
|
struct dwarf2_locexpr_baton
|
||||||
dwarf2_fetch_die_location_block (unsigned int offset,
|
dwarf2_fetch_die_location_block (unsigned int offset,
|
||||||
@ -13912,9 +13912,6 @@ dwarf2_fetch_die_location_block (unsigned int offset,
|
|||||||
}
|
}
|
||||||
retval.per_cu = cu->per_cu;
|
retval.per_cu = cu->per_cu;
|
||||||
|
|
||||||
if (retval.data)
|
|
||||||
retval.data = xmemdup (retval.data, retval.size, retval.size);
|
|
||||||
|
|
||||||
age_cached_comp_units ();
|
age_cached_comp_units ();
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
Reference in New Issue
Block a user