Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [commit/obvious] Fix PR 21352: Command tsave does not support -r argument
@ 2017-04-05 16:31 Sergio Durigan Junior
  2017-04-05 16:34 ` Pedro Alves
  0 siblings, 1 reply; 4+ messages in thread
From: Sergio Durigan Junior @ 2017-04-05 16:31 UTC (permalink / raw)
  To: GDB Patches; +Cc: Sergio Durigan Junior

This is an obvious fix for PR 21352.  The problem is that the argument
parsing loop is not using an "else if" where it should, and therefore
the '-r' option ends up unrecognized by GDB.

gdb/ChangeLog:
2017-04-05  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR gdb/21352
	* tracefile.c (tsave_command): Fix argument parsing for '-r'
	option.
---
 gdb/ChangeLog   | 6 ++++++
 gdb/tracefile.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c3999b6..4141beb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-05  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+	PR gdb/21352
+	* tracefile.c (tsave_command): Fix argument parsing for '-r'
+	option.
+
 2017-04-05  Yao Qi  <yao.qi@linaro.org>
 
 	* frame.c (frame_unwind_register_unsigned): Call
diff --git a/gdb/tracefile.c b/gdb/tracefile.c
index 641ad4d..cc90945 100644
--- a/gdb/tracefile.c
+++ b/gdb/tracefile.c
@@ -325,7 +325,7 @@ tsave_command (char *args, int from_tty)
     {
       if (strcmp (*argv, "-r") == 0)
 	target_does_save = 1;
-      if (strcmp (*argv, "-ctf") == 0)
+      else if (strcmp (*argv, "-ctf") == 0)
 	generate_ctf = 1;
       else if (**argv == '-')
 	error (_("unknown option `%s'"), *argv);
-- 
2.9.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [commit/obvious] Fix PR 21352: Command tsave does not support -r argument
  2017-04-05 16:31 [commit/obvious] Fix PR 21352: Command tsave does not support -r argument Sergio Durigan Junior
@ 2017-04-05 16:34 ` Pedro Alves
  2017-04-05 16:45   ` Sergio Durigan Junior
  0 siblings, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2017-04-05 16:34 UTC (permalink / raw)
  To: Sergio Durigan Junior, GDB Patches

On 04/05/2017 05:31 PM, Sergio Durigan Junior wrote:
> This is an obvious fix for PR 21352.  The problem is that the argument
> parsing loop is not using an "else if" where it should, and therefore
> the '-r' option ends up unrecognized by GDB.

We have a few tests under gdb.trace/ that exercise "tsave".  Would it
be easy to augment some to exercise this?

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [commit/obvious] Fix PR 21352: Command tsave does not support -r argument
  2017-04-05 16:34 ` Pedro Alves
@ 2017-04-05 16:45   ` Sergio Durigan Junior
  2017-04-05 16:49     ` Pedro Alves
  0 siblings, 1 reply; 4+ messages in thread
From: Sergio Durigan Junior @ 2017-04-05 16:45 UTC (permalink / raw)
  To: Pedro Alves; +Cc: GDB Patches

On Wednesday, April 05 2017, Pedro Alves wrote:

> On 04/05/2017 05:31 PM, Sergio Durigan Junior wrote:
>> This is an obvious fix for PR 21352.  The problem is that the argument
>> parsing loop is not using an "else if" where it should, and therefore
>> the '-r' option ends up unrecognized by GDB.
>
> We have a few tests under gdb.trace/ that exercise "tsave".  Would it
> be easy to augment some to exercise this?

Yes, absolutely.  I was thinking about doing that but decided not too.
Anyway, here's what I checked in.

Thanks,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

From 0ad9d8c73486e60c5a4963c1b7a0ea7063d69cd2 Mon Sep 17 00:00:00 2001
From: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Wed, 5 Apr 2017 12:43:52 -0400
Subject: [PATCH] PR 21352: Add testsuite for "tsave -r" command

This commit adds a test for the fix of PR 21352.

gdb/testsuite/ChangeLog:
2017-04-05  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR gdb/21352
	* gdb.trace/tsv.exp: Add test for "tsave -r".
---
 gdb/testsuite/ChangeLog         | 5 +++++
 gdb/testsuite/gdb.trace/tsv.exp | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index eb543eb..83d6018 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-05  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+	PR gdb/21352
+	* gdb.trace/tsv.exp: Add test for "tsave -r".
+
 2017-03-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	* gdb.python/py-section-script.exp (sepdebug): New testcases.
diff --git a/gdb/testsuite/gdb.trace/tsv.exp b/gdb/testsuite/gdb.trace/tsv.exp
index 9da4669..2b80c80 100644
--- a/gdb/testsuite/gdb.trace/tsv.exp
+++ b/gdb/testsuite/gdb.trace/tsv.exp
@@ -26,6 +26,10 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
 }
 gdb_load $binfile
 
+# PR gdb/21352: Command tsave does not support -r argument
+gdb_test "tsave -r" "Argument required \\\(file in which to save trace data\\\)\." \
+    "tsave command properly supports -r argument"
+
 gdb_test "tvariable \$tvar1" \
   "Trace state variable \\\$tvar1 created, with initial value 0." \
   "create a trace state variable"
-- 
2.9.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [commit/obvious] Fix PR 21352: Command tsave does not support -r argument
  2017-04-05 16:45   ` Sergio Durigan Junior
@ 2017-04-05 16:49     ` Pedro Alves
  0 siblings, 0 replies; 4+ messages in thread
From: Pedro Alves @ 2017-04-05 16:49 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: GDB Patches

On 04/05/2017 05:45 PM, Sergio Durigan Junior wrote:
> On Wednesday, April 05 2017, Pedro Alves wrote:
> 
>> On 04/05/2017 05:31 PM, Sergio Durigan Junior wrote:
>>> This is an obvious fix for PR 21352.  The problem is that the argument
>>> parsing loop is not using an "else if" where it should, and therefore
>>> the '-r' option ends up unrecognized by GDB.
>>
>> We have a few tests under gdb.trace/ that exercise "tsave".  Would it
>> be easy to augment some to exercise this?
> 
> Yes, absolutely.  I was thinking about doing that but decided not too.
> Anyway, here's what I checked in.

Thanks, I like the new decision better.  :-)

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-05 16:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-05 16:31 [commit/obvious] Fix PR 21352: Command tsave does not support -r argument Sergio Durigan Junior
2017-04-05 16:34 ` Pedro Alves
2017-04-05 16:45   ` Sergio Durigan Junior
2017-04-05 16:49     ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox