Update comment for struct type's length field, introduce type_length_units
[deliverable/binutils-gdb.git] / gdb / lm32-tdep.c
index 57d73b5aedc0dff2ab2b22c1d8d4d2f78a080bd9..779575c77365afaac3a9f22a358aabc978308598 100644 (file)
@@ -1,7 +1,7 @@
 /* Target-dependent code for Lattice Mico32 processor, for GDB.
    Contributed by Jon Beniston <jon@beniston.com>
 
-   Copyright (C) 2009-2012 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -37,8 +37,6 @@
 #include "reggroups.h"
 #include "opcodes/lm32-desc.h"
 
-#include "gdb_string.h"
-
 /* Macros to extract fields from an instruction.  */
 #define LM32_OPCODE(insn)       ((insn >> 26) & 0x3f)
 #define LM32_REG0(insn)         ((insn >> 21) & 0x1f)
@@ -261,7 +259,6 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       struct value *arg = args[i];
       struct type *arg_type = check_typedef (value_type (arg));
       gdb_byte *contents;
-      int len;
       ULONGEST val;
 
       /* Promote small integer types to int.  */
@@ -283,8 +280,8 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       /* FIXME: Handle structures.  */
 
       contents = (gdb_byte *) value_contents (arg);
-      len = TYPE_LENGTH (arg_type);
-      val = extract_unsigned_integer (contents, len, byte_order);
+      val = extract_unsigned_integer (contents, TYPE_LENGTH (arg_type),
+                                     byte_order);
 
       /* First num_arg_regs parameters are passed by registers, 
          and the rest are passed on the stack.  */
@@ -292,7 +289,7 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
        regcache_cooked_write_unsigned (regcache, first_arg_reg + i, val);
       else
        {
-         write_memory (sp, (void *) &val, len);
+         write_memory (sp, (void *) &val, TYPE_LENGTH (arg_type));
          sp -= 4;
        }
     }
@@ -528,7 +525,7 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     return arches->gdbarch;
 
   /* None found, create a new architecture from the information provided.  */
-  tdep = XMALLOC (struct gdbarch_tdep);
+  tdep = XNEW (struct gdbarch_tdep);
   gdbarch = gdbarch_alloc (&info, tdep);
 
   /* Type sizes.  */
This page took 0.026282 seconds and 4 git commands to generate.