From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105265 invoked by alias); 25 Jan 2017 15:53:26 -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 105128 invoked by uid 89); 25 Jan 2017 15:53:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2428, Tel, tel, office X-HELO: mga14.intel.com Received: from mga14.intel.com (HELO mga14.intel.com) (192.55.52.115) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 25 Jan 2017 15:53:15 +0000 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jan 2017 07:53:13 -0800 X-ExtLoop1: 1 Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga003.jf.intel.com with ESMTP; 25 Jan 2017 07:52:49 -0800 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.142]) by IRSMSX103.ger.corp.intel.com ([163.33.3.157]) with mapi id 14.03.0248.002; Wed, 25 Jan 2017 15:52:48 +0000 From: "Metzger, Markus T" To: Pedro Alves , "gdb-patches@sourceware.org" CC: Simon Marchi Subject: RE: [PATCH v2 2/2] btrace: allow recording to be started for running threads Date: Wed, 25 Jan 2017 15:53:00 -0000 Message-ID: References: <1484923135-31270-1-git-send-email-markus.t.metzger@intel.com> <1484923135-31270-3-git-send-email-markus.t.metzger@intel.com> In-Reply-To: Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-01/txt/msg00534.txt.bz2 Hello Pedro, Thanks for your review. > > +/* Validate that we can read PTID's registers. */ > > + > > +static void > > +validate_registers_access_ptid (ptid_t ptid) > > +{ > > + struct cleanup *cleanup =3D save_inferior_ptid (); > > + > > + inferior_ptid =3D ptid; > > + validate_registers_access (); > > + do_cleanups (cleanup); > > +} >=20 > Do we need this, we we have the new function added > by patch #1 ? This is a safeguard. I don't expect that we will ever throw, here. > > + && can_access_registers_ptid (tp->ptid)) >=20 > If you have this check, why do you need to the TRY/CATCH ? >=20 > Or even, given the validate_registers_access_ptid check > above, why is this check necessary? >=20 > > + btrace_add_pc (tp); > > + } > > + CATCH (exception, RETURN_MASK_ALL) >=20 > Adding a RETURN_MASK_ALL always raises alarm bells, > because this swallows a user-typed ctrl-c, which > is probably wrong. >=20 > > + { > > + btrace_disable (tp); > > + } > > + END_CATCH The TRY/CATCH is to clean things up in case of errors or ctrl-c. The caller will clean things up for previously enabled threads but expects each btrace_enable to either succeed or fail and throw. I see that I forgot to rethrow, though. This is not intended to swallow the error - only to disable tracing again in case of errors. The can_access_registers_ptid check is to avoid the error and thus allow "record btrace" for running (or exited) threads where the btrace_add_pc call can be omitted. > > +# We need to enable non-stop mode for the remote case. > > +gdb_test_no_output "set non-stop on" >=20 > This is too late with --target_board=3Dnative-extended-gdbserver. > Use instead: >=20 > save_vars { GDBFLAGS } { > append GDBFLAGS " -ex \"set non-stop on\"" > clean_restart $testfile > } This test seems to run fine with --target_board=3Dnative-extended-gdbserver. Making the change nevertheless. There's another instance of this in gdb.btrace/non-stop.exp. Will fix this in a separate patch. A different test, gdb.btrace/enable.exp is failing with that target_board. Thanks, 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