Fix an illegal memory access triggered when trying to examine an input file containin...
[deliverable/binutils-gdb.git] / gdb / xtensa-linux-tdep.c
index e912c01940c9d415a9cfc3eba0097ee51ffcb88d..ab07eedd0e8ea10086af3874012dc4142ee294f7 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for GNU/Linux on Xtensa processors.
 
-   Copyright (C) 2007-2017 Free Software Foundation, Inc.
+   Copyright (C) 2007-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
+#include "xtensa-tdep.h"
 #include "osabi.h"
 #include "linux-tdep.h"
 #include "solib-svr4.h"
 #include "symtab.h"
+#include "gdbarch.h"
 
 /* This enum represents the signals' numbers on the Xtensa
    architecture.  It just contains the signal definitions which are
@@ -97,6 +99,17 @@ xtensa_linux_gdb_signal_to_target (struct gdbarch *gdbarch,
 static void
 xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  if (tdep->num_nopriv_regs < tdep->num_regs)
+    {
+      tdep->num_pseudo_regs += tdep->num_regs - tdep->num_nopriv_regs;
+      tdep->num_regs = tdep->num_nopriv_regs;
+
+      set_gdbarch_num_regs (gdbarch, tdep->num_regs);
+      set_gdbarch_num_pseudo_regs (gdbarch, tdep->num_pseudo_regs);
+    }
+
   linux_init_abi (info, gdbarch);
 
   set_solib_svr4_fetch_link_map_offsets
This page took 0.025211 seconds and 4 git commands to generate.