From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 1/5] gdb/doc: improve Python Disassembler API documentation
Date: Tue, 4 Apr 2023 09:21:03 +0100 [thread overview]
Message-ID: <3cdddabce2d5acfbdb9a8c5bdcb1a205a2bd01e5.1680596378.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1680596378.git.aburgess@redhat.com>
Some small improvements to the Python Disassembler API documentation:
* More use of @var{...} in the @defun lines,
* Be consistent about using the package scope in the @deftp lines,
* Rework the description of the DisassemblerResult class to include
mention of builtin_disassemble.
---
gdb/doc/python.texi | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index c74d586ef39..a350260559f 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -6909,7 +6909,7 @@
@code{RuntimeError} exception if it is invalid.
@end defun
-@defun DisassembleInfo.__init__ (info)
+@defun DisassembleInfo.__init__ (@var{info})
This can be used to create a new @code{DisassembleInfo} object that is
a copy of @var{info}. The copy will have the same @code{address},
@code{architecture}, and @code{progspace} values as @var{info}, and
@@ -6923,7 +6923,7 @@
(@pxref{builtin_disassemble}).
@end defun
-@defun DisassembleInfo.read_memory (length, offset)
+@defun DisassembleInfo.read_memory (@var{length}, @var{offset})
This method allows the disassembler to read the bytes of the
instruction to be disassembled. The method reads @var{length} bytes,
starting at @var{offset} from
@@ -6973,16 +6973,17 @@
@end defun
@end deftp
-@deftp {class} Disassembler
+@anchor{Disassembler Class}
+@deftp {class} gdb.disassembler.Disassembler
This is a base class from which all user implemented disassemblers
must inherit.
-@defun Disassembler.__init__ (name)
+@defun Disassembler.__init__ (@var{name})
The constructor takes @var{name}, a string, which should be a short
name for this disassembler.
@end defun
-@defun Disassembler.__call__ (info)
+@defun Disassembler.__call__ (@var{info})
The @code{__call__} method must be overridden by sub-classes to
perform disassembly. Calling @code{__call__} on this base class will
raise a @code{NotImplementedError} exception.
@@ -7023,10 +7024,16 @@
@end defun
@end deftp
-@deftp {class} DisassemblerResult
-This class is used to hold the result of calling
-@w{@code{Disassembler.__call__}}, and represents a single disassembled
-instruction. This class has the following properties and methods:
+@deftp {class} gdb.disassembler.DisassemblerResult
+This class represents the result of disassembling a single
+instruction. An instance of this class will be returned from
+@code{builtin_disassemble} (@pxref{builtin_disassemble}), and an
+instance of this class should be returned from
+@w{@code{Disassembler.__call__}} (@pxref{Disassembler Class}) if an
+instruction was successfully disassembled.
+
+The @code{DisassemblerResult} class has the following properties and
+methods:
@defun DisassemblerResult.__init__ (@var{length}, @var{string})
Initialize an instance of this class, @var{length} is the length of
@@ -7049,7 +7056,7 @@
The following functions are also contained in the
@code{gdb.disassembler} module:
-@defun register_disassembler (disassembler, architecture)
+@defun register_disassembler (@var{disassembler}, @var{architecture})
The @var{disassembler} must be a sub-class of
@code{gdb.disassembler.Disassembler} or @code{None}.
@@ -7099,7 +7106,7 @@
@end defun
@anchor{builtin_disassemble}
-@defun builtin_disassemble (info)
+@defun builtin_disassemble (@var{info})
This function calls back into @value{GDBN}'s builtin disassembler to
disassemble the instruction identified by @var{info}, an instance, or
sub-class, of @code{DisassembleInfo}.
--
2.25.4
next prev parent reply other threads:[~2023-04-04 8:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 8:21 [PATCH 0/5] Disassembler Styling And The Python API Andrew Burgess
2023-04-04 8:21 ` Andrew Burgess [this message]
2023-04-04 11:36 ` [PATCH 1/5] gdb/doc: improve Python Disassembler API documentation Eli Zaretskii
2023-04-28 22:49 ` Andrew Burgess
2023-05-12 17:42 ` Andrew Burgess
2023-04-04 8:21 ` [PATCH 2/5] gdb/python: implement __repr__ methods for py-disasm.c types Andrew Burgess
2023-05-12 17:43 ` Andrew Burgess
2023-04-04 8:21 ` [PATCH 3/5] gdb/python: implement DisassemblerResult.__str__ method Andrew Burgess
2023-05-12 17:43 ` Andrew Burgess
2023-04-04 8:21 ` [PATCH 4/5] gdb/python: rework how the disassembler API reads the result object Andrew Burgess
2023-04-04 11:38 ` Eli Zaretskii
2023-04-04 8:21 ` [PATCH 5/5] gdb/python: extend the Python Disassembler API to allow for styling Andrew Burgess
2023-04-04 12:01 ` Eli Zaretskii
2023-04-28 23:11 ` Andrew Burgess
2023-04-17 16:25 ` Tom Tromey
2023-04-28 23:09 ` [PATCHv2 " Andrew Burgess
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=3cdddabce2d5acfbdb9a8c5bdcb1a205a2bd01e5.1680596378.git.aburgess@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).