2005-11-03 Andrew Cagney <cagney@gnu.org>
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>
Fri, 4 Nov 2005 02:42:34 +0000 (02:42 +0000)
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>
Fri, 4 Nov 2005 02:42:34 +0000 (02:42 +0000)
       Checked in by Elena Zannoni  <ezannoni@redhat.com>

       * dwarf2loc.c (dwarf2_evaluate_loc_desc): Handle DW_OP_piece
       reads.

gdb/ChangeLog
gdb/dwarf2loc.c

index e31c2723ce0f8383e64a9d5f20d29c2077bcc2cc..30d0abe55f6ca966fb3ec9179f912b62513199b2 100644 (file)
@@ -1,3 +1,10 @@
+2005-11-03 Andrew Cagney  <cagney@gnu.org>
+
+       Checked in by Elena Zannoni  <ezannoni@redhat.com>
+
+       * dwarf2loc.c (dwarf2_evaluate_loc_desc): Handle DW_OP_piece
+       reads.
+
 2006-11-03  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * linux-nat.c (linux_nat_resume): Add more debugging messages.  Do
index 6c334485bb76407733968f0ebfc0654bd886920c..fea2c99a9d5e18af21f45a4d498f4ee9a0d8c822 100644 (file)
@@ -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)
     {
This page took 0.027885 seconds and 4 git commands to generate.