summaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>2019-12-05 23:41:58 +0100
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>2019-12-06 06:06:02 +0100
commite0fad1eadfcb68d543cdd96f44dca86364778fa2 (patch)
tree68b36fc2f7ffd19d3bc886bac5e9ef0bea5bc1c1 /gdb/thread.c
parent8fc52a054bb7954813ff62adc6187c1072f09e8b (diff)
downloadbinutils-gdb-e0fad1eadfcb68d543cdd96f44dca86364778fa2.tar.gz
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 <philippe.waroquiers@skynet.be> * stack.c (faas_command): Check a command is provided. * thread.c (taas_command, tfaas_command): Likewise. gdb/testsuite/ChangeLog 2019-12-06 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.threads/pthreads.exp: Test taas and tfaas without command. * gdb.base/frameapply.exp: Test faas without command.
Diffstat (limited to 'gdb/thread.c')
-rw-r--r--gdb/thread.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/thread.c b/gdb/thread.c
index 7c8426d6257..a210d328ed0 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);