From da9160e4c8b95f900048f9ca7018344b5b2e8461 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Sat, 13 Apr 2013 14:14:08 +0000 Subject: [PATCH] gdb/ * ctf.c (_initialize_ctf): Include "completer.h". Call add_target_with_completer instead of add_target. gdb/testsuite/ * gdb.base/completion.exp: Test completion of command 'target ctf' if target ctf is supported. --- gdb/ChangeLog | 5 +++++ gdb/ctf.c | 3 ++- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.base/completion.exp | 13 ++++++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 969b119258..48cbd0ee25 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2013-04-13 Yao Qi + + * ctf.c (_initialize_ctf): Include "completer.h". + Call add_target_with_completer instead of add_target. + 2013-04-12 Jan Kratochvil Fix GDB regression related to PR binutils/14813. diff --git a/gdb/ctf.c b/gdb/ctf.c index 0985784ad4..b8252e40fc 100644 --- a/gdb/ctf.c +++ b/gdb/ctf.c @@ -25,6 +25,7 @@ #include "regcache.h" #include "gdb_stat.h" #include "exec.h" +#include "completer.h" #include @@ -1843,6 +1844,6 @@ _initialize_ctf (void) #if HAVE_LIBBABELTRACE init_ctf_ops (); - add_target (&ctf_ops); + add_target_with_completer (&ctf_ops, filename_completer); #endif } diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 90a83b003a..93360a426c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-04-13 Yao Qi + + * gdb.base/completion.exp: Test completion of command + 'target ctf' if target ctf is supported. + 2013-04-10 Pedro Alves * gdb.base/completion.exp: Test "set height", "set listsize" and diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 008cb0a33a..80cfbff60a 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -714,8 +714,19 @@ gdb_test "complete set gnutarget aut" "set gnutarget auto" gdb_test "complete set cp-abi aut" "set cp-abi auto" # Test that completion of commands 'target FOO' works well. +set targets [list "core" "tfile" "exec"] -foreach target_name { "core" "tfile" "exec" } { +# Test that completion of command 'target ctf' if GDB supports ctf +# target. +gdb_test_multiple "target ctf" "" { + -re "Undefined target command: \"ctf\"\. Try \"help target\"\.\r\n$gdb_prompt $" { + } + -re "No CTF directory specified.*\r\n$gdb_prompt $" { + lappend targets "ctf" + } +} + +foreach target_name ${targets} { gdb_test "complete target ${target_name} ./gdb.base/completion" \ "target ${target_name} ./gdb.base/completion\\.exp.*" } -- 2.34.1