aboutsummaryrefslogtreecommitdiff
path: root/gdb/tracepoint.c
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2013-03-14 09:02:30 +0000
committerYao Qi <yao@codesourcery.com>2013-03-14 09:02:30 +0000
commitd0353e76919f8bd8cfdd0e9da13fa16ab95df2d3 (patch)
treed751aa23ce561e260256105b4fc16e18e87f2551 /gdb/tracepoint.c
parent6f2ef5f590ac789d01b27e3463d0d69cb339b4e4 (diff)
downloadgdb-d0353e76919f8bd8cfdd0e9da13fa16ab95df2d3.zip
gdb-d0353e76919f8bd8cfdd0e9da13fa16ab95df2d3.tar.gz
gdb-d0353e76919f8bd8cfdd0e9da13fa16ab95df2d3.tar.bz2
gdb/
2013-03-14 Hui Zhu <hui@codesourcery.com> Yao Qi <yao@codesourcery.com> * Makefile.in (REMOTE_OBS): Add ctf.o. (SFILES): Add ctf.c. (HFILES_NO_SRCDIR): Add ctf.h. * ctf.c, ctf.h: New files. * tracepoint.c: Include 'ctf.h'. (collect_pseudocommand): Remove static. (trace_save_command): Parse option "-ctf". Produce different trace file writers per option. Adjust output message. (trace_save_tfile, trace_save_ctf): New. * tracepoint.h (trace_save_tfile, trace_save_ctf): Declare. * mi/mi-main.c: Include 'ctf.h'. (mi_cmd_trace_save): Handle option '-ctf'. Call either trace_save_tfile or trace_save_ctf. * NEWS: Mention these changes. gdb/doc/ 2013-03-14 Hui Zhu <hui@codesourcery.com> Yao Qi <yao@codesourcery.com> * gdb.texinfo (Trace Files): Add "tsave -ctf".
Diffstat (limited to 'gdb/tracepoint.c')
-rw-r--r--gdb/tracepoint.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 2bfa500..d579fb4 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -53,6 +53,7 @@
#include "exceptions.h"
#include "cli/cli-utils.h"
#include "probe.h"
+#include "ctf.h"
/* readline include files */
#include "readline/readline.h"
@@ -3544,6 +3545,7 @@ trace_save_command (char *args, int from_tty)
char **argv;
char *filename = NULL;
struct cleanup *back_to;
+ int generate_ctf = 0;
struct trace_file_writer *writer = NULL;
if (args == NULL)
@@ -3556,6 +3558,8 @@ trace_save_command (char *args, int from_tty)
{
if (strcmp (*argv, "-r") == 0)
target_does_save = 1;
+ if (strcmp (*argv, "-ctf") == 0)
+ generate_ctf = 1;
else if (**argv == '-')
error (_("unknown option `%s'"), *argv);
else
@@ -3565,14 +3569,18 @@ trace_save_command (char *args, int from_tty)
if (!filename)
error_no_arg (_("file in which to save trace data"));
- writer = tfile_trace_file_writer_new ();
+ if (generate_ctf)
+ writer = ctf_trace_file_writer_new ();
+ else
+ writer = tfile_trace_file_writer_new ();
make_cleanup (trace_file_writer_xfree, writer);
trace_save (filename, writer, target_does_save);
if (from_tty)
- printf_filtered (_("Trace data saved to file '%s'.\n"), filename);
+ printf_filtered (_("Trace data saved to %s '%s'.\n"),
+ generate_ctf ? "directory" : "file", filename);
do_cleanups (back_to);
}
@@ -3591,6 +3599,21 @@ trace_save_tfile (const char *filename, int target_does_save)
do_cleanups (back_to);
}
+/* Save the trace data to dir DIRNAME of ctf format. */
+
+void
+trace_save_ctf (const char *dirname, int target_does_save)
+{
+ struct trace_file_writer *writer;
+ struct cleanup *back_to;
+
+ writer = ctf_trace_file_writer_new ();
+ back_to = make_cleanup (trace_file_writer_xfree, writer);
+
+ trace_save (dirname, writer, target_does_save);
+ do_cleanups (back_to);
+}
+
/* Tell the target what to do with an ongoing tracing run if GDB
disconnects for some reason. */
@@ -5657,6 +5680,7 @@ _initialize_tracepoint (void)
add_com ("tsave", class_trace, trace_save_command, _("\
Save the trace data to a file.\n\
+Use the '-ctf' option to save the data to CTF format.\n\
Use the '-r' option to direct the target to save directly to the file,\n\
using its own filesystem."));