diff options
author | Pedro Alves <palves@redhat.com> | 2015-08-13 18:56:42 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-08-13 18:56:42 +0100 |
commit | 3207396b9532f179bad24a9fb9a83253f3f5144d (patch) | |
tree | 6d9719683fdc1c9935d3d8973dbac92699236ae9 /gdb/python | |
parent | 67994074671a31e3d2fb78f6036f38095211ac49 (diff) | |
download | binutils-gdb-3207396b9532f179bad24a9fb9a83253f3f5144d.tar.gz |
Fix Python frame unwinder issue caught by Valgrind
Valgrind shows:
==17026== Invalid write of size 8
==17026== at 0x54AA80: pending_frame_invalidate (py-unwind.c:477)
==17026== by 0x5AB934: do_my_cleanups (cleanups.c:155)
==17026== by 0x5AB9AF: do_cleanups (cleanups.c:177)
==17026== by 0x54B009: pyuw_sniffer (py-unwind.c:606)
==17026== by 0x755DAC: frame_unwind_try_unwinder (frame-unwind.c:105)
==17026== by 0x755EEE: frame_unwind_find_by_frame (frame-unwind.c:160)
==17026== by 0x750FFA: compute_frame_id (frame.c:454)
==17026== by 0x753BD6: get_prev_frame_if_no_cycle (frame.c:1781)
==17026== by 0x754292: get_prev_frame_always_1 (frame.c:1955)
==17026== by 0x7542DA: get_prev_frame_always (frame.c:1971)
==17026== by 0x7547BE: get_prev_frame (frame.c:2213)
==17026== by 0x7532BD: unwind_to_current_frame (frame.c:1450)
==17026== Address 0xd27b570 is 16 bytes inside a block of size 32 free'd
==17026== at 0x4A07577: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==17026== by 0x54B276: gdb_Py_DECREF (python-internal.h:185)
==17026== by 0x54B298: py_decref (py-utils.c:34)
==17026== by 0x5AB934: do_my_cleanups (cleanups.c:155)
==17026== by 0x5AB9AF: do_cleanups (cleanups.c:177)
==17026== by 0x54B009: pyuw_sniffer (py-unwind.c:606)
==17026== by 0x755DAC: frame_unwind_try_unwinder (frame-unwind.c:105)
==17026== by 0x755EEE: frame_unwind_find_by_frame (frame-unwind.c:160)
==17026== by 0x750FFA: compute_frame_id (frame.c:454)
==17026== by 0x753BD6: get_prev_frame_if_no_cycle (frame.c:1781)
==17026== by 0x754292: get_prev_frame_always_1 (frame.c:1955)
==17026== by 0x7542DA: get_prev_frame_always (frame.c:1971)
==17026==
Simply invalidate the object before releasing it.
gdb/ChangeLog:
2015-08-13 Pedro Alves <palves@redhat.com>
* python/py-unwind.c (pyuw_sniffer): Install the invalidate
cleanup after the decref cleanup, not before.
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/py-unwind.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c index b6e8a7531ba..18f8f4d3546 100644 --- a/gdb/python/py-unwind.c +++ b/gdb/python/py-unwind.c @@ -537,8 +537,8 @@ pyuw_sniffer (const struct frame_unwind *self, struct frame_info *this_frame, goto error; ((pending_frame_object *) pyo_pending_frame)->gdbarch = gdbarch; ((pending_frame_object *) pyo_pending_frame)->frame_info = this_frame; - make_cleanup (pending_frame_invalidate, (void *) pyo_pending_frame); make_cleanup_py_decref (pyo_pending_frame); + make_cleanup (pending_frame_invalidate, (void *) pyo_pending_frame); /* Run unwinders. */ if (gdb_python_module == NULL |