Re: [PATCH v2 12/12] btrace: Extend ptwrite event decoding.

Eli Zaretskii via Gdb-patches
2021-06-15T11:50:59Z

> Date: Mon, 14 Jun 2021 16:54:11 +0200
> From: Felix Willgerodt via Gdb-patches <gdb-patches@sourceware.org>
>
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -3,6 +3,12 @@
>
> *** Changes since GDB 10
>
> +* GDB now supports printing of ptwrite payloads from the Intel Processor
> + Trace during 'record instruction-history', 'record function-call-history',
> + all stepping commands and in Python. Printing is customizable via a
> + ptwrite listener function in Python. By default, the raw ptwrite
> + payload is printed for each ptwrite that is encountered.
> +
> * The 'set disassembler-options' command now supports specifying options
> for the ARC target.

This part is OK.

> +This module provides additional functionality for recording programs that make
> +use of the PTWRITE instruction. PTWRITE is a x86 instruction that allows to
> +write values into the Intel Processor Trace (@pxref{Process Record and Replay}).

Should PTWRITE be in @code or in @sc?

> +The @code{gdb.ptwrite} module allows customizing the default output of ptwrite
> +auxiliary information. A custom Python function can be registered via
> +@code{gdb.ptwrite.register_listener()} as the ptwrite listener function.
^^
Please remove the parentheses there. Otherwise, this looks like a
call to the function with no arguments, which is not what you want.

> +@smallexample
> +@group
> +(gdb) python-interactive
> +>>> class my_listener(object):
> +... def __init__(self):
> +... self.variable = 0
> +... def __call__(self, payload, ip):
> +... if gdb.selected_thread().global_num == 1:
> +... self.variable += 1
> +... return "payload: @{@}, ip: @{:#x@}".format(self.variable, ip)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This line is too long for @smallexample, it will cause overful hbox in
the printed version of the manual.

> +This GDB feature is dependent on hardware and operating system support and
^^^
@value{GDBN}

Thanks.