From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 119838 invoked by alias); 20 Nov 2015 12:11:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 119808 invoked by uid 89); 20 Nov 2015 12:11:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mga02.intel.com Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Nov 2015 12:11:45 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 20 Nov 2015 04:11:43 -0800 X-ExtLoop1: 1 Received: from irsmsx110.ger.corp.intel.com ([163.33.3.25]) by orsmga001.jf.intel.com with ESMTP; 20 Nov 2015 04:11:42 -0800 Received: from irsmsx111.ger.corp.intel.com (10.108.20.4) by irsmsx110.ger.corp.intel.com (163.33.3.25) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 20 Nov 2015 12:11:41 +0000 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.138]) by irsmsx111.ger.corp.intel.com ([169.254.2.223]) with mapi id 14.03.0248.002; Fri, 20 Nov 2015 12:11:41 +0000 From: "Metzger, Markus T" To: Pedro Alves CC: "gdb-patches@sourceware.org" Subject: RE: [PATCH] btrace: diagnose "record btrace pt" without libipt Date: Fri, 20 Nov 2015 12:11:00 -0000 Message-ID: References: <1448011026-4192-1-git-send-email-markus.t.metzger@intel.com> <564F0591.3020006@redhat.com> In-Reply-To: <564F0591.3020006@redhat.com> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg00421.txt.bz2 > -----Original Message----- > From: Pedro Alves [mailto:palves@redhat.com] > Sent: Friday, November 20, 2015 12:36 PM > To: Metzger, Markus T > Cc: gdb-patches@sourceware.org > Subject: Re: [PATCH] btrace: diagnose "record btrace pt" without libipt >=20 > 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 > Trace, > > GDB will run into an internal error when trying to decode the trace. > > > > (gdb) record btrace > > (gdb) s > > usage (name=3D0x7fffffffe954 "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. > > > > 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. >=20 > BTW, this made me wonder what happens if you're remote debugging with > gdbserver, and then: >=20 > #1 - enable btrace pt > #2 - disconnect with "disconnect" > #3 - restart gdb > #4 - reconnect to gdbserver >=20 > - Does gdb sync the "btrace-enabled" state with the server? Or does it g= et > out > of sync and confused? The record target is popped off the target stack on disconnect. This disab= les branch tracing. The below log is for BTS but the logic is the same for PT. (gdb) rec b [record-btrace] open [record-btrace] open [btrace] enable thread 1 (Thread 135520) Sending packet: $Qbtrace-conf:bts:size=3D0x10000#e3...Packet received: OK Sending packet: $Qbtrace:bts#45...Packet received: OK Sending packet: $qXfer:btrace-conf:read::0,fff#5c...Packet received: l\n= \n\n\n\000 [btrace] compute ftrace [record-btrace] attach thread observer (gdb) info rec Active record target: record-btrace [record-btrace] info 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\n\n\n\n\000 Recorded 0 instructions in 0 functions (0 gaps) for thread 1 (Thread 13552= 0). (gdb) disconnect=20 Sending packet: $qTStatus#49...Packet received: T0;tnotrun:0;tframes:0;tc= reated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptim= e: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 (gdb) After reconnecting, you need to enable btrace again. Regards, Markus. 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