From: Markus Metzger Date: Thu, 19 Nov 2015 13:33:41 +0000 (+0100) Subject: btrace: diagnose "record btrace pt" without libipt X-Git-Tag: gdb-7.10.1-release~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bab694b7f968cc5703a69df694b5968384d6c0b4;p=thirdparty%2Fbinutils-gdb.git btrace: diagnose "record btrace pt" without libipt If GDB has been configured without libipt support, i.e. HAVE_LIBIPT is undefined, and is running on a system that supports Intel(R) Processor Trace, GDB will run into an internal error when trying to decode the trace. (gdb) record btrace (gdb) s usage (name=0x7fffffffe954 "fib-64") at src/fib.c:12 12 fprintf(stderr, "usage: %s \n", name); (gdb) info record Active record target: record-btrace Recording format: Intel(R) Processor Trace. Buffer size: 16kB. gdb/btrace.c:971: internal-error: Unexpected branch trace format. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) This requires a system with Linux kernel 4.1 or later running on a 5th Generation Intel Core processor or later. The issue is documented as PR 19297. When trying to enable branch tracing, in addition to checking the target support for the requested branch tracing format, also check whether GDB supports. it. gdb/ * btrace.c (btrace_enable): Check whether HAVE_LIBIPT is defined. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 94bcf9f30da..f2b395f10e0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2015-11-26 Markus Metzger + + PR 19297 + * btrace.c (btrace_enable): Check whether HAVE_LIBIPT is defined. + 2015-09-14 Peter Bergner PR gdb/18957 diff --git a/gdb/btrace.c b/gdb/btrace.c index 1618e55f664..ada0eb7b2a3 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -1020,6 +1020,11 @@ btrace_enable (struct thread_info *tp, const struct btrace_config *conf) if (tp->btrace.target != NULL) return; +#if !defined (HAVE_LIBIPT) + if (conf->format == BTRACE_FORMAT_PT) + error (_("GDB does not support Intel(R) Processor Trace.")); +#endif /* !defined (HAVE_LIBIPT) */ + if (!target_supports_btrace (conf->format)) error (_("Target does not support branch tracing."));