aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2loc.c
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2004-08-24 17:31:49 +0000
committerJim Blandy <jimb@codesourcery.com>2004-08-24 17:31:49 +0000
commit5ca2e3275d6a1d969990090805596f5211091afd (patch)
treefdef5b19856cc20889e10ff48fa84b27d5fa3f07 /gdb/dwarf2loc.c
parent8f94ae4da35d549beb11b77c7c19adf0f52bf008 (diff)
downloadgdb-5ca2e3275d6a1d969990090805596f5211091afd.zip
gdb-5ca2e3275d6a1d969990090805596f5211091afd.tar.gz
gdb-5ca2e3275d6a1d969990090805596f5211091afd.tar.bz2
* dwarf2loc.c (dwarf2_evaluate_loc_desc): Wait to fetch the top of
the stack until we've decided what sort of result the evaluation has produced. Use separate variables, with more specific names.
Diffstat (limited to 'gdb/dwarf2loc.c')
-rw-r--r--gdb/dwarf2loc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index cdbeb10..3e7cdd6 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -205,7 +205,6 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
unsigned char *data, unsigned short size,
struct objfile *objfile)
{
- CORE_ADDR result;
struct value *retval;
struct dwarf_expr_baton baton;
struct dwarf_expr_context *ctx;
@@ -228,21 +227,23 @@ 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);
- result = dwarf_expr_fetch (ctx, 0);
if (ctx->in_reg)
{
- int regnum = DWARF2_REG_TO_REGNUM (result);
- retval = value_from_register (SYMBOL_TYPE (var), regnum, frame);
+ CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0);
+ int gdb_regnum = DWARF2_REG_TO_REGNUM (dwarf_regnum);
+ retval = value_from_register (SYMBOL_TYPE (var), gdb_regnum, frame);
}
else
{
+ CORE_ADDR address = dwarf_expr_fetch (ctx, 0);
+
retval = allocate_value (SYMBOL_TYPE (var));
VALUE_BFD_SECTION (retval) = SYMBOL_BFD_SECTION (var);
VALUE_LVAL (retval) = lval_memory;
VALUE_LAZY (retval) = 1;
- VALUE_ADDRESS (retval) = result;
+ VALUE_ADDRESS (retval) = address;
}
free_dwarf_expr_context (ctx);