This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Add record_start and record_stop functions.
- From: Tim Wiederhake <twiederh at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 14 Feb 2017 10:07:14 -0000
- Subject: [binutils-gdb] Add record_start and record_stop functions.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=45b196c59065cd2c5b750b78a0329d42f6e924b1
commit 45b196c59065cd2c5b750b78a0329d42f6e924b1
Author: Tim Wiederhake <tim.wiederhake@intel.com>
Date: Mon Nov 21 16:39:57 2016 +0100
Add record_start and record_stop functions.
Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com>
gdb/ChangeLog
* record.h (record_start, record_stop): New export.
* record.c (record_start, record_stop): New function.
Change-Id: If235d4bde8ec61dab6dbd23e087430e66d2e91a7
Diff:
---
gdb/record.c | 42 ++++++++++++++++++++++++++++++++++++++++++
gdb/record.h | 8 ++++++++
2 files changed, 50 insertions(+)
diff --git a/gdb/record.c b/gdb/record.c
index 15271b2..eff8fe1 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -93,6 +93,48 @@ record_preopen (void)
/* See record.h. */
+void
+record_start (const char *method, const char *format, int from_tty)
+{
+ if (method == NULL)
+ {
+ if (format == NULL)
+ execute_command_to_string ("record", from_tty);
+ else
+ error (_("Invalid format."));
+ }
+ else if (strcmp (method, "full") == 0)
+ {
+ if (format == NULL)
+ execute_command_to_string ("record full", from_tty);
+ else
+ error (_("Invalid format."));
+ }
+ else if (strcmp (method, "btrace") == 0)
+ {
+ if (format == NULL)
+ execute_command_to_string ("record btrace", from_tty);
+ else if (strcmp (format, "bts") == 0)
+ execute_command_to_string ("record btrace bts", from_tty);
+ else if (strcmp (format, "pt") == 0)
+ execute_command_to_string ("record btrace pt", from_tty);
+ else
+ error (_("Invalid format."));
+ }
+ else
+ error (_("Invalid method."));
+}
+
+/* See record.h. */
+
+void
+record_stop (int from_tty)
+{
+ execute_command_to_string ("record stop", from_tty);
+}
+
+/* See record.h. */
+
int
record_read_memory (struct gdbarch *gdbarch,
CORE_ADDR memaddr, gdb_byte *myaddr,
diff --git a/gdb/record.h b/gdb/record.h
index e1d4aae..cff4506 100644
--- a/gdb/record.h
+++ b/gdb/record.h
@@ -91,4 +91,12 @@ extern struct target_ops *find_record_target (void);
it does anything. */
extern void record_preopen (void);
+/* Start recording with the given METHOD and FORMAT. NULL means default method
+ or format. Throw on failure or invalid method / format. */
+extern void record_start (const char *method, const char *format,
+ int from_tty);
+
+/* Stop recording. Throw on failure. */
+extern void record_stop (int from_tty);
+
#endif /* _RECORD_H_ */