Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tim Wiederhake <tim.wiederhake@intel.com>
To: gdb-patches@sourceware.org
Cc: palves@redhat.com, markus.t.metzger@intel.com
Subject: [PATCH v2 4/8] Add record_start function.
Date: Fri, 04 Nov 2016 07:55:00 -0000	[thread overview]
Message-ID: <1478246074-14526-5-git-send-email-tim.wiederhake@intel.com> (raw)
In-Reply-To: <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


  parent reply	other threads:[~2016-11-04  7:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-04  7:55 [PATCH v2 0/8] Python bindings for btrace recordings Tim Wiederhake
2016-11-04  7:55 ` [PATCH v2 1/8] btrace: Count gaps as one instruction explicitly Tim Wiederhake
2016-11-04  7:55 ` Tim Wiederhake [this message]
2016-11-04  7:55 ` [PATCH v2 3/8] btrace: Use binary search to find instruction Tim Wiederhake
2016-11-04  7:55 ` [PATCH v2 5/8] python: Create Python bindings for record history Tim Wiederhake
2016-11-04  7:55 ` [PATCH v2 8/8] Add documentation for new instruction record Python bindings Tim Wiederhake
2016-11-04  8:16   ` Eli Zaretskii
2016-11-04  7:55 ` [PATCH v2 6/8] python: Implement btrace Python bindings for record history Tim Wiederhake
2016-11-04  7:55 ` [PATCH v2 7/8] python: Add tests for record Python bindings Tim Wiederhake
2016-11-04  7:55 ` [PATCH v2 2/8] btrace: Export btrace_decode_error function Tim Wiederhake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1478246074-14526-5-git-send-email-tim.wiederhake@intel.com \
    --to=tim.wiederhake@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=markus.t.metzger@intel.com \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox