diff options
author | Tom Tromey <tromey@adacore.com> | 2021-10-22 10:49:19 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2021-10-29 07:52:31 -0600 |
commit | d3771fe234b74d60cfa553940bce9d047bd38e8d (patch) | |
tree | 9ad43197c7905e0f64bf6b77e526e0c34fa3035b /gdb/doc/python.texi | |
parent | 7a72f09da5c62a213952752c9659e7686e1dd4ab (diff) | |
download | binutils-d3771fe234b74d60cfa553940bce9d047bd38e8d.zip binutils-d3771fe234b74d60cfa553940bce9d047bd38e8d.tar.gz binutils-d3771fe234b74d60cfa553940bce9d047bd38e8d.tar.bz2 |
Add gdb.Architecture.integer_type Python function
This adds a new Python function, gdb.Architecture.integer_type, which
can be used to look up an integer type of a given size and
signed-ness. This is useful to avoid dependency on debuginfo when a
particular integer type would be useful.
v2 moves this to be a method on gdb.Architecture and addresses other
review comments.
Diffstat (limited to 'gdb/doc/python.texi')
-rw-r--r-- | gdb/doc/python.texi | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index 90214f2..9a76813 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -1125,6 +1125,9 @@ Ordinarily, this function will return an instance of @code{gdb.Type}. If the named type cannot be found, it will throw an exception. @end defun +Integer types can be found without looking them up by name. +@xref{Architectures In Python}, for the @code{integer_type} method. + If the type is a structure or class type, or an enum type, the fields of that type can be accessed using the Python @dfn{dictionary syntax}. For example, if @code{some_type} is a @code{gdb.Type} instance holding @@ -5883,6 +5886,21 @@ instruction in bytes. @end table @end defun +@findex Architecture.integer_type +@defun Architecture.integer_type (size @r{[}, signed@r{]}) +This function looks up an integer type by its @var{size}, and +optionally whether or not it is signed. + +@var{size} is the size, in bits, of the desired integer type. Only +certain sizes are currently supported: 0, 8, 16, 24, 32, 64, and 128. + +If @var{signed} is not specified, it defaults to @code{True}. If +@var{signed} is @code{False}, the returned type will be unsigned. + +If the indicated type cannot be found, this function will throw a +@code{ValueError} exception. +@end defun + @anchor{gdbpy_architecture_registers} @defun Architecture.registers (@r{[} @var{reggroup} @r{]}) Return a @code{gdb.RegisterDescriptorIterator} (@pxref{Registers In |