* [PATCH 0/3] Use selftest.c in GDBserver
@ 2017-08-11 15:31 Yao Qi
2017-08-11 15:31 ` [PATCH 2/3] Remove some GDB specific stuff from selftest.c Yao Qi
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Yao Qi @ 2017-08-11 15:31 UTC (permalink / raw)
To: gdb-patches
This patch series is split from "[PATCH 00/26 v3] Make GDB builtin
target descriptions more flexible"
https://sourceware.org/ml/gdb-patches/2017-07/msg00076.html, because,
IMO, adding self/unit tests in GDBserver doesn't related much to my
target description patches. My target description patches only use
common/selftest.c to do some unit tests in GDBserver.
I also want to include one patch to use self tests in GDBserver, but
can't find a module in GDBserver to test.
*** BLURB HERE ***
Yao Qi (3):
Put selftests api into selftests namespace
Remove some GDB specific stuff from selftest.c
GDBserver self tests
gdb/Makefile.in | 2 +-
gdb/NEWS | 21 +++++++++++++--------
gdb/aarch64-tdep.c | 4 ++--
gdb/arm-tdep.c | 2 +-
gdb/{ => common}/selftest.c | 24 +++++++++++++-----------
gdb/{ => common}/selftest.h | 13 +++++++++++--
gdb/disasm-selftests.c | 4 ++--
gdb/doc/gdb.texinfo | 9 +++++++++
gdb/dwarf2-frame.c | 2 +-
gdb/dwarf2loc.c | 2 +-
gdb/findvar.c | 2 +-
gdb/gdbarch-selftests.c | 2 +-
gdb/gdbserver/Makefile.in | 1 +
gdb/gdbserver/config.in | 3 +++
gdb/gdbserver/configure | 6 ++++++
gdb/gdbserver/configure.ac | 5 +++++
gdb/gdbserver/server.c | 29 +++++++++++++++++++++++++++--
gdb/maint.c | 2 +-
gdb/regcache.c | 2 +-
gdb/rust-exp.y | 2 +-
gdb/selftest-arch.c | 18 ++++++++++++------
gdb/selftest-arch.h | 5 ++++-
gdb/unittests/environ-selftests.c | 2 +-
gdb/unittests/function-view-selftests.c | 2 +-
gdb/unittests/offset-type-selftests.c | 2 +-
gdb/unittests/optional-selftests.c | 2 +-
gdb/unittests/scoped_restore-selftests.c | 2 +-
gdb/utils-selftests.c | 2 +-
28 files changed, 123 insertions(+), 49 deletions(-)
rename gdb/{ => common}/selftest.c (76%)
rename gdb/{ => common}/selftest.h (87%)
--
1.9.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 2/3] Remove some GDB specific stuff from selftest.c 2017-08-11 15:31 [PATCH 0/3] Use selftest.c in GDBserver Yao Qi @ 2017-08-11 15:31 ` Yao Qi 2017-08-11 15:31 ` [PATCH 1/3] Put selftests api into selftests namespace Yao Qi ` (2 subsequent siblings) 3 siblings, 0 replies; 8+ messages in thread From: Yao Qi @ 2017-08-11 15:31 UTC (permalink / raw) To: gdb-patches The next patch moves selftest.c to common/selftest.c, so that GDBserver can use it as well. However selftest.c uses something isn't "portable" on GDB and GDBserver. First, this patch removes QUIT. I don't expect that we type ctrl-c during self/unit tests, and each test shouldn't take long time. Secondly, I replace exception_fprintf and printf_filtered with debug_printf. Verified that unit tests still catch fails. gdb: 2017-08-09 Yao Qi <yao.qi@linaro.org> * selftest.c (run_tests): Don't call QUIT. Call debug_printf instead of exception_fprintf and printf_filtered. --- gdb/selftest.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gdb/selftest.c b/gdb/selftest.c index 31d16af..eb7728b 100644 --- a/gdb/selftest.c +++ b/gdb/selftest.c @@ -44,8 +44,6 @@ run_tests (void) for (int i = 0; i < tests.size (); ++i) { - QUIT; - TRY { tests[i] (); @@ -53,7 +51,7 @@ run_tests (void) CATCH (ex, RETURN_MASK_ERROR) { ++failed; - exception_fprintf (gdb_stderr, ex, _("Self test failed: ")); + debug_printf ("Self test failed: %s\n", ex.message); } END_CATCH @@ -62,7 +60,7 @@ run_tests (void) reinit_frame_cache (); } - printf_filtered (_("Ran %lu unit tests, %d failed\n"), - (long) tests.size (), failed); + debug_printf ("Ran %lu unit tests, %d failed\n", + (long) tests.size (), failed); } } // namespace selftests -- 1.9.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] Put selftests api into selftests namespace 2017-08-11 15:31 [PATCH 0/3] Use selftest.c in GDBserver Yao Qi 2017-08-11 15:31 ` [PATCH 2/3] Remove some GDB specific stuff from selftest.c Yao Qi @ 2017-08-11 15:31 ` Yao Qi 2017-08-11 15:31 ` [PATCH 3/3] GDBserver self tests Yao Qi 2017-08-11 17:11 ` [PATCH 0/3] Use selftest.c in GDBserver Pedro Alves 3 siblings, 0 replies; 8+ messages in thread From: Yao Qi @ 2017-08-11 15:31 UTC (permalink / raw) To: gdb-patches This patch changes register_self_test to selftests::register_test, and run_self_tests to selftest::run_tests. gdb: 2017-08-09 Yao Qi <yao.qi@linaro.org> * selftest.c (register_self_test): Rename it to selftests::register_test. (run_self_tests): selftest::run_tests. * selftest.h: Update declarations. * selftest-arch.c (register_self_test_foreach_arch): Rename it to selftests::register_test_foreach_arch. * selftest-arch.h: Update declaration. * aarch64-tdep.c: Update. * arm-tdep.c: Likewise. * disasm-selftests.c: Likewise. * dwarf2loc.c: Likewise. * dwarf2-frame.c: Likewise. * findvar.c: Likewise. * gdbarch-selftests.c: Likewise. * maint.c (maintenance_selftest): Likewise. * regcache.c: Likewise. * rust-exp.y: Likewise. * selftest-arch.c: Likewise. * unittests/environ-selftests.c: Likewise. * unittests/function-view-selftests.c: Likewise. * unittests/offset-type-selftests.c: Likewise. * unittests/optional-selftests.c: Likewise. * unittests/scoped_restore-selftests.c: Likewise. * utils-selftests.c: Likewise. --- gdb/aarch64-tdep.c | 4 ++-- gdb/arm-tdep.c | 2 +- gdb/disasm-selftests.c | 4 ++-- gdb/dwarf2-frame.c | 2 +- gdb/dwarf2loc.c | 2 +- gdb/findvar.c | 2 +- gdb/gdbarch-selftests.c | 2 +- gdb/maint.c | 2 +- gdb/regcache.c | 2 +- gdb/rust-exp.y | 2 +- gdb/selftest-arch.c | 8 ++++---- gdb/selftest-arch.h | 5 ++++- gdb/selftest.c | 8 ++++++-- gdb/selftest.h | 9 +++++++-- gdb/unittests/environ-selftests.c | 2 +- gdb/unittests/function-view-selftests.c | 2 +- gdb/unittests/offset-type-selftests.c | 2 +- gdb/unittests/optional-selftests.c | 2 +- gdb/unittests/scoped_restore-selftests.c | 2 +- gdb/utils-selftests.c | 2 +- 20 files changed, 39 insertions(+), 27 deletions(-) diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 7816281..5a627a3 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -3068,8 +3068,8 @@ When on, AArch64 specific debugging is enabled."), &setdebuglist, &showdebuglist); #if GDB_SELF_TEST - register_self_test (selftests::aarch64_analyze_prologue_test); - register_self_test (selftests::aarch64_process_record_test); + selftests::register_test (selftests::aarch64_analyze_prologue_test); + selftests::register_test (selftests::aarch64_process_record_test); #endif } diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 9943324..a107584 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -9719,7 +9719,7 @@ vfp - VFP co-processor."), &setdebuglist, &showdebuglist); #if GDB_SELF_TEST - register_self_test (selftests::arm_record_test); + selftests::register_test (selftests::arm_record_test); #endif } diff --git a/gdb/disasm-selftests.c b/gdb/disasm-selftests.c index 9eb80b4..4d38ccf 100644 --- a/gdb/disasm-selftests.c +++ b/gdb/disasm-selftests.c @@ -214,7 +214,7 @@ void _initialize_disasm_selftests (void) { #if GDB_SELF_TEST - register_self_test_foreach_arch (selftests::print_one_insn_test); - register_self_test_foreach_arch (selftests::memory_error_test); + selftests::register_test_foreach_arch (selftests::print_one_insn_test); + selftests::register_test_foreach_arch (selftests::memory_error_test); #endif } diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index f8e6522..aaf3aee 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -2406,6 +2406,6 @@ _initialize_dwarf2_frame (void) dwarf2_frame_objfile_data = register_objfile_data (); #if GDB_SELF_TEST - register_self_test_foreach_arch (selftests::execute_cfa_program_test); + selftests::register_test_foreach_arch (selftests::execute_cfa_program_test); #endif } diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 927d950..1a1b06a 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -4687,6 +4687,6 @@ _initialize_dwarf2loc (void) &setdebuglist, &showdebuglist); #if GDB_SELF_TEST - register_self_test (selftests::copy_bitwise_tests); + selftests::register_test (selftests::copy_bitwise_tests); #endif } diff --git a/gdb/findvar.c b/gdb/findvar.c index beb127e..de6b6ed 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -1095,6 +1095,6 @@ void _initialize_findvar (void) { #if GDB_SELF_TEST - register_self_test (selftests::findvar_tests::copy_integer_to_size_test); + selftests::register_test (selftests::findvar_tests::copy_integer_to_size_test); #endif } diff --git a/gdb/gdbarch-selftests.c b/gdb/gdbarch-selftests.c index 096ba97..cb15964 100644 --- a/gdb/gdbarch-selftests.c +++ b/gdb/gdbarch-selftests.c @@ -151,6 +151,6 @@ void _initialize_gdbarch_selftests (void) { #if GDB_SELF_TEST - register_self_test_foreach_arch (selftests::register_to_value_test); + selftests::register_test_foreach_arch (selftests::register_to_value_test); #endif } diff --git a/gdb/maint.c b/gdb/maint.c index a0d43ec..28f7287 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -959,7 +959,7 @@ show_per_command_cmd (char *args, int from_tty) static void maintenance_selftest (char *args, int from_tty) { - run_self_tests (); + selftests::run_tests (); } \f diff --git a/gdb/regcache.c b/gdb/regcache.c index e8f92d6..dcbcedd 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -1776,6 +1776,6 @@ remote register number and buffer offset in the g/G packets.\n\ Takes an optional file parameter."), &maintenanceprintlist); #if GDB_SELF_TEST - register_self_test (selftests::current_regcache_test); + selftests::register_test (selftests::current_regcache_test); #endif } diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y index 30c0cb4..4cb3aa2 100644 --- a/gdb/rust-exp.y +++ b/gdb/rust-exp.y @@ -2781,6 +2781,6 @@ _initialize_rust_exp (void) gdb_assert (code == 0); #if GDB_SELF_TEST - register_self_test (rust_lex_tests); + selftests::register_test (rust_lex_tests); #endif } diff --git a/gdb/selftest-arch.c b/gdb/selftest-arch.c index c4fe60d..dfcbe27 100644 --- a/gdb/selftest-arch.c +++ b/gdb/selftest-arch.c @@ -23,16 +23,16 @@ #include "selftest-arch.h" #include "arch-utils.h" +namespace selftests { + static std::vector<self_test_foreach_arch_function *> gdbarch_tests; void -register_self_test_foreach_arch (self_test_foreach_arch_function *function) +register_test_foreach_arch (self_test_foreach_arch_function *function) { gdbarch_tests.push_back (function); } -namespace selftests { - static void tests_with_arch () { @@ -101,6 +101,6 @@ void _initialize_selftests_foreach_arch () { #if GDB_SELF_TEST - register_self_test (selftests::tests_with_arch); + selftests::register_test (selftests::tests_with_arch); #endif } diff --git a/gdb/selftest-arch.h b/gdb/selftest-arch.h index d1725cd..dc16c4d 100644 --- a/gdb/selftest-arch.h +++ b/gdb/selftest-arch.h @@ -21,7 +21,10 @@ typedef void self_test_foreach_arch_function (struct gdbarch *); +namespace selftests +{ extern void - register_self_test_foreach_arch (self_test_foreach_arch_function *function); + register_test_foreach_arch (self_test_foreach_arch_function *function); +} #endif /* SELFTEST_ARCH_H */ diff --git a/gdb/selftest.c b/gdb/selftest.c index 14b76f6..31d16af 100644 --- a/gdb/selftest.c +++ b/gdb/selftest.c @@ -20,6 +20,9 @@ #include "selftest.h" #include <vector> +namespace selftests +{ + /* All the tests that have been registered. */ static std::vector<self_test_function *> tests; @@ -27,7 +30,7 @@ static std::vector<self_test_function *> tests; /* See selftest.h. */ void -register_self_test (self_test_function *function) +register_test (self_test_function *function) { tests.push_back (function); } @@ -35,7 +38,7 @@ register_self_test (self_test_function *function) /* See selftest.h. */ void -run_self_tests (void) +run_tests (void) { int failed = 0; @@ -62,3 +65,4 @@ run_self_tests (void) printf_filtered (_("Ran %lu unit tests, %d failed\n"), (long) tests.size (), failed); } +} // namespace selftests diff --git a/gdb/selftest.h b/gdb/selftest.h index 94684ff..8a01a5d 100644 --- a/gdb/selftest.h +++ b/gdb/selftest.h @@ -24,14 +24,19 @@ typedef void self_test_function (void); +namespace selftests +{ + /* Register a new self-test. */ -extern void register_self_test (self_test_function *function); +extern void register_test (self_test_function *function); /* Run all the self tests. This print a message describing the number of test and the number of failures. */ -extern void run_self_tests (void); +extern void run_tests (void); + +} /* Check that VALUE is true, and, if not, throw an exception. */ diff --git a/gdb/unittests/environ-selftests.c b/gdb/unittests/environ-selftests.c index 28b16f8..1e938e6 100644 --- a/gdb/unittests/environ-selftests.c +++ b/gdb/unittests/environ-selftests.c @@ -155,5 +155,5 @@ run_tests () void _initialize_environ_selftests () { - register_self_test (selftests::gdb_environ_tests::run_tests); + selftests::register_test (selftests::gdb_environ_tests::run_tests); } diff --git a/gdb/unittests/function-view-selftests.c b/gdb/unittests/function-view-selftests.c index 310f2ad..d3018ba 100644 --- a/gdb/unittests/function-view-selftests.c +++ b/gdb/unittests/function-view-selftests.c @@ -174,5 +174,5 @@ run_tests () void _initialize_function_view_selftests () { - register_self_test (selftests::function_view::run_tests); + selftests::register_test (selftests::function_view::run_tests); } diff --git a/gdb/unittests/offset-type-selftests.c b/gdb/unittests/offset-type-selftests.c index a11e908..3e66547 100644 --- a/gdb/unittests/offset-type-selftests.c +++ b/gdb/unittests/offset-type-selftests.c @@ -174,5 +174,5 @@ run_tests () void _initialize_offset_type_selftests () { - register_self_test (selftests::offset_type::run_tests); + selftests::register_test (selftests::offset_type::run_tests); } diff --git a/gdb/unittests/optional-selftests.c b/gdb/unittests/optional-selftests.c index 76343c6..0bcf964 100644 --- a/gdb/unittests/optional-selftests.c +++ b/gdb/unittests/optional-selftests.c @@ -90,5 +90,5 @@ run_tests () void _initialize_optional_selftests () { - register_self_test (selftests::optional::run_tests); + selftests::register_test (selftests::optional::run_tests); } diff --git a/gdb/unittests/scoped_restore-selftests.c b/gdb/unittests/scoped_restore-selftests.c index e97d622..ea7492b 100644 --- a/gdb/unittests/scoped_restore-selftests.c +++ b/gdb/unittests/scoped_restore-selftests.c @@ -106,5 +106,5 @@ run_tests () void _initialize_scoped_restore_selftests () { - register_self_test (selftests::scoped_restore_tests::run_tests); + selftests::register_test (selftests::scoped_restore_tests::run_tests); } diff --git a/gdb/utils-selftests.c b/gdb/utils-selftests.c index ebaeef0..08feac6 100644 --- a/gdb/utils-selftests.c +++ b/gdb/utils-selftests.c @@ -55,6 +55,6 @@ void _initialize_utils_selftests (void) { #if GDB_SELF_TEST - register_self_test (selftests::common_utils_tests); + selftests::register_test (selftests::common_utils_tests); #endif } -- 1.9.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] GDBserver self tests 2017-08-11 15:31 [PATCH 0/3] Use selftest.c in GDBserver Yao Qi 2017-08-11 15:31 ` [PATCH 2/3] Remove some GDB specific stuff from selftest.c Yao Qi 2017-08-11 15:31 ` [PATCH 1/3] Put selftests api into selftests namespace Yao Qi @ 2017-08-11 15:31 ` Yao Qi 2017-08-11 16:01 ` Eli Zaretskii 2017-08-11 17:10 ` Pedro Alves 2017-08-11 17:11 ` [PATCH 0/3] Use selftest.c in GDBserver Pedro Alves 3 siblings, 2 replies; 8+ messages in thread From: Yao Qi @ 2017-08-11 15:31 UTC (permalink / raw) To: gdb-patches This patch uses GDB self test in GDBserver. The self tests are run if GDBserver is started with option --selftest. gdb: 2017-07-07 Yao Qi <yao.qi@linaro.org> * NEWS: Mention GDBserver's new option "--selftest". * Makefile.in (SFILES): Remove selftest.c, add common/selftest.c. * selftest.c: Move it to common/selftest.c. * selftest.h: Move it to common/selftest.h. * selftest-arch.c (reset): New function. (tests_with_arch): Call reset. gdb/gdbserver: 2017-07-07 Yao Qi <yao.qi@linaro.org> * Makefile.in (OBS): Add selftest.o. * configure.ac: AC_DEFINE GDB_SELF_TEST if $development. * configure, config.in: Re-generated. * server.c: Include common/sefltest.h. (captured_main): Handle option --selftest. (gdbserver_usage): Print usage for "--selftest". gdb/testsuite: 2017-05-26 Yao Qi <yao.qi@linaro.org> * gdb.server/unittest.exp: New. gdb/doc: 2017-07-07 Yao Qi <yao.qi@linaro.org> * gdb.texinfo (Server): Document "--selftest". --- gdb/Makefile.in | 2 +- gdb/NEWS | 21 +++++++++++++-------- gdb/{ => common}/selftest.c | 8 ++++---- gdb/{ => common}/selftest.h | 3 +++ gdb/doc/gdb.texinfo | 9 +++++++++ gdb/gdbserver/Makefile.in | 1 + gdb/gdbserver/config.in | 3 +++ gdb/gdbserver/configure | 6 ++++++ gdb/gdbserver/configure.ac | 5 +++++ gdb/gdbserver/server.c | 29 +++++++++++++++++++++++++++-- gdb/selftest-arch.c | 12 +++++++++--- 11 files changed, 81 insertions(+), 18 deletions(-) rename gdb/{ => common}/selftest.c (92%) rename gdb/{ => common}/selftest.h (95%) diff --git a/gdb/Makefile.in b/gdb/Makefile.in index c6e618a..85de646 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1178,7 +1178,6 @@ SFILES = \ reverse.c \ rust-exp.y \ rust-lang.c \ - selftest.c \ selftest-arch.c \ sentinel-frame.c \ ser-base.c \ @@ -1244,6 +1243,7 @@ SFILES = \ common/ptid.c \ common/rsp-low.c \ common/run-time-clock.c \ + common/selftest.c \ common/signals.c \ common/signals-state-save-restore.c \ common/vec.c \ diff --git a/gdb/NEWS b/gdb/NEWS index 9cd1df1..8fca378 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -3,14 +3,19 @@ *** Changes since GDB 8.0 -* On Unix systems, GDBserver now does globbing expansion and variable - substitution in inferior command line arguments. - - This is done by starting inferiors using a shell, like GDB does. - See "set startup-with-shell" in the user manual for how to disable - this from GDB when using "target extended-remote". When using - "target remote", you can disable the startup with shell by using the - new "--no-startup-with-shell" GDBserver command line option. +* New features in the GDB remote stub, GDBserver + + ** New "--selftest" command line option runs some GDBserver self + tests. These self tests are disabled in release. + + ** On Unix systems, GDBserver now does globbing expansion and variable + substitution in inferior command line arguments. + + This is done by starting inferiors using a shell, like GDB does. + See "set startup-with-shell" in the user manual for how to disable + this from GDB when using "target extended-remote". When using + "target remote", you can disable the startup with shell by using the + new "--no-startup-with-shell" GDBserver command line option. * New remote packets diff --git a/gdb/selftest.c b/gdb/common/selftest.c similarity index 92% rename from gdb/selftest.c rename to gdb/common/selftest.c index eb7728b..0fb8f2a 100644 --- a/gdb/selftest.c +++ b/gdb/common/selftest.c @@ -16,7 +16,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "defs.h" +#include "common-defs.h" +#include "common-exceptions.h" +#include "common-debug.h" #include "selftest.h" #include <vector> @@ -55,9 +57,7 @@ run_tests (void) } END_CATCH - /* Clear GDB internal state. */ - registers_changed (); - reinit_frame_cache (); + reset (); } debug_printf ("Ran %lu unit tests, %d failed\n", diff --git a/gdb/selftest.h b/gdb/common/selftest.h similarity index 95% rename from gdb/selftest.h rename to gdb/common/selftest.h index 8a01a5d..e211c34 100644 --- a/gdb/selftest.h +++ b/gdb/common/selftest.h @@ -36,6 +36,9 @@ extern void register_test (self_test_function *function); extern void run_tests (void); +/* Reset GDB or GDBserver's internal state. */ +extern void reset (); + } /* Check that VALUE is true, and, if not, throw an exception. */ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index d098eba..be03da0 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -20253,6 +20253,15 @@ environment: $ gdbserver --wrapper env LD_PRELOAD=libtest.so -- :2222 ./testprog @end smallexample +@cindex @option{--selftest} +The @option{--wrapper} option runs the self tests in @code{gdbserver}: + +@smallexample +$ gdbserver --selftest +Ran 2 unit tests, 0 failed +@end smallexample + +These tests are disabled in release. @subsection Connecting to @code{gdbserver} The basic procedure for connecting to the remote target is: diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index 4e0080e..6cd0959 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -258,6 +258,7 @@ OBS = \ regcache.o \ remote-utils.o \ rsp-low.o \ + selftest.o \ server.o \ signals.o \ signals-state-save-restore.o \ diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in index 34a7443..5dacbac 100644 --- a/gdb/gdbserver/config.in +++ b/gdb/gdbserver/config.in @@ -8,6 +8,9 @@ /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA +/* Define if self-testing features should be enabled */ +#undef GDB_SELF_TEST + /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index 35aeabc..30aa95b 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -5813,6 +5813,12 @@ fi fi +if $development; then + +$as_echo "#define GDB_SELF_TEST 1" >>confdefs.h + +fi + case ${build_alias} in "") build_noncanonical=${build} ;; *) build_noncanonical=${build_alias} ;; diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac index 4ea7913..36e21c5 100644 --- a/gdb/gdbserver/configure.ac +++ b/gdb/gdbserver/configure.ac @@ -56,6 +56,11 @@ else fi GDB_AC_LIBMCHECK(${libmcheck_default}) +if $development; then + AC_DEFINE(GDB_SELF_TEST, 1, + [Define if self-testing features should be enabled]) +fi + ACX_NONCANONICAL_TARGET ACX_NONCANONICAL_HOST diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 3838351..346a3c2 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -40,6 +40,8 @@ #include "job-control.h" #include "environ.h" +#include "common/selftest.h" + /* The environment to pass to the inferior when creating it. */ static gdb_environ our_environ; @@ -3357,6 +3359,7 @@ gdbserver_usage (FILE *stream) " Options:\n" " vCont, Tthread, qC, qfThreadInfo and \n" " threads (disable all threading packets).\n" + " --selftest Run self tests.\n" "\n" "For more information, consult the GDB manual (available as on-line \n" "info or a printed manual).\n"); @@ -3521,6 +3524,7 @@ captured_main (int argc, char *argv[]) volatile int multi_mode = 0; volatile int attach = 0; int was_running; + bool selftest = false; while (*next_arg != NULL && **next_arg == '-') { @@ -3639,6 +3643,8 @@ captured_main (int argc, char *argv[]) startup_with_shell = false; else if (strcmp (*next_arg, "--once") == 0) run_once = 1; + else if (strcmp (*next_arg, "--selftest") == 0) + selftest = true; else { fprintf (stderr, "Unknown argument: %s\n", *next_arg); @@ -3654,7 +3660,8 @@ captured_main (int argc, char *argv[]) port = *next_arg; next_arg++; } - if (port == NULL || (!attach && !multi_mode && *next_arg == NULL)) + if ((port == NULL || (!attach && !multi_mode && *next_arg == NULL)) + && !selftest) { gdbserver_usage (stderr); exit (1); @@ -3670,7 +3677,8 @@ captured_main (int argc, char *argv[]) starting the inferior. Inferiors created in this scenario have stdin,stdout redirected. So do this here before we call start_inferior. */ - remote_prepare (port); + if (port != NULL) + remote_prepare (port); bad_attach = 0; pid = 0; @@ -3711,6 +3719,12 @@ captured_main (int argc, char *argv[]) own_buf = (char *) xmalloc (PBUFSIZ + 1); mem_buf = (unsigned char *) xmalloc (PBUFSIZ); + if (selftest) + { + selftests::run_tests (); + throw_quit ("Quit"); + } + if (pid == 0 && *next_arg != NULL) { int i, n; @@ -4507,3 +4521,14 @@ handle_target_event (int err, gdb_client_data client_data) return 0; } + +#if GDB_SELF_TEST +namespace selftests +{ + +void +reset () +{} + +} // namespace selftests +#endif /* GDB_SELF_TEST */ diff --git a/gdb/selftest-arch.c b/gdb/selftest-arch.c index dfcbe27..9a19f76 100644 --- a/gdb/selftest-arch.c +++ b/gdb/selftest-arch.c @@ -33,6 +33,14 @@ register_test_foreach_arch (self_test_foreach_arch_function *function) gdbarch_tests.push_back (function); } +void +reset () +{ + /* Clear GDB internal state. */ + registers_changed (); + reinit_frame_cache (); +} + static void tests_with_arch () { @@ -82,9 +90,7 @@ tests_with_arch () } END_CATCH - /* Clear GDB internal state. */ - registers_changed (); - reinit_frame_cache (); + reset (); } } -- 1.9.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] GDBserver self tests 2017-08-11 15:31 ` [PATCH 3/3] GDBserver self tests Yao Qi @ 2017-08-11 16:01 ` Eli Zaretskii 2017-08-11 17:10 ` Pedro Alves 1 sibling, 0 replies; 8+ messages in thread From: Eli Zaretskii @ 2017-08-11 16:01 UTC (permalink / raw) To: Yao Qi; +Cc: gdb-patches > From: Yao Qi <qiyaoltc@gmail.com> > Date: Fri, 11 Aug 2017 16:30:08 +0100 > > This patch uses GDB self test in GDBserver. The self tests are run if > GDBserver is started with option --selftest. > > gdb: > > 2017-07-07 Yao Qi <yao.qi@linaro.org> > > * NEWS: Mention GDBserver's new option "--selftest". > * Makefile.in (SFILES): Remove selftest.c, add common/selftest.c. > * selftest.c: Move it to common/selftest.c. > * selftest.h: Move it to common/selftest.h. > * selftest-arch.c (reset): New function. > (tests_with_arch): Call reset. > > gdb/gdbserver: > > 2017-07-07 Yao Qi <yao.qi@linaro.org> > > * Makefile.in (OBS): Add selftest.o. > * configure.ac: AC_DEFINE GDB_SELF_TEST if $development. > * configure, config.in: Re-generated. > * server.c: Include common/sefltest.h. > (captured_main): Handle option --selftest. > (gdbserver_usage): Print usage for "--selftest". > > gdb/testsuite: > > 2017-05-26 Yao Qi <yao.qi@linaro.org> > > * gdb.server/unittest.exp: New. > > gdb/doc: > > 2017-07-07 Yao Qi <yao.qi@linaro.org> > > * gdb.texinfo (Server): Document "--selftest". OK for the documentation parts. Thanks. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] GDBserver self tests 2017-08-11 15:31 ` [PATCH 3/3] GDBserver self tests Yao Qi 2017-08-11 16:01 ` Eli Zaretskii @ 2017-08-11 17:10 ` Pedro Alves 2017-08-18 8:16 ` Yao Qi 1 sibling, 1 reply; 8+ messages in thread From: Pedro Alves @ 2017-08-11 17:10 UTC (permalink / raw) To: Yao Qi, gdb-patches On 08/11/2017 04:30 PM, Yao Qi wrote: > > 2017-05-26 Yao Qi <yao.qi@linaro.org> > > * gdb.server/unittest.exp: New. This is missing from the patch. > +* New features in the GDB remote stub, GDBserver > + > + ** New "--selftest" command line option runs some GDBserver self > + tests. These self tests are disabled in release. "disabled in release mode." or "disabled in releases." ? > @@ -3357,6 +3359,7 @@ gdbserver_usage (FILE *stream) > " Options:\n" > " vCont, Tthread, qC, qfThreadInfo and \n" > " threads (disable all threading packets).\n" > + " --selftest Run self tests.\n" > "\n" > "For more information, consult the GDB manual (available as on-line \n" > "info or a printed manual).\n"); I wonder whether "gdbserver --help" should really advertise --selftests, given it's a maintenance command and essentially does nothing in release mode. > +@cindex @option{--selftest} > +The @option{--wrapper} option runs the self tests in @code{gdbserver}: > + Pasto: "--wrapper" should be "--selftest". Thanks, Pedro Alves ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] GDBserver self tests 2017-08-11 17:10 ` Pedro Alves @ 2017-08-18 8:16 ` Yao Qi 0 siblings, 0 replies; 8+ messages in thread From: Yao Qi @ 2017-08-18 8:16 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches Pedro Alves <palves@redhat.com> writes: >> 2017-05-26 Yao Qi <yao.qi@linaro.org> >> >> * gdb.server/unittest.exp: New. > > This is missing from the patch. > Added it back. >> +* New features in the GDB remote stub, GDBserver >> + >> + ** New "--selftest" command line option runs some GDBserver self >> + tests. These self tests are disabled in release. > > "disabled in release mode." or "disabled in releases." ? > The latter, "disabled in releases". >> @@ -3357,6 +3359,7 @@ gdbserver_usage (FILE *stream) >> " Options:\n" >> " vCont, Tthread, qC, qfThreadInfo and \n" >> " threads (disable all threading packets).\n" >> + " --selftest Run self tests.\n" >> "\n" >> "For more information, consult the GDB manual (available as >> on-line \n" >> "info or a printed manual).\n"); > > > I wonder whether "gdbserver --help" should really advertise --selftests, > given it's a maintenance command and essentially does nothing in > release mode. > I thought since "--selftests" is documented in gdb.texinfo, it is better to show it in the gdbserver usage. However, I agree that this is a maintenance command, don't have to mention it in "gdbserver --help". >> +@cindex @option{--selftest} >> +The @option{--wrapper} option runs the self tests in @code{gdbserver}: >> + > > Pasto: "--wrapper" should be "--selftest". Fixed. Patch below is what I pushed in. -- Yao (齐尧) From bf72c259134cc3a5cc7c8e22a679b3d5f0fe7ce7 Mon Sep 17 00:00:00 2001 From: Yao Qi <yao.qi@linaro.org> Date: Wed, 9 Aug 2017 17:48:47 +0100 Subject: [PATCH] GDBserver self tests This patch uses GDB self test in GDBserver. The self tests are run if GDBserver is started with option --selftest. gdb: 2017-08-18 Yao Qi <yao.qi@linaro.org> * NEWS: Mention GDBserver's new option "--selftest". * Makefile.in (SFILES): Remove selftest.c, add common/selftest.c. * selftest.c: Move it to common/selftest.c. * selftest.h: Move it to common/selftest.h. * selftest-arch.c (reset): New function. (tests_with_arch): Call reset. gdb/gdbserver: 2017-08-18 Yao Qi <yao.qi@linaro.org> * Makefile.in (OBS): Add selftest.o. * configure.ac: AC_DEFINE GDB_SELF_TEST if $development. * configure, config.in: Re-generated. * server.c: Include common/sefltest.h. (captured_main): Handle option --selftest. gdb/testsuite: 2017-08-18 Yao Qi <yao.qi@linaro.org> * gdb.server/unittest.exp: New. gdb/doc: 2017-08-18 Yao Qi <yao.qi@linaro.org> * gdb.texinfo (Server): Document "--selftest". diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4a0f3e7..2581935 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,14 @@ 2017-08-18 Yao Qi <yao.qi@linaro.org> + * NEWS: Mention GDBserver's new option "--selftest". + * Makefile.in (SFILES): Remove selftest.c, add common/selftest.c. + * selftest.c: Move it to common/selftest.c. + * selftest.h: Move it to common/selftest.h. + * selftest-arch.c (reset): New function. + (tests_with_arch): Call reset. + +2017-08-18 Yao Qi <yao.qi@linaro.org> + * selftest.c (run_tests): Don't call QUIT. Call debug_printf instead of exception_fprintf and printf_filtered. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index c6e618a..85de646 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1178,7 +1178,6 @@ SFILES = \ reverse.c \ rust-exp.y \ rust-lang.c \ - selftest.c \ selftest-arch.c \ sentinel-frame.c \ ser-base.c \ @@ -1244,6 +1243,7 @@ SFILES = \ common/ptid.c \ common/rsp-low.c \ common/run-time-clock.c \ + common/selftest.c \ common/signals.c \ common/signals-state-save-restore.c \ common/vec.c \ diff --git a/gdb/NEWS b/gdb/NEWS index 341e934..4b0a956 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -3,14 +3,19 @@ *** Changes since GDB 8.0 -* On Unix systems, GDBserver now does globbing expansion and variable - substitution in inferior command line arguments. - - This is done by starting inferiors using a shell, like GDB does. - See "set startup-with-shell" in the user manual for how to disable - this from GDB when using "target extended-remote". When using - "target remote", you can disable the startup with shell by using the - new "--no-startup-with-shell" GDBserver command line option. +* New features in the GDB remote stub, GDBserver + + ** New "--selftest" command line option runs some GDBserver self + tests. These self tests are disabled in releases. + + ** On Unix systems, GDBserver now does globbing expansion and variable + substitution in inferior command line arguments. + + This is done by starting inferiors using a shell, like GDB does. + See "set startup-with-shell" in the user manual for how to disable + this from GDB when using "target extended-remote". When using + "target remote", you can disable the startup with shell by using the + new "--no-startup-with-shell" GDBserver command line option. * New remote packets diff --git a/gdb/selftest.c b/gdb/common/selftest.c similarity index 92% rename from gdb/selftest.c rename to gdb/common/selftest.c index eb7728b..0fb8f2a 100644 --- a/gdb/selftest.c +++ b/gdb/common/selftest.c @@ -16,7 +16,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "defs.h" +#include "common-defs.h" +#include "common-exceptions.h" +#include "common-debug.h" #include "selftest.h" #include <vector> @@ -55,9 +57,7 @@ run_tests (void) } END_CATCH - /* Clear GDB internal state. */ - registers_changed (); - reinit_frame_cache (); + reset (); } debug_printf ("Ran %lu unit tests, %d failed\n", diff --git a/gdb/selftest.h b/gdb/common/selftest.h similarity index 95% rename from gdb/selftest.h rename to gdb/common/selftest.h index 8a01a5d..e211c34 100644 --- a/gdb/selftest.h +++ b/gdb/common/selftest.h @@ -36,6 +36,9 @@ extern void register_test (self_test_function *function); extern void run_tests (void); +/* Reset GDB or GDBserver's internal state. */ +extern void reset (); + } /* Check that VALUE is true, and, if not, throw an exception. */ diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 8e3e5ce..32c9425 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2017-08-18 Yao Qi <yao.qi@linaro.org> + + * gdb.texinfo (Server): Document "--selftest". + 2017-08-16 Ruslan Kabatsayev <b7.10110111@gmail.com> * gdb.texinfo (TUI Single Key Mode): Document the new shortcuts in diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 0d39a55..620d11d 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -20253,6 +20253,15 @@ environment: $ gdbserver --wrapper env LD_PRELOAD=libtest.so -- :2222 ./testprog @end smallexample +@cindex @option{--selftest} +The @option{--selftest} option runs the self tests in @code{gdbserver}: + +@smallexample +$ gdbserver --selftest +Ran 2 unit tests, 0 failed +@end smallexample + +These tests are disabled in release. @subsection Connecting to @code{gdbserver} The basic procedure for connecting to the remote target is: diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 0059b91..04dac06 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,11 @@ +2017-08-18 Yao Qi <yao.qi@linaro.org> + + * Makefile.in (OBS): Add selftest.o. + * configure.ac: AC_DEFINE GDB_SELF_TEST if $development. + * configure, config.in: Re-generated. + * server.c: Include common/sefltest.h. + (captured_main): Handle option --selftest. + 2017-08-09 Yao Qi <yao.qi@linaro.org> * configure.srv (srv_i386_regobj): Remove i386-avx.o, diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index 4e0080e..6cd0959 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -258,6 +258,7 @@ OBS = \ regcache.o \ remote-utils.o \ rsp-low.o \ + selftest.o \ server.o \ signals.o \ signals-state-save-restore.o \ diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in index 34a7443..5dacbac 100644 --- a/gdb/gdbserver/config.in +++ b/gdb/gdbserver/config.in @@ -8,6 +8,9 @@ /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA +/* Define if self-testing features should be enabled */ +#undef GDB_SELF_TEST + /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index 35aeabc..30aa95b 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -5813,6 +5813,12 @@ fi fi +if $development; then + +$as_echo "#define GDB_SELF_TEST 1" >>confdefs.h + +fi + case ${build_alias} in "") build_noncanonical=${build} ;; *) build_noncanonical=${build_alias} ;; diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac index 4ea7913..36e21c5 100644 --- a/gdb/gdbserver/configure.ac +++ b/gdb/gdbserver/configure.ac @@ -56,6 +56,11 @@ else fi GDB_AC_LIBMCHECK(${libmcheck_default}) +if $development; then + AC_DEFINE(GDB_SELF_TEST, 1, + [Define if self-testing features should be enabled]) +fi + ACX_NONCANONICAL_TARGET ACX_NONCANONICAL_HOST diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 3838351..8200aa1 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -40,6 +40,8 @@ #include "job-control.h" #include "environ.h" +#include "common/selftest.h" + /* The environment to pass to the inferior when creating it. */ static gdb_environ our_environ; @@ -3521,6 +3523,7 @@ captured_main (int argc, char *argv[]) volatile int multi_mode = 0; volatile int attach = 0; int was_running; + bool selftest = false; while (*next_arg != NULL && **next_arg == '-') { @@ -3639,6 +3642,8 @@ captured_main (int argc, char *argv[]) startup_with_shell = false; else if (strcmp (*next_arg, "--once") == 0) run_once = 1; + else if (strcmp (*next_arg, "--selftest") == 0) + selftest = true; else { fprintf (stderr, "Unknown argument: %s\n", *next_arg); @@ -3654,7 +3659,8 @@ captured_main (int argc, char *argv[]) port = *next_arg; next_arg++; } - if (port == NULL || (!attach && !multi_mode && *next_arg == NULL)) + if ((port == NULL || (!attach && !multi_mode && *next_arg == NULL)) + && !selftest) { gdbserver_usage (stderr); exit (1); @@ -3670,7 +3676,8 @@ captured_main (int argc, char *argv[]) starting the inferior. Inferiors created in this scenario have stdin,stdout redirected. So do this here before we call start_inferior. */ - remote_prepare (port); + if (port != NULL) + remote_prepare (port); bad_attach = 0; pid = 0; @@ -3711,6 +3718,12 @@ captured_main (int argc, char *argv[]) own_buf = (char *) xmalloc (PBUFSIZ + 1); mem_buf = (unsigned char *) xmalloc (PBUFSIZ); + if (selftest) + { + selftests::run_tests (); + throw_quit ("Quit"); + } + if (pid == 0 && *next_arg != NULL) { int i, n; @@ -4507,3 +4520,14 @@ handle_target_event (int err, gdb_client_data client_data) return 0; } + +#if GDB_SELF_TEST +namespace selftests +{ + +void +reset () +{} + +} // namespace selftests +#endif /* GDB_SELF_TEST */ diff --git a/gdb/selftest-arch.c b/gdb/selftest-arch.c index dfcbe27..9a19f76 100644 --- a/gdb/selftest-arch.c +++ b/gdb/selftest-arch.c @@ -33,6 +33,14 @@ register_test_foreach_arch (self_test_foreach_arch_function *function) gdbarch_tests.push_back (function); } +void +reset () +{ + /* Clear GDB internal state. */ + registers_changed (); + reinit_frame_cache (); +} + static void tests_with_arch () { @@ -82,9 +90,7 @@ tests_with_arch () } END_CATCH - /* Clear GDB internal state. */ - registers_changed (); - reinit_frame_cache (); + reset (); } } diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 39c49b8..d188f83 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-08-18 Yao Qi <yao.qi@linaro.org> + + * gdb.server/unittest.exp: New. + 2017-08-15 Sergio Durigan Junior <sergiodj@redhat.com> PR gdb/21954 diff --git a/gdb/testsuite/gdb.server/unittest.exp b/gdb/testsuite/gdb.server/unittest.exp new file mode 100644 index 0000000..584a23d --- /dev/null +++ b/gdb/testsuite/gdb.server/unittest.exp @@ -0,0 +1,41 @@ +# This testcase is part of GDB, the GNU debugger. + +# Copyright 2017 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +load_lib gdbserver-support.exp + +standard_testfile + +if { [skip_gdbserver_tests] } { + return 0 +} + +global server_spawn_id + +set gdbserver [find_gdbserver] +set gdbserver_command "$gdbserver --selftest" + +set server_spawn_id [remote_spawn target $gdbserver_command] + +gdb_expect { + -i $server_spawn_id + -re "Ran $decimal unit tests, 0 failed" { + pass "unit tests" + } + default { + fail "unit tests" + } +} ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] Use selftest.c in GDBserver 2017-08-11 15:31 [PATCH 0/3] Use selftest.c in GDBserver Yao Qi ` (2 preceding siblings ...) 2017-08-11 15:31 ` [PATCH 3/3] GDBserver self tests Yao Qi @ 2017-08-11 17:11 ` Pedro Alves 3 siblings, 0 replies; 8+ messages in thread From: Pedro Alves @ 2017-08-11 17:11 UTC (permalink / raw) To: Yao Qi, gdb-patches On 08/11/2017 04:30 PM, Yao Qi wrote: > This patch series is split from "[PATCH 00/26 v3] Make GDB builtin > target descriptions more flexible" > https://sourceware.org/ml/gdb-patches/2017-07/msg00076.html, because, > IMO, adding self/unit tests in GDBserver doesn't related much to my > target description patches. My target description patches only use > common/selftest.c to do some unit tests in GDBserver. > > I also want to include one patch to use self tests in GDBserver, but > can't find a module in GDBserver to test. Nice, I had skimmed version of the patches in the large series a couple weeks back, and was planning on suggesting to move the gdb-specifics to hooks implemented by the client. Which is exactly what you've done. Moving to selftests namespace seems like a good idea to me too. I guess you could have left QUIT in the gdb hook, though it's fine with me to remove it. I wonder whether "gdbserver --help" should really advertise --selftests, given it's a maintenance command and essentially does nothing in release mode. Implementing gdb's version of "selftest::reset ()" in selftest-arch.c directly feels a bit like an abstraction violation. The cleanest would I guess be to add a new .c file with reset() that calls a new selftest-arch.c:reset_arch(), but we can always do that later if we need to reset other things. Otherwise, LGTM. Actually, I sent a couple comments to patch #3 now. But it's all minor things. Thanks, Pedro Alves ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-08-18 8:16 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-08-11 15:31 [PATCH 0/3] Use selftest.c in GDBserver Yao Qi 2017-08-11 15:31 ` [PATCH 2/3] Remove some GDB specific stuff from selftest.c Yao Qi 2017-08-11 15:31 ` [PATCH 1/3] Put selftests api into selftests namespace Yao Qi 2017-08-11 15:31 ` [PATCH 3/3] GDBserver self tests Yao Qi 2017-08-11 16:01 ` Eli Zaretskii 2017-08-11 17:10 ` Pedro Alves 2017-08-18 8:16 ` Yao Qi 2017-08-11 17:11 ` [PATCH 0/3] Use selftest.c in GDBserver Pedro Alves
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox