diff options
author | Yao Qi <yao@codesourcery.com> | 2013-03-14 09:02:30 +0000 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2013-03-14 09:02:30 +0000 |
commit | d0353e76919f8bd8cfdd0e9da13fa16ab95df2d3 (patch) | |
tree | d751aa23ce561e260256105b4fc16e18e87f2551 /gdb/mi | |
parent | 6f2ef5f590ac789d01b27e3463d0d69cb339b4e4 (diff) | |
download | gdb-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/mi')
-rw-r--r-- | gdb/mi/mi-main.c | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 085439b..94fda8f 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -49,6 +49,7 @@ #include "osdata.h" #include "splay-tree.h" #include "tracepoint.h" +#include "ctf.h" #include "ada-lang.h" #include "linespec.h" @@ -2477,25 +2478,45 @@ void mi_cmd_trace_save (char *command, char **argv, int argc) { int target_saves = 0; + int generate_ctf = 0; char *filename; + int oind = 0; + char *oarg; - if (argc != 1 && argc != 2) - error (_("Usage: -trace-save [-r] filename")); - - if (argc == 2) + enum opt + { + TARGET_SAVE_OPT, CTF_OPT + }; + static const struct mi_opt opts[] = { - filename = argv[1]; - if (strcmp (argv[0], "-r") == 0) - target_saves = 1; - else - error (_("Invalid option: %s"), argv[0]); - } - else + {"r", TARGET_SAVE_OPT, 0}, + {"ctf", CTF_OPT, 0}, + { 0, 0, 0 } + }; + + while (1) { - filename = argv[0]; + int opt = mi_getopt ("-trace-save", argc, argv, opts, + &oind, &oarg); + + if (opt < 0) + break; + switch ((enum opt) opt) + { + case TARGET_SAVE_OPT: + target_saves = 1; + break; + case CTF_OPT: + generate_ctf = 1; + break; + } } + filename = argv[oind]; - trace_save_tfile (filename, target_saves); + if (generate_ctf) + trace_save_ctf (filename, target_saves); + else + trace_save_tfile (filename, target_saves); } void |