Recognize a few more AIX XCOFF DWARF sections.
[deliverable/binutils-gdb.git] / gdb / avr-tdep.c
index be0b543e6ffb8753ad1e61a62e887691230ce331..1108eb4681ee5f9400c325f7fa1d77a01387ae52 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for Atmel AVR, for GDB.
 
-   Copyright (C) 1996-2014 Free Software Foundation, Inc.
+   Copyright (C) 1996-2015 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -34,7 +34,6 @@
 #include "symfile.h"
 #include "arch-utils.h"
 #include "regcache.h"
-#include <string.h>
 #include "dis-asm.h"
 #include "objfiles.h"
 
@@ -308,7 +307,7 @@ avr_address_to_pointer (struct gdbarch *gdbarch,
   /* Is it a data address in flash?  */
   if (AVR_TYPE_ADDRESS_CLASS_FLASH (type))
     {
-      /* A data address in flash is always byte addressed.  */
+      /* A data pointer in flash is byte addressed.  */
       store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order,
                              avr_convert_iaddr_to_raw (addr));
     }
@@ -316,8 +315,8 @@ avr_address_to_pointer (struct gdbarch *gdbarch,
   else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
           || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD)
     {
-      /* A code address, either a function pointer or the program counter, is
-        word (16 bits) addressed.  */
+      /* A code pointer is word (16 bits) addressed.  We shift the address down
+        by 1 bit to convert it to a pointer.  */
       store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order,
                              avr_convert_iaddr_to_raw (addr >> 1));
     }
@@ -339,12 +338,19 @@ avr_pointer_to_address (struct gdbarch *gdbarch,
 
   /* Is it a data address in flash?  */
   if (AVR_TYPE_ADDRESS_CLASS_FLASH (type))
-    return avr_make_iaddr (addr);
+    {
+      /* A data pointer in flash is already byte addressed.  */
+      return avr_make_iaddr (addr);
+    }
   /* Is it a code address?  */
   else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
           || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD
           || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)))
-    return avr_make_iaddr (addr << 1);
+    {
+      /* A code pointer is word (16 bits) addressed so we shift it up
+        by 1 bit to convert it to an address.  */
+      return avr_make_iaddr (addr << 1);
+    }
   else
     return avr_make_saddr (addr);
 }
@@ -981,7 +987,7 @@ avr_frame_unwind_cache (struct frame_info *this_frame,
   int i;
 
   if (*this_prologue_cache)
-    return *this_prologue_cache;
+    return (struct avr_unwind_cache *) *this_prologue_cache;
 
   info = FRAME_OBSTACK_ZALLOC (struct avr_unwind_cache);
   *this_prologue_cache = info;
@@ -1192,15 +1198,15 @@ struct stack_item
 {
   int len;
   struct stack_item *prev;
-  void *data;
+  gdb_byte *data;
 };
 
 static struct stack_item *
 push_stack_item (struct stack_item *prev, const bfd_byte *contents, int len)
 {
   struct stack_item *si;
-  si = xmalloc (sizeof (struct stack_item));
-  si->data = xmalloc (len);
+  si = XNEW (struct stack_item);
+  si->data = (gdb_byte *) xmalloc (len);
   si->len = len;
   si->prev = prev;
   memcpy (si->data, contents, len);
This page took 0.043715 seconds and 4 git commands to generate.