summaryrefslogtreecommitdiff
path: root/gdb/maint.c
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2018-01-08 10:09:32 +0000
committerYao Qi <yao.qi@linaro.org>2018-01-08 10:16:28 +0000
commit6caf4baae5fc2ea553b981eeb9533ce287e7b86c (patch)
tree38cca2125293d3344a0a3f45e0e78db76f393088 /gdb/maint.c
parentc6799036946500b6a08d4ade8cf1c20aaae45f95 (diff)
Fix GDB build failure when $development is false
We don't build GDB selftests bits when $development is false. However, if we turn bfd/development.sh:$development to false, common/selftest.c is compiled which is not expected. It causes the build failure, selftest.o: In function `selftests::run_tests(char const*)': binutils-gdb/gdb/common/selftest.c:97: undefined reference to `selftests::reset()' collect2: error: ld returned 1 exit status I fix this issue by putting selftest.o selftest-arch.o into CONFIG_OBS only when $development is true. After this is fixed, there are other build failures in maint.c, this patch fixes them as well. In the release mode, the output of these commands are: (gdb) maintenance selftest Selftests are not available in a non-development build. (gdb) maintenance selftest foo Selftests are not available in a non-development build. (gdb) maintenance info selftests Selftests are not available in a non-development build. gdb: 2018-01-08 Yao Qi <yao.qi@linaro.org> Simon Marchi <simon.marchi@ericsson.com> * Makefile.in (COMMON_SFILES): Remove selftest-arch.c and common/selftest.c. (COMMON_OBS): Remove selftest.o. * configure.ac: Append selftest-arch.c and common/selftest.c to CONFIG_SRCS. Append selftest-arch.o and selftest.o to COMMON_OBS. * configure: Re-generated. * maint.c (maintenance_selftest): Wrap selftests::run_tests with GDB_SELF_TEST. (maintenance_info_selftests): Likewise. gdb/testsuite: 2018-01-08 Simon Marchi <simon.marchi@ericsson.com> * gdb.gdb/unittest.exp: Match output in non-development mode.
Diffstat (limited to 'gdb/maint.c')
-rw-r--r--gdb/maint.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/maint.c b/gdb/maint.c
index a924f8363c..70e00110e5 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -939,16 +939,26 @@ show_per_command_cmd (const char *args, int from_tty)
static void
maintenance_selftest (const char *args, int from_tty)
{
+#if GDB_SELF_TEST
selftests::run_tests (args);
+#else
+ printf_filtered (_("\
+Selftests are not available in a non-development build.\n"));
+#endif
}
static void
maintenance_info_selftests (const char *arg, int from_tty)
{
+#if GDB_SELF_TEST
printf_filtered ("Registered selftests:\n");
selftests::for_each_selftest ([] (const std::string &name) {
printf_filtered (" - %s\n", name.c_str ());
});
+#else
+ printf_filtered (_("\
+Selftests are not available in a non-development build.\n"));
+#endif
}