This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: fix catch syscall completion


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 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]