diff options
author | Doug Evans <dje@google.com> | 2010-10-13 20:08:46 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2010-10-13 20:08:46 +0000 |
commit | 0e3509dbced8d51a4293ab311eac20a2aee8cfdf (patch) | |
tree | aeb24174c6105a11cf8d6e78fd6d2682065190c6 /gdb/doc | |
parent | 577ce03a7c7132afb57ce6ebd2ce2c155110ccd4 (diff) | |
download | gdb-0e3509dbced8d51a4293ab311eac20a2aee8cfdf.zip gdb-0e3509dbced8d51a4293ab311eac20a2aee8cfdf.tar.gz gdb-0e3509dbced8d51a4293ab311eac20a2aee8cfdf.tar.bz2 |
New python module gdb.types.
* NEWS: Document it.
* data-directory/Makefile.in (PYTHON_FILES): Add gdb/types.py.
* python/lib/gdb/types.py: New file.
testsuite/
* lib/gdb-python.exp (gdb_check_python_config): New function.
* gdb.python/Makefile.in (EXECUTABLES): Add lib-types.
* gdb.python/lib-types.cc: New file.
* gdb.python/lib-types.exp: New file.
doc/
* gdb.texinfo (Python): Add "Python modules".
(Types in Python): Add reference to gdb.types section.
(Python modules): New node.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 54 |
2 files changed, 60 insertions, 0 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index e2b435e..c2e45ae 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,9 @@ +2010-10-13 Doug Evans <dje@google.com> + + * gdb.texinfo (Python): Add "Python modules". + (Types in Python): Add reference to gdb.types section. + (Python modules): New node. + 2010-10-11 Doug Evans <dje@google.com> * gdb.texinfo (Values From Inferior): Add reference to "Types in diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index c73e2f3..9446932 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -20401,6 +20401,7 @@ the Python interpreter to locate all scripts installed at this location. * Python Commands:: Accessing Python from @value{GDBN}. * Python API:: Accessing @value{GDBN} from Python. * Auto-loading:: Automatically loading Python code. +* Python modules:: Python modules provided by @value{GDBN}. @end menu @node Python Commands @@ -21245,6 +21246,9 @@ A function internal to @value{GDBN}. This is the type used to represent convenience functions. @end table +Further support for types is provided in the @code{gdb.types} +Python module (@pxref{gdb.types}). + @node Pretty Printing API @subsubsection Pretty Printing API @@ -22911,6 +22915,56 @@ cumbersome. It may be easier to specify the scripts in the top of the source tree to the source search path. @end itemize +@node Python modules +@subsection Python modules +@cindex python modules + +@c It is assumed that at least one more module will be added before +@c the next release of gdb. Thus we use a menu here. +@value{GDBN} comes with a module to assist writing Python code. + +@menu +* gdb.types:: Utilities for working with types. +@end menu + +@node gdb.types +@subsubsection gdb.types + +This module provides a collection of utilities for working with +@code{gdb.Types} objects. + +@table @code +@item get_basic_type (@var{type}) +Return @var{type} with const and volatile qualifiers stripped, +and with typedefs and C@t{++} references converted to the underlying type. + +C@t{++} example: + +@smallexample +typedef const int const_int; +const_int foo (3); +const_int& foo_ref (foo); +int main () @{ return 0; @} +@end smallexample + +Then in gdb: + +@smallexample +(gdb) start +(gdb) python import gdb.types +(gdb) python foo_ref = gdb.parse_and_eval("foo_ref") +(gdb) python print gdb.types.get_basic_type(foo_ref.type) +int +@end smallexample + +@item has_field (@var{type}, @var{field}) +Return @code{True} if @var{type}, assumed to be a type with fields +(e.g., a structure or union), has field @var{field}. + +@item make_enum_dict (@var{enum_type}) +Return a Python @code{dictionary} type produced from @var{enum_type}. +@end table + @node Interpreters @chapter Command Interpreters @cindex command interpreters |