gdb: Don't skip prologue for explicit line breakpoints in assembler
[deliverable/binutils-gdb.git] / gdb / common / btrace-common.h
index ebae17eee45f248226f40c75ebcef362bef86dd9..0b18924882c65488a45e0db6de7d0ded0ccf6134 100644 (file)
@@ -1,6 +1,6 @@
 /* Branch trace support for GDB, the GNU debugger.
 
-   Copyright (C) 2013-2015 Free Software Foundation, Inc.
+   Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
    Contributed by Intel Corp. <markus.t.metzger@intel.com>.
 
@@ -19,8 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#ifndef BTRACE_COMMON_H
-#define BTRACE_COMMON_H
+#ifndef COMMON_BTRACE_COMMON_H
+#define COMMON_BTRACE_COMMON_H
 
 /* Branch tracing (btrace) is a per-thread control-flow execution trace of the
    inferior.  For presentation purposes, the branch trace is represented as a
@@ -60,7 +60,7 @@ enum btrace_format
      Actually, the format is a sequence of blocks derived from BTS.  */
   BTRACE_FORMAT_BTS,
 
-  /* Branch trace is in Intel(R) Processor Trace format.  */
+  /* Branch trace is in Intel Processor Trace format.  */
   BTRACE_FORMAT_PT
 };
 
@@ -96,15 +96,21 @@ struct btrace_cpu
 
 struct btrace_config_bts
 {
-  /* The size of the branch trace buffer in bytes.  */
+  /* The size of the branch trace buffer in bytes.
+
+     This is unsigned int and not size_t since it is registered as
+     control variable for "set record btrace bts buffer-size".  */
   unsigned int size;
 };
 
-/* An Intel(R) Processor Trace configuration.  */
+/* An Intel Processor Trace configuration.  */
 
 struct btrace_config_pt
 {
-  /* The size of the branch trace buffer in bytes.  */
+  /* The size of the branch trace buffer in bytes.
+
+     This is unsigned int and not size_t since it is registered as
+     control variable for "set record btrace pt buffer-size".  */
   unsigned int size;
 };
 
@@ -123,7 +129,7 @@ struct btrace_config
   /* The BTS format configuration.  */
   struct btrace_config_bts bts;
 
-  /* The Intel(R) Processor Trace format configuration.  */
+  /* The Intel Processor Trace format configuration.  */
   struct btrace_config_pt pt;
 };
 
@@ -142,7 +148,7 @@ struct btrace_data_pt_config
   struct btrace_cpu cpu;
 };
 
-/* Branch trace in Intel(R) Processor Trace format.  */
+/* Branch trace in Intel Processor Trace format.  */
 struct btrace_data_pt
 {
   /* Some configuration information to go with the data.  */
@@ -152,13 +158,38 @@ struct btrace_data_pt
   gdb_byte *data;
 
   /* The size of DATA in bytes.  */
-  unsigned long size;
+  size_t size;
 };
 
 /* The branch trace data.  */
 struct btrace_data
 {
-  enum btrace_format format;
+  btrace_data () = default;
+
+  ~btrace_data ()
+  {
+    fini ();
+  }
+
+  btrace_data &operator= (btrace_data &&other)
+  {
+    if (this != &other)
+      {
+       fini ();
+       format = other.format;
+       variant = other.variant;
+       other.format = BTRACE_FORMAT_NONE;
+      }
+    return *this;
+  }
+
+  /* Return true if this is empty; false otherwise.  */
+  bool empty () const;
+
+  /* Clear this object.  */
+  void clear ();
+
+  enum btrace_format format = BTRACE_FORMAT_NONE;
 
   union
   {
@@ -168,6 +199,12 @@ struct btrace_data
     /* Format == BTRACE_FORMAT_PT.  */
     struct btrace_data_pt pt;
   } variant;
+
+private:
+
+  DISABLE_COPY_AND_ASSIGN (btrace_data);
+
+  void fini ();
 };
 
 /* Target specific branch trace information.  */
@@ -208,13 +245,13 @@ enum btrace_error
 /* Return a string representation of FORMAT.  */
 extern const char *btrace_format_string (enum btrace_format format);
 
-/* Initialize DATA.  */
-extern void btrace_data_init (struct btrace_data *data);
-
-/* Cleanup DATA.  */
-extern void btrace_data_fini (struct btrace_data *data);
+/* Return an abbreviation string representation of FORMAT.  */
+extern const char *btrace_format_short_string (enum btrace_format format);
 
-/* Return non-zero if DATA is empty; zero otherwise.  */
-extern int btrace_data_empty (struct btrace_data *data);
+/* Append the branch trace data from SRC to the end of DST.
+   Both SRC and DST must use the same format.
+   Returns zero on success; a negative number otherwise.  */
+extern int btrace_data_append (struct btrace_data *dst,
+                              const struct btrace_data *src);
 
-#endif /* BTRACE_COMMON_H */
+#endif /* COMMON_BTRACE_COMMON_H */
This page took 0.026171 seconds and 4 git commands to generate.