This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA][patch 1/9] Yet another respin of the patch with initial Python support
On Mon, 2008-08-04 at 22:07 -0400, Daniel Jacobowitz wrote:
> So that gives me a paragraph like this, which I think is accurate.
> Does this look OK to you?
I liked it. So this is the complete version of this text that I have for
now. I changed the last sentence a bit, to reflect what you actually get
from the Python exception:
@cindex python exceptions
@cindex exceptions, python
When executing Python code, uncaught Python exceptions are translated
to calls to the @value{GDBN} error-reporting mechanism. If
@value{GDBN} does not handle the error, it will terminate the current
command and print an error message containing the Python exception
name, the associated value, and the Python call stack backtrace at the
point where the exception was raised. Example:
@smallexample
(@value{GDBP}) python print foo
Traceback (most recent call last):
File "<string>", line 1, in <module>
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{GDB} error occured as the
traceback.
It this ok?
--
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center