Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Subject: Patch: fix catch syscall completion
Date: Fri, 26 Oct 2012 17:20:00 -0000	[thread overview]
Message-ID: <87fw512ls8.fsf@fleche.redhat.com> (raw)

I noticed that the "catch syscall" completer doesn't work quite right.
It will complete "catch syscall vfor" ok, but not a multi-word
use like "catch syscall read vfor".

This patch fixes the bug.  New test case included.
Built and regtested on x86-64 Fedora 16.

Tom

2012-10-26  Tom Tromey  <tromey@redhat.com>

	* breakpoint.c (catch_syscall_completer): Pass 'word' as second
	argument to complete_on_enum.

2012-10-26  Tom Tromey  <tromey@redhat.com>

	* gdb.base/catch-syscall.exp (do_syscall_tests): Add completion
	test.

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 76e3e89..0023ba5 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -14972,7 +14972,7 @@ catch_syscall_completer (struct cmd_list_element *cmd,
 {
   const char **list = get_syscall_names ();
   VEC (char_ptr) *retlist
-    = (list == NULL) ? NULL : complete_on_enum (list, text, word);
+    = (list == NULL) ? NULL : complete_on_enum (list, word, word);
 
   xfree (list);
   return retlist;
diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp
index 9054cfe..8aa81e0 100644
--- a/gdb/testsuite/gdb.base/catch-syscall.exp
+++ b/gdb/testsuite/gdb.base/catch-syscall.exp
@@ -288,6 +288,11 @@ proc do_syscall_tests {} {
     set thistest "catch syscall to a nonsense syscall is prohibited"
     gdb_test "catch syscall nonsense_syscall" "Unknown syscall name .*" $thistest
 
+    # Regression test for syscall completer bug.
+    gdb_test "complete catch syscall close chroo" \
+	"catch syscall close chroot" \
+	"complete catch syscall with multiple words"
+
     # Testing the 'catch syscall' command without arguments.
     # This test should catch any syscalls.
     if [runto_main] then { test_catch_syscall_without_args }


             reply	other threads:[~2012-10-26 17:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-26 17:20 Tom Tromey [this message]
2012-10-26 17:40 ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fw512ls8.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox