This is the mail archive of the
mailing list for the GDB project.
RE: [PATCH] btrace: diagnose "record btrace pt" without libipt
- From: "Metzger, Markus T" <markus dot t dot metzger at intel dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 20 Nov 2015 12:11:40 +0000
- Subject: RE: [PATCH] btrace: diagnose "record btrace pt" without libipt
- Authentication-results: sourceware.org; auth=none
- References: <1448011026-4192-1-git-send-email-markus dot t dot metzger at intel dot com> <564F0591 dot 3020006 at redhat dot com>
> -----Original Message-----
> From: Pedro Alves [mailto:firstname.lastname@example.org]
> Sent: Friday, November 20, 2015 12:36 PM
> To: Metzger, Markus T
> Cc: email@example.com
> Subject: Re: [PATCH] btrace: diagnose "record btrace pt" without libipt
> On 11/20/2015 09:17 AM, Markus Metzger wrote:
> > 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
> > 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 <num>\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.
> > 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.
> BTW, this made me wonder what happens if you're remote debugging with
> gdbserver, and then:
> #1 - enable btrace pt
> #2 - disconnect with "disconnect"
> #3 - restart gdb
> #4 - reconnect to gdbserver
> - Does gdb sync the "btrace-enabled" state with the server? Or does it get
> of sync and confused?
The record target is popped off the target stack on disconnect. This disables
branch tracing. The below log is for BTS but the logic is the same for PT.
(gdb) rec b
[btrace] enable thread 1 (Thread 135520)
Sending packet: $Qbtrace-conf:bts:size=0x10000#e3...Packet received: OK
Sending packet: $Qbtrace:bts#45...Packet received: OK
Sending packet: $qXfer:btrace-conf:read::0,fff#5c...Packet received: l<!DOCTYPE btrace-conf SYSTEM "btrace- conf.dtd">\n<btrace-conf version="1.0">\n<bts size="0x10000" />\n</btrace-conf>\n\000
[btrace] compute ftrace
[record-btrace] attach thread observer
(gdb) info rec
Active record target: record-btrace
Recording format: Branch Trace Store.
Buffer size: 64kB.
[btrace] fetch thread 1 (Thread 135520)
Sending packet: $qXfer:btrace:read:delta:0,fff#93...Packet received: l<!DOCTYPE btrace SYSTEM "btrace.dtd">\n<btrace version="1.0">\n<block begin="0x0" end="0x7ffff7ddc423"/>\n</btrace>\n\000
Recorded 0 instructions in 0 functions (0 gaps) for thread 1 (Thread 135520).
Sending packet: $qTStatus#49...Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes::
record: disconnect record-btrace
record: stop record-btrace
[record-btrace] stop recording
[record-btrace] detach thread observer
[btrace] disable thread 1 (Thread 135520)
Sending packet: $Qbtrace:off#37...Packet received: OK
[btrace] clear thread 1 (Thread 135520)
record: unpush record-btrace
Ending remote debugging.
[btrace] free objfile
[btrace] free objfile
After reconnecting, you need to enable btrace again.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928