aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/python.c
diff options
context:
space:
mode:
authorThiago Jung Bauermann <bauerman@br.ibm.com>2009-03-21 03:13:02 +0000
committerThiago Jung Bauermann <bauerman@br.ibm.com>2009-03-21 03:13:02 +0000
commitcc924cad9149ec2249eb5b18658b2516a9014969 (patch)
tree56fab376894dbf9010290b011765fe677c77f8b8 /gdb/python/python.c
parentbc3b79fd1ac12e5432ef017d81064427d04a2d71 (diff)
downloadgdb-cc924cad9149ec2249eb5b18658b2516a9014969.zip
gdb-cc924cad9149ec2249eb5b18658b2516a9014969.tar.gz
gdb-cc924cad9149ec2249eb5b18658b2516a9014969.tar.bz2
gdb/
2009-03-21 Jan Kratochvil <jan.kratochvil@redhat.com> Jim Blandy <jimb@red-bean.com> Thiago Jung Bauermann <bauerman@br.ibm.com> Tom Tromey <tromey@redhat.com> Miscellaneous fixes to the Python code. * python/python-cmd.c (cmdpy_init): Accept keyword arguments. * python/python-value.c (valpy_string): Accept keyword arguments. (valpy_binop): Use `break' to exit from the TRY_CATCH block. Do not call value_to_value_object on NULL RES_VAL. (value_object_methods): Change `string' entry to also accept keyword arguments. (convert_value_from_python): Return a copy of the value if obj is a gdb.Value object. (value_object_methods): Mark the `string' method as accepting keywords, and show method "prototype" in the doc string. * python/python.c (get_parameter): Don't return inside a TRY_CATCH. gdb/doc/ 2009-03-21 Thiago Jung Bauermann <bauerman@br.ibm.com> * gdb.texinfo (Values From Inferior): Fix optional arguments markup. (Commands In Python): Adjust argument names of gdb.Command.__init__ to what the function accepts as keywords. gdb/testsuite/ 2009-03-21 Thiago Jung Bauermann <bauerman@br.ibm.com> * gdb.python/python-cmd.exp: Add tests for keyword arguments. * gdb.python/python-function.exp: Add test for function returning a GDB value.
Diffstat (limited to 'gdb/python/python.c')
-rw-r--r--gdb/python/python.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 29f83bb..b48cf05 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -206,6 +206,7 @@ get_parameter (PyObject *self, PyObject *args)
{
struct cmd_list_element *alias, *prefix, *cmd;
char *arg, *newarg;
+ int found = -1;
volatile struct gdb_exception except;
if (! PyArg_ParseTuple (args, "s", &arg))
@@ -215,15 +216,13 @@ get_parameter (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- if (! lookup_cmd_composition (newarg, &alias, &prefix, &cmd))
- {
- xfree (newarg);
- return PyErr_Format (PyExc_RuntimeError,
- "could not find variable `%s'", arg);
- }
+ found = lookup_cmd_composition (newarg, &alias, &prefix, &cmd);
}
xfree (newarg);
GDB_PY_HANDLE_EXCEPTION (except);
+ if (!found)
+ return PyErr_Format (PyExc_RuntimeError,
+ "could not find parameter `%s'", arg);
if (! cmd->var)
return PyErr_Format (PyExc_RuntimeError, "`%s' is not a variable", arg);