aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2010-04-15 19:54:13 +0000
committerDoug Evans <dje@google.com>2010-04-15 19:54:13 +0000
commitfa33c3cd050c9f8a33ab0826479fd3e0f26a3da6 (patch)
tree8aa1bd5a3237ffff09f051cad7544427a67ed81e /gdb/doc
parent3f7b2faa4bb3f35f6c88687b6943cdbe6003b615 (diff)
downloadgdb-fa33c3cd050c9f8a33ab0826479fd3e0f26a3da6.zip
gdb-fa33c3cd050c9f8a33ab0826479fd3e0f26a3da6.tar.gz
gdb-fa33c3cd050c9f8a33ab0826479fd3e0f26a3da6.tar.bz2
* NEWS: Add entry for python program space support.
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-progspace.o. (SUBDIR_PYTHON_SRCS): Add py-progspace.c. (py-progspace.o): New rule. * python/py-prettyprint.c (find_pretty_printer_from_objfiles): New function. (find_pretty_printer_from_progspace): New function. (find_pretty_printer_from_gdb): New function. (find_pretty_printer): Rewrite. * python/py-progspace.c: New file. * python/python-internal.h (program_space): Add forward decl. (pspace_to_pspace_object, pspy_get_printers): Declare. (gdbpy_initialize_pspace): Declare. * python/python.c: #include "progspace.h". (gdbpy_get_current_progspace, gdbpy_progspaces): New functions. (_initialize_python): Call gdbpy_initialize_pspace. (GdbMethods): Add current_progspace, progspaces. doc/ * gdb.texinfo (Python API): Add progspaces section. (Selecting Pretty-Printers): Progspace pretty-printers are searched too. (Progspaces In Python): New section. testsuite/ * gdb.python/py-progspace.c: New file. * gdb.python/py-progspace.exp: New file.
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdb.texinfo53
2 files changed, 56 insertions, 2 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index ce9092f..0260d1e 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,5 +1,10 @@
2010-04-15 Doug Evans <dje@google.com>
+ * gdb.texinfo (Python API): Add progspaces section.
+ (Selecting Pretty-Printers): Progspace pretty-printers are
+ searched too.
+ (Progspaces In Python): New section.
+
* gdb.texinfo (Command Files): Add docs for new "source -s" option.
2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 749e975..8a224e0 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -19723,6 +19723,7 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown.
* Selecting Pretty-Printers:: How GDB chooses a pretty-printer.
* Commands In Python:: Implementing new commands in Python.
* Functions In Python:: Writing new convenience functions.
+* Progspaces In Python:: Program spaces.
* Objfiles In Python:: Object files.
* Frames In Python:: Accessing inferior stack frames from Python.
* Blocks In Python:: Accessing frame blocks from Python.
@@ -20461,6 +20462,7 @@ If the result is not one of these types, an exception is raised.
The Python list @code{gdb.pretty_printers} contains an array of
functions that have been registered via addition as a pretty-printer.
+Each @code{gdb.Progspace} contains a @code{pretty_printers} attribute.
Each @code{gdb.Objfile} also contains a @code{pretty_printers}
attribute.
@@ -20471,8 +20473,12 @@ cannot create a pretty-printer for the value, it should return
@code{None}.
@value{GDBN} first checks the @code{pretty_printers} attribute of each
-@code{gdb.Objfile} and iteratively calls each function in the list for
-that @code{gdb.Objfile} until it receives a pretty-printer object.
+@code{gdb.Objfile} in the current program space and iteratively calls
+each function in the list for that @code{gdb.Objfile} until it receives
+a pretty-printer object.
+If no pretty-printer is found in the objfile lists, @value{GDBN} then
+searches the pretty-printer list of the current program space,
+calling each function until an object is returned.
After these lists have been exhausted, it tries the global
@code{gdb.pretty-printers} list, again calling each function until an
object is returned.
@@ -20870,6 +20876,49 @@ registration of the function with @value{GDBN}. Depending on how the
Python code is read into @value{GDBN}, you may need to import the
@code{gdb} module explicitly.
+@node Progspaces In Python
+@subsubsection Program Spaces In Python
+
+@cindex progspaces in python
+@tindex gdb.Progspace
+@tindex Progspace
+A program space, or @dfn{progspace}, represents a symbolic view
+of an address space.
+It consists of all of the objfiles of the program.
+@xref{Objfiles In Python}.
+@xref{Inferiors and Programs, program spaces}, for more details
+about program spaces.
+
+The following progspace-related functions are available in the
+@code{gdb} module:
+
+@findex gdb.current_progspace
+@defun current_progspace
+This function returns the program space of the currently selected inferior.
+@xref{Inferiors and Programs}.
+@end defun
+
+@findex gdb.progspaces
+@defun progspaces
+Return a sequence of all the progspaces currently known to @value{GDBN}.
+@end defun
+
+Each progspace is represented by an instance of the @code{gdb.Progspace}
+class.
+
+@defivar Progspace filename
+The file name of the progspace as a string.
+@end defivar
+
+@defivar Progspace pretty_printers
+The @code{pretty_printers} attribute is a list of functions. It is
+used to look up pretty-printers. A @code{Value} is passed to each
+function in order; if the function returns @code{None}, then the
+search continues. Otherwise, the return value should be an object
+which is used to format the value. @xref{Pretty Printing}, for more
+information.
+@end defivar
+
@node Objfiles In Python
@subsubsection Objfiles In Python