* [PATCH 0/2] Two MI notifications on TSV and process record
@ 2012-09-12 7:16 Yao Qi
2012-09-12 7:16 ` [PATCH 2/2] MI notification on record started and stopped Yao Qi
2012-09-12 7:16 ` [PATCH 1/2] MI notification on tsv created and deleted Yao Qi
0 siblings, 2 replies; 22+ messages in thread
From: Yao Qi @ 2012-09-12 7:16 UTC (permalink / raw)
To: gdb-patches
Hi,
These two patches add two MI notifications on TSV changes and process
record changes respectively. They depend on this patch, because they
change the same files, such as mi/mi-cmds.c and NEWS.
[PATCH] traceframe_changed observer and MI notification
http://sourceware.org/ml/gdb-patches/2012-09/msg00153.html
Regression tested on x86_64-linux.
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 2/2] MI notification on record started and stopped
2012-09-12 7:16 [PATCH 0/2] Two MI notifications on TSV and process record Yao Qi
@ 2012-09-12 7:16 ` Yao Qi
2012-09-12 17:52 ` Eli Zaretskii
` (2 more replies)
2012-09-12 7:16 ` [PATCH 1/2] MI notification on tsv created and deleted Yao Qi
1 sibling, 3 replies; 22+ messages in thread
From: Yao Qi @ 2012-09-12 7:16 UTC (permalink / raw)
To: gdb-patches
This patch is to add the MI notification on record started and
stopped.
gdb/doc:
* gdb.texinfo (GDB/MI Async Records): Document notification
'record-changed'.
* observer.texi (GDB Observers): New observer 'record-changed'.
gdb:
* mi/mi-interp.c: Declare mi_record_changed.
(mi_interpreter_init): Call observer_attach_record_changed.
(mi_record_changed): New.
* record.c (record_open): Call observer_notify_record_changed.
(cmd_record_stop): Call observer_notify_record_changed.
* NEWS: Mention it.
gdb/testsuite:
* gdb.mi/mi-record-changed.exp: New.
* gdb.mi/mi-reverse.exp: Adjust expected output.
---
gdb/NEWS | 2 +
gdb/doc/gdb.texinfo | 5 +++
gdb/doc/observer.texi | 7 +++++
gdb/mi/mi-interp.c | 15 ++++++++++
gdb/record.c | 5 +++
gdb/testsuite/gdb.mi/mi-record-changed.exp | 41 ++++++++++++++++++++++++++++
gdb/testsuite/gdb.mi/mi-reverse.exp | 3 +-
7 files changed, 77 insertions(+), 1 deletions(-)
create mode 100644 gdb/testsuite/gdb.mi/mi-record-changed.exp
diff --git a/gdb/NEWS b/gdb/NEWS
index dad72af..89c38be 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -47,6 +47,8 @@ py [command]
new async record "=traceframe-changed".
** The creation and deletion of trace state variables are now notified
using new async records "=tsv-created" and "=tsv-deleted".
+ ** The start and stop of process record are not notified using new
+ async record "=record-started" and "=record-stopped".
*** Changes in GDB 7.5
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 1e9b4fc..21e5849 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -27660,6 +27660,11 @@ breakpoint commands; @xref{GDB/MI Breakpoint Commands}. The
Note that if a breakpoint is emitted in the result record of a
command, then it will not also be emitted in an async record.
+@item =record-started,id=@var{id}
+@item =record-stopped,id=@var{id}
+The process record is either started or stoped in process @var{id}.
+The @var{id} field contains the @value{GDBN} identifier of process.
+
@item =cmd-param-changed,param=@var{param},value=@var{value}
Reports that a parameter of the command @code{set @var{param}} is
changed to @var{value}. In the multi-word @code{set} command,
diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
index 74aa8c8..b874f05 100644
--- a/gdb/doc/observer.texi
+++ b/gdb/doc/observer.texi
@@ -113,6 +113,13 @@ at the entry-point instruction. For @samp{attach} and @samp{core},
inferior, and before any information on the inferior has been printed.
@end deftypefun
+@deftypefun void record_changed (struct inferior *@var{inferior}, int @var{started})
+The status of process record for inferior @var{inferior} in
+@value{GDBN} has changed. The process record is started if
+@var{started} is true, and the process record is stopped if
+@var{started} is false.
+@end deftypefun
+
@deftypefun void solib_loaded (struct so_list *@var{solib})
The shared library specified by @var{solib} has been loaded. Note that
when @value{GDBN} calls this observer, the library's symbols probably
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 5c37bc7..6ccb098 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -60,6 +60,7 @@ static void mi_on_normal_stop (struct bpstats *bs, int print_frame);
static void mi_new_thread (struct thread_info *t);
static void mi_thread_exit (struct thread_info *t, int silent);
+static void mi_record_changed (struct inferior*, int);
static void mi_inferior_added (struct inferior *inf);
static void mi_inferior_appeared (struct inferior *inf);
static void mi_inferior_exit (struct inferior *inf);
@@ -124,6 +125,7 @@ mi_interpreter_init (struct interp *interp, int top_level)
observer_attach_inferior_appeared (mi_inferior_appeared);
observer_attach_inferior_exit (mi_inferior_exit);
observer_attach_inferior_removed (mi_inferior_removed);
+ observer_attach_record_changed (mi_record_changed);
observer_attach_normal_stop (mi_on_normal_stop);
observer_attach_target_resumed (mi_on_resume);
observer_attach_solib_loaded (mi_solib_loaded);
@@ -381,6 +383,19 @@ mi_thread_exit (struct thread_info *t, int silent)
gdb_flush (mi->event_channel);
}
+/* Emit notification on changing the state of record. */
+
+static void
+mi_record_changed (struct inferior *inferior, int started)
+{
+ struct mi_interp *mi = top_level_interpreter_data ();
+
+ fprintf_unfiltered (mi->event_channel, "record-%s,id=\"%d\"",
+ started ? "started" : "stopped", inferior->num);
+
+ gdb_flush (mi->event_channel);
+}
+
static void
mi_inferior_added (struct inferior *inf)
{
diff --git a/gdb/record.c b/gdb/record.c
index 5cbac00..c98ed32 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -33,6 +33,7 @@
#include "event-loop.h"
#include "inf-loop.h"
#include "gdb_bfd.h"
+#include "observer.h"
#include <signal.h>
@@ -1001,6 +1002,8 @@ record_open (char *name, int from_tty)
NULL);
record_init_record_breakpoints ();
+
+ observer_notify_record_changed (current_inferior (), 1);
}
/* "to_close" target method. Close the process record target. */
@@ -2260,6 +2263,8 @@ cmd_record_stop (char *args, int from_tty)
unpush_target (&record_ops);
printf_unfiltered (_("Process record is stopped and all execution "
"logs are deleted.\n"));
+
+ observer_notify_record_changed (current_inferior (), 0);
}
else
printf_unfiltered (_("Process record is not started.\n"));
diff --git a/gdb/testsuite/gdb.mi/mi-record-changed.exp b/gdb/testsuite/gdb.mi/mi-record-changed.exp
new file mode 100644
index 0000000..5fc8f0a
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/mi-record-changed.exp
@@ -0,0 +1,41 @@
+# Copyright 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if ![supports_process_record] {
+ return
+}
+
+standard_testfile basics.c
+if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
+ executable {debug nowarnings}] != "" } {
+ untested mi-record-changed.exp
+ return -1
+}
+
+load_lib mi-support.exp
+
+if [mi_gdb_start] {
+ return
+}
+mi_run_to_main
+
+mi_gdb_test "record" ".*=record-started,id=\"${decimal}\".*\\^done" "record"
+mi_gdb_test "record stop" ".*=record-stopped,id=\"${decimal}\".*\\^done" \
+ "record end"
+
+mi_gdb_test "target record" ".*=record-started,id=\"${decimal}\".*\\^done" \
+ "target record"
+
+return 0
diff --git a/gdb/testsuite/gdb.mi/mi-reverse.exp b/gdb/testsuite/gdb.mi/mi-reverse.exp
index f65493d..974a095 100644
--- a/gdb/testsuite/gdb.mi/mi-reverse.exp
+++ b/gdb/testsuite/gdb.mi/mi-reverse.exp
@@ -51,7 +51,8 @@ mi_run_to_main
if [supports_process_record] {
# Activate process record/replay
if [mi_gdb_test "-interpreter-exec console record" \
- {\^done} "Turn on process record"] {
+ "=record-started,id=\"1\"\r\n\\^done" \
+ "Turn on process record"] {
warning "Fail to activate process record/replay, tests in this group will not be performed.\n";
return -1
}
--
1.7.7.6
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 1/2] MI notification on tsv created and deleted.
2012-09-12 7:16 [PATCH 0/2] Two MI notifications on TSV and process record Yao Qi
2012-09-12 7:16 ` [PATCH 2/2] MI notification on record started and stopped Yao Qi
@ 2012-09-12 7:16 ` Yao Qi
2012-09-12 17:48 ` Eli Zaretskii
2012-09-13 20:17 ` Tom Tromey
1 sibling, 2 replies; 22+ messages in thread
From: Yao Qi @ 2012-09-12 7:16 UTC (permalink / raw)
To: gdb-patches
This patch is to add MI notifications on TSV creation and deletion.
gdb/doc:
* gdb.texinfo (GDB/MI Async Records): Document new MI
notifications '=tsv-created' and '=tsv-deleted'.
* observer.texi (GDB Observers): New observer tsv_created and
tsv_deleted.
gdb:
* mi/mi-interp.c: Declare mi_tsv_created and mi_tsv_deleted.
(mi_interpreter_init): Call observer_attach_tsv_created and
observer_attach_tsv_deleted.
(mi_tsv_created, mi_tsv_deleted): New.
* tracepoint.c (delete_trace_state_variable): Call
observer_notify_tsv_deleted.
(trace_variable_command): Call observer_notify_tsv_created.
(delete_trace_variable_command): Call
observer_notify_tsv_deleted.
(create_tsv_from_upload): Call observer_notify_tsv_created.
* NEWS: Mention it.
gdb/testsuite:
gdb.trace/mi-tsv-changed.exp: New.
---
gdb/NEWS | 2 +
gdb/doc/gdb.texinfo | 8 ++
gdb/doc/observer.texi | 9 ++
gdb/mi/mi-interp.c | 38 ++++++
gdb/testsuite/gdb.trace/mi-tsv-changed.exp | 171 ++++++++++++++++++++++++++++
gdb/tracepoint.c | 8 ++
6 files changed, 236 insertions(+), 0 deletions(-)
create mode 100644 gdb/testsuite/gdb.trace/mi-tsv-changed.exp
diff --git a/gdb/NEWS b/gdb/NEWS
index 126c2af..dad72af 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -45,6 +45,8 @@ py [command]
"=cmd-param-changed".
** Traceframe changes caused by command "tfind" are now notified using
new async record "=traceframe-changed".
+ ** The creation and deletion of trace state variables are now notified
+ using new async records "=tsv-created" and "=tsv-deleted".
*** Changes in GDB 7.5
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index d9cd578..1e9b4fc 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -27638,6 +27638,14 @@ or @value{GDBN} stops examining traceframes and resumes live debugging.
The number of the tracepoint associated with this traceframe is
@var{tpnum}.
+@item =tsv-created,name=@var{name},value=@var{value}
+Reports that the new trace state variable @var{name} is created with
+value @var{value}.
+
+@item =tsv-deleted,name=@var{name}
+Reports that the trace state variable @var{name} is deleted. If
+@var{name} is @code{NULL}, all trace state variables are deleted.
+
@item =breakpoint-created,bkpt=@{...@}
@itemx =breakpoint-modified,bkpt=@{...@}
@itemx =breakpoint-deleted,id=@var{number}
diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
index 81d3bf9..74aa8c8 100644
--- a/gdb/doc/observer.texi
+++ b/gdb/doc/observer.texi
@@ -242,7 +242,16 @@ The parameter of some @code{set} commands in console are changed. This
method is called after a command @code{set @var{param} @var{value}}.
@var{param} is the parameter of @code{set} command, and @var{value}
is the value of changed parameter.
+@end deftypefun
+
+@deftypefun void tsv_created (const char *@var{name}, LONGEST @var{value})
+The new trace state variable @var{name} is created with value
+@var{value}.
+@end deftypefun
+@deftypefun void tsv_deleted (const char *@var{name})
+The trace state variable @var{name} is deleted. If @var{name} is
+@code{NULL}, all trace state variables are deleted.
@end deftypefun
@deftypefun void test_notification (int @var{somearg})
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 9537aac..5c37bc7 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -69,6 +69,8 @@ static void mi_solib_loaded (struct so_list *solib);
static void mi_solib_unloaded (struct so_list *solib);
static void mi_about_to_proceed (void);
static void mi_traceframe_changed (int tfnum, int tpnum);
+static void mi_tsv_created (const char *name, LONGEST value);
+static void mi_tsv_deleted (const char *name);
static void mi_breakpoint_created (struct breakpoint *b);
static void mi_breakpoint_deleted (struct breakpoint *b);
static void mi_breakpoint_modified (struct breakpoint *b);
@@ -128,6 +130,8 @@ mi_interpreter_init (struct interp *interp, int top_level)
observer_attach_solib_unloaded (mi_solib_unloaded);
observer_attach_about_to_proceed (mi_about_to_proceed);
observer_attach_traceframe_changed (mi_traceframe_changed);
+ observer_attach_tsv_created (mi_tsv_created);
+ observer_attach_tsv_deleted (mi_tsv_deleted);
observer_attach_breakpoint_created (mi_breakpoint_created);
observer_attach_breakpoint_deleted (mi_breakpoint_deleted);
observer_attach_breakpoint_modified (mi_breakpoint_modified);
@@ -537,6 +541,40 @@ mi_traceframe_changed (int tfnum, int tpnum)
gdb_flush (mi->event_channel);
}
+/* Emit notification on creating a trace state variable. */
+
+static void
+mi_tsv_created (const char *name, LONGEST value)
+{
+ struct mi_interp *mi = top_level_interpreter_data ();
+
+ target_terminal_ours ();
+
+ fprintf_unfiltered (mi->event_channel, "tsv-created,"
+ "name=\"%s\",value=\"%s\"\n",
+ name, plongest (value));
+
+ gdb_flush (mi->event_channel);
+}
+
+/* Emit notification on deleting a trace state variable. */
+
+static void
+mi_tsv_deleted (const char *name)
+{
+ struct mi_interp *mi = top_level_interpreter_data ();
+
+ target_terminal_ours ();
+
+ if (name != NULL)
+ fprintf_unfiltered (mi->event_channel, "tsv-deleted,"
+ "name=\"%s\"\n", name);
+ else
+ fprintf_unfiltered (mi->event_channel, "tsv-deleted\n");
+
+ gdb_flush (mi->event_channel);
+}
+
/* Emit notification about a created breakpoint. */
static void
diff --git a/gdb/testsuite/gdb.trace/mi-tsv-changed.exp b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp
new file mode 100644
index 0000000..411efad
--- /dev/null
+++ b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp
@@ -0,0 +1,171 @@
+# Copyright 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib trace-support.exp
+load_lib mi-support.exp
+
+standard_testfile actions.c
+if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
+ executable {debug nowarnings}] != "" } {
+ untested mi-tsv-changed.exp
+ return -1
+}
+
+# Test notifications on creating and deleting TSV.
+
+proc test_create_delete_tsv { } {with_test_prefix "create delete" {
+ global binfile
+ global decimal
+
+ if [mi_gdb_start] {
+ return
+ }
+ mi_gdb_load ${binfile}
+
+ mi_gdb_test "tvariable \$tvar1" \
+ ".*=tsv-created,name=\"tvar1\",value=\"0\"\\\\n.*\\^done" \
+ "tvariable \$tvar1"
+ mi_gdb_test "tvariable \$tvar2 = 45" \
+ ".*=tsv-created,name=\"tvar2\",value=\"45\"\\\\n.*\\^done" \
+ "tvariable \$tvar2"
+
+ mi_gdb_test "delete tvariable \$tvar2" \
+ ".*=tsv-deleted,name=\"tvar2\"\\\\n.*\\^done" \
+ "delete tvariable \$tvar2"
+
+ mi_gdb_test "delete tvariable" \
+ ".*=tsv-deleted\\\\n.*\\^done" \
+ "delete all tvariables"
+
+}}
+
+
+# Test when GDB connects to a disconnected stub, existing TSVs in
+# remote stub can be uploaded to GDB, and GDB emits MI notification
+# for new uploaded TSVs.
+
+proc test_upload_tsv { } { with_test_prefix "upload" {
+
+ global gdbserver_reconnect_p
+ global gdb_prompt
+ global testfile
+ global decimal
+
+ set gdbserver_reconnect_p 1
+ if { [info proc gdb_reconnect] == "" } {
+ return 0
+ }
+
+ clean_restart $testfile
+ if ![runto_main] then {
+ fail "Can't run to main"
+ return 0
+ }
+
+ gdb_test "tvariable \$tvar1" \
+ "Trace state variable \\\$tvar1 created, with initial value 0." \
+ "Create a trace state variable"
+
+ gdb_test "tvariable \$tvar2 = 45" \
+ "Trace state variable \\\$tvar2 created, with initial value 45." \
+ "Create a trace state variable with initial value"
+ # Define a tracepoint otherwise tracing cannot be started.
+ gdb_test "trace main" "Tracepoint $decimal at .*"
+ gdb_test_no_output "tstart" "start trace experiment"
+
+ set test "disconnect"
+ gdb_test_multiple "disconnect" $test {
+ -re "Trace is running but will stop on detach; detach anyway\\? \\(y or n\\) $" {
+ pass $test
+
+ set test "disconnected"
+ gdb_test_multiple "y" $test {
+ -re "$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+ }
+ }
+
+ gdb_exit
+
+ if [mi_gdb_start] {
+ return
+ }
+
+ global srcdir
+ global subdir
+ global binfile
+
+ mi_gdb_reinitialize_dir $srcdir/$subdir
+ mi_gdb_load ${binfile}
+
+ global gdbserver_protocol
+ global gdbserver_gdbport
+
+ send_gdb "47-target-select $gdbserver_protocol $gdbserver_gdbport\n"
+
+ global mi_gdb_prompt
+ set tsv1_created 0
+ set tsv2_created 0
+ gdb_expect {
+ -re "=tsv-created,name=\"tvar1\",value=\"0\"" {
+ set tsv1_created 1
+ exp_continue
+ }
+ -re "=tsv-created,name=\"tvar2\",value=\"45\"" {
+ set tsv2_created 1
+ exp_continue
+ }
+ -re ".*${mi_gdb_prompt}" {
+
+ }
+ }
+
+ if $tsv1_created {
+ pass "tsv1 created"
+ } else {
+ fail "tsv1 created"
+ }
+ if $tsv2_created {
+ pass "tsv2 created"
+ } else {
+ fail "tsv2 created"
+ }
+
+ set gdbserver_reconnect_p 0
+}}
+
+ test_create_delete_tsv
+
+# Test target supports tracepoints or not.
+
+clean_restart $testfile
+
+if ![runto_main] {
+ fail "Can't run to main to check for trace support"
+ return -1
+}
+
+if ![gdb_target_supports_trace] {
+ unsupported "Current target does not support trace"
+ return -1;
+}
+
+gdb_exit
+
+test_upload_tsv
+
+return 0
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 296999b..bdd6f50 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -359,6 +359,9 @@ delete_trace_state_variable (const char *name)
{
xfree ((void *)tsv->name);
VEC_unordered_remove (tsv_s, tvariables, ix);
+
+ observer_notify_tsv_deleted (name);
+
return;
}
@@ -423,6 +426,8 @@ trace_variable_command (char *args, int from_tty)
tsv = create_trace_state_variable (internalvar_name (intvar));
tsv->initial_value = initval;
+ observer_notify_tsv_created (tsv->name, initval);
+
printf_filtered (_("Trace state variable $%s "
"created, with initial value %s.\n"),
tsv->name, plongest (tsv->initial_value));
@@ -442,6 +447,7 @@ delete_trace_variable_command (char *args, int from_tty)
if (query (_("Delete all trace state variables? ")))
VEC_free (tsv_s, tvariables);
dont_repeat ();
+ observer_notify_tsv_deleted (NULL);
return;
}
@@ -3551,6 +3557,8 @@ create_tsv_from_upload (struct uploaded_tsv *utsv)
tsv->initial_value = utsv->initial_value;
tsv->builtin = utsv->builtin;
+ observer_notify_tsv_created (tsv->name, tsv->initial_value);
+
do_cleanups (old_chain);
return tsv;
--
1.7.7.6
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 1/2] MI notification on tsv created and deleted.
2012-09-12 7:16 ` [PATCH 1/2] MI notification on tsv created and deleted Yao Qi
@ 2012-09-12 17:48 ` Eli Zaretskii
2012-09-18 12:19 ` [committed]: " Yao Qi
2012-09-13 20:17 ` Tom Tromey
1 sibling, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2012-09-12 17:48 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
> From: Yao Qi <yao@codesourcery.com>
> Date: Wed, 12 Sep 2012 15:15:17 +0800
>
> +@item =tsv-deleted,name=@var{name}
> +Reports that the trace state variable @var{name} is deleted. If
> +@var{name} is @code{NULL}, all trace state variables are deleted.
From the code I glean that the last sentence is incorrect: when all
tsv's are deleted, the notification is
=tsv-deleted
without the "name=" part.
OK for the documentation parts, provided that you fix the above.
Thanks.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] MI notification on record started and stopped
2012-09-12 7:16 ` [PATCH 2/2] MI notification on record started and stopped Yao Qi
@ 2012-09-12 17:52 ` Eli Zaretskii
2012-09-13 8:57 ` Yao Qi
2012-09-12 18:07 ` Tom Tromey
2012-09-12 19:01 ` Pedro Alves
2 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2012-09-12 17:52 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
> From: Yao Qi <yao@codesourcery.com>
> Date: Wed, 12 Sep 2012 15:15:18 +0800
>
> +@item =record-started,id=@var{id}
> +@item =record-stopped,id=@var{id}
The second line should use "@itemx", otherwise the result will be
ugly.
> +The process record is either started or stoped in process @var{id}.
> +The @var{id} field contains the @value{GDBN} identifier of process.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"contains the @value{GDBN} process ID."
By the way: why is it useful to have the GDB PID part of this
notification? Can you have more than one GDB process at a time that
all communicate on the same wire?
Or did you mean the inferior PID?
Thanks.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] MI notification on record started and stopped
2012-09-12 7:16 ` [PATCH 2/2] MI notification on record started and stopped Yao Qi
2012-09-12 17:52 ` Eli Zaretskii
@ 2012-09-12 18:07 ` Tom Tromey
2012-09-12 19:04 ` Pedro Alves
2012-09-12 19:01 ` Pedro Alves
2 siblings, 1 reply; 22+ messages in thread
From: Tom Tromey @ 2012-09-12 18:07 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
Yao> This patch is to add the MI notification on record started and
Yao> stopped.
Yao> + fprintf_unfiltered (mi->event_channel, "record-%s,id=\"%d\"",
Yao> + started ? "started" : "stopped", inferior->num);
Other MI notifications seem to use "i%d" when identifying an inferior.
Tom
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] MI notification on record started and stopped
2012-09-12 7:16 ` [PATCH 2/2] MI notification on record started and stopped Yao Qi
2012-09-12 17:52 ` Eli Zaretskii
2012-09-12 18:07 ` Tom Tromey
@ 2012-09-12 19:01 ` Pedro Alves
2 siblings, 0 replies; 22+ messages in thread
From: Pedro Alves @ 2012-09-12 19:01 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On 09/12/2012 08:15 AM, Yao Qi wrote:
> + ** The start and stop of process record are not notified using new
> + async record "=record-started" and "=record-stopped".
typo: "now notified"
> +The process record is either started or stoped in process @var{id}.
"stopped"
I'd suggest s/is/was/.
--
Pedro Alves
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] MI notification on record started and stopped
2012-09-12 18:07 ` Tom Tromey
@ 2012-09-12 19:04 ` Pedro Alves
0 siblings, 0 replies; 22+ messages in thread
From: Pedro Alves @ 2012-09-12 19:04 UTC (permalink / raw)
To: Tom Tromey; +Cc: Yao Qi, gdb-patches
On 09/12/2012 07:06 PM, Tom Tromey wrote:
>>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
>
> Yao> This patch is to add the MI notification on record started and
> Yao> stopped.
>
> Yao> + fprintf_unfiltered (mi->event_channel, "record-%s,id=\"%d\"",
> Yao> + started ? "started" : "stopped", inferior->num);
>
> Other MI notifications seem to use "i%d" when identifying an inferior.
>
Yeah, and they use the thread group terminology (of which only inferiors are
supported currently, but could be extended towards itsets). So for consistency IMO,
this would best be thread-group=\"i%d\"".
--
Pedro Alves
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] MI notification on record started and stopped
2012-09-12 17:52 ` Eli Zaretskii
@ 2012-09-13 8:57 ` Yao Qi
2012-09-13 17:33 ` Eli Zaretskii
0 siblings, 1 reply; 22+ messages in thread
From: Yao Qi @ 2012-09-13 8:57 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On 09/13/2012 01:51 AM, Eli Zaretskii wrote:
>> +The process record is either started or stoped in process @var{id}.
>> >+The @var{id} field contains the @value{GDBN} identifier of process.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> "contains the @value{GDBN} process ID."
>
> By the way: why is it useful to have the GDB PID part of this
> notification? Can you have more than one GDB process at a time that
> all communicate on the same wire?
>
> Or did you mean the inferior PID?
I meant the inferior PID. Originally I wrote "inferior ID" in doc, but
I found "inferior ID" is never used in gdb.texinfo. Looks
"@value{GDBN} identifier of the" is used. In this version, I change it
to:
"contains the @value{GDBN} identifier of the process",
because this pattern is used some times in doc. Is it OK?
Tom and Pedro's comments are address as well.
--
Yao
gdb/doc:
* gdb.texinfo (GDB/MI Async Records): Document notification
'record-started' and 'record-stopped'.
* observer.texi (GDB Observers): New observer 'record-changed'.
gdb:
* mi/mi-interp.c: Declare mi_record_changed.
(mi_interpreter_init): Call observer_attach_record_changed.
(mi_record_changed): New.
* record.c (record_open): Call observer_notify_record_changed.
(cmd_record_stop): Call observer_notify_record_changed.
* NEWS: Mention it.
gdb/testsuite:
* gdb.mi/mi-record-changed.exp: New.
* gdb.mi/mi-reverse.exp: Adjust expected output.
---
gdb/NEWS | 2 +
gdb/doc/gdb.texinfo | 6 ++++
gdb/doc/observer.texi | 7 ++++
gdb/mi/mi-interp.c | 15 +++++++++
gdb/record.c | 5 +++
gdb/testsuite/gdb.mi/mi-record-changed.exp | 44 ++++++++++++++++++++++++++++
gdb/testsuite/gdb.mi/mi-reverse.exp | 3 +-
7 files changed, 81 insertions(+), 1 deletions(-)
create mode 100644 gdb/testsuite/gdb.mi/mi-record-changed.exp
diff --git a/gdb/NEWS b/gdb/NEWS
index dad72af..d5220ed 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -47,6 +47,8 @@ py [command]
new async record "=traceframe-changed".
** The creation and deletion of trace state variables are now notified
using new async records "=tsv-created" and "=tsv-deleted".
+ ** The start and stop of process record are now notified using new
+ async record "=record-started" and "=record-stopped".
*** Changes in GDB 7.5
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 376eafa..b6755de 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -27661,6 +27661,12 @@ breakpoint commands; @xref{GDB/MI Breakpoint Commands}. The
Note that if a breakpoint is emitted in the result record of a
command, then it will not also be emitted in an async record.
+@item =record-started,thread-group="@var{id}"
+@itemx =record-stopped,thread-group="@var{id}"
+The process record was either started or stopped in process @var{id}.
+The @var{id} field contains the @value{GDBN} identifier of the
+process .
+
@item =cmd-param-changed,param=@var{param},value=@var{value}
Reports that a parameter of the command @code{set @var{param}} is
changed to @var{value}. In the multi-word @code{set} command,
diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
index 74aa8c8..b874f05 100644
--- a/gdb/doc/observer.texi
+++ b/gdb/doc/observer.texi
@@ -113,6 +113,13 @@ at the entry-point instruction. For @samp{attach} and @samp{core},
inferior, and before any information on the inferior has been printed.
@end deftypefun
+@deftypefun void record_changed (struct inferior *@var{inferior}, int @var{started})
+The status of process record for inferior @var{inferior} in
+@value{GDBN} has changed. The process record is started if
+@var{started} is true, and the process record is stopped if
+@var{started} is false.
+@end deftypefun
+
@deftypefun void solib_loaded (struct so_list *@var{solib})
The shared library specified by @var{solib} has been loaded. Note that
when @value{GDBN} calls this observer, the library's symbols probably
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 5c37bc7..d383958 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -60,6 +60,7 @@ static void mi_on_normal_stop (struct bpstats *bs, int print_frame);
static void mi_new_thread (struct thread_info *t);
static void mi_thread_exit (struct thread_info *t, int silent);
+static void mi_record_changed (struct inferior*, int);
static void mi_inferior_added (struct inferior *inf);
static void mi_inferior_appeared (struct inferior *inf);
static void mi_inferior_exit (struct inferior *inf);
@@ -124,6 +125,7 @@ mi_interpreter_init (struct interp *interp, int top_level)
observer_attach_inferior_appeared (mi_inferior_appeared);
observer_attach_inferior_exit (mi_inferior_exit);
observer_attach_inferior_removed (mi_inferior_removed);
+ observer_attach_record_changed (mi_record_changed);
observer_attach_normal_stop (mi_on_normal_stop);
observer_attach_target_resumed (mi_on_resume);
observer_attach_solib_loaded (mi_solib_loaded);
@@ -381,6 +383,19 @@ mi_thread_exit (struct thread_info *t, int silent)
gdb_flush (mi->event_channel);
}
+/* Emit notification on changing the state of record. */
+
+static void
+mi_record_changed (struct inferior *inferior, int started)
+{
+ struct mi_interp *mi = top_level_interpreter_data ();
+
+ fprintf_unfiltered (mi->event_channel, "record-%s,thread-group=\"i%d\"",
+ started ? "started" : "stopped", inferior->num);
+
+ gdb_flush (mi->event_channel);
+}
+
static void
mi_inferior_added (struct inferior *inf)
{
diff --git a/gdb/record.c b/gdb/record.c
index 5cbac00..c98ed32 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -33,6 +33,7 @@
#include "event-loop.h"
#include "inf-loop.h"
#include "gdb_bfd.h"
+#include "observer.h"
#include <signal.h>
@@ -1001,6 +1002,8 @@ record_open (char *name, int from_tty)
NULL);
record_init_record_breakpoints ();
+
+ observer_notify_record_changed (current_inferior (), 1);
}
/* "to_close" target method. Close the process record target. */
@@ -2260,6 +2263,8 @@ cmd_record_stop (char *args, int from_tty)
unpush_target (&record_ops);
printf_unfiltered (_("Process record is stopped and all execution "
"logs are deleted.\n"));
+
+ observer_notify_record_changed (current_inferior (), 0);
}
else
printf_unfiltered (_("Process record is not started.\n"));
diff --git a/gdb/testsuite/gdb.mi/mi-record-changed.exp b/gdb/testsuite/gdb.mi/mi-record-changed.exp
new file mode 100644
index 0000000..bb54248
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/mi-record-changed.exp
@@ -0,0 +1,44 @@
+# Copyright 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if ![supports_process_record] {
+ return
+}
+
+standard_testfile basics.c
+if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
+ executable {debug nowarnings}] != "" } {
+ untested mi-record-changed.exp
+ return -1
+}
+
+load_lib mi-support.exp
+
+if [mi_gdb_start] {
+ return
+}
+mi_run_to_main
+
+mi_gdb_test "record" ".*=record-started,thread-group=\"i${decimal}\".*\\^done" \
+ "record"
+mi_gdb_test "record stop" \
+ ".*=record-stopped,thread-group=\"i${decimal}\".*\\^done" \
+ "record end"
+
+mi_gdb_test "target record" \
+ ".*=record-started,thread-group=\"i${decimal}\".*\\^done" \
+ "target record"
+
+return 0
diff --git a/gdb/testsuite/gdb.mi/mi-reverse.exp b/gdb/testsuite/gdb.mi/mi-reverse.exp
index f65493d..974a095 100644
--- a/gdb/testsuite/gdb.mi/mi-reverse.exp
+++ b/gdb/testsuite/gdb.mi/mi-reverse.exp
@@ -51,7 +51,8 @@ mi_run_to_main
if [supports_process_record] {
# Activate process record/replay
if [mi_gdb_test "-interpreter-exec console record" \
- {\^done} "Turn on process record"] {
+ "=record-started,id=\"1\"\r\n\\^done" \
+ "Turn on process record"] {
warning "Fail to activate process record/replay, tests in this group will not be performed.\n";
return -1
}
--
1.7.7.6
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] MI notification on record started and stopped
2012-09-13 8:57 ` Yao Qi
@ 2012-09-13 17:33 ` Eli Zaretskii
2012-09-14 2:54 ` Yao Qi
0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2012-09-13 17:33 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
> Date: Thu, 13 Sep 2012 16:56:38 +0800
> From: Yao Qi <yao@codesourcery.com>
> CC: <gdb-patches@sourceware.org>
>
> On 09/13/2012 01:51 AM, Eli Zaretskii wrote:
> >> +The process record is either started or stoped in process @var{id}.
> >> >+The @var{id} field contains the @value{GDBN} identifier of process.
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > "contains the @value{GDBN} process ID."
> >
> > By the way: why is it useful to have the GDB PID part of this
> > notification? Can you have more than one GDB process at a time that
> > all communicate on the same wire?
> >
> > Or did you mean the inferior PID?
>
> I meant the inferior PID. Originally I wrote "inferior ID" in doc, but
> I found "inferior ID" is never used in gdb.texinfo. Looks
> "@value{GDBN} identifier of the" is used. In this version, I change it
> to:
>
> "contains the @value{GDBN} identifier of the process",
>
> because this pattern is used some times in doc. Is it OK?
Sorry, I don't understand: is that parameter the OS PID of the
inferior, or is that the inferior number displayed in the first column
of the "info inferiors" output?
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 1/2] MI notification on tsv created and deleted.
2012-09-12 7:16 ` [PATCH 1/2] MI notification on tsv created and deleted Yao Qi
2012-09-12 17:48 ` Eli Zaretskii
@ 2012-09-13 20:17 ` Tom Tromey
1 sibling, 0 replies; 22+ messages in thread
From: Tom Tromey @ 2012-09-13 20:17 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
Yao> * mi/mi-interp.c: Declare mi_tsv_created and mi_tsv_deleted.
Yao> (mi_interpreter_init): Call observer_attach_tsv_created and
Yao> observer_attach_tsv_deleted.
Yao> (mi_tsv_created, mi_tsv_deleted): New.
Yao> * tracepoint.c (delete_trace_state_variable): Call
Yao> observer_notify_tsv_deleted.
Yao> (trace_variable_command): Call observer_notify_tsv_created.
Yao> (delete_trace_variable_command): Call
Yao> observer_notify_tsv_deleted.
Yao> (create_tsv_from_upload): Call observer_notify_tsv_created.
Yao> * NEWS: Mention it.
Yao> gdb/testsuite:
Yao> gdb.trace/mi-tsv-changed.exp: New.
Looks good to me.
Tom
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] MI notification on record started and stopped
2012-09-13 17:33 ` Eli Zaretskii
@ 2012-09-14 2:54 ` Yao Qi
2012-09-14 9:49 ` Eli Zaretskii
0 siblings, 1 reply; 22+ messages in thread
From: Yao Qi @ 2012-09-14 2:54 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On 09/14/2012 01:33 AM, Eli Zaretskii wrote:
> Sorry, I don't understand: is that parameter the OS PID of the
> inferior, or is that the inferior number displayed in the first column
> of the "info inferiors" output?
The latter. The notification is like '=record-started,thread-group="i1"'.
--
Yao
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] MI notification on record started and stopped
2012-09-14 2:54 ` Yao Qi
@ 2012-09-14 9:49 ` Eli Zaretskii
2012-09-14 11:45 ` Yao Qi
0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2012-09-14 9:49 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
> Date: Fri, 14 Sep 2012 10:53:21 +0800
> From: Yao Qi <yao@codesourcery.com>
> CC: <gdb-patches@sourceware.org>
>
> On 09/14/2012 01:33 AM, Eli Zaretskii wrote:
> > Sorry, I don't understand: is that parameter the OS PID of the
> > inferior, or is that the inferior number displayed in the first column
> > of the "info inferiors" output?
>
> The latter.
Thanks, and sorry for my slow understanding.
In that case, please use "the number assigned by @value{GDBN} to the
inferior".
> The notification is like '=record-started,thread-group="i1"'.
?? If this is a thread-group, why does i1 identify a _process_? Don't
you mean "thread group"?
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] MI notification on record started and stopped
2012-09-14 9:49 ` Eli Zaretskii
@ 2012-09-14 11:45 ` Yao Qi
2012-09-14 12:09 ` Pedro Alves
2012-09-14 13:30 ` [PATCH 2/2] MI notification on record started and stopped Eli Zaretskii
0 siblings, 2 replies; 22+ messages in thread
From: Yao Qi @ 2012-09-14 11:45 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On 09/14/2012 05:49 PM, Eli Zaretskii wrote:
>> The notification is like '=record-started,thread-group="i1"'.
> ?? If this is a thread-group, why does i1 identify a_process_? Don't
> you mean "thread group"?
As matter of fact, this is an inferior, but in MI notification, we call
"inferior" as "thread group", IIUC. So i1 identify an inferior. Your
suggestion "the number assigned by @value{GDBN} to the inferior" is good
to me.
--
Yao
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] MI notification on record started and stopped
2012-09-14 11:45 ` Yao Qi
@ 2012-09-14 12:09 ` Pedro Alves
2012-09-14 13:14 ` Yao Qi
2012-09-14 13:30 ` [PATCH 2/2] MI notification on record started and stopped Eli Zaretskii
1 sibling, 1 reply; 22+ messages in thread
From: Pedro Alves @ 2012-09-14 12:09 UTC (permalink / raw)
To: Yao Qi; +Cc: Eli Zaretskii, gdb-patches
On 09/14/2012 12:44 PM, Yao Qi wrote:
> On 09/14/2012 05:49 PM, Eli Zaretskii wrote:
>>> The notification is like '=record-started,thread-group="i1"'.
>> ?? If this is a thread-group, why does i1 identify a_process_? Don't
>> you mean "thread group"?
>
> As matter of fact, this is an inferior, but in MI notification, we call "inferior" as "thread group", IIUC. So i1 identify an inferior. Your suggestion "the number assigned by @value{GDBN} to the inferior" is good to me.
In these cases, I'd just go and copy what is written in other similar
cases already in the manual. Should make the end overall result a bit more
consistent. For example, borrowing from the "-add-inferior" command's text,
you'd get something like:
"The notification has a single field, @samp{thread-group}, whose value is the
identifier of the thread group corresponding to the affected inferior."
--
Pedro Alves
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] MI notification on record started and stopped
2012-09-14 12:09 ` Pedro Alves
@ 2012-09-14 13:14 ` Yao Qi
2012-09-14 14:13 ` Pedro Alves
0 siblings, 1 reply; 22+ messages in thread
From: Yao Qi @ 2012-09-14 13:14 UTC (permalink / raw)
To: Pedro Alves; +Cc: Eli Zaretskii, gdb-patches
On 09/14/2012 08:08 PM, Pedro Alves wrote:
> On 09/14/2012 12:44 PM, Yao Qi wrote:
>> On 09/14/2012 05:49 PM, Eli Zaretskii wrote:
>>>> The notification is like '=record-started,thread-group="i1"'.
>>> ?? If this is a thread-group, why does i1 identify a_process_? Don't
>>> you mean "thread group"?
>>
>> As matter of fact, this is an inferior, but in MI notification, we call "inferior" as "thread group", IIUC. So i1 identify an inferior. Your suggestion "the number assigned by @value{GDBN} to the inferior" is good to me.
>
> In these cases, I'd just go and copy what is written in other similar
> cases already in the manual. Should make the end overall result a bit more
> consistent. For example, borrowing from the "-add-inferior" command's text,
> you'd get something like:
>
> "The notification has a single field, @samp{thread-group}, whose value is the
> identifier of the thread group corresponding to the affected inferior."
>
How about this?
The process record was either started or stopped in thread group
@var{id}. The @var{id} is the identifier of the thread group
corresponding to the affected inferior.
--
Yao
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] MI notification on record started and stopped
2012-09-14 11:45 ` Yao Qi
2012-09-14 12:09 ` Pedro Alves
@ 2012-09-14 13:30 ` Eli Zaretskii
1 sibling, 0 replies; 22+ messages in thread
From: Eli Zaretskii @ 2012-09-14 13:30 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
> Date: Fri, 14 Sep 2012 19:44:45 +0800
> From: Yao Qi <yao@codesourcery.com>
> CC: <gdb-patches@sourceware.org>
>
> On 09/14/2012 05:49 PM, Eli Zaretskii wrote:
> >> The notification is like '=record-started,thread-group="i1"'.
> > ?? If this is a thread-group, why does i1 identify a_process_? Don't
> > you mean "thread group"?
>
> As matter of fact, this is an inferior, but in MI notification, we call
> "inferior" as "thread group", IIUC. So i1 identify an inferior. Your
> suggestion "the number assigned by @value{GDBN} to the inferior" is good
> to me.
But all the other places that describe thread-group= fields talk about
thread groups, so I think we need to do that here for consistency.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] MI notification on record started and stopped
2012-09-14 13:14 ` Yao Qi
@ 2012-09-14 14:13 ` Pedro Alves
2012-09-21 1:47 ` [committed]: " Yao Qi
0 siblings, 1 reply; 22+ messages in thread
From: Pedro Alves @ 2012-09-14 14:13 UTC (permalink / raw)
To: Yao Qi; +Cc: Eli Zaretskii, gdb-patches
On 09/14/2012 02:13 PM, Yao Qi wrote:
> On 09/14/2012 08:08 PM, Pedro Alves wrote:
>> On 09/14/2012 12:44 PM, Yao Qi wrote:
>>> On 09/14/2012 05:49 PM, Eli Zaretskii wrote:
>>>>> The notification is like '=record-started,thread-group="i1"'.
>>>> ?? If this is a thread-group, why does i1 identify a_process_? Don't
>>>> you mean "thread group"?
>>>
>>> As matter of fact, this is an inferior, but in MI notification, we call "inferior" as "thread group", IIUC. So i1 identify an inferior. Your suggestion "the number assigned by @value{GDBN} to the inferior" is good to me.
>>
>> In these cases, I'd just go and copy what is written in other similar
>> cases already in the manual. Should make the end overall result a bit more
>> consistent. For example, borrowing from the "-add-inferior" command's text,
>> you'd get something like:
>>
>> "The notification has a single field, @samp{thread-group}, whose value is the
>> identifier of the thread group corresponding to the affected inferior."
>>
>
> How about this?
>
> The process record was either started or stopped in thread group
> @var{id}. The @var{id} is the identifier of the thread group
> corresponding to the affected inferior.
Nitpicking at this point, as I think that already conveys the necessary
info. But, I think "Execution log recording" would sound more natural
than "The process record". The mention of @var{id} twice looks
redundant, yet disconnected. So I'd suggest:
Execution log recording was either started or stopped on an
inferior. The @var{id} is the identifier of the thread group
corresponding to the affected inferior.
Thanks,
--
Pedro Alves
^ permalink raw reply [flat|nested] 22+ messages in thread
* [committed]: [PATCH 1/2] MI notification on tsv created and deleted.
2012-09-12 17:48 ` Eli Zaretskii
@ 2012-09-18 12:19 ` Yao Qi
0 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-09-18 12:19 UTC (permalink / raw)
To: gdb-patches
On 09/13/2012 01:47 AM, Eli Zaretskii wrote:
>> From: Yao Qi <yao@codesourcery.com>
>> Date: Wed, 12 Sep 2012 15:15:17 +0800
>>
>> +@item =tsv-deleted,name=@var{name}
>> +Reports that the trace state variable @var{name} is deleted. If
>> +@var{name} is @code{NULL}, all trace state variables are deleted.
>
> From the code I glean that the last sentence is incorrect: when all
> tsv's are deleted, the notification is
>
> =tsv-deleted
>
> without the "name=" part.
>
> OK for the documentation parts, provided that you fix the above.
>
It is fixed, and this is what I committed.
--
Yao
gdb/doc:
* gdb.texinfo (GDB/MI Async Records): Document new MI
notifications '=tsv-created' and '=tsv-deleted'.
* observer.texi (GDB Observers): New observer tsv_created and
tsv_deleted.
gdb:
* mi/mi-interp.c: Declare mi_tsv_created and mi_tsv_deleted.
(mi_interpreter_init): Call observer_attach_tsv_created and
observer_attach_tsv_deleted.
(mi_tsv_created, mi_tsv_deleted): New.
* tracepoint.c (delete_trace_state_variable): Call
observer_notify_tsv_deleted.
(trace_variable_command): Call observer_notify_tsv_created.
(delete_trace_variable_command): Call
observer_notify_tsv_deleted.
(create_tsv_from_upload): Call observer_notify_tsv_created.
* NEWS: Mention it.
gdb/testsuite:
gdb.trace/mi-tsv-changed.exp: New.
---
gdb/NEWS | 2 +
gdb/doc/gdb.texinfo | 9 ++
gdb/doc/observer.texi | 9 ++
gdb/mi/mi-interp.c | 38 ++++++
gdb/testsuite/gdb.trace/mi-tsv-changed.exp | 171 ++++++++++++++++++++++++++++
gdb/tracepoint.c | 8 ++
6 files changed, 237 insertions(+), 0 deletions(-)
create mode 100644 gdb/testsuite/gdb.trace/mi-tsv-changed.exp
diff --git a/gdb/NEWS b/gdb/NEWS
index 126c2af..dad72af 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -45,6 +45,8 @@ py [command]
"=cmd-param-changed".
** Traceframe changes caused by command "tfind" are now notified using
new async record "=traceframe-changed".
+ ** The creation and deletion of trace state variables are now notified
+ using new async records "=tsv-created" and "=tsv-deleted".
*** Changes in GDB 7.5
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index ee03521..cd4513b 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -27639,6 +27639,15 @@ Reports that the trace frame was changed and its new number is
@var{tfnum}. The number of the tracepoint associated with this trace
frame is @var{tpnum}.
+@item =tsv-created,name=@var{name},value=@var{value}
+Reports that the new trace state variable @var{name} is created with
+value @var{value}.
+
+@item =tsv-deleted,name=@var{name}
+@itemx =tsv-deleted
+Reports that the trace state variable @var{name} is deleted or all
+trace state variables are deleted.
+
@item =breakpoint-created,bkpt=@{...@}
@itemx =breakpoint-modified,bkpt=@{...@}
@itemx =breakpoint-deleted,id=@var{number}
diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
index 4270286..09aa91f 100644
--- a/gdb/doc/observer.texi
+++ b/gdb/doc/observer.texi
@@ -242,7 +242,16 @@ The parameter of some @code{set} commands in console are changed. This
method is called after a command @code{set @var{param} @var{value}}.
@var{param} is the parameter of @code{set} command, and @var{value}
is the value of changed parameter.
+@end deftypefun
+
+@deftypefun void tsv_created (const char *@var{name}, LONGEST @var{value})
+The new trace state variable @var{name} is created with value
+@var{value}.
+@end deftypefun
+@deftypefun void tsv_deleted (const char *@var{name})
+The trace state variable @var{name} is deleted. If @var{name} is
+@code{NULL}, all trace state variables are deleted.
@end deftypefun
@deftypefun void test_notification (int @var{somearg})
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 9537aac..5c37bc7 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -69,6 +69,8 @@ static void mi_solib_loaded (struct so_list *solib);
static void mi_solib_unloaded (struct so_list *solib);
static void mi_about_to_proceed (void);
static void mi_traceframe_changed (int tfnum, int tpnum);
+static void mi_tsv_created (const char *name, LONGEST value);
+static void mi_tsv_deleted (const char *name);
static void mi_breakpoint_created (struct breakpoint *b);
static void mi_breakpoint_deleted (struct breakpoint *b);
static void mi_breakpoint_modified (struct breakpoint *b);
@@ -128,6 +130,8 @@ mi_interpreter_init (struct interp *interp, int top_level)
observer_attach_solib_unloaded (mi_solib_unloaded);
observer_attach_about_to_proceed (mi_about_to_proceed);
observer_attach_traceframe_changed (mi_traceframe_changed);
+ observer_attach_tsv_created (mi_tsv_created);
+ observer_attach_tsv_deleted (mi_tsv_deleted);
observer_attach_breakpoint_created (mi_breakpoint_created);
observer_attach_breakpoint_deleted (mi_breakpoint_deleted);
observer_attach_breakpoint_modified (mi_breakpoint_modified);
@@ -537,6 +541,40 @@ mi_traceframe_changed (int tfnum, int tpnum)
gdb_flush (mi->event_channel);
}
+/* Emit notification on creating a trace state variable. */
+
+static void
+mi_tsv_created (const char *name, LONGEST value)
+{
+ struct mi_interp *mi = top_level_interpreter_data ();
+
+ target_terminal_ours ();
+
+ fprintf_unfiltered (mi->event_channel, "tsv-created,"
+ "name=\"%s\",value=\"%s\"\n",
+ name, plongest (value));
+
+ gdb_flush (mi->event_channel);
+}
+
+/* Emit notification on deleting a trace state variable. */
+
+static void
+mi_tsv_deleted (const char *name)
+{
+ struct mi_interp *mi = top_level_interpreter_data ();
+
+ target_terminal_ours ();
+
+ if (name != NULL)
+ fprintf_unfiltered (mi->event_channel, "tsv-deleted,"
+ "name=\"%s\"\n", name);
+ else
+ fprintf_unfiltered (mi->event_channel, "tsv-deleted\n");
+
+ gdb_flush (mi->event_channel);
+}
+
/* Emit notification about a created breakpoint. */
static void
diff --git a/gdb/testsuite/gdb.trace/mi-tsv-changed.exp b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp
new file mode 100644
index 0000000..411efad
--- /dev/null
+++ b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp
@@ -0,0 +1,171 @@
+# Copyright 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib trace-support.exp
+load_lib mi-support.exp
+
+standard_testfile actions.c
+if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
+ executable {debug nowarnings}] != "" } {
+ untested mi-tsv-changed.exp
+ return -1
+}
+
+# Test notifications on creating and deleting TSV.
+
+proc test_create_delete_tsv { } {with_test_prefix "create delete" {
+ global binfile
+ global decimal
+
+ if [mi_gdb_start] {
+ return
+ }
+ mi_gdb_load ${binfile}
+
+ mi_gdb_test "tvariable \$tvar1" \
+ ".*=tsv-created,name=\"tvar1\",value=\"0\"\\\\n.*\\^done" \
+ "tvariable \$tvar1"
+ mi_gdb_test "tvariable \$tvar2 = 45" \
+ ".*=tsv-created,name=\"tvar2\",value=\"45\"\\\\n.*\\^done" \
+ "tvariable \$tvar2"
+
+ mi_gdb_test "delete tvariable \$tvar2" \
+ ".*=tsv-deleted,name=\"tvar2\"\\\\n.*\\^done" \
+ "delete tvariable \$tvar2"
+
+ mi_gdb_test "delete tvariable" \
+ ".*=tsv-deleted\\\\n.*\\^done" \
+ "delete all tvariables"
+
+}}
+
+
+# Test when GDB connects to a disconnected stub, existing TSVs in
+# remote stub can be uploaded to GDB, and GDB emits MI notification
+# for new uploaded TSVs.
+
+proc test_upload_tsv { } { with_test_prefix "upload" {
+
+ global gdbserver_reconnect_p
+ global gdb_prompt
+ global testfile
+ global decimal
+
+ set gdbserver_reconnect_p 1
+ if { [info proc gdb_reconnect] == "" } {
+ return 0
+ }
+
+ clean_restart $testfile
+ if ![runto_main] then {
+ fail "Can't run to main"
+ return 0
+ }
+
+ gdb_test "tvariable \$tvar1" \
+ "Trace state variable \\\$tvar1 created, with initial value 0." \
+ "Create a trace state variable"
+
+ gdb_test "tvariable \$tvar2 = 45" \
+ "Trace state variable \\\$tvar2 created, with initial value 45." \
+ "Create a trace state variable with initial value"
+ # Define a tracepoint otherwise tracing cannot be started.
+ gdb_test "trace main" "Tracepoint $decimal at .*"
+ gdb_test_no_output "tstart" "start trace experiment"
+
+ set test "disconnect"
+ gdb_test_multiple "disconnect" $test {
+ -re "Trace is running but will stop on detach; detach anyway\\? \\(y or n\\) $" {
+ pass $test
+
+ set test "disconnected"
+ gdb_test_multiple "y" $test {
+ -re "$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+ }
+ }
+
+ gdb_exit
+
+ if [mi_gdb_start] {
+ return
+ }
+
+ global srcdir
+ global subdir
+ global binfile
+
+ mi_gdb_reinitialize_dir $srcdir/$subdir
+ mi_gdb_load ${binfile}
+
+ global gdbserver_protocol
+ global gdbserver_gdbport
+
+ send_gdb "47-target-select $gdbserver_protocol $gdbserver_gdbport\n"
+
+ global mi_gdb_prompt
+ set tsv1_created 0
+ set tsv2_created 0
+ gdb_expect {
+ -re "=tsv-created,name=\"tvar1\",value=\"0\"" {
+ set tsv1_created 1
+ exp_continue
+ }
+ -re "=tsv-created,name=\"tvar2\",value=\"45\"" {
+ set tsv2_created 1
+ exp_continue
+ }
+ -re ".*${mi_gdb_prompt}" {
+
+ }
+ }
+
+ if $tsv1_created {
+ pass "tsv1 created"
+ } else {
+ fail "tsv1 created"
+ }
+ if $tsv2_created {
+ pass "tsv2 created"
+ } else {
+ fail "tsv2 created"
+ }
+
+ set gdbserver_reconnect_p 0
+}}
+
+ test_create_delete_tsv
+
+# Test target supports tracepoints or not.
+
+clean_restart $testfile
+
+if ![runto_main] {
+ fail "Can't run to main to check for trace support"
+ return -1
+}
+
+if ![gdb_target_supports_trace] {
+ unsupported "Current target does not support trace"
+ return -1;
+}
+
+gdb_exit
+
+test_upload_tsv
+
+return 0
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 296999b..bdd6f50 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -359,6 +359,9 @@ delete_trace_state_variable (const char *name)
{
xfree ((void *)tsv->name);
VEC_unordered_remove (tsv_s, tvariables, ix);
+
+ observer_notify_tsv_deleted (name);
+
return;
}
@@ -423,6 +426,8 @@ trace_variable_command (char *args, int from_tty)
tsv = create_trace_state_variable (internalvar_name (intvar));
tsv->initial_value = initval;
+ observer_notify_tsv_created (tsv->name, initval);
+
printf_filtered (_("Trace state variable $%s "
"created, with initial value %s.\n"),
tsv->name, plongest (tsv->initial_value));
@@ -442,6 +447,7 @@ delete_trace_variable_command (char *args, int from_tty)
if (query (_("Delete all trace state variables? ")))
VEC_free (tsv_s, tvariables);
dont_repeat ();
+ observer_notify_tsv_deleted (NULL);
return;
}
@@ -3551,6 +3557,8 @@ create_tsv_from_upload (struct uploaded_tsv *utsv)
tsv->initial_value = utsv->initial_value;
tsv->builtin = utsv->builtin;
+ observer_notify_tsv_created (tsv->name, tsv->initial_value);
+
do_cleanups (old_chain);
return tsv;
--
1.7.7.6
^ permalink raw reply [flat|nested] 22+ messages in thread
* [committed]: [PATCH 2/2] MI notification on record started and stopped
2012-09-14 14:13 ` Pedro Alves
@ 2012-09-21 1:47 ` Yao Qi
2012-09-21 6:58 ` Regression for gdb.mi/mi-reverse.exp [Re: [committed]: [PATCH 2/2] MI notification on record started and stopped] Jan Kratochvil
0 siblings, 1 reply; 22+ messages in thread
From: Yao Qi @ 2012-09-21 1:47 UTC (permalink / raw)
To: Pedro Alves, gdb-patches; +Cc: Eli Zaretskii
On 09/14/2012 10:13 PM, Pedro Alves wrote:
> On 09/14/2012 02:13 PM, Yao Qi wrote:
>> On 09/14/2012 08:08 PM, Pedro Alves wrote:
>>> On 09/14/2012 12:44 PM, Yao Qi wrote:
>>>> On 09/14/2012 05:49 PM, Eli Zaretskii wrote:
>>>>>> The notification is like '=record-started,thread-group="i1"'.
>>>>> ?? If this is a thread-group, why does i1 identify a_process_? Don't
>>>>> you mean "thread group"?
>>>>
>>>> As matter of fact, this is an inferior, but in MI notification, we call "inferior" as "thread group", IIUC. So i1 identify an inferior. Your suggestion "the number assigned by @value{GDBN} to the inferior" is good to me.
>>>
>>> In these cases, I'd just go and copy what is written in other similar
>>> cases already in the manual. Should make the end overall result a bit more
>>> consistent. For example, borrowing from the "-add-inferior" command's text,
>>> you'd get something like:
>>>
>>> "The notification has a single field, @samp{thread-group}, whose value is the
>>> identifier of the thread group corresponding to the affected inferior."
>>>
>>
>> How about this?
>>
>> The process record was either started or stopped in thread group
>> @var{id}. The @var{id} is the identifier of the thread group
>> corresponding to the affected inferior.
>
> Nitpicking at this point, as I think that already conveys the necessary
> info. But, I think "Execution log recording" would sound more natural
> than "The process record". The mention of @var{id} twice looks
> redundant, yet disconnected. So I'd suggest:
>
> Execution log recording was either started or stopped on an
> inferior. The @var{id} is the identifier of the thread group
> corresponding to the affected inferior.
>
OK. This is what I committed.
> Thanks,
>
--
Yao
gdb/doc:
2012-09-21 Yao Qi <yao@codesourcery.com>
Pedro Alves <palves@redhat.com>
* gdb.texinfo (GDB/MI Async Records): Document notification
'record-started' and 'record-stopped'.
* observer.texi (GDB Observers): New observer 'record-changed'.
gdb:
2012-09-21 Yao Qi <yao@codesourcery.com>
* mi/mi-interp.c: Declare mi_record_changed.
(mi_interpreter_init): Call observer_attach_record_changed.
(mi_record_changed): New.
* record.c (record_open): Call observer_notify_record_changed.
(cmd_record_stop): Call observer_notify_record_changed.
* NEWS: Mention it.
gdb/testsuite:
2012-09-21 Yao Qi <yao@codesourcery.com>
* gdb.mi/mi-record-changed.exp: New.
* gdb.mi/mi-reverse.exp: Adjust expected output.
---
gdb/NEWS | 2 +
gdb/doc/gdb.texinfo | 6 ++++
gdb/doc/observer.texi | 7 ++++
gdb/mi/mi-interp.c | 15 +++++++++
gdb/record.c | 5 +++
gdb/testsuite/gdb.mi/mi-record-changed.exp | 44 ++++++++++++++++++++++++++++
gdb/testsuite/gdb.mi/mi-reverse.exp | 3 +-
7 files changed, 81 insertions(+), 1 deletions(-)
create mode 100644 gdb/testsuite/gdb.mi/mi-record-changed.exp
diff --git a/gdb/NEWS b/gdb/NEWS
index 365b2d4..8351467 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -53,6 +53,8 @@ py [command]
new async record "=traceframe-changed".
** The creation and deletion of trace state variables are now notified
using new async records "=tsv-created" and "=tsv-deleted".
+ ** The start and stop of process record are now notified using new
+ async record "=record-started" and "=record-stopped".
*** Changes in GDB 7.5
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 1c8c1c2..5fcbada 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -27658,6 +27658,12 @@ breakpoint commands; @xref{GDB/MI Breakpoint Commands}. The
Note that if a breakpoint is emitted in the result record of a
command, then it will not also be emitted in an async record.
+@item =record-started,thread-group="@var{id}"
+@itemx =record-stopped,thread-group="@var{id}"
+Execution log recording was either started or stopped on an
+inferior. The @var{id} is the @value{GDBN} identifier of the thread
+group corresponding to the affected inferior.
+
@item =cmd-param-changed,param=@var{param},value=@var{value}
Reports that a parameter of the command @code{set @var{param}} is
changed to @var{value}. In the multi-word @code{set} command,
diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
index 09aa91f..a27e983 100644
--- a/gdb/doc/observer.texi
+++ b/gdb/doc/observer.texi
@@ -113,6 +113,13 @@ at the entry-point instruction. For @samp{attach} and @samp{core},
inferior, and before any information on the inferior has been printed.
@end deftypefun
+@deftypefun void record_changed (struct inferior *@var{inferior}, int @var{started})
+The status of process record for inferior @var{inferior} in
+@value{GDBN} has changed. The process record is started if
+@var{started} is true, and the process record is stopped if
+@var{started} is false.
+@end deftypefun
+
@deftypefun void solib_loaded (struct so_list *@var{solib})
The shared library specified by @var{solib} has been loaded. Note that
when @value{GDBN} calls this observer, the library's symbols probably
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 5c37bc7..d383958 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -60,6 +60,7 @@ static void mi_on_normal_stop (struct bpstats *bs, int print_frame);
static void mi_new_thread (struct thread_info *t);
static void mi_thread_exit (struct thread_info *t, int silent);
+static void mi_record_changed (struct inferior*, int);
static void mi_inferior_added (struct inferior *inf);
static void mi_inferior_appeared (struct inferior *inf);
static void mi_inferior_exit (struct inferior *inf);
@@ -124,6 +125,7 @@ mi_interpreter_init (struct interp *interp, int top_level)
observer_attach_inferior_appeared (mi_inferior_appeared);
observer_attach_inferior_exit (mi_inferior_exit);
observer_attach_inferior_removed (mi_inferior_removed);
+ observer_attach_record_changed (mi_record_changed);
observer_attach_normal_stop (mi_on_normal_stop);
observer_attach_target_resumed (mi_on_resume);
observer_attach_solib_loaded (mi_solib_loaded);
@@ -381,6 +383,19 @@ mi_thread_exit (struct thread_info *t, int silent)
gdb_flush (mi->event_channel);
}
+/* Emit notification on changing the state of record. */
+
+static void
+mi_record_changed (struct inferior *inferior, int started)
+{
+ struct mi_interp *mi = top_level_interpreter_data ();
+
+ fprintf_unfiltered (mi->event_channel, "record-%s,thread-group=\"i%d\"",
+ started ? "started" : "stopped", inferior->num);
+
+ gdb_flush (mi->event_channel);
+}
+
static void
mi_inferior_added (struct inferior *inf)
{
diff --git a/gdb/record.c b/gdb/record.c
index 5cbac00..c98ed32 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -33,6 +33,7 @@
#include "event-loop.h"
#include "inf-loop.h"
#include "gdb_bfd.h"
+#include "observer.h"
#include <signal.h>
@@ -1001,6 +1002,8 @@ record_open (char *name, int from_tty)
NULL);
record_init_record_breakpoints ();
+
+ observer_notify_record_changed (current_inferior (), 1);
}
/* "to_close" target method. Close the process record target. */
@@ -2260,6 +2263,8 @@ cmd_record_stop (char *args, int from_tty)
unpush_target (&record_ops);
printf_unfiltered (_("Process record is stopped and all execution "
"logs are deleted.\n"));
+
+ observer_notify_record_changed (current_inferior (), 0);
}
else
printf_unfiltered (_("Process record is not started.\n"));
diff --git a/gdb/testsuite/gdb.mi/mi-record-changed.exp b/gdb/testsuite/gdb.mi/mi-record-changed.exp
new file mode 100644
index 0000000..bb54248
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/mi-record-changed.exp
@@ -0,0 +1,44 @@
+# Copyright 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if ![supports_process_record] {
+ return
+}
+
+standard_testfile basics.c
+if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
+ executable {debug nowarnings}] != "" } {
+ untested mi-record-changed.exp
+ return -1
+}
+
+load_lib mi-support.exp
+
+if [mi_gdb_start] {
+ return
+}
+mi_run_to_main
+
+mi_gdb_test "record" ".*=record-started,thread-group=\"i${decimal}\".*\\^done" \
+ "record"
+mi_gdb_test "record stop" \
+ ".*=record-stopped,thread-group=\"i${decimal}\".*\\^done" \
+ "record end"
+
+mi_gdb_test "target record" \
+ ".*=record-started,thread-group=\"i${decimal}\".*\\^done" \
+ "target record"
+
+return 0
diff --git a/gdb/testsuite/gdb.mi/mi-reverse.exp b/gdb/testsuite/gdb.mi/mi-reverse.exp
index f65493d..974a095 100644
--- a/gdb/testsuite/gdb.mi/mi-reverse.exp
+++ b/gdb/testsuite/gdb.mi/mi-reverse.exp
@@ -51,7 +51,8 @@ mi_run_to_main
if [supports_process_record] {
# Activate process record/replay
if [mi_gdb_test "-interpreter-exec console record" \
- {\^done} "Turn on process record"] {
+ "=record-started,id=\"1\"\r\n\\^done" \
+ "Turn on process record"] {
warning "Fail to activate process record/replay, tests in this group will not be performed.\n";
return -1
}
--
1.7.7.6
^ permalink raw reply [flat|nested] 22+ messages in thread
* Regression for gdb.mi/mi-reverse.exp [Re: [committed]: [PATCH 2/2] MI notification on record started and stopped]
2012-09-21 1:47 ` [committed]: " Yao Qi
@ 2012-09-21 6:58 ` Jan Kratochvil
2012-09-21 7:26 ` Yao Qi
0 siblings, 1 reply; 22+ messages in thread
From: Jan Kratochvil @ 2012-09-21 6:58 UTC (permalink / raw)
To: Yao Qi; +Cc: Pedro Alves, gdb-patches, Eli Zaretskii
On Fri, 21 Sep 2012 03:46:44 +0200, Yao Qi wrote:
> OK. This is what I committed.
It happens on all my tested platforms like Fedora 16/17 (but not 18), not sure
if there is a race:
052e8b6ee41e74bcb1c19b171f3c96ca74c20224 is the first bad commit
commit 052e8b6ee41e74bcb1c19b171f3c96ca74c20224
Author: qiyao <qiyao>
Date: Fri Sep 21 01:46:39 2012 +0000
Running gdb/testsuite/gdb.mi/mi-reverse.exp ...
PASS: gdb.mi/mi-reverse.exp: breakpoint at main
PASS: gdb.mi/mi-reverse.exp: mi runto main
-PASS: gdb.mi/mi-reverse.exp: Turn on process record
-PASS: gdb.mi/mi-reverse.exp: breakpoint at callme
-PASS: gdb.mi/mi-reverse.exp: mi runto callme
-PASS: gdb.mi/mi-reverse.exp: reverse finish from callme
-PASS: gdb.mi/mi-reverse.exp: reverse next to get over the call to do_nothing
-PASS: gdb.mi/mi-reverse.exp: reverse step to callee1
-PASS: gdb.mi/mi-reverse.exp: reverse step to callee2
-PASS: gdb.mi/mi-reverse.exp: reverse step to callee3
-PASS: gdb.mi/mi-reverse.exp: reverse step to callee4
-PASS: gdb.mi/mi-reverse.exp: reverse-step-instruction at callee4
-PASS: gdb.mi/mi-reverse.exp: reverse-next-instruction at callee4
-PASS: gdb.mi/mi-reverse.exp: insert temp breakpoint at basics.c:32
-PASS: gdb.mi/mi-reverse.exp: reverse-continue at callee3
-PASS: gdb.mi/mi-reverse.exp: reverse-continue at main
+FAIL: gdb.mi/mi-reverse.exp: Turn on process record
+WARNING: Fail to activate process record/replay, tests in this group will not be performed.
PASS: gdb.mi/mi-reverse.exp: mi runto main
Expecting: ^(-interpreter-exec console record[^M
-]+)?(\^done[^M
+]+)?(=record-started,id="1"^M
+\^done[^M
]+[(]gdb[)] ^M
[ ]*)
-interpreter-exec console record^M
+=record-started,thread-group="i1"^M
^done^M
(gdb) ^M
-PASS: gdb.mi/mi-reverse.exp: Turn on process record
-Expecting: ^(200-break-insert -t callme[^M
[...]
+FAIL: gdb.mi/mi-reverse.exp: Turn on process record
+WARNING: Fail to activate process record/replay, tests in this group will not be performed.
Regards,
Jan
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Regression for gdb.mi/mi-reverse.exp [Re: [committed]: [PATCH 2/2] MI notification on record started and stopped]
2012-09-21 6:58 ` Regression for gdb.mi/mi-reverse.exp [Re: [committed]: [PATCH 2/2] MI notification on record started and stopped] Jan Kratochvil
@ 2012-09-21 7:26 ` Yao Qi
0 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-09-21 7:26 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Pedro Alves, gdb-patches, Eli Zaretskii
On 09/21/2012 02:58 PM, Jan Kratochvil wrote:
> PASS: gdb.mi/mi-reverse.exp: mi runto main
> Expecting: ^(-interpreter-exec console record[^M
> -]+)?(\^done[^M
> +]+)?(=record-started,id="1"^M
> +\^done[^M
> ]+[(]gdb[)] ^M
> [ ]*)
> -interpreter-exec console record^M
> +=record-started,thread-group="i1"^M
After changed the output in "=record-started" notification, I forgot to
update the expected output here, and it causes the regression.
Committed.
--
Yao
gdb/testsuite:
2012-09-21 Yao Qi <yao@codesourcery.com>
* gdb.mi/mi-reverse.exp: Fix the typo in expected output of
"=record-started" notification.
---
gdb/testsuite/gdb.mi/mi-reverse.exp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gdb/testsuite/gdb.mi/mi-reverse.exp b/gdb/testsuite/gdb.mi/mi-reverse.exp
index 974a095..06a0943 100644
--- a/gdb/testsuite/gdb.mi/mi-reverse.exp
+++ b/gdb/testsuite/gdb.mi/mi-reverse.exp
@@ -51,7 +51,7 @@ mi_run_to_main
if [supports_process_record] {
# Activate process record/replay
if [mi_gdb_test "-interpreter-exec console record" \
- "=record-started,id=\"1\"\r\n\\^done" \
+ "=record-started,thread-group=\"i1\"\r\n\\^done" \
"Turn on process record"] {
warning "Fail to activate process record/replay, tests in this group will not be performed.\n";
return -1
--
1.7.7.6
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2012-09-21 7:26 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-12 7:16 [PATCH 0/2] Two MI notifications on TSV and process record Yao Qi
2012-09-12 7:16 ` [PATCH 2/2] MI notification on record started and stopped Yao Qi
2012-09-12 17:52 ` Eli Zaretskii
2012-09-13 8:57 ` Yao Qi
2012-09-13 17:33 ` Eli Zaretskii
2012-09-14 2:54 ` Yao Qi
2012-09-14 9:49 ` Eli Zaretskii
2012-09-14 11:45 ` Yao Qi
2012-09-14 12:09 ` Pedro Alves
2012-09-14 13:14 ` Yao Qi
2012-09-14 14:13 ` Pedro Alves
2012-09-21 1:47 ` [committed]: " Yao Qi
2012-09-21 6:58 ` Regression for gdb.mi/mi-reverse.exp [Re: [committed]: [PATCH 2/2] MI notification on record started and stopped] Jan Kratochvil
2012-09-21 7:26 ` Yao Qi
2012-09-14 13:30 ` [PATCH 2/2] MI notification on record started and stopped Eli Zaretskii
2012-09-12 18:07 ` Tom Tromey
2012-09-12 19:04 ` Pedro Alves
2012-09-12 19:01 ` Pedro Alves
2012-09-12 7:16 ` [PATCH 1/2] MI notification on tsv created and deleted Yao Qi
2012-09-12 17:48 ` Eli Zaretskii
2012-09-18 12:19 ` [committed]: " Yao Qi
2012-09-13 20:17 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox