aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-inferior.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-10-13 13:24:40 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-10-13 13:24:40 +0000
commit8dc785338e94086138ebe94b9cae2dc5194a3d5e (patch)
treece43e5d0cf65b83fd8df28031134c2f4d41238b3 /gdb/python/py-inferior.c
parenta071456ba824298e1d93c08d155932933334e532 (diff)
downloadgdb-8dc785338e94086138ebe94b9cae2dc5194a3d5e.zip
gdb-8dc785338e94086138ebe94b9cae2dc5194a3d5e.tar.gz
gdb-8dc785338e94086138ebe94b9cae2dc5194a3d5e.tar.bz2
gdb/
* python/py-breakpoint.c (bppy_set_condition): New comment. * python/py-cmd.c (cmdpy_function): Call also gdbpy_print_stack for failed PyUnicode_Decode. (cmdpy_completer): Skip element for failed python_string_to_host_string. (cmdpy_init): Return -1 on failed python_string_to_host_string. * python/py-frame.c (frapy_read_var): Extend the function comment. * python/py-function.c (fnpy_init): Return -1 on failed python_string_to_host_string. * python/py-inferior.c (infpy_read_memory, infpy_write_memory): Extend the function comment. (infpy_search_memory): Extend the function comment. Remove the PyErr_SetString call on already set error state. * python/py-param.c (set_parameter_value): Extend the function comment. Return -1 on failed python_string_to_host_string, twice. (set_attr): Extend the function comment. (compute_enum_values): Extend the function comment. New variable back_to. Protect self->enumeration by BACK_TO cleanups. Return 0 on failed python_string_to_host_string. (get_doc_string): Call gdbpy_print_stack on failed python_string_to_host_string. (parmpy_init): Extend the function comment. * python/py-prettyprint.c (pretty_print_one_value): Likewise. (gdbpy_get_display_hint, print_children): Call gdbpy_print_stack on failed python_string_to_host_string. * python/py-value.c (valpy_new, valpy_getitem, valpy_call) (valpy_binop, valpy_richcompare): Extend the function comment. * python/python.c (struct python_env) <error_type, error_value, error_traceback>: New fields. (restore_python_env): Handle PyErr_Occurred. Call PyErr_Restore. (ensure_python_env): Call PyErr_Fetch. * varobj.c (update_dynamic_varobj_children): Call gdbpy_print_stack on failed convert_value_from_python. (value_get_print_value): Call gdbpy_print_stack on failed python_string_to_target_python_string. gdb/testsuite/ * gdb.python/py-error.exp: New file. * gdb.python/py-error.py: New file.
Diffstat (limited to 'gdb/python/py-inferior.c')
-rw-r--r--gdb/python/py-inferior.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 3a0feab..b1ddb168 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -293,7 +293,8 @@ gdbpy_inferiors (PyObject *unused, PyObject *unused2)
/* Implementation of gdb.read_memory (address, length).
Returns a Python buffer object with LENGTH bytes of the inferior's
- memory at ADDRESS. Both arguments are integers. */
+ memory at ADDRESS. Both arguments are integers. Returns NULL on error,
+ with a python exception set. */
static PyObject *
infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
{
@@ -361,7 +362,8 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
Writes the contents of BUFFER (a Python object supporting the read
buffer protocol) at ADDRESS in the inferior's memory. Write LENGTH
bytes from BUFFER, or its entire contents if the argument is not
- provided. The function returns nothing. */
+ provided. The function returns nothing. Returns NULL on error, with
+ a python exception set. */
static PyObject *
infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
{
@@ -473,7 +475,8 @@ get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr)
search from ADDRESS. PATTERN is the pattern to search for (and
must be a Python object supporting the buffer protocol).
Returns a Python Long object holding the address where the pattern
- was located, or if the pattern was not found, returns None. */
+ was located, or if the pattern was not found, returns None. Returns NULL
+ on error, with a python exception set. */
static PyObject *
infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
{
@@ -511,12 +514,7 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
}
}
else
- {
- PyErr_SetString (PyExc_RuntimeError,
- _("Cannot get search address/range from Python."));
-
- return NULL;
- }
+ return NULL;
if (!PyObject_CheckReadBuffer (pattern))
{