/* Branch trace support for GDB, the GNU debugger.
- Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ Copyright (C) 2013-2019 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>.
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
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
};
unsigned int size;
};
-/* An Intel(R) Processor Trace configuration. */
+/* An Intel Processor Trace configuration. */
struct btrace_config_pt
{
/* 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;
};
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. */
/* 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
{
/* Format == BTRACE_FORMAT_PT. */
struct btrace_data_pt pt;
} variant;
+
+private:
+
+ DISABLE_COPY_AND_ASSIGN (btrace_data);
+
+ void fini ();
};
/* Target specific branch trace information. */
/* 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);
-
-/* Clear DATA. */
-extern void btrace_data_clear (struct btrace_data *data);
-
-/* Return non-zero if DATA is empty; zero otherwise. */
-extern int btrace_data_empty (struct btrace_data *data);
+/* Return an abbreviation string representation of FORMAT. */
+extern const char *btrace_format_short_string (enum btrace_format format);
/* Append the branch trace data from SRC to the end of DST.
Both SRC and DST must use the same format.
extern int btrace_data_append (struct btrace_data *dst,
const struct btrace_data *src);
-#endif /* BTRACE_COMMON_H */
+#endif /* COMMON_BTRACE_COMMON_H */