+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.
+
2012-09-20 Tom Tromey <tromey@redhat.com>
* NEWS: Update.
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
+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'.
+
2012-09-19 Thomas Schwinge <thomas@codesourcery.com>
* gdb.texinfo: Document the removal of SH's 'regs' command.
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,
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
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);
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);
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)
{
#include "event-loop.h"
#include "inf-loop.h"
#include "gdb_bfd.h"
+#include "observer.h"
#include <signal.h>
NULL);
record_init_record_breakpoints ();
+
+ observer_notify_record_changed (current_inferior (), 1);
}
/* "to_close" target method. Close the process record target. */
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"));
+2012-09-21 Yao Qi <yao@codesourcery.com>
+
+ * gdb.mi/mi-record-changed.exp: New.
+ * gdb.mi/mi-reverse.exp: Adjust expected output.
+
2012-09-20 Tom Tromey <tromey@redhat.com>
* gdb.python/python.exp: Test atexit.register.
--- /dev/null
+# 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
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
}