From 21909fa1c6d934bfa0c7ad3ef95909db48f6f756 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 22 Jan 2014 08:10:01 -0700 Subject: fix crash in frame filters apply_frame_filter calls ensure_python_env before computing the gdbarch to use. This means that python_gdbarch can be NULL while in Python code, and if a frame filter depends on this somehow (easy to do), gdb will crash. The fix is to compute the gdbarch first. Built and regtested on x86-64 Fedora 18. New test case included. 2014-01-23 Tom Tromey PR python/16491: * python/py-framefilter.c (apply_frame_filter): Call ensure_python_env after computing gdbarch. 2014-01-23 Tom Tromey PR python/16491: * gdb.python/py-framefilter.py (Reverse_Function.function): Read a string from an inferior frame. * gdb.python/py-framefilter-mi.exp: Update. --- gdb/python/py-framefilter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gdb/python') diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index 76ce4e5..c6a29ef 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -1477,18 +1477,18 @@ apply_frame_filter (struct frame_info *frame, int flags, if (!gdb_python_initialized) return PY_BT_NO_FILTERS; - cleanups = ensure_python_env (gdbarch, current_language); - TRY_CATCH (except, RETURN_MASK_ALL) { gdbarch = get_frame_arch (frame); } if (except.reason < 0) { - gdbpy_convert_exception (except); - goto error; + /* Let gdb try to print the stack trace. */ + return PY_BT_NO_FILTERS; } + cleanups = ensure_python_env (gdbarch, current_language); + iterable = bootstrap_python_frame_filters (frame, frame_low, frame_high); if (iterable == NULL) -- cgit v1.1