aboutsummaryrefslogtreecommitdiff
path: root/gdb/btrace.c
diff options
context:
space:
mode:
authorTim Wiederhake <tim.wiederhake@intel.com>2016-11-21 16:39:57 +0100
committerTim Wiederhake <tim.wiederhake@intel.com>2017-02-14 10:57:56 +0100
commit508352a9bf3f84f2d731397bb0d9382c84f27f25 (patch)
tree8fdd48f21d56fbd799907ac577a76898fa9b0144 /gdb/btrace.c
parent69090ceead6fa841669eea0c81b3e8e9695def5f (diff)
downloadgdb-508352a9bf3f84f2d731397bb0d9382c84f27f25.zip
gdb-508352a9bf3f84f2d731397bb0d9382c84f27f25.tar.gz
gdb-508352a9bf3f84f2d731397bb0d9382c84f27f25.tar.bz2
btrace: Export btrace_decode_error function.
Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com> gdb/ChangeLog: * record-btrace.c (btrace_ui_out_decode_error): Move most of it ... * btrace.c (btrace_decode_error): ... here. New function. * btrace.h (btrace_decode_error): New export. Change-Id: I2b4b43a55dbfd9f526a540d2ad52a6708f31feba
Diffstat (limited to 'gdb/btrace.c')
-rw-r--r--gdb/btrace.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 9f5657d..06122cd 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -1725,6 +1725,55 @@ btrace_maint_clear (struct btrace_thread_info *btinfo)
/* See btrace.h. */
+const char *
+btrace_decode_error (enum btrace_format format, int errcode)
+{
+ switch (format)
+ {
+ case BTRACE_FORMAT_BTS:
+ switch (errcode)
+ {
+ case BDE_BTS_OVERFLOW:
+ return _("instruction overflow");
+
+ case BDE_BTS_INSN_SIZE:
+ return _("unknown instruction");
+
+ default:
+ break;
+ }
+ break;
+
+#if defined (HAVE_LIBIPT)
+ case BTRACE_FORMAT_PT:
+ switch (errcode)
+ {
+ case BDE_PT_USER_QUIT:
+ return _("trace decode cancelled");
+
+ case BDE_PT_DISABLED:
+ return _("disabled");
+
+ case BDE_PT_OVERFLOW:
+ return _("overflow");
+
+ default:
+ if (errcode < 0)
+ return pt_errstr (pt_errcode (errcode));
+ break;
+ }
+ break;
+#endif /* defined (HAVE_LIBIPT) */
+
+ default:
+ break;
+ }
+
+ return _("unknown");
+}
+
+/* See btrace.h. */
+
void
btrace_fetch (struct thread_info *tp)
{