diff options
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 47 |
2 files changed, 39 insertions, 15 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index d999772..75f6f70 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,10 @@ +2010-11-12 Tom Tromey <tromey@redhat.com> + + * gdb.texinfo (Basic Python): Update. Add xref. + (Exception Handling): Document new exception classes. + (Types In Python): Update. + (Frames In Python): Update. + 2010-11-11 Phil Muldoon <pmuldoon@redhat.com> * gdb.texinfo (Breakpoints In Python): Document "internal" diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index cf70ce4..ddc711b 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -20729,8 +20729,9 @@ spaces if the parameter has a multi-part name. For example, @samp{print object} is a valid parameter name. If the named parameter does not exist, this function throws a -@code{RuntimeError}. Otherwise, the parameter's value is converted to -a Python value of the appropriate type, and returned. +@code{gdb.error} (@pxref{Exception Handling}). Otherwise, the +parameter's value is converted to a Python value of the appropriate +type, and returned. @end defun @findex gdb.history @@ -20741,7 +20742,7 @@ If @var{number} is negative, then @value{GDBN} will take its absolute value and count backward from the last element (i.e., the most recent element) to find the value to return. If @var{number} is zero, then @value{GDBN} will return the most recent element. If the element specified by @var{number} -doesn't exist in the value history, a @code{RuntimeError} exception will be +doesn't exist in the value history, a @code{gdb.error} exception will be raised. If no exception is raised, the return value is always an instance of @@ -20869,15 +20870,31 @@ Traceback (most recent call last): NameError: name 'foo' is not defined @end smallexample -@value{GDBN} errors that happen in @value{GDBN} commands invoked by Python -code are converted to Python @code{RuntimeError} exceptions. User -interrupt (via @kbd{C-c} or by typing @kbd{q} at a pagination -prompt) is translated to a Python @code{KeyboardInterrupt} -exception. If you catch these exceptions in your Python code, your -exception handler will see @code{RuntimeError} or -@code{KeyboardInterrupt} as the exception type, the @value{GDBN} error -message as its value, and the Python call stack backtrace at the -Python statement closest to where the @value{GDBN} error occured as the +@value{GDBN} errors that happen in @value{GDBN} commands invoked by +Python code are converted to Python exceptions. The type of the +Python exception depends on the error. + +@ftable @code +@item gdb.error +This is the base class for most exceptions generated by @value{GDBN}. +It is derived from @code{RuntimeError}, for compatibility with earlier +versions of @value{GDBN}. + +If an error occurring in @value{GDBN} does not fit into some more +specific category, then the generated exception will have this type. + +@item gdb.MemoryError +This is a subclass of @code{gdb.error} which is thrown when an +operation tried to access invalid memory in the inferior. + +@item KeyboardInterrupt +User interrupt (via @kbd{C-c} or by typing @kbd{q} at a pagination +prompt) is translated to a Python @code{KeyboardInterrupt} exception. +@end ftable + +In all cases, your exception handler will see the @value{GDBN} error +message as its value and the Python call stack backtrace at the Python +statement closest to where the @value{GDBN} error occured as the traceback. @findex gdb.GdbError @@ -21242,7 +21259,7 @@ variant of this type. That is, the result is neither @code{const} nor Return a Python @code{Tuple} object that contains two elements: the low bound of the argument type and the high bound of that type. If the type does not have a range, @value{GDBN} will raise a -@code{RuntimeError} exception. +@code{gdb.error} exception (@pxref{Exception Handling}). @end defmethod @defmethod Type reference @@ -22433,8 +22450,8 @@ When the debugged program stops, @value{GDBN} is able to analyze its call stack (@pxref{Frames,,Stack frames}). The @code{gdb.Frame} class represents a frame in the stack. A @code{gdb.Frame} object is only valid while its corresponding frame exists in the inferior's stack. If you try -to use an invalid frame object, @value{GDBN} will throw a @code{RuntimeError} -exception. +to use an invalid frame object, @value{GDBN} will throw a @code{gdb.error} +exception (@pxref{Exception Handling}). Two @code{gdb.Frame} objects can be compared for equality with the @code{==} operator, like: |