*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / dwarf2loc.c
index 841fb8f2333f8378ce502971298bfc216d684aab..a179566cfa58d232950d3a294e77cede1b4c21bc 100644 (file)
@@ -1,6 +1,6 @@
 /* DWARF 2 location expression support for GDB.
 
-   Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005, 2007 Free Software Foundation, Inc.
 
    Contributed by Daniel Jacobowitz, MontaVista Software, Inc.
 
@@ -114,28 +114,18 @@ struct dwarf_expr_baton
 
 /* Helper functions for dwarf2_evaluate_loc_desc.  */
 
-/* Using the frame specified in BATON, read register REGNUM.  The lval
-   type will be returned in LVALP, and for lval_memory the register
-   save address will be returned in ADDRP.  */
+/* Using the frame specified in BATON, return the value of register
+   REGNUM, treated as a pointer.  */
 static CORE_ADDR
 dwarf_expr_read_reg (void *baton, int dwarf_regnum)
 {
   struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
-  CORE_ADDR result, save_addr;
-  enum lval_type lval_type;
-  gdb_byte *buf;
-  int optimized, regnum, realnum, regsize;
+  CORE_ADDR result;
+  int regnum;
 
   regnum = DWARF2_REG_TO_REGNUM (dwarf_regnum);
-  regsize = register_size (current_gdbarch, regnum);
-  buf = alloca (regsize);
-
-  frame_register (debaton->frame, regnum, &optimized, &lval_type, &save_addr,
-                 &realnum, buf);
-  /* NOTE: cagney/2003-05-22: This extract is assuming that a DWARF 2
-     address is always unsigned.  That may or may not be true.  */
-  result = extract_unsigned_integer (buf, regsize);
-
+  result = address_from_register (builtin_type_void_data_ptr,
+                                 regnum, debaton->frame);
   return result;
 }
 
@@ -211,6 +201,7 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
       retval = allocate_value (SYMBOL_TYPE (var));
       VALUE_LVAL (retval) = not_lval;
       set_value_optimized_out (retval, 1);
+      return retval;
     }
 
   baton.frame = frame;
This page took 0.024126 seconds and 4 git commands to generate.