aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2expr.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2003-04-13 15:53:44 +0000
committerDaniel Jacobowitz <drow@false.org>2003-04-13 15:53:44 +0000
commit61fbb938d653fed62f0c7d893b5f8e842fa7a09f (patch)
tree93b66b0415ff276ac0d3f0ef948449e9097ffb74 /gdb/dwarf2expr.c
parent0d53c4c49facfc7400795d0d4fc7489b296d743d (diff)
downloadgdb-61fbb938d653fed62f0c7d893b5f8e842fa7a09f.zip
gdb-61fbb938d653fed62f0c7d893b5f8e842fa7a09f.tar.gz
gdb-61fbb938d653fed62f0c7d893b5f8e842fa7a09f.tar.bz2
* dwarf2expr.h (struct dwarf_expr_context): Remove extra arguments
to read_reg and update its comment. Remove regnum member. * dwarf2expr.c (execute_stack_op): Remove memaddr and expr_lval. Don't call read_reg when setting in_reg. Call read_reg to get the frame base if it's in a register. Return the register number on the stack instead of in the context. Remove extra arguments to read_reg. * dwarf2loc.c (dwarf_expr_read_reg): Remove extra arguments. (dwarf2_evaluate_loc_desc): Call value_from_register. Expect the register number on the expression stack. (needs_frame_read_reg): Remove extra arguments.
Diffstat (limited to 'gdb/dwarf2expr.c')
-rw-r--r--gdb/dwarf2expr.c39
1 files changed, 10 insertions, 29 deletions
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index a87dfc6..35e76f3 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -231,11 +231,10 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
while (op_ptr < op_end)
{
enum dwarf_location_atom op = *op_ptr++;
- CORE_ADDR result, memaddr;
+ CORE_ADDR result;
ULONGEST uoffset, reg;
LONGEST offset;
int bytes_read;
- enum lval_type expr_lval;
ctx->in_reg = 0;
@@ -361,19 +360,8 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
error ("DWARF-2 expression error: DW_OP_reg operations must be "
"used alone.");
- /* FIXME drow/2003-02-21: This call to read_reg could be pushed
- into the evaluator's caller by changing the semantics for in_reg.
- Then we wouldn't need to return an lval_type and a memaddr. */
- result = (ctx->read_reg) (ctx->baton, op - DW_OP_reg0, &expr_lval,
- &memaddr);
-
- if (expr_lval == lval_register)
- {
- ctx->regnum = op - DW_OP_reg0;
- ctx->in_reg = 1;
- }
- else
- result = memaddr;
+ result = op - DW_OP_reg0;
+ ctx->in_reg = 1;
break;
@@ -383,16 +371,8 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
error ("DWARF-2 expression error: DW_OP_reg operations must be "
"used alone.");
- result = (ctx->read_reg) (ctx->baton, reg, &expr_lval, &memaddr);
-
- if (expr_lval == lval_register)
- {
- ctx->regnum = reg;
- ctx->in_reg = 1;
- }
- else
- result = memaddr;
-
+ result = reg;
+ ctx->in_reg = 1;
break;
case DW_OP_breg0:
@@ -429,8 +409,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
case DW_OP_breg31:
{
op_ptr = read_sleb128 (op_ptr, op_end, &offset);
- result = (ctx->read_reg) (ctx->baton, op - DW_OP_breg0,
- &expr_lval, &memaddr);
+ result = (ctx->read_reg) (ctx->baton, op - DW_OP_breg0);
result += offset;
}
break;
@@ -438,7 +417,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
{
op_ptr = read_uleb128 (op_ptr, op_end, &reg);
op_ptr = read_sleb128 (op_ptr, op_end, &offset);
- result = (ctx->read_reg) (ctx->baton, reg, &expr_lval, &memaddr);
+ result = (ctx->read_reg) (ctx->baton, reg);
result += offset;
}
break;
@@ -460,7 +439,9 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
(ctx->get_frame_base) (ctx->baton, &datastart, &datalen);
dwarf_expr_eval (ctx, datastart, datalen);
result = dwarf_expr_fetch (ctx, 0);
- if (! ctx->in_reg)
+ if (ctx->in_reg)
+ result = (ctx->read_reg) (ctx->baton, result);
+ else
{
char *buf = alloca (TARGET_ADDR_BIT / TARGET_CHAR_BIT);
int bytes_read;