[commit/obvious] Fix PR 21352: Command tsave does not support -r argument

Message ID 87bmsa9517.fsf@redhat.com
State New, archived
Headers

Commit Message

Sergio Durigan Junior April 5, 2017, 4:45 p.m. UTC
  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,
  

Comments

Pedro Alves April 5, 2017, 4:49 p.m. UTC | #1
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.  :-)
  

Patch

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"