AArch64: Ensure regcache is reset between tests
[external/binutils.git] / gdb / aarch64-tdep.c
index ca0d002..1b3977b 100644 (file)
 
 #include "defs.h"
 
-/* Standard C++ includes.  */
-#include <algorithm>
-
-/* Local non-gdb includes.  */
-#include "aarch64-ravenscar-thread.h"
-#include "aarch64-tdep.h"
-#include "arch-utils.h"
-#include "arch/aarch64-insn.h"
-#include "ax-gdb.h"
-#include "ax.h"
-#include "common/selftest.h"
-#include "common/vec.h"
-#include "dis-asm.h"
-#include "dwarf2-frame.h"
-#include "dwarf2.h"
-#include "elf-bfd.h"
-#include "elf/aarch64.h"
-#include "frame-base.h"
-#include "frame-unwind.h"
 #include "frame.h"
+#include "inferior.h"
 #include "gdbcmd.h"
 #include "gdbcore.h"
-#include "gdbtypes.h"
-#include "infcall.h"
-#include "inferior.h"
-#include "language.h"
-#include "objfiles.h"
-#include "opcode/aarch64.h"
-#include "osabi.h"
-#include "prologue-value.h"
-#include "record-full.h"
-#include "record.h"
+#include "dis-asm.h"
 #include "regcache.h"
 #include "reggroups.h"
-#include "target-descriptions.h"
+#include "value.h"
+#include "arch-utils.h"
+#include "osabi.h"
+#include "frame-unwind.h"
+#include "frame-base.h"
 #include "trad-frame.h"
+#include "objfiles.h"
+#include "dwarf2.h"
+#include "dwarf2-frame.h"
+#include "gdbtypes.h"
+#include "prologue-value.h"
+#include "target-descriptions.h"
 #include "user-regs.h"
-#include "value.h"
+#include "language.h"
+#include "infcall.h"
+#include "ax.h"
+#include "ax-gdb.h"
+#include "common/selftest.h"
+
+#include "aarch64-tdep.h"
+#include "aarch64-ravenscar-thread.h"
+
+#include "elf-bfd.h"
+#include "elf/aarch64.h"
+
+#include "common/vec.h"
+
+#include "record.h"
+#include "record-full.h"
+#include "arch/aarch64-insn.h"
+
+#include "opcode/aarch64.h"
+#include <algorithm>
 
 #define submask(x) ((1L << ((x) + 1)) - 1)
 #define bit(obj,st) (((obj) >> (st)) & 1)
@@ -663,6 +665,7 @@ aarch64_analyze_prologue_test (void)
     };
     instruction_reader_test reader (insns);
 
+    trad_frame_reset_saved_regs (gdbarch, cache.saved_regs);
     CORE_ADDR end = aarch64_analyze_prologue (gdbarch, 0, 128, &cache, reader);
 
     SELF_CHECK (end == 4 * 5);
@@ -705,6 +708,7 @@ aarch64_analyze_prologue_test (void)
       };
       instruction_reader_test reader (insns);
 
+      trad_frame_reset_saved_regs (gdbarch, cache.saved_regs);
       CORE_ADDR end = aarch64_analyze_prologue (gdbarch, 0, 128, &cache,
                                                reader);
 
@@ -872,16 +876,15 @@ aarch64_make_prologue_cache (struct frame_info *this_frame, void **this_cache)
   cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
   *this_cache = cache;
 
-  TRY
+  try
     {
       aarch64_make_prologue_cache_1 (this_frame, cache);
     }
-  CATCH (ex, RETURN_MASK_ERROR)
+  catch (const gdb_exception_error &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-       throw_exception (ex);
+       throw;
     }
-  END_CATCH
 
   return cache;
 }
@@ -1004,19 +1007,18 @@ aarch64_make_stub_cache (struct frame_info *this_frame, void **this_cache)
   cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
   *this_cache = cache;
 
-  TRY
+  try
     {
       cache->prev_sp = get_frame_register_unsigned (this_frame,
                                                    AARCH64_SP_REGNUM);
       cache->prev_pc = get_frame_pc (this_frame);
       cache->available_p = 1;
     }
-  CATCH (ex, RETURN_MASK_ERROR)
+  catch (const gdb_exception_error &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-       throw_exception (ex);
+       throw;
     }
-  END_CATCH
 
   return cache;
 }