summaryrefslogtreecommitdiffstats
path: root/gdb/dwarf2loc.c
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2004-08-24 21:01:49 +0000
committerJim Blandy <jimb@codesourcery.com>2004-08-24 21:01:49 +0000
commit87808bd699575a850139a1f916512ab7a47fd496 (patch)
tree16b075db667922d055eb918d2b4eaa76ffb51b14 /gdb/dwarf2loc.c
parent8d2c00cb73ae9b3d1e5d7317241dc02e575b7f1b (diff)
downloadppe42-binutils-87808bd699575a850139a1f916512ab7a47fd496.tar.gz
ppe42-binutils-87808bd699575a850139a1f916512ab7a47fd496.zip
* dwarf2expr.h (struct dwarf_expr_context): New members
'num_pieces' and 'pieces', for returning the result of an expression that uses DW_OP_piece. (struct dwarf_expr_piece): New struct type. * dwarf2expr.c (new_dwarf_expr_context): Initialize num_pieces and pieces. (free_dwarf_expr_context): Free pieces, if any. (add_piece): New function. (execute_stack_op): Implement DW_OP_piece. * dwarf2loc.c (dwarf2_evaluate_loc_desc): If the result of the expression is a list of pieces, print an error message. (dwarf2_loc_desc_needs_frame): If the expression yields pieces, and any piece is in a register, then we need a frame.
Diffstat (limited to 'gdb/dwarf2loc.c')
-rw-r--r--gdb/dwarf2loc.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 3e7cdd6040..c281642ced 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -205,6 +205,7 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
unsigned char *data, unsigned short size,
struct objfile *objfile)
{
+ struct gdbarch *arch = get_frame_arch (frame);
struct value *retval;
struct dwarf_expr_baton baton;
struct dwarf_expr_context *ctx;
@@ -227,8 +228,15 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
ctx->get_tls_address = dwarf_expr_tls_address;
dwarf_expr_eval (ctx, data, size);
-
- if (ctx->in_reg)
+ 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));
+ }
+ else if (ctx->in_reg)
{
CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0);
int gdb_regnum = DWARF2_REG_TO_REGNUM (dwarf_regnum);
@@ -323,6 +331,17 @@ dwarf2_loc_desc_needs_frame (unsigned char *data, unsigned short size)
in_reg = ctx->in_reg;
+ if (ctx->num_pieces > 0)
+ {
+ int i;
+
+ /* If the location has several pieces, and any of them are in
+ registers, then we will need a frame to fetch them from. */
+ for (i = 0; i < ctx->num_pieces; i++)
+ if (ctx->pieces[i].in_reg)
+ in_reg = 1;
+ }
+
free_dwarf_expr_context (ctx);
return baton.needs_frame || in_reg;
OpenPOWER on IntegriCloud