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 <tromey@redhat.com> PR python/16491: * python/py-framefilter.c (apply_frame_filter): Call ensure_python_env after computing gdbarch. 2014-01-23 Tom Tromey <tromey@redhat.com> 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.
This commit is contained in:
parent
17fde6d091
commit
21909fa1c6
|
@ -1,3 +1,9 @@
|
||||||
|
2014-01-23 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
PR python/16491:
|
||||||
|
* python/py-framefilter.c (apply_frame_filter): Call
|
||||||
|
ensure_python_env after computing gdbarch.
|
||||||
|
|
||||||
2014-01-23 Yao Qi <yao@codesourcery.com>
|
2014-01-23 Yao Qi <yao@codesourcery.com>
|
||||||
|
|
||||||
* target.c (raw_memory_xfer_partial): Change argument type
|
* target.c (raw_memory_xfer_partial): Change argument type
|
||||||
|
|
|
@ -1477,18 +1477,18 @@ apply_frame_filter (struct frame_info *frame, int flags,
|
||||||
if (!gdb_python_initialized)
|
if (!gdb_python_initialized)
|
||||||
return PY_BT_NO_FILTERS;
|
return PY_BT_NO_FILTERS;
|
||||||
|
|
||||||
cleanups = ensure_python_env (gdbarch, current_language);
|
|
||||||
|
|
||||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||||
{
|
{
|
||||||
gdbarch = get_frame_arch (frame);
|
gdbarch = get_frame_arch (frame);
|
||||||
}
|
}
|
||||||
if (except.reason < 0)
|
if (except.reason < 0)
|
||||||
{
|
{
|
||||||
gdbpy_convert_exception (except);
|
/* Let gdb try to print the stack trace. */
|
||||||
goto error;
|
return PY_BT_NO_FILTERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanups = ensure_python_env (gdbarch, current_language);
|
||||||
|
|
||||||
iterable = bootstrap_python_frame_filters (frame, frame_low, frame_high);
|
iterable = bootstrap_python_frame_filters (frame, frame_low, frame_high);
|
||||||
|
|
||||||
if (iterable == NULL)
|
if (iterable == NULL)
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
2014-01-23 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
2014-01-22 Doug Evans <dje@google.com>
|
2014-01-22 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
* gdb.server/server-mon.exp: Add tests for "set debug-format".
|
* gdb.server/server-mon.exp: Add tests for "set debug-format".
|
||||||
|
|
|
@ -66,10 +66,10 @@ mi_continue_to_line [gdb_get_line_number {Backtrace end breakpoint} ${srcfile}]
|
||||||
"step to breakpoint"
|
"step to breakpoint"
|
||||||
|
|
||||||
mi_gdb_test "-stack-list-frames" \
|
mi_gdb_test "-stack-list-frames" \
|
||||||
"\\^done,stack=\\\[frame={level=\"0\",addr=\"$hex\",func=\"cnuf_dne\".*},frame={level=\"1\",addr=\"$hex\",func=\"acnuf\".*},frame={level=\"2\",addr=\"$hex\",func=\"bcnuf\".*},frame={level=\"3\",addr=\"$hex\",func=\"acnuf\".*},frame={level=\"22\",addr=\"$hex\",func=\"1cnuf\".*,children=\\\[frame={level=\"23\",addr=\"$hex\",func=\"func2\".*}\\\]},frame={level=\"24\",addr=\"$hex\",func=\"3cnuf\".*},frame={level=\"27\",addr=\"$hex\",func=\"niam\".*}\\\].*" \
|
"\\^done,stack=\\\[frame={level=\"0\",addr=\"$hex\",func=\"cnuf_dne.*\".*},frame={level=\"1\",addr=\"$hex\",func=\"acnuf\".*},frame={level=\"2\",addr=\"$hex\",func=\"bcnuf\".*},frame={level=\"3\",addr=\"$hex\",func=\"acnuf\".*},frame={level=\"22\",addr=\"$hex\",func=\"1cnuf\".*,children=\\\[frame={level=\"23\",addr=\"$hex\",func=\"func2\".*}\\\]},frame={level=\"24\",addr=\"$hex\",func=\"3cnuf\".*},frame={level=\"27\",addr=\"$hex\",func=\"niam\".*}\\\].*" \
|
||||||
"filtered stack listing"
|
"filtered stack listing"
|
||||||
mi_gdb_test "-stack-list-frames 0 3" \
|
mi_gdb_test "-stack-list-frames 0 3" \
|
||||||
"\\^done,stack=\\\[frame={level=\"0\",addr=\"$hex\",func=\"cnuf_dne\".*},frame={level=\"1\",addr=\"$hex\",func=\"acnuf\".*},frame={level=\"2\",addr=\"$hex\",func=\"bcnuf\".*},frame={level=\"3\",addr=\"$hex\",func=\"acnuf\".*}\\\]" \
|
"\\^done,stack=\\\[frame={level=\"0\",addr=\"$hex\",func=\"cnuf_dne.*\".*},frame={level=\"1\",addr=\"$hex\",func=\"acnuf\".*},frame={level=\"2\",addr=\"$hex\",func=\"bcnuf\".*},frame={level=\"3\",addr=\"$hex\",func=\"acnuf\".*}\\\]" \
|
||||||
"filtered stack list 0 3"
|
"filtered stack list 0 3"
|
||||||
mi_gdb_test "-stack-list-frames 22 24" \
|
mi_gdb_test "-stack-list-frames 22 24" \
|
||||||
"\\^done,stack=\\\[frame={level=\"22\",addr=\"$hex\",func=\"1cnuf\".*,children=\\\[frame={level=\"23\",addr=\"$hex\",func=\"func2\".*}\\\]},frame={level=\"24\",addr=\"$hex\",func=\"3cnuf\".*}\\\]" \
|
"\\^done,stack=\\\[frame={level=\"22\",addr=\"$hex\",func=\"1cnuf\".*,children=\\\[frame={level=\"23\",addr=\"$hex\",func=\"func2\".*}\\\]},frame={level=\"24\",addr=\"$hex\",func=\"3cnuf\".*}\\\]" \
|
||||||
|
|
|
@ -30,8 +30,11 @@ class Reverse_Function (FrameDecorator):
|
||||||
fname = str (self.fobj.function())
|
fname = str (self.fobj.function())
|
||||||
if (fname == None or fname == ""):
|
if (fname == None or fname == ""):
|
||||||
return None
|
return None
|
||||||
|
if fname == 'end_func':
|
||||||
|
extra = self.fobj.inferior_frame().read_var('str').string()
|
||||||
else:
|
else:
|
||||||
fname = fname[::-1]
|
extra = ''
|
||||||
|
fname = fname[::-1] + extra
|
||||||
return fname
|
return fname
|
||||||
|
|
||||||
class Dummy (FrameDecorator):
|
class Dummy (FrameDecorator):
|
||||||
|
|
Loading…
Reference in New Issue