Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Add completer to commands 'target {core/tfile/exec}'
@ 2013-03-28 15:14 Yao Qi
  2013-03-28 18:50 ` Pedro Alves
  0 siblings, 1 reply; 6+ messages in thread
From: Yao Qi @ 2013-03-28 15:14 UTC (permalink / raw)
  To: gdb-patches

Hi,
Recently I type command 'target tifle' and 'target ctf' frequently,
and feel uneasy to type file name without a completer.
This patch adds filename completer to commands target {core,tfile,exec}.
Note that command "core-file" has already has a filename completer, but
"target core" doesn't.  Is it OK?

gdb:

2013-03-28  Yao Qi  <yao@codesourcery.com>

	* corelow.c: Include "completer.h".
	(_initialize_corelow): Call add_target_with_completer with parameter
	'filename_completer'.
	* tracepoint.c: Likewise.
	* exec.c (_initialize_exec): Likewise.
	* target.c (add_target): Rename to ...
	(add_target_with_completer): ... it.  New.  Call set_cmd_completer if
	parameter completer is not NULL.
	(add_target): New.
	* target.h: Include "command.h".
	(add_target_with_completer): Declare it.

gdb/testsuite:

2013-03-28  Yao Qi  <yao@codesourcery.com>

	* gdb.base/completion.exp: Test completion of commands "target core",
	"target tfile" and "target exec".
	* gdb.trace/tfile.exp: Test completion of command "target tfile".
---
 gdb/corelow.c                         |    3 ++-
 gdb/exec.c                            |    2 +-
 gdb/target.c                          |   22 +++++++++++++++++++---
 gdb/target.h                          |    4 ++++
 gdb/testsuite/gdb.base/completion.exp |    7 +++++++
 gdb/testsuite/gdb.trace/tfile.exp     |    5 +++++
 gdb/tracepoint.c                      |    3 ++-
 7 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/gdb/corelow.c b/gdb/corelow.c
index 77bab82..fa48941 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -46,6 +46,7 @@
 #include "progspace.h"
 #include "objfiles.h"
 #include "gdb_bfd.h"
+#include "completer.h"
 
 #ifndef O_LARGEFILE
 #define O_LARGEFILE 0
@@ -977,5 +978,5 @@ _initialize_corelow (void)
 {
   init_core_ops ();
 
-  add_target (&core_ops);
+  add_target_with_completer (&core_ops, filename_completer);
 }
diff --git a/gdb/exec.c b/gdb/exec.c
index f550194..3386b60 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -943,7 +943,7 @@ Show writing into executable and core files."), NULL,
 			   show_write_files,
 			   &setlist, &showlist);
 
-  add_target (&exec_ops);
+  add_target_with_completer (&exec_ops, filename_completer);
 }
 
 static char *
diff --git a/gdb/target.c b/gdb/target.c
index 9193c97..f0eefd4 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -384,11 +384,16 @@ target_has_execution_current (void)
   return target_has_execution_1 (inferior_ptid);
 }
 
-/* Add a possible target architecture to the list.  */
+/* Add a possible target architecture T to the list and add a new
+   command 'target T->to_shortname'.  Set COMPLETER for the command
+   completer if it is not NULL.  */
 
 void
-add_target (struct target_ops *t)
+add_target_with_completer (struct target_ops *t,
+			   completer_ftype *completer)
 {
+  struct cmd_list_element *c;
+
   /* Provide default values for all "must have" methods.  */
   if (t->to_xfer_partial == NULL)
     t->to_xfer_partial = default_xfer_partial;
@@ -431,7 +436,18 @@ Remaining arguments are interpreted by the target protocol.  For more\n\
 information on the arguments for a particular protocol, type\n\
 `help target ' followed by the protocol name."),
 		    &targetlist, "target ", 0, &cmdlist);
-  add_cmd (t->to_shortname, no_class, t->to_open, t->to_doc, &targetlist);
+  c = add_cmd (t->to_shortname, no_class, t->to_open, t->to_doc,
+	       &targetlist);
+  if (completer != NULL)
+    set_cmd_completer (c, completer);
+}
+
+/* Add a possible target architecture to the list.  */
+
+void
+add_target (struct target_ops *t)
+{
+  add_target_with_completer (t, NULL);
 }
 
 /* See target.h.  */
diff --git a/gdb/target.h b/gdb/target.h
index ee3fbff..4f8520c 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -63,6 +63,7 @@ struct expression;
 #include "vec.h"
 #include "gdb_signals.h"
 #include "btrace.h"
+#include "command.h"
 
 enum strata
   {
@@ -1841,6 +1842,9 @@ int target_verify_memory (const gdb_byte *data,
 
 extern void add_target (struct target_ops *);
 
+extern void add_target_with_completer (struct target_ops *t,
+				       completer_ftype *completer);
+
 /* Adds a command ALIAS for target T and marks it deprecated.  This is useful
    for maintaining backwards compatibility when renaming targets.  */
 
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index cddc548..df93733 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -713,6 +713,13 @@ gdb_test "complete set gnutarget aut" "set gnutarget auto"
 
 gdb_test "complete set cp-abi aut" "set cp-abi auto"
 
+# Test commands 'target FOO' completion works well.
+
+foreach target_name { "core" "tfile" "exec" } {
+    gdb_test "complete target ${target_name} ./gdb.base/completion" \
+	"target ${target_name} ./gdb.base/completion\\.exp.*"
+}
+
 # Restore globals modified in this test...
 set timeout $oldtimeout1
 
diff --git a/gdb/testsuite/gdb.trace/tfile.exp b/gdb/testsuite/gdb.trace/tfile.exp
index e8a778d..3b720cc 100644
--- a/gdb/testsuite/gdb.trace/tfile.exp
+++ b/gdb/testsuite/gdb.trace/tfile.exp
@@ -128,3 +128,8 @@ gdb_test \
 gdb_test "interpreter-exec mi \"-trace-status\"" \
     "\\^done,supported=\"file\",trace-file=\".*basic.tf\",running=\"0\",stop-reason=\"request\",frames=\"${decimal}\",frames-created=\"${decimal}\",buffer-size=\"${decimal}\",buffer-free=\"${decimal}\",disconnected=\".*\",circular=\".*\",user-name=\"\",notes=\"\",start-time=\".*\",stop-time=\".*\"" \
     "-trace-status"
+
+# Test completion works well.
+
+gdb_test "target tfile basic\t" "Assuming tracepoint.*" \
+    "complete-command 'target tfile'"
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index d42138b..1044606 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -53,6 +53,7 @@
 #include "cli/cli-utils.h"
 #include "probe.h"
 #include "ctf.h"
+#include "completer.h"
 
 /* readline include files */
 #include "readline/readline.h"
@@ -5846,5 +5847,5 @@ Show the notes string to use for future tstop commands"), NULL,
 
   init_tfile_ops ();
 
-  add_target (&tfile_ops);
+  add_target_with_completer (&tfile_ops, filename_completer);
 }
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add completer to commands 'target {core/tfile/exec}'
  2013-03-28 15:14 [PATCH] Add completer to commands 'target {core/tfile/exec}' Yao Qi
@ 2013-03-28 18:50 ` Pedro Alves
  2013-03-29 16:42   ` Yao Qi
  0 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2013-03-28 18:50 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

Nice!

On 03/28/2013 09:25 AM, Yao Qi wrote:
> 2013-03-28  Yao Qi  <yao@codesourcery.com>
> 
> 	* corelow.c: Include "completer.h".
> 	(_initialize_corelow): Call add_target_with_completer with parameter
> 	'filename_completer'.

s/parameter/argument/

> 	* tracepoint.c: Likewise.
> 	* exec.c (_initialize_exec): Likewise.
> 	* target.c (add_target): Rename to ...
> 	(add_target_with_completer): ... it.  New.  Call set_cmd_completer if
> 	parameter completer is not NULL.

s/it./this./.  "New." looks stale here.  Did you mean "New parameter"?


> 	(add_target): New.
> 	* target.h: Include "command.h".
> 	(add_target_with_completer): Declare it.
> 


> -/* Add a possible target architecture to the list.  */
> +/* Add a possible target architecture T to the list and add a new

s/Add a/Add / (you've identified T, so no longer indefinite).

> +   command 'target T->to_shortname'.  Set COMPLETER for the command
> +   completer if it is not NULL.  */

I suggest:

  "If not NULL, set COMPLETER as that command's completer."

>  
>  void
> -add_target (struct target_ops *t)
> +add_target_with_completer (struct target_ops *t,
> +			   completer_ftype *completer)

...

>  /* Adds a command ALIAS for target T and marks it deprecated.  This is useful
>     for maintaining backwards compatibility when renaming targets.  */
>  
> diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
> index cddc548..df93733 100644
> --- a/gdb/testsuite/gdb.base/completion.exp
> +++ b/gdb/testsuite/gdb.base/completion.exp
> @@ -713,6 +713,13 @@ gdb_test "complete set gnutarget aut" "set gnutarget auto"
>  
>  gdb_test "complete set cp-abi aut" "set cp-abi auto"
>  
> +# Test commands 'target FOO' completion works well.

"Test that completion of 'target FOO' commands works well."

> +
> +foreach target_name { "core" "tfile" "exec" } {
> +    gdb_test "complete target ${target_name} ./gdb.base/completion" \
> +	"target ${target_name} ./gdb.base/completion\\.exp.*"
> +}

Otherwise OK.

Thanks,
-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add completer to commands 'target {core/tfile/exec}'
  2013-03-28 18:50 ` Pedro Alves
@ 2013-03-29 16:42   ` Yao Qi
  2013-04-03 13:44     ` Doug Evans
  0 siblings, 1 reply; 6+ messages in thread
From: Yao Qi @ 2013-03-29 16:42 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On 03/28/2013 11:14 PM, Pedro Alves wrote:
>> 	(add_target_with_completer): ... it.  New.  Call set_cmd_completer if
>> >	parameter completer is not NULL.
> s/it./this./.  "New." looks stale here.  Did you mean "New parameter"?
> 

"New" is not needed here.  Removed.  Patch below is committed.  Thanks
for the review.

-- 
Yao (齐尧)

gdb:

2013-03-29  Yao Qi  <yao@codesourcery.com>

	* corelow.c: Include "completer.h".
	(_initialize_corelow): Call add_target_with_completer with
	argument 'filename_completer'.
	* tracepoint.c: Likewise.
	* exec.c (_initialize_exec): Likewise.
	* target.c (add_target): Rename to ...
	(add_target_with_completer): ... this.  Call set_cmd_completer
	if parameter completer is not NULL.
	(add_target): New.
	* target.h: Include "command.h".
	(add_target_with_completer): Declare it.

gdb/testsuite:

2013-03-29  Yao Qi  <yao@codesourcery.com>

	* gdb.base/completion.exp: Test completion of commands
	"target core", "target tfile" and "target exec".
	* gdb.trace/tfile.exp: Test completion of command
	"target tfile".
---
 gdb/corelow.c                         |    3 ++-
 gdb/exec.c                            |    2 +-
 gdb/target.c                          |   22 +++++++++++++++++++---
 gdb/target.h                          |    4 ++++
 gdb/testsuite/gdb.base/completion.exp |    7 +++++++
 gdb/testsuite/gdb.trace/tfile.exp     |    5 +++++
 gdb/tracepoint.c                      |    3 ++-
 7 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/gdb/corelow.c b/gdb/corelow.c
index 77bab82..fa48941 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -46,6 +46,7 @@
 #include "progspace.h"
 #include "objfiles.h"
 #include "gdb_bfd.h"
+#include "completer.h"
 
 #ifndef O_LARGEFILE
 #define O_LARGEFILE 0
@@ -977,5 +978,5 @@ _initialize_corelow (void)
 {
   init_core_ops ();
 
-  add_target (&core_ops);
+  add_target_with_completer (&core_ops, filename_completer);
 }
diff --git a/gdb/exec.c b/gdb/exec.c
index f550194..3386b60 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -943,7 +943,7 @@ Show writing into executable and core files."), NULL,
 			   show_write_files,
 			   &setlist, &showlist);
 
-  add_target (&exec_ops);
+  add_target_with_completer (&exec_ops, filename_completer);
 }
 
 static char *
diff --git a/gdb/target.c b/gdb/target.c
index 9193c97..24cc79d 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -384,11 +384,16 @@ target_has_execution_current (void)
   return target_has_execution_1 (inferior_ptid);
 }
 
-/* Add a possible target architecture to the list.  */
+/* Add possible target architecture T to the list and add a new
+   command 'target T->to_shortname'.  Set COMPLETER as the command's
+   completer if not NULL.  */
 
 void
-add_target (struct target_ops *t)
+add_target_with_completer (struct target_ops *t,
+			   completer_ftype *completer)
 {
+  struct cmd_list_element *c;
+
   /* Provide default values for all "must have" methods.  */
   if (t->to_xfer_partial == NULL)
     t->to_xfer_partial = default_xfer_partial;
@@ -431,7 +436,18 @@ Remaining arguments are interpreted by the target protocol.  For more\n\
 information on the arguments for a particular protocol, type\n\
 `help target ' followed by the protocol name."),
 		    &targetlist, "target ", 0, &cmdlist);
-  add_cmd (t->to_shortname, no_class, t->to_open, t->to_doc, &targetlist);
+  c = add_cmd (t->to_shortname, no_class, t->to_open, t->to_doc,
+	       &targetlist);
+  if (completer != NULL)
+    set_cmd_completer (c, completer);
+}
+
+/* Add a possible target architecture to the list.  */
+
+void
+add_target (struct target_ops *t)
+{
+  add_target_with_completer (t, NULL);
 }
 
 /* See target.h.  */
diff --git a/gdb/target.h b/gdb/target.h
index ee3fbff..4f8520c 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -63,6 +63,7 @@ struct expression;
 #include "vec.h"
 #include "gdb_signals.h"
 #include "btrace.h"
+#include "command.h"
 
 enum strata
   {
@@ -1841,6 +1842,9 @@ int target_verify_memory (const gdb_byte *data,
 
 extern void add_target (struct target_ops *);
 
+extern void add_target_with_completer (struct target_ops *t,
+				       completer_ftype *completer);
+
 /* Adds a command ALIAS for target T and marks it deprecated.  This is useful
    for maintaining backwards compatibility when renaming targets.  */
 
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index cddc548..7b664bf 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -713,6 +713,13 @@ 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.
+
+foreach target_name { "core" "tfile" "exec" } {
+    gdb_test "complete target ${target_name} ./gdb.base/completion" \
+	"target ${target_name} ./gdb.base/completion\\.exp.*"
+}
+
 # Restore globals modified in this test...
 set timeout $oldtimeout1
 
diff --git a/gdb/testsuite/gdb.trace/tfile.exp b/gdb/testsuite/gdb.trace/tfile.exp
index e8a778d..3b720cc 100644
--- a/gdb/testsuite/gdb.trace/tfile.exp
+++ b/gdb/testsuite/gdb.trace/tfile.exp
@@ -128,3 +128,8 @@ gdb_test \
 gdb_test "interpreter-exec mi \"-trace-status\"" \
     "\\^done,supported=\"file\",trace-file=\".*basic.tf\",running=\"0\",stop-reason=\"request\",frames=\"${decimal}\",frames-created=\"${decimal}\",buffer-size=\"${decimal}\",buffer-free=\"${decimal}\",disconnected=\".*\",circular=\".*\",user-name=\"\",notes=\"\",start-time=\".*\",stop-time=\".*\"" \
     "-trace-status"
+
+# Test completion works well.
+
+gdb_test "target tfile basic\t" "Assuming tracepoint.*" \
+    "complete-command 'target tfile'"
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index d42138b..1044606 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -53,6 +53,7 @@
 #include "cli/cli-utils.h"
 #include "probe.h"
 #include "ctf.h"
+#include "completer.h"
 
 /* readline include files */
 #include "readline/readline.h"
@@ -5846,5 +5847,5 @@ Show the notes string to use for future tstop commands"), NULL,
 
   init_tfile_ops ();
 
-  add_target (&tfile_ops);
+  add_target_with_completer (&tfile_ops, filename_completer);
 }
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add completer to commands 'target {core/tfile/exec}'
  2013-03-29 16:42   ` Yao Qi
@ 2013-04-03 13:44     ` Doug Evans
  2013-04-03 15:53       ` Yao Qi
  0 siblings, 1 reply; 6+ messages in thread
From: Doug Evans @ 2013-04-03 13:44 UTC (permalink / raw)
  To: Yao Qi; +Cc: Pedro Alves, gdb-patches

On Fri, Mar 29, 2013 at 8:22 AM, Yao Qi <yao@codesourcery.com> wrote:
> On 03/28/2013 11:14 PM, Pedro Alves wrote:
>>>      (add_target_with_completer): ... it.  New.  Call set_cmd_completer if
>>> >    parameter completer is not NULL.
>> s/it./this./.  "New." looks stale here.  Did you mean "New parameter"?
>>
>
> "New" is not needed here.  Removed.  Patch below is committed.  Thanks
> for the review.
>
> --
> Yao (齐尧)
>
> gdb:
>
> 2013-03-29  Yao Qi  <yao@codesourcery.com>
>
>         * corelow.c: Include "completer.h".
>         (_initialize_corelow): Call add_target_with_completer with
>         argument 'filename_completer'.
>         * tracepoint.c: Likewise.
>         * exec.c (_initialize_exec): Likewise.
>         * target.c (add_target): Rename to ...
>         (add_target_with_completer): ... this.  Call set_cmd_completer
>         if parameter completer is not NULL.
>         (add_target): New.
>         * target.h: Include "command.h".
>         (add_target_with_completer): Declare it.
>
> gdb/testsuite:
>
> 2013-03-29  Yao Qi  <yao@codesourcery.com>
>
>         * gdb.base/completion.exp: Test completion of commands
>         "target core", "target tfile" and "target exec".
>         * gdb.trace/tfile.exp: Test completion of command
>         "target tfile".
> [...]
> diff --git a/gdb/testsuite/gdb.trace/tfile.exp b/gdb/testsuite/gdb.trace/tfile.exp
> index e8a778d..3b720cc 100644
> --- a/gdb/testsuite/gdb.trace/tfile.exp
> +++ b/gdb/testsuite/gdb.trace/tfile.exp
> @@ -128,3 +128,8 @@ gdb_test \
>  gdb_test "interpreter-exec mi \"-trace-status\"" \
>      "\\^done,supported=\"file\",trace-file=\".*basic.tf\",running=\"0\",stop-reason=\"request\",frames=\"${decimal}\",frames-created=\"${decimal}\",buffer-size=\"${decimal}\",buffer-free=\"${decimal}\",disconnected=\".*\",circular=\".*\",user-name=\"\",notes=\"\",start-time=\".*\",stop-time=\".*\"" \
>      "-trace-status"
> +
> +# Test completion works well.
> +
> +gdb_test "target tfile basic\t" "Assuming tracepoint.*" \
> +    "complete-command 'target tfile'"

Hi.  This test is failing for me because I have another file that
begins with "basic".
Can you change this to use "tfile-basic" instead of "basic?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add completer to commands 'target {core/tfile/exec}'
  2013-04-03 13:44     ` Doug Evans
@ 2013-04-03 15:53       ` Yao Qi
  2013-04-03 17:09         ` Yao Qi
  0 siblings, 1 reply; 6+ messages in thread
From: Yao Qi @ 2013-04-03 15:53 UTC (permalink / raw)
  To: Doug Evans; +Cc: Pedro Alves, gdb-patches

On 04/03/2013 05:15 AM, Doug Evans wrote:
> Hi.  This test is failing for me because I have another file that
> begins with "basic".
> Can you change this to use "tfile-basic" instead of "basic?

OK, the patch below is to rename basic.tf and error.tf to
tfile-basic.tf and tfile-error.tf.  Tested on x86_64-linux.
Committed.

-- 
Yao (齐尧)

gdb/testsuite:

2013-04-03  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/tfile.c (write_basic_trace_file): Pass argument
	"tfile-basic.tf" instead of "basic.tf".
	(write_error_trace_file): Pass argument "tfile-error.tf"
	instead of "error.tf".
	* gdb.trace/tfile.exp: Update tfile names to
	"tfile-basic.tf" and "tfile-error.tf".
---
 gdb/testsuite/gdb.trace/tfile.c   |    4 ++--
 gdb/testsuite/gdb.trace/tfile.exp |   24 +++++++++++++-----------
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/gdb/testsuite/gdb.trace/tfile.c b/gdb/testsuite/gdb.trace/tfile.c
index 3ee3ac5..7020744 100644
--- a/gdb/testsuite/gdb.trace/tfile.c
+++ b/gdb/testsuite/gdb.trace/tfile.c
@@ -92,7 +92,7 @@ write_basic_trace_file (void)
   int fd, int_x;
   short short_x;
 
-  fd = start_trace_file ("basic.tf");
+  fd = start_trace_file ("tfile-basic.tf");
 
   /* The next part of the file consists of newline-separated lines
      defining status, tracepoints, etc.  The section is terminated by
@@ -177,7 +177,7 @@ write_error_trace_file (void)
   int len = sizeof (made_up) - 1;
   char *hex = alloca (len * 2 + 1);
 
-  fd = start_trace_file ("error.tf");
+  fd = start_trace_file ("tfile-error.tf");
 
   /* The next part of the file consists of newline-separated lines
      defining status, tracepoints, etc.  The section is terminated by
diff --git a/gdb/testsuite/gdb.trace/tfile.exp b/gdb/testsuite/gdb.trace/tfile.exp
index f259952..087d207 100644
--- a/gdb/testsuite/gdb.trace/tfile.exp
+++ b/gdb/testsuite/gdb.trace/tfile.exp
@@ -33,21 +33,22 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
 gdb_reinitialize_dir $srcdir/$subdir
 
 # Make sure we are starting fresh.
-remote_file host delete basic.tf
-remote_file host delete error.tf
-remote_file target delete basic.tf
-remote_file target delete error.tf
+remote_file host delete tfile-basic.tf
+remote_file host delete tfile-error.tf
+remote_file target delete tfile-basic.tf
+remote_file target delete tfile-error.tf
 
 remote_exec target "$binfile"
 # Copy tracefile from target to host through build.
-remote_download host [remote_upload target basic.tf] basic.tf
-remote_download host [remote_upload target error.tf] error.tf
+remote_download host [remote_upload target tfile-basic.tf] tfile-basic.tf
+remote_download host [remote_upload target tfile-error.tf] tfile-error.tf
 
 gdb_load $binfile
 
 # Program has presumably exited, now target a trace file it created.
 
-gdb_test "target tfile basic.tf" "Created tracepoint.*" "target tfile"
+gdb_test "target tfile tfile-basic.tf" "Created tracepoint.*" \
+    "target tfile"
 
 gdb_test "info trace" ".*tracepoint.*in write_basic_trace_file.*" \
     "info tracepoints on trace file"
@@ -107,7 +108,8 @@ gdb_start
 
 gdb_load $binfile
 
-gdb_test "target tfile error.tf" "Created tracepoint.*" "target tfile"
+gdb_test "target tfile tfile-error.tf" "Created tracepoint.*" \
+    "target tfile"
 
 gdb_test "tstatus" \
     "Using a trace file.*
@@ -119,14 +121,14 @@ Not looking at any trace frame.*" \
 
 # Make sure we can reopen without error.
 gdb_test \
-    "interpreter-exec mi \"-target-select tfile basic.tf\"" \
+    "interpreter-exec mi \"-target-select tfile tfile-basic.tf\"" \
     "\\^connected.*"
 
 gdb_test "interpreter-exec mi \"-trace-status\"" \
-    "\\^done,supported=\"file\",trace-file=\".*basic.tf\",running=\"0\",stop-reason=\"request\",frames=\"${decimal}\",frames-created=\"${decimal}\",buffer-size=\"${decimal}\",buffer-free=\"${decimal}\",disconnected=\".*\",circular=\".*\",user-name=\"\",notes=\"\",start-time=\".*\",stop-time=\".*\"" \
+    "\\^done,supported=\"file\",trace-file=\".*tfile-basic.tf\",running=\"0\",stop-reason=\"request\",frames=\"${decimal}\",frames-created=\"${decimal}\",buffer-size=\"${decimal}\",buffer-free=\"${decimal}\",disconnected=\".*\",circular=\".*\",user-name=\"\",notes=\"\",start-time=\".*\",stop-time=\".*\"" \
     "-trace-status"
 
 # Test completion works well.
 
-gdb_test "target tfile basic\t" "Assuming tracepoint.*" \
+gdb_test "target tfile tfile-basic\t" "Assuming tracepoint.*" \
     "complete-command 'target tfile'"
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add completer to commands 'target {core/tfile/exec}'
  2013-04-03 15:53       ` Yao Qi
@ 2013-04-03 17:09         ` Yao Qi
  0 siblings, 0 replies; 6+ messages in thread
From: Yao Qi @ 2013-04-03 17:09 UTC (permalink / raw)
  To: Doug Evans; +Cc: Pedro Alves, gdb-patches

On 04/03/2013 11:32 AM, Yao Qi wrote:
> gdb/testsuite:
> 
> 2013-04-03  Yao Qi<yao@codesourcery.com>
> 
> 	* gdb.trace/tfile.c (write_basic_trace_file): Pass argument
> 	"tfile-basic.tf" instead of "basic.tf".
> 	(write_error_trace_file): Pass argument "tfile-error.tf"
> 	instead of "error.tf".
> 	* gdb.trace/tfile.exp: Update tfile names to
> 	"tfile-basic.tf" and "tfile-error.tf".

The change on tfile name affects gdb.trace/mi-traceframe-changed.exp.
Update the tfile name in it.

-- 
Yao (齐尧)

gdb/testsuite:

2013-04-03  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/mi-traceframe-changed.exp: Update tfile name to
	"tfile-basic.tf".
	(test_tfind_tfile): Likewise.
---
 gdb/testsuite/gdb.trace/mi-traceframe-changed.exp |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
index 7849a7e..cb83dbe 100644
--- a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
+++ b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
@@ -27,12 +27,13 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
 }
 
 # Make sure we are starting fresh.
-remote_file host delete basic.tf
-remote_file target delete basic.tf
+remote_file host delete tfile-basic.tf
+remote_file target delete tfile-basic.tf
 
 remote_exec target "$binfile"
 # Copy tracefile from target to host.
-remote_download host [remote_upload target basic.tf] basic.tf
+remote_download host [remote_upload target tfile-basic.tf] \
+    tfile-basic.tf
 
 proc test_tfind_tfile { } {
     with_test_prefix "tfile" {
@@ -44,7 +45,7 @@ proc test_tfind_tfile { } {
 	}
 	mi_gdb_load ${binfile}
 
-	mi_gdb_test "-target-select tfile basic.tf" \
+	mi_gdb_test "-target-select tfile tfile-basic.tf" \
 	    ".*=breakpoint-created,bkpt=\{number=\"${decimal}\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"write_basic_trace_file\".*\\^connected" \
 	    "select trace file"
 
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-04-03 10:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-28 15:14 [PATCH] Add completer to commands 'target {core/tfile/exec}' Yao Qi
2013-03-28 18:50 ` Pedro Alves
2013-03-29 16:42   ` Yao Qi
2013-04-03 13:44     ` Doug Evans
2013-04-03 15:53       ` Yao Qi
2013-04-03 17:09         ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox