This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 4/8] Add record_start function.
- From: Tim Wiederhake <tim dot wiederhake at intel dot com>
- To: gdb-patches at sourceware dot org
- Cc: palves at redhat dot com, markus dot t dot metzger at intel dot com
- Date: Fri, 4 Nov 2016 08:54:30 +0100
- Subject: [PATCH v2 4/8] Add record_start function.
- Authentication-results: sourceware.org; auth=none
- References: <1478246074-14526-1-git-send-email-tim.wiederhake@intel.com>
2016-11-04 Tim Wiederhake <tim.wiederhake@intel.com>
gdb/ChangeLog
* record.h (record_start): New export.
* record.c (record_start): New function.
---
gdb/record.c | 28 ++++++++++++++++++++++++++++
gdb/record.h | 5 +++++
2 files changed, 33 insertions(+)
diff --git a/gdb/record.c b/gdb/record.c
index 34ebd1b..1ab81bc 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -93,6 +93,34 @@ record_preopen (void)
/* See record.h. */
+void
+record_start (const char *method, const char *format, int from_tty)
+{
+ if (method == NULL)
+ {
+ if (format == NULL)
+ return execute_command ("record", from_tty);
+ }
+ else if (strncmp (method, "full", sizeof ("full")) == 0)
+ {
+ if (format == NULL)
+ return execute_command ("record full", from_tty);
+ }
+ else if (strncmp (method, "btrace", sizeof ("btrace")) == 0)
+ {
+ if (format == NULL)
+ return execute_command ("record btrace", from_tty);
+ if (strncmp (format, "bts", sizeof ("bts")) == 0)
+ return execute_command ("record btrace bts", from_tty);
+ if (strncmp (format, "pt", sizeof ("pt")) == 0)
+ return execute_command ("record btrace pt", from_tty);
+ }
+
+ error (_("Invalid argument."));
+}
+
+/* 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 84440c64..eb091ce 100644
--- a/gdb/record.h
+++ b/gdb/record.h
@@ -91,4 +91,9 @@ extern struct target_ops *find_record_target (void);
it does anything. */
extern void record_preopen (void);
+/* Internal function that starts recording with the given METHOD and FORMAT.
+ NULL means default method or format. */
+extern void record_start (const char *method, const char *format,
+ int from_tty);
+
#endif /* _RECORD_H_ */
--
2.7.4