2007-06-13 Claudio Fontana <claudio.fontana@gmail.com>
[deliverable/binutils-gdb.git] / gdb / ax-gdb.c
index c1aa202cfde02a5e96dd33d8e7c34442916830f5..82e095367aabc64f9996f8120cec32cd8265e65c 100644 (file)
@@ -1,7 +1,7 @@
 /* GDB-specific functions for operating on agent expressions.
 
-   Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation,
-   Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2007
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -461,7 +461,8 @@ gen_frame_args_address (struct agent_expr *ax)
   int frame_reg;
   LONGEST frame_offset;
 
-  TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset);
+  gdbarch_virtual_frame_pointer (current_gdbarch,
+                                ax->scope, &frame_reg, &frame_offset);
   ax_reg (ax, frame_reg);
   gen_offset (ax, frame_offset);
 }
@@ -475,7 +476,8 @@ gen_frame_locals_address (struct agent_expr *ax)
   int frame_reg;
   LONGEST frame_offset;
 
-  TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset);
+  gdbarch_virtual_frame_pointer (current_gdbarch,
+                                ax->scope, &frame_reg, &frame_offset);
   ax_reg (ax, frame_reg);
   gen_offset (ax, frame_offset);
 }
@@ -1317,7 +1319,7 @@ gen_bitfield_ref (struct agent_expr *ax, struct axs_value *value,
             the sign/zero extension will wipe them out.
             - If we're in the interior of the word, then there is no garbage
             on either end, because the ref operators zero-extend.  */
-         if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+         if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
            gen_left_shift (ax, end - (offset + op_size));
          else
            gen_left_shift (ax, offset - start);
@@ -1597,8 +1599,14 @@ gen_expr (union exp_element **pc, struct agent_expr *ax,
 
     case OP_REGISTER:
       {
-       int reg = (int) (*pc)[1].longconst;
-       (*pc) += 3;
+       const char *name = &(*pc)[2].string;
+       int reg;
+       (*pc) += 4 + BYTES_TO_EXP_ELEM ((*pc)[1].longconst + 1);
+       reg = frame_map_name_to_regnum (deprecated_safe_get_selected_frame (),
+                                       name, strlen (name));
+       if (reg == -1)
+         internal_error (__FILE__, __LINE__,
+                         _("Register $%s not available"), name);
        value->kind = axs_lvalue_register;
        value->u.reg = reg;
        value->type = register_type (current_gdbarch, reg);
This page took 0.027158 seconds and 4 git commands to generate.