hurd: add gnu_target pointer to fix thread API calls
[deliverable/binutils-gdb.git] / gdb / avr-tdep.c
index 64be41ad35fda345d22034d9d8aae8b67dc16421..74ab531711e9f0e878041efcc42453397ac91f3a 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for Atmel AVR, for GDB.
 
-   Copyright (C) 1996-2019 Free Software Foundation, Inc.
+   Copyright (C) 1996-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    by Denis Chertykov, denisc@overta.ru */
 
 #include "defs.h"
-
-/* Standard C++ includes.  */
-#include <algorithm>
-
-/* Local non-gdb includes.  */
-#include "arch-utils.h"
-#include "dis-asm.h"
-#include "frame-base.h"
-#include "frame-unwind.h"
 #include "frame.h"
+#include "frame-unwind.h"
+#include "frame-base.h"
+#include "trad-frame.h"
 #include "gdbcmd.h"
 #include "gdbcore.h"
 #include "gdbtypes.h"
 #include "inferior.h"
-#include "objfiles.h"
-#include "regcache.h"
 #include "symfile.h"
-#include "trad-frame.h"
+#include "arch-utils.h"
+#include "regcache.h"
+#include "dis-asm.h"
+#include "objfiles.h"
+#include <algorithm>
 
 /* AVR Background:
 
@@ -318,8 +314,8 @@ avr_address_to_pointer (struct gdbarch *gdbarch,
                              avr_convert_iaddr_to_raw (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)
+  else if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC
+          || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD)
     {
       /* A code pointer is word (16 bits) addressed.  We shift the address down
         by 1 bit to convert it to a pointer.  */
@@ -349,8 +345,8 @@ avr_pointer_to_address (struct gdbarch *gdbarch,
       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
+  else if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC
+          || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD
           || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)))
     {
       /* A code pointer is word (16 bits) addressed so we shift it up
@@ -367,7 +363,10 @@ avr_integer_to_address (struct gdbarch *gdbarch,
 {
   ULONGEST addr = unpack_long (type, buf);
 
-  return avr_make_saddr (addr);
+  if (TYPE_DATA_SPACE (type))
+    return avr_make_saddr (addr);
+  else
+    return avr_make_iaddr (addr);
 }
 
 static CORE_ADDR
@@ -939,9 +938,9 @@ avr_return_value (struct gdbarch *gdbarch, struct value *function,
      register holds the LSB.  */
   int lsb_reg;
 
-  if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
-       || TYPE_CODE (valtype) == TYPE_CODE_UNION
-       || TYPE_CODE (valtype) == TYPE_CODE_ARRAY)
+  if ((valtype->code () == TYPE_CODE_STRUCT
+       || valtype->code () == TYPE_CODE_UNION
+       || valtype->code () == TYPE_CODE_ARRAY)
       && TYPE_LENGTH (valtype) > 8)
     return RETURN_VALUE_STRUCT_CONVENTION;
 
@@ -1620,8 +1619,9 @@ avr_io_reg_read_command (const char *args, int from_tty)
     }
 }
 
+void _initialize_avr_tdep ();
 void
-_initialize_avr_tdep (void)
+_initialize_avr_tdep ()
 {
   register_gdbarch_init (bfd_arch_avr, avr_gdbarch_init);
 
@@ -1633,5 +1633,5 @@ _initialize_avr_tdep (void)
      io_registers' to signify it is not available on other platforms.  */
 
   add_info ("io_registers", avr_io_reg_read_command,
-           _("query remote avr target for io space register values"));
+           _("Query remote AVR target for I/O space register values."));
 }
This page took 0.026449 seconds and 4 git commands to generate.