From: Yao Qi Date: Wed, 24 May 2017 21:15:22 +0000 (+0100) Subject: Clear GDB internal state after each unit test X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7a3929c417b1388c689a0cd6b0b2f6579d85ec78;p=binutils-gdb.git Clear GDB internal state after each unit test GDB has some global variables, like sentinel_frame, current_thread_arch, and etc, we need to reset them after each unit tests. gdb: 2017-05-24 Yao Qi * selftest-arch.c (tests_with_arch): Call registers_changed and reinit_frame_cache. * selftest.c (run_self_tests): Likewise. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a96e71f69da..e5222c615ec 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2017-05-24 Yao Qi + + * selftest-arch.c (tests_with_arch): Call registers_changed + and reinit_frame_cache. + * selftest.c (run_self_tests): Likewise. + 2017-05-24 Yao Qi * rs6000-tdep.c (gdb_print_insn_powerpc): Remove. diff --git a/gdb/selftest-arch.c b/gdb/selftest-arch.c index cbc8c50cda4..c4fe60db898 100644 --- a/gdb/selftest-arch.c +++ b/gdb/selftest-arch.c @@ -81,6 +81,10 @@ tests_with_arch () _("Self test failed: arch %s: "), arches[i]); } END_CATCH + + /* Clear GDB internal state. */ + registers_changed (); + reinit_frame_cache (); } } diff --git a/gdb/selftest.c b/gdb/selftest.c index adc7dda78b6..14b76f6f259 100644 --- a/gdb/selftest.c +++ b/gdb/selftest.c @@ -53,6 +53,10 @@ run_self_tests (void) exception_fprintf (gdb_stderr, ex, _("Self test failed: ")); } END_CATCH + + /* Clear GDB internal state. */ + registers_changed (); + reinit_frame_cache (); } printf_filtered (_("Ran %lu unit tests, %d failed\n"),