From e0fad1eadfcb68d543cdd96f44dca86364778fa2 Mon Sep 17 00:00:00 2001 From: Philippe Waroquiers Date: Thu, 5 Dec 2019 23:41:58 +0100 Subject: Fix crash when command arg is missing in faas/taas/tfaas commands. GDB crashes when doing: (gdb) faas Aborted Do the needed check to avoid crashing. gdb/ChangeLog 2019-12-06 Philippe Waroquiers * stack.c (faas_command): Check a command is provided. * thread.c (taas_command, tfaas_command): Likewise. gdb/testsuite/ChangeLog 2019-12-06 Philippe Waroquiers * gdb.threads/pthreads.exp: Test taas and tfaas without command. * gdb.base/frameapply.exp: Test faas without command. --- gdb/thread.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gdb/thread.c') diff --git a/gdb/thread.c b/gdb/thread.c index 7c8426d..a210d32 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -1818,6 +1818,8 @@ thread_apply_command (const char *tidlist, int from_tty) static void taas_command (const char *cmd, int from_tty) { + if (cmd == NULL || *cmd == '\0') + error (_("Please specify a command to apply on all threads")); std::string expanded = std::string ("thread apply all -s ") + cmd; execute_command (expanded.c_str (), from_tty); } @@ -1827,6 +1829,8 @@ taas_command (const char *cmd, int from_tty) static void tfaas_command (const char *cmd, int from_tty) { + if (cmd == NULL || *cmd == '\0') + error (_("Please specify a command to apply on all frames of all threads")); std::string expanded = std::string ("thread apply all -s -- frame apply all -s ") + cmd; execute_command (expanded.c_str (), from_tty); -- cgit v1.1