aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2loc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/dwarf2loc.c')
-rw-r--r--gdb/dwarf2loc.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 6c33448..fea2c99 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -302,11 +302,28 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
dwarf_expr_eval (ctx, data, size);
if (ctx->num_pieces > 0)
{
- /* We haven't implemented splicing together pieces from
- arbitrary sources yet. */
- error (_("The value of variable '%s' is distributed across several\n"
- "locations, and GDB cannot access its value.\n"),
- SYMBOL_NATURAL_NAME (var));
+ int i;
+ long offset = 0;
+ bfd_byte *contents;
+
+ retval = allocate_value (SYMBOL_TYPE (var));
+ contents = value_contents_raw (retval);
+ for (i = 0; i < ctx->num_pieces; i++)
+ {
+ struct dwarf_expr_piece *p = &ctx->pieces[i];
+ if (p->in_reg)
+ {
+ bfd_byte regval[MAX_REGISTER_SIZE];
+ int gdb_regnum = DWARF2_REG_TO_REGNUM (p->value);
+ get_frame_register (frame, gdb_regnum, regval);
+ memcpy (contents + offset, regval, p->size);
+ }
+ else /* In memory? */
+ {
+ read_memory (p->value, contents + offset, p->size);
+ }
+ offset += p->size;
+ }
}
else if (ctx->in_reg)
{