public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Fix defaults of some "maint test-settings" subcommands
@ 2019-07-03 12:40 Pedro Alves
0 siblings, 0 replies; only message in thread
From: Pedro Alves @ 2019-07-03 12:40 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=970f9d091dae835304d1a96805bdb5c081a40b48
commit 970f9d091dae835304d1a96805bdb5c081a40b48
Author: Pedro Alves <palves@redhat.com>
Date: Wed Jul 3 13:34:17 2019 +0100
Fix defaults of some "maint test-settings" subcommands
New tests added later for the incoming "with" command exposed a couple
invalid-default-value bugs in the "maint test-settings" commands:
- var_filename commands don't allow setting the filename to the empty
string (unlike var_optional_filename commands), yet, "maint
test-settings filename"'s control variable was not initialized, so
on startup, "maint test-settings show filename" shows an empty
string.
- "maint test-settings enum"'s control variable was not initialized,
so on startup, "maint test-settings show enum" shows an empty value
instead of a valid enum value.
Both issues are fixed by initializing the control variables.
gdb/ChangeLog:
2019-07-03 Pedro Alves <palves@redhat.com>
* maint-test-settings.c (maintenance_test_settings_xxx)
(maintenance_test_settings_yyy, maintenance_test_settings_zzz):
New.
(maintenance_test_settings_enums): Use them.
(maintenance_test_settings_enum): Default to
maintenance_test_settings_xxx.
(_initialize_maint_test_settings): Initialize
MAINTENANCE_TEST_SETTINGS_FILENAME.
gdb/testsuite/ChangeLog:
2019-07-03 Pedro Alves <palves@redhat.com>
* gdb.base/settings.exp (test-string): Adjust expected out when
testing "maint test-settings show filename"
Diff:
---
gdb/ChangeLog | 11 +++++++++++
gdb/maint-test-settings.c | 16 +++++++++++++---
gdb/testsuite/ChangeLog | 5 +++++
gdb/testsuite/gdb.base/settings.exp | 9 ++++++---
4 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d50fe89..05c25b4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,14 @@
+2019-07-03 Pedro Alves <palves@redhat.com>
+
+ * maint-test-settings.c (maintenance_test_settings_xxx)
+ (maintenance_test_settings_yyy, maintenance_test_settings_zzz):
+ New.
+ (maintenance_test_settings_enums): Use them.
+ (maintenance_test_settings_enum): Default to
+ maintenance_test_settings_xxx.
+ (_initialize_maint_test_settings): Initialize
+ MAINTENANCE_TEST_SETTINGS_FILENAME.
+
2019-07-02 Simon Marchi <simon.marchi@polymtl.ca>
* breakpoint.h (remove_breakpoints_inf): Change return type to
diff --git a/gdb/maint-test-settings.c b/gdb/maint-test-settings.c
index fa13519..79e002e 100644
--- a/gdb/maint-test-settings.c
+++ b/gdb/maint-test-settings.c
@@ -85,14 +85,22 @@ static char *maintenance_test_settings_optional_filename;
static char *maintenance_test_settings_filename;
-static const char *maintenance_test_settings_enum;
-
/* Enum values for the "maintenance test-settings set/show boolean"
commands. */
+static const char maintenance_test_settings_xxx[] = "xxx";
+static const char maintenance_test_settings_yyy[] = "yyy";
+static const char maintenance_test_settings_zzz[] = "zzz";
+
static const char *const maintenance_test_settings_enums[] = {
- "xxx", "yyy", "zzz", nullptr
+ maintenance_test_settings_xxx,
+ maintenance_test_settings_yyy,
+ maintenance_test_settings_zzz,
+ nullptr
};
+static const char *maintenance_test_settings_enum
+ = maintenance_test_settings_xxx;
+
/* The "maintenance test-options show xxx" commands. */
static void
@@ -107,6 +115,8 @@ maintenance_test_settings_show_value_cmd
void
_initialize_maint_test_settings (void)
{
+ maintenance_test_settings_filename = xstrdup ("/foo/bar");
+
add_prefix_cmd ("test-settings", no_class,
maintenance_test_settings_cmd,
_("\
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index f38efbe..9129c11 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-07-03 Pedro Alves <palves@redhat.com>
+
+ * gdb.base/settings.exp (test-string): Adjust expected out when
+ testing "maint test-settings show filename"
+
2019-07-02 Pedro Alves <palves@redhat.com>
* gdb.base/options.exp (test-info-threads): New procedure.
diff --git a/gdb/testsuite/gdb.base/settings.exp b/gdb/testsuite/gdb.base/settings.exp
index aeca67c..b691ad8 100644
--- a/gdb/testsuite/gdb.base/settings.exp
+++ b/gdb/testsuite/gdb.base/settings.exp
@@ -447,9 +447,12 @@ proc test-string {variant} {
set set_cmd "maint test-settings set $variant"
set show_cmd "maint test-settings show $variant"
- # Empty string. Also checks that gdb doesn't crash if we haven't
- # set the string yet.
- gdb_test "$show_cmd" "^$show_cmd\r\n" "$show_cmd: empty first time"
+ # Checks that gdb doesn't crash if we haven't set the string yet.
+ if {$variant != "filename"} {
+ gdb_test "$show_cmd" "^$show_cmd\r\n" "$show_cmd: show default"
+ } else {
+ gdb_test "$show_cmd" "/foo/bar" "$show_cmd: show default"
+ }
# A string value.
gdb_test_no_output "$set_cmd hello world"
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-07-03 12:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03 12:40 [binutils-gdb] Fix defaults of some "maint test-settings" subcommands Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).