From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Cc: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Subject: [PATCH v2 1/4] Fix defaults of some "maint test-settings" subcommands
Date: Tue, 18 Jun 2019 00:39:00 -0000 [thread overview]
Message-ID: <20190618003902.19805-2-palves@redhat.com> (raw)
In-Reply-To: <20190618003902.19805-1-palves@redhat.com>
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:
yyyy-mm-dd 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:
yyyy-mm-dd Pedro Alves <palves@redhat.com>
* gdb.base/settings.exp (test-string): Adjust expected out when
testing "maint test-settings show filename"
---
gdb/maint-test-settings.c | 16 +++++++++++++---
gdb/testsuite/gdb.base/settings.exp | 9 ++++++---
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/gdb/maint-test-settings.c b/gdb/maint-test-settings.c
index fa13519eb96..79e002e727f 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/gdb.base/settings.exp b/gdb/testsuite/gdb.base/settings.exp
index aeca67c0e7f..b691ad8cf68 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"
--
2.14.5
next prev parent reply other threads:[~2019-06-18 0:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-18 0:39 [PATCH v2 0/4] Introduce the "with" command Pedro Alves
2019-06-18 0:39 ` [PATCH v2 3/4] "maint test-settings set/show" -> "maint set/show test-settings" Pedro Alves
2019-06-18 16:35 ` Eli Zaretskii
2019-06-18 0:39 ` Pedro Alves [this message]
2019-06-18 0:39 ` [PATCH v2 4/4] Introduce the "with" command Pedro Alves
2019-06-18 16:42 ` Eli Zaretskii
2019-06-19 15:46 ` Pedro Alves
2019-06-19 16:53 ` Eli Zaretskii
2019-06-19 17:20 ` [PATCH v2.1] " Pedro Alves
2019-06-22 10:30 ` Philippe Waroquiers
2019-06-22 11:48 ` Pedro Alves
2019-06-22 12:09 ` Philippe Waroquiers
2019-06-18 0:39 ` [PATCH v2 2/4] Fix a few comments in maint-test-settings.c Pedro Alves
2019-06-19 0:34 ` [PATCH v2 0/4] Introduce the "with" command Philippe Waroquiers
2019-06-19 13:05 ` Pedro Alves
2019-06-19 13:40 ` Philippe Waroquiers
2019-07-03 12:49 ` Pedro Alves
2019-08-02 23:24 ` New FAIL on gdb.base/with.exp on native-extended-gdbserver (was: Re: [PATCH v2 0/4] Introduce the "with" command) Sergio Durigan Junior
2020-05-11 14:54 ` [PATCH] gdb/testsuite: fix gdb.base/with.exp failure with, native-extended-gdbserver (was: New FAIL on gdb.base/with.exp on native-extended-gdbserver) Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190618003902.19805-2-palves@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=philippe.waroquiers@skynet.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox