From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 9F848385742D for ; Thu, 17 Jun 2021 07:00:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9F848385742D Received: from fencepost.gnu.org ([2001:470:142:3::e]:51018) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltm0n-0008F7-DN; Thu, 17 Jun 2021 03:00:25 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2280 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltm0n-0002Pq-1L; Thu, 17 Jun 2021 03:00:25 -0400 Date: Thu, 17 Jun 2021 10:00:27 +0300 Message-Id: <83a6np0yd0.fsf@gnu.org> From: Eli Zaretskii To: Felix Willgerodt Cc: markus.t.metzger@intel.com, gdb-patches@sourceware.org In-Reply-To: <20210616074205.1129553-13-felix.willgerodt@intel.com> (message from Felix Willgerodt via Gdb-patches on Wed, 16 Jun 2021 09:42:05 +0200) Subject: Re: [PATCH v3 12/12] btrace: Extend ptwrite event decoding. References: <20210616074205.1129553-1-felix.willgerodt@intel.com> <20210616074205.1129553-13-felix.willgerodt@intel.com> X-Spam-Status: No, score=2.0 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jun 2021 07:00:49 -0000 > Date: Wed, 16 Jun 2021 09:42:05 +0200 > From: Felix Willgerodt via Gdb-patches > > +@exdent Sample program: > +@smallexample > +@group > +void > +ptwrite64 (unsigned long long value) > +@{ > + __builtin_ia32_ptwrite64 (value); > +@} > + > +int > +main (void) > +@{ > + ptwrite64 (0x42); > + return 0; /* break here. */ > +@} > +@end group > +@end smallexample Here and elsewhere in the patch, you use @group..@end group in a sub-optimal manner. That directive is intended to allow TeX to break long @example stretches into several parts that can be printed on different pages. That's because by default each @example will be typeset entirely on a single page (leaving empty space before and after as needed) -- TeX won't break any @example between pages. So the correct use of @group is to subdivide the @example into separate independent groups and mark each one of them with @group. For example, the above could be rewritten as @smallexample @group void ptwrite64 (unsigned long long value) @{ __builtin_ia32_ptwrite64 (value); @} @end group @group int main (void) @{ ptwrite64 (0x42); return 0; /* break here. */ @} @end group @end smallexample That is, you want to have each function on one page, but there can be a page break between the functions. > +@smallexample > +@group > +(gdb) python-interactive > +>>> class my_listener(object): > +... def __init__(self): > +... self.var = 0 > +... def __call__(self, payload, ip): > +... if gdb.selected_thread().global_num == 1: > +... self.var += 1 > +... return "counter: @{@}, ip: @{:#x@}".format(self.var, ip) > +... else: > +... return None > +... > +>>> import gdb.ptwrite > +>>> gdb.ptwrite.register_listener(my_listener()) > +>>> > +(gdb) record function-call-history 59,64 > +59 pthread_create@@GLIBC_2.2.5 > +60 job() > +61 task(void*) > +62 ptwrite64(unsigned long) > + [counter: 1, ip: 0x401156] > +63 task(void*) > +64 ptwrite32(unsigned int) > + [counter: 2, ip: 0x40116c] > +(gdb) info threads > +* 1 Thread 0x7ffff7fd8740 (LWP 25796) "ptwrite_threads" task (arg=0x0) > + at bin/ptwrite/ptwrite_threads.c:45 > + 2 Thread 0x7ffff6eb8700 (LWP 25797) "ptwrite_threads" task (arg=0x0) > + at bin/ptwrite/ptwrite_threads.c:45 > +(gdb) thread 2 > +[Switching to thread 2 (Thread 0x7ffff6eb8700 (LWP 25797))] > +#0 task (arg=0x0) at ptwrite_threads.c:45 > +45 return NULL; > +(gdb) record function-call-history 10,14 > +10 start_thread > +11 task(void*) > +12 ptwrite64(unsigned long) > +13 task(void*) > +14 ptwrite32(unsigned int) > +@end group > +@end smallexample Likewise here: the Python code would be one @group, and then each GDB command that follows, with its results, would be a separate @group. Otherwise, the documentation part is OK. Since the changes I request are mechanical, you don't need to post the documentation part for an additional review, provided that you make those changes in the final commit. Thanks.