* elf-m10300.c (mn10300_elf_relax_section): Allow for the
[deliverable/binutils-gdb.git] / gdb / ax-gdb.c
index 5d1332a1c0de898ee4a94cf88df69d2dd1b0f49b..5e04b07f5208fcaddb92246e6f025cdd40da57f3 100644 (file)
@@ -1,6 +1,6 @@
 /* GDB-specific functions for operating on agent expressions.
 
-   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2007, 2008
+   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2007, 2008, 2009
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -124,10 +124,10 @@ static void gen_complement (struct agent_expr *ax, struct axs_value *value);
 static void gen_deref (struct agent_expr *, struct axs_value *);
 static void gen_address_of (struct agent_expr *, struct axs_value *);
 static int find_field (struct type *type, char *name);
-static void gen_bitfield_ref (struct agent_expr *ax,
+static void gen_bitfield_ref (struct expression *exp, struct agent_expr *ax,
                              struct axs_value *value,
                              struct type *type, int start, int end);
-static void gen_struct_ref (struct agent_expr *ax,
+static void gen_struct_ref (struct expression *exp, struct agent_expr *ax,
                            struct axs_value *value,
                            char *field,
                            char *operator_name, char *operand_name);
@@ -592,7 +592,7 @@ gen_var_ref (struct gdbarch *gdbarch, struct agent_expr *ax,
          this as an lvalue or rvalue, the caller will generate the
          right code.  */
       value->kind = axs_lvalue_register;
-      value->u.reg = SYMBOL_VALUE (var);
+      value->u.reg = SYMBOL_REGISTER_OPS (var)->register_number (var, gdbarch);
       break;
 
       /* A lot like LOC_REF_ARG, but the pointer lives directly in a
@@ -600,7 +600,7 @@ gen_var_ref (struct gdbarch *gdbarch, struct agent_expr *ax,
          because it's just like any other case where the thing
         has a real address.  */
     case LOC_REGPARM_ADDR:
-      ax_reg (ax, SYMBOL_VALUE (var));
+      ax_reg (ax, SYMBOL_REGISTER_OPS (var)->register_number (var, gdbarch));
       value->kind = axs_lvalue_memory;
       break;
 
@@ -619,11 +619,11 @@ gen_var_ref (struct gdbarch *gdbarch, struct agent_expr *ax,
 
     case LOC_COMPUTED:
       /* FIXME: cagney/2004-01-26: It should be possible to
-        unconditionally call the SYMBOL_OPS method when available.
+        unconditionally call the SYMBOL_COMPUTED_OPS method when available.
         Unfortunately DWARF 2 stores the frame-base (instead of the
         function) location in a function's symbol.  Oops!  For the
         moment enable this when/where applicable.  */
-      SYMBOL_OPS (var)->tracepoint_var_ref (var, ax, value);
+      SYMBOL_COMPUTED_OPS (var)->tracepoint_var_ref (var, gdbarch, ax, value);
       break;
 
     case LOC_OPTIMIZED_OUT:
@@ -1147,8 +1147,9 @@ find_field (struct type *type, char *name)
    starting and one-past-ending *bit* numbers of the field within the
    structure.  */
 static void
-gen_bitfield_ref (struct agent_expr *ax, struct axs_value *value,
-                 struct type *type, int start, int end)
+gen_bitfield_ref (struct expression *exp, struct agent_expr *ax,
+                 struct axs_value *value, struct type *type,
+                 int start, int end)
 {
   /* Note that ops[i] fetches 8 << i bits.  */
   static enum agent_op ops[]
@@ -1274,7 +1275,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 (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+         if (gdbarch_byte_order (exp->gdbarch) == BFD_ENDIAN_BIG)
            gen_left_shift (ax, end - (offset + op_size));
          else
            gen_left_shift (ax, offset - start);
@@ -1308,7 +1309,8 @@ gen_bitfield_ref (struct agent_expr *ax, struct axs_value *value,
    the operator being compiled, and OPERAND_NAME is the kind of thing
    it operates on; we use them in error messages.  */
 static void
-gen_struct_ref (struct agent_expr *ax, struct axs_value *value, char *field,
+gen_struct_ref (struct expression *exp, struct agent_expr *ax,
+               struct axs_value *value, char *field,
                char *operator_name, char *operand_name)
 {
   struct type *type;
@@ -1339,7 +1341,7 @@ gen_struct_ref (struct agent_expr *ax, struct axs_value *value, char *field,
 
   /* Is this a bitfield?  */
   if (TYPE_FIELD_PACKED (type, i))
-    gen_bitfield_ref (ax, value, TYPE_FIELD_TYPE (type, i),
+    gen_bitfield_ref (exp, ax, value, TYPE_FIELD_TYPE (type, i),
                      TYPE_FIELD_BITPOS (type, i),
                      (TYPE_FIELD_BITPOS (type, i)
                       + TYPE_FIELD_BITSIZE (type, i)));
@@ -1698,9 +1700,9 @@ gen_expr (struct expression *exp, union exp_element **pc,
        (*pc) += 4 + BYTES_TO_EXP_ELEM (length + 1);
        gen_expr (exp, pc, ax, value);
        if (op == STRUCTOP_STRUCT)
-         gen_struct_ref (ax, value, name, ".", "structure or union");
+         gen_struct_ref (exp, ax, value, name, ".", "structure or union");
        else if (op == STRUCTOP_PTR)
-         gen_struct_ref (ax, value, name, "->",
+         gen_struct_ref (exp, ax, value, name, "->",
                          "pointer to a structure or union");
        else
          /* If this `if' chain doesn't handle it, then the case list
This page took 0.025893 seconds and 4 git commands to generate.