From: "Metzger, Markus T" <markus.t.metzger@intel.com>
To: "Wiederhake, Tim" <tim.wiederhake@intel.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: "palves@redhat.com" <palves@redhat.com>
Subject: RE: [PATCH v3 8/8] Add documentation for new instruction record Python bindings.
Date: Tue, 29 Nov 2016 15:48:00 -0000 [thread overview]
Message-ID: <A78C989F6D9628469189715575E55B23400131BC@IRSMSX104.ger.corp.intel.com> (raw)
In-Reply-To: <1479743318-24523-9-git-send-email-tim.wiederhake@intel.com>
> -----Original Message-----
> From: Wiederhake, Tim
> Sent: Monday, November 21, 2016 4:49 PM
> To: gdb-patches@sourceware.org
> Cc: palves@redhat.com; Metzger, Markus T <markus.t.metzger@intel.com>
> Subject: [PATCH v3 8/8] Add documentation for new instruction record Python
> bindings.
>
> 2016-11-21 Tim Wiederhake <tim.wiederhake@intel.com>
>
> gdb/ChangeLog:
>
> * NEWS: Add record Python bindings entry.
>
> gdb/doc/ChangeLog:
>
> * python.texi (Recordings In Python): New section.
> +@defvar Record.format
> +A string with the current recording format, e.g.@: @code{bt} or
> +@code{pts}. Can be empty.
This should be "bts" instead of "pts". IIRC the patches don't really allow
it to be empty.
> +@end defvar
> +
> +@defvar Record.begin
> +A format specific instruction object representing the first instruction
Should this be "method-specific" instead of "format-specific"?
> +The attributes and methods of instruction objects depend on the current
> +recording format. Currently, only btrace instructions are supported.
Should this be "method" instead of "format"?
> +@defvar BtraceInstruction.number
> +An integer identifying this instruction. @var{number} corresponds to
> +the numbers seen in @code{record instruction-history}
> +(@pxref{Process Record and Replay}).
> +@end defvar
> +
> +@defvar BtraceInstruction.error
> +An integer identifying the error code for gaps in the record.
Should this be "history" instead of "record"?
> +@defvar BtraceInstruction.decoded
> +A human readable string with the decoded instruction. Contains the
Should this be "disassembled" instead of "decoded"?
> +@defvar BtraceFunctionCall.instructions
> +A list of instructions associated with this function call.
Should this be "a list of gdb.BtraceInstruction objects"?
> +The following example demonstrates the usage of these objects and
> +functions to create a function that will rewind a record to the last
> +time a function in a different file was executed. This would typically
> +be used to track the execution of user provided callback functions in a
> +library which typically are not visible in a back trace.
> +
> +@smallexample
> +def bringback ():
> + rec = gdb.current_recording ()
> + if not rec:
> + return
> +
> + insn = rec.instruction_history
> + if len (insn) == 0:
> + return
> +
> + try:
> + position = insn.index (rec.replay_position)
> + except:
> + position = -1
> + try:
> + filename = insn[position].symbol.symtab.fullname ()
> + except:
> + filename = None
> +
> + for i in reversed (insn[:position]):
> + try:
> + current = i.symbol.symtab.fullname ()
> + except:
> + current = None
> +
> + if filename == current:
> + continue
> +
> + rec.goto (i)
> + return
> +@end smallexample
> +
> +Another possible application is to write a function that counts the
> +number of code executions in a given line range. This line range can
> +contain parts of functions or span across several functions and is not
> +limited to be contiguous.
> +
> +@smallexample
> +def countrange (filename, linerange):
> + count = 0
> +
> + def filter_only (file_name):
> + for call in gdb.current_recording ().function_call_history:
> + try:
> + if file_name in call.symbol.symtab.fullname ():
> + yield call
> + except:
> + pass
> +
> + for c in filter_only (filename):
> + for i in c.instructions:
> + try:
> + if i.symbol.line in linerange:
> + count += 1
> + break;
> + except:
> + pass
> +
> + return count
> +@end smallexample
> +
> @node Commands In Python
> @subsubsection Commands In Python
The examples are really helpful.
The patch looks good to me but we need Eli to approve it.
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
next prev parent reply other threads:[~2016-11-29 15:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-21 15:49 [PATCH v3 0/8] Python bindings for btrace recordings Tim Wiederhake
2016-11-21 15:49 ` [PATCH v3 8/8] Add documentation for new instruction record Python bindings Tim Wiederhake
2016-11-29 15:48 ` Metzger, Markus T [this message]
2016-11-29 17:32 ` Eli Zaretskii
2016-11-21 15:49 ` [PATCH v3 6/8] python: Implement btrace Python bindings for record history Tim Wiederhake
2016-11-29 15:48 ` Metzger, Markus T
2016-11-21 15:49 ` [PATCH v3 2/8] btrace: Export btrace_decode_error function Tim Wiederhake
2016-11-29 15:47 ` Metzger, Markus T
2016-11-21 15:49 ` [PATCH v3 4/8] Add record_start function Tim Wiederhake
2016-11-29 15:47 ` Metzger, Markus T
2016-11-21 15:49 ` [PATCH v3 7/8] python: Add tests for record Python bindings Tim Wiederhake
2016-11-29 15:48 ` Metzger, Markus T
2016-11-21 15:49 ` [PATCH v3 5/8] python: Create Python bindings for record history Tim Wiederhake
2016-11-29 15:48 ` Metzger, Markus T
2016-11-21 15:49 ` [PATCH v3 1/8] btrace: Count gaps as one instruction explicitly Tim Wiederhake
2016-11-29 15:47 ` Metzger, Markus T
2016-11-21 15:49 ` [PATCH v3 3/8] btrace: Use binary search to find instruction Tim Wiederhake
2016-11-29 15:47 ` Metzger, Markus T
2016-11-29 15:49 ` [PATCH v3 0/8] Python bindings for btrace recordings Metzger, Markus T
2016-12-01 1:04 [PATCH v3 8/8] Add documentation for new instruction record Python bindings Doug Evans
2016-12-02 13:18 ` Wiederhake, Tim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A78C989F6D9628469189715575E55B23400131BC@IRSMSX104.ger.corp.intel.com \
--to=markus.t.metzger@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=tim.wiederhake@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox