aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/python.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2010-05-17 21:23:25 +0000
committerMichael Snyder <msnyder@vmware.com>2010-05-17 21:23:25 +0000
commitd59b6f6c38a3e9c229dae40bd6c668be47fe8e48 (patch)
treed3e248c0abb4d8baf265767d9542537bd1b0d373 /gdb/python/python.c
parent102040f0d08b06980adf402c17b2f039fee7d23c (diff)
downloadgdb-d59b6f6c38a3e9c229dae40bd6c668be47fe8e48.zip
gdb-d59b6f6c38a3e9c229dae40bd6c668be47fe8e48.tar.gz
gdb-d59b6f6c38a3e9c229dae40bd6c668be47fe8e48.tar.bz2
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/python.c')
-rw-r--r--gdb/python/python.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 0f66f67..f03af2e 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -77,6 +77,7 @@ static void
restore_python_env (void *p)
{
struct python_env *env = (struct python_env *)p;
+
PyGILState_Release (env->state);
python_gdbarch = env->gdbarch;
python_language = env->language;
@@ -124,6 +125,7 @@ compute_python_string (struct command_line *l)
for (iter = l; iter; iter = iter->next)
{
int len = strlen (iter->line);
+
strcpy (&script[here], iter->line);
here += len;
script[here++] = '\n';
@@ -165,8 +167,8 @@ static void
python_command (char *arg, int from_tty)
{
struct cleanup *cleanup;
- cleanup = ensure_python_env (get_current_arch (), current_language);
+ cleanup = ensure_python_env (get_current_arch (), current_language);
while (arg && *arg && isspace (*arg))
++arg;
if (arg && *arg)
@@ -180,6 +182,7 @@ python_command (char *arg, int from_tty)
else
{
struct command_line *l = get_command_line (python_control, "");
+
make_cleanup_free_command_lines (&l);
execute_control_command_untraced (l);
}
@@ -204,6 +207,7 @@ gdbpy_parameter_value (enum var_types type, void *var)
case var_enum:
{
char *str = * (char **) var;
+
if (! str)
str = "";
return PyString_Decode (str, strlen (str), host_charset (), NULL);
@@ -220,6 +224,7 @@ gdbpy_parameter_value (enum var_types type, void *var)
case var_auto_boolean:
{
enum auto_boolean ab = * (enum auto_boolean *) var;
+
if (ab == AUTO_BOOLEAN_TRUE)
Py_RETURN_TRUE;
else if (ab == AUTO_BOOLEAN_FALSE)
@@ -238,6 +243,7 @@ gdbpy_parameter_value (enum var_types type, void *var)
case var_uinteger:
{
unsigned int val = * (unsigned int *) var;
+
if (val == UINT_MAX)
Py_RETURN_NONE;
return PyLong_FromUnsignedLong (val);
@@ -286,6 +292,7 @@ static PyObject *
gdbpy_target_charset (PyObject *self, PyObject *args)
{
const char *cset = target_charset (python_gdbarch);
+
return PyUnicode_Decode (cset, strlen (cset), host_charset (), NULL);
}
@@ -295,6 +302,7 @@ static PyObject *
gdbpy_target_wide_charset (PyObject *self, PyObject *args)
{
const char *cset = target_wide_charset (python_gdbarch);
+
return PyUnicode_Decode (cset, strlen (cset), host_charset (), NULL);
}
@@ -326,6 +334,7 @@ execute_gdb_command (PyObject *self, PyObject *args)
/* Copy the argument text in case the command modifies it. */
char *copy = xstrdup (arg);
struct cleanup *cleanup = make_cleanup (xfree, copy);
+
execute_command (copy, from_tty);
do_cleanups (cleanup);
}
@@ -383,6 +392,7 @@ static PyObject *
gdbpy_write (PyObject *self, PyObject *args)
{
char *arg;
+
if (! PyArg_ParseTuple (args, "s", &arg))
return NULL;
printf_filtered ("%s", arg);
@@ -440,6 +450,7 @@ gdbpy_progspaces (PyObject *unused1, PyObject *unused2)
ALL_PSPACES (ps)
{
PyObject *item = pspace_to_pspace_object (ps);
+
if (!item || PyList_Append (list, item) == -1)
{
Py_DECREF (list);
@@ -509,6 +520,7 @@ gdbpy_objfiles (PyObject *unused1, PyObject *unused2)
ALL_OBJFILES (objf)
{
PyObject *item = objfile_to_objfile_object (objf);
+
if (!item || PyList_Append (list, item) == -1)
{
Py_DECREF (list);
@@ -534,6 +546,7 @@ python_command (char *arg, int from_tty)
{
struct command_line *l = get_command_line (python_control, "");
struct cleanup *cleanups = make_cleanup_free_command_lines (&l);
+
execute_control_command_untraced (l);
do_cleanups (cleanups);
}