This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v2 4/8] Add record_start function.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]