gdb/
[deliverable/binutils-gdb.git] / gdb / moxie-tdep.c
index 80fecf8661ac2a5a6afe492938409f0d99912bd3..4b250f812041ff75c6a10b823727ef36487240df 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for Moxie.
 
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -166,33 +166,35 @@ moxie_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
     {
       inst = read_memory_unsigned_integer (next_addr, 2, byte_order);
 
-      /* Match "push $rN" where N is between 2 and 13 inclusive.  */
-      if (inst >= 0x0614 && inst <= 0x061f)
+      /* Match "push $sp $rN" where N is between 0 and 13 inclusive.  */
+      if (inst >= 0x0612 && inst <= 0x061f)
        {
          regnum = inst & 0x000f;
          cache->framesize += 4;
          cache->saved_regs[regnum] = cache->framesize;
          next_addr += 2;
        }
+      else
+       break;
     }
 
   inst = read_memory_unsigned_integer (next_addr, 2, byte_order);
 
   /* Optional stack allocation for args and local vars <= 4
      byte.  */
-  if (inst == 0x0170)           /* ldi.l $r5, X */
+  if (inst == 0x01e0)          /* ldi.l $r12, X */
     {
       offset = read_memory_integer (next_addr + 2, 4, byte_order);
       inst2 = read_memory_unsigned_integer (next_addr + 6, 2, byte_order);
       
-      if (inst2 == 0x0517)           /* add.l $sp, $r5 */
+      if (inst2 == 0x291e)     /* sub.l $sp, $r12 */
        {
          cache->framesize += offset;
        }
       
       return (next_addr + 8);
     }
-  else if ((inst & 0xff00) == 0x91)   /* dec $sp, X */
+  else if ((inst & 0xff00) == 0x9100)   /* dec $sp, X */
     {
       cache->framesize += (inst & 0x00ff);
       next_addr += 2;
@@ -200,7 +202,7 @@ moxie_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
       while (next_addr < end_addr)
        {
          inst = read_memory_unsigned_integer (next_addr, 2, byte_order);
-         if ((inst & 0xff00) != 0x91) /* no more dec $sp, X */
+         if ((inst & 0xff00) != 0x9100) /* no more dec $sp, X */
            break;
          cache->framesize += (inst & 0x00ff);
          next_addr += 2;
@@ -216,7 +218,7 @@ static CORE_ADDR
 moxie_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
   CORE_ADDR func_addr = 0, func_end = 0;
-  char *func_name;
+  const char *func_name;
 
   /* See if we can determine the end of the prologue via the symbol table.
      If so, then return either PC, or the PC after the prologue, whichever
@@ -243,7 +245,7 @@ moxie_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
          /* Found a function.  */
          sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL);
          /* Don't use line number debug info for assembly source
-            files. */
+            files.  */
          if (sym && SYMBOL_LANGUAGE (sym) != language_asm)
            {
              sal = find_pc_line (func_addr, 0);
@@ -339,7 +341,7 @@ moxie_extract_return_value (struct type *type, struct regcache *regcache,
 /* Implement the "return_value" gdbarch method.  */
 
 static enum return_value_convention
-moxie_return_value (struct gdbarch *gdbarch, struct type *func_type,
+moxie_return_value (struct gdbarch *gdbarch, struct value *function,
                   struct type *valtype, struct regcache *regcache,
                   gdb_byte *readbuf, const gdb_byte *writebuf)
 {
@@ -459,6 +461,7 @@ moxie_frame_prev_register (struct frame_info *this_frame,
 
 static const struct frame_unwind moxie_frame_unwind = {
   NORMAL_FRAME,
+  default_frame_unwind_stop_reason,
   moxie_frame_this_id,
   moxie_frame_prev_register,
   NULL,
@@ -502,7 +505,7 @@ moxie_process_readu (CORE_ADDR addr, char *buf,
       if (record_debug)
        printf_unfiltered (_("Process record: error reading memory at "
                             "addr 0x%s len = %d.\n"),
-                          paddress (target_gdbarch, addr), length);
+                          paddress (target_gdbarch (), addr), length);
       return -1;
     }
 
@@ -511,9 +514,9 @@ moxie_process_readu (CORE_ADDR addr, char *buf,
 
 /* Parse the current instruction and record the values of the registers and
    memory that will be changed in current instruction to "record_arch_list".
-   Return -1 if something wrong. */
+   Return -1 if something wrong.  */
 
-int
+static int
 moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
                      CORE_ADDR addr)
 {
@@ -525,7 +528,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
   if (record_debug > 1)
     fprintf_unfiltered (gdb_stdlog, "Process record: moxie_process_record "
                                    "addr = 0x%s\n",
-                       paddress (target_gdbarch, addr));
+                       paddress (target_gdbarch (), addr));
 
   inst = (uint16_t) moxie_process_readu (addr, buf, 2, byte_order);
 
@@ -846,7 +849,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
                  ptr = extract_unsigned_integer ((gdb_byte *) & ptr, 
                                                  4, byte_order);
 
-                 /* String length is at 0x12($fp) */
+                 /* String length is at 0x12($fp) */
                  regcache_raw_read (regcache, 
                                     MOXIE_FP_REGNUM, (gdb_byte *) & tmpu32);
                  tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32, 
This page took 0.025371 seconds and 4 git commands to generate.