[commit/obvious] Fix PR 21352: Command tsave does not support -r argument
Commit Message
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(-)
Comments
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
@@ -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
@@ -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);