diff options
author | Michael Snyder <msnyder@vmware.com> | 2010-05-17 21:23:25 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2010-05-17 21:23:25 +0000 |
commit | d59b6f6c38a3e9c229dae40bd6c668be47fe8e48 (patch) | |
tree | d3e248c0abb4d8baf265767d9542537bd1b0d373 /gdb/python/py-cmd.c | |
parent | 102040f0d08b06980adf402c17b2f039fee7d23c (diff) | |
download | binutils-gdb-d59b6f6c38a3e9c229dae40bd6c668be47fe8e48.tar.gz |
2010-05-17 Michael Snyder <msnyder@vmware.com>
* python/py-auto-load.c: White space.
* python/py-block.c: White space.
* python/py-breakpoint.c: White space.
* python/py-cmd.c: White space.
* python/py-function.c: White space.
* python/py-lazy-string.c: White space.
* python/py-objfile.c: White space.
* python/py-param.c: White space.
* python/py-prettyprint.c: White space.
* python/py-progspace.c: White space.
* python/py-symtab.c: White space.
* python/python.c: White space.
* python/py-type.c: White space.
* python/py-utils.c: White space.
* python/py-value.c: White space.
Diffstat (limited to 'gdb/python/py-cmd.c')
-rw-r--r-- | gdb/python/py-cmd.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c index 677a03da565..f9a4130f26d 100644 --- a/gdb/python/py-cmd.c +++ b/gdb/python/py-cmd.c @@ -156,8 +156,8 @@ cmdpy_function (struct cmd_list_element *command, char *args, int from_tty) /* Make a temporary copy of the string data. */ char *s = PyString_AsString (pvalue); char *copy = alloca (strlen (s) + 1); - strcpy (copy, s); + strcpy (copy, s); PyErr_Restore (ptype, pvalue, ptraceback); gdbpy_print_stack (); error (_("Error occurred in Python command: %s"), copy); @@ -217,6 +217,7 @@ cmdpy_completer (struct cmd_list_element *command, char *text, char *word) { Py_ssize_t i, len = PySequence_Size (resultobj); Py_ssize_t out; + if (len < 0) goto done; @@ -224,6 +225,7 @@ cmdpy_completer (struct cmd_list_element *command, char *text, char *word) for (i = out = 0; i < len; ++i) { PyObject *elt = PySequence_GetItem (resultobj, i); + if (elt == NULL || ! gdbpy_is_string (elt)) { /* Skip problem elements. */ @@ -240,6 +242,7 @@ cmdpy_completer (struct cmd_list_element *command, char *text, char *word) /* User code may also return one of the completion constants, thus requesting that sort of completion. */ long value = PyInt_AsLong (resultobj); + if (value >= 0 && value < (long) N_COMPLETERS) result = completers[value].completer (command, text, word); } @@ -438,6 +441,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw) if (PyObject_HasAttr (self, gdbpy_doc_cst)) { PyObject *ds_obj = PyObject_GetAttr (self, gdbpy_doc_cst); + if (ds_obj && gdbpy_is_string (ds_obj)) docstring = python_string_to_host_string (ds_obj); } |