Re: [patch] fix for crash in python pretty-printer

Paul Pluzhnikov
2009-07-07T20:41:33Z

[-- Attachment #1: Type: text/plain, Size: 484 bytes --]

On Tue, Jul 7, 2009 at 12:50 PM, Paul Pluzhnikov<ppluzhnikov@google.com> wrote:

> Committed to the mainline.

It turns out I didn't follow what happens when value_struct_elt() raises
error correctly: when it does, res_val will be left as NULL, and that will
trigger gdb_assert in my previous patch.

Here is a fix. Sorry for the noise :-(

--
Paul Pluzhnikov

2009-07-07 Paul Pluzhnikov <ppluzhnikov@google.com>

* python/python-value.c (valpy_getitem): Remove incorrect assert.

[-- Attachment #2: gdb-pretty-printer-crash-20090707-2.txt --]
[-- Type: text/plain, Size: 682 bytes --]

Index: python/python-value.c
===================================================================
RCS file: /cvs/src/src/gdb/python/python-value.c,v
retrieving revision 1.22
diff -u -p -u -r1.22 python-value.c
--- python/python-value.c 7 Jul 2009 19:36:09 -0000 1.22
+++ python/python-value.c 7 Jul 2009 20:32:27 -0000
@@ -294,17 +294,11 @@ valpy_getitem (PyObject *self, PyObject
}
}

- if (res_val == NULL)
- {
- gdb_assert (field == NULL);
- return NULL;
- }
-
if (field)
xfree (field);
GDB_PY_HANDLE_EXCEPTION (except);

- return value_to_value_object (res_val);
+ return res_val ? value_to_value_object (res_val) : NULL;
}

static int