diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2016-05-30 17:29:39 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2016-06-06 17:10:18 -0400 |
commit | 38b022b4452f996fb5a8598f80d850b594621bcf (patch) | |
tree | 8ed5065415b8788590724df647994b0162e1d203 /gdb/mi/mi-interp.c | |
parent | e2cbcd9156d1606a9f2153aecd93a89fe6e29180 (diff) | |
download | gdb-38b022b4452f996fb5a8598f80d850b594621bcf.zip gdb-38b022b4452f996fb5a8598f80d850b594621bcf.tar.gz gdb-38b022b4452f996fb5a8598f80d850b594621bcf.tar.bz2 |
Add method/format information to =record-started
Eclipse CDT now supports enabling execution recording using two methods
(full and btrace) and both formats for btrace (bts and pt). In the
event that recording is enabled behind the back of the GUI (by the user
on the command line, or a script), we need to know which method/format
are being used, so it can be correctly reflected in the interface. This
patch adds this information to the =record-started async record.
Before:
=record-started,thread-group="i1"
After:
=record-started,thread-group="i1",method="btrace",format="bts"
=record-started,thread-group="i1",method="btrace",format="pt"
=record-started,thread-group="i1",method="full"
The "format" field is only present when the current method supports
multiple formats (only the btrace method as of now).
gdb/ChangeLog:
* NEWS: Mention the new fields in =record-started.
* common/btrace-common.h (btrace_format_short_string): New function
declaration.
* common/btrace-common.c (btrace_format_short_string): New
function.
* mi/mi-interp.c (mi_record_changed): Output method and format
fields in the =record-started record.
* record-btrace.c (record_btrace_open): Adapt record_changed
notification.
* record-full.c (record_full_open): Likewise.
* record.c (cmd_record_stop): Likewise.
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Async Records): Document method and
format fields in =record-started.
* observer.texi (record_changed): Add method and format
parameters.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-record-changed.exp: Adjust =record-started output
matching.
Diffstat (limited to 'gdb/mi/mi-interp.c')
-rw-r--r-- | gdb/mi/mi-interp.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 0fe19af..8ce816c 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -65,7 +65,8 @@ static void mi_on_no_history (void); 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_record_changed (struct inferior*, int, const char *, + const char *); static void mi_inferior_added (struct inferior *inf); static void mi_inferior_appeared (struct inferior *inf); static void mi_inferior_exit (struct inferior *inf); @@ -399,7 +400,8 @@ mi_thread_exit (struct thread_info *t, int silent) /* Emit notification on changing the state of record. */ static void -mi_record_changed (struct inferior *inferior, int started) +mi_record_changed (struct inferior *inferior, int started, const char *method, + const char *format) { struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data (); struct cleanup *old_chain; @@ -407,8 +409,23 @@ mi_record_changed (struct inferior *inferior, int started) old_chain = make_cleanup_restore_target_terminal (); target_terminal_ours_for_output (); - fprintf_unfiltered (mi->event_channel, "record-%s,thread-group=\"i%d\"", - started ? "started" : "stopped", inferior->num); + if (started) + { + if (format != NULL) + fprintf_unfiltered ( + mi->event_channel, + "record-started,thread-group=\"i%d\",method=\"%s\",format=\"%s\"", + inferior->num, method, format); + else + fprintf_unfiltered ( + mi->event_channel, + "record-started,thread-group=\"i%d\",method=\"%s\"", + inferior->num, method); + } + else + fprintf_unfiltered (mi->event_channel, + "record-stopped,thread-group=\"i%d\"", inferior->num); + gdb_flush (mi->event_channel); |