PR ld/12549
[binutils-gdb.git] / gdb / ax-gdb.c
index 2db56bffa49813b06bc41ed5e08424efc2319390..202988256893eb0f6c7e6cf4225ccaba94950dc1 100644 (file)
@@ -1,7 +1,6 @@
 /* GDB-specific functions for operating on agent expressions.
 
-   Copyright (C) 1998-2001, 2003, 2007-2012 Free Software Foundation,
-   Inc.
+   Copyright (C) 1998-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -367,9 +366,9 @@ gen_trace_static_fields (struct gdbarch *gdbarch,
            {
            case axs_lvalue_memory:
              {
-               int length = TYPE_LENGTH (check_typedef (value.type));
-
-               ax_const_l (ax, length);
+               /* Initialize the TYPE_LENGTH if it is a typedef.  */
+               check_typedef (value.type);
+               ax_const_l (ax, TYPE_LENGTH (value.type));
                ax_simple (ax, aop_trace);
              }
              break;
@@ -425,17 +424,18 @@ gen_traced_pop (struct gdbarch *gdbarch,
 
       case axs_lvalue_memory:
        {
-         int length = TYPE_LENGTH (check_typedef (value->type));
-
          if (string_trace)
            ax_simple (ax, aop_dup);
 
+         /* Initialize the TYPE_LENGTH if it is a typedef.  */
+         check_typedef (value->type);
+
          /* There's no point in trying to use a trace_quick bytecode
             here, since "trace_quick SIZE pop" is three bytes, whereas
             "const8 SIZE trace" is also three bytes, does the same
             thing, and the simplest code which generates that will also
             work correctly for objects with large sizes.  */
-         ax_const_l (ax, length);
+         ax_const_l (ax, TYPE_LENGTH (value->type));
          ax_simple (ax, aop_trace);
 
          if (string_trace)
@@ -2255,6 +2255,8 @@ gen_expr (struct expression *exp, union exp_element **pc,
       break;
 
     case OP_TYPE:
+    case OP_TYPEOF:
+    case OP_DECLTYPE:
       error (_("Attempt to use a type name as an expression."));
 
     default:
@@ -2560,13 +2562,11 @@ gen_printf (CORE_ADDR scope, struct gdbarch *gdbarch,
            struct format_piece *frags,
            int nargs, struct expression **exprs)
 {
-  struct expression *expr;
   struct cleanup *old_chain = 0;
   struct agent_expr *ax = new_agent_expr (gdbarch, scope);
   union exp_element *pc;
   struct axs_value value;
-  int i, tem, bot, fr, flen;
-  char *fmt;
+  int tem;
 
   old_chain = make_cleanup_free_agent_expr (ax);