Bug 16491 - crash in py-framefilter.c
Summary: crash in py-framefilter.c
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 7.7
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-22 07:37 UTC by Tom Tromey
Modified: 2014-01-23 15:36 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Tromey 2014-01-22 07:37:52 UTC
Another py-framefilter crash, different from the previous one.

(top) bt
#0  0x00000036876e5790 in __read_nocancel ()
    at ../sysdeps/unix/syscall-template.S:81
#1  0x0000003687677f28 in _IO_new_file_underflow (fp=
    0x36879b2360 <_IO_2_1_stdin_>) at fileops.c:613
#2  0x0000003687678ece in __GI__IO_default_uflow (fp=
    0x36879b2360 <_IO_2_1_stdin_>) at genops.c:436
#3  0x0000003687673e17 in _IO_getc (fp=0x36879b2360 <_IO_2_1_stdin_>)
    at getc.c:40
#4  0x000000000085f88b in defaulted_query (ctlstr=
    0x1035648 "%s\nQuit this debugging session? ", defchar=0 '\000', args=
    0x7fffffffcbe0) at ../../binutils-gdb/gdb/utils.c:1267
#5  0x000000000085fc30 in query (ctlstr=
    0x1035648 "%s\nQuit this debugging session? ")
    at ../../binutils-gdb/gdb/utils.c:1388
#6  0x000000000085eb3f in internal_vproblem (problem=
    0x1d63630 <internal_error_problem>, file=
    0xff86a0 "../../binutils-gdb/gdb/gdbarch.c", line=4312, fmt=
    0xff866b "%s: Assertion `%s' failed.", ap=0x7fffffffcd78)
    at ../../binutils-gdb/gdb/utils.c:763
#7  0x000000000085ecbd in internal_verror (file=
    0xff86a0 "../../binutils-gdb/gdb/gdbarch.c", line=4312, fmt=
    0xff866b "%s: Assertion `%s' failed.", ap=0x7fffffffcd78)
    at ../../binutils-gdb/gdb/utils.c:820
#8  0x000000000085ed7c in internal_error (file=
    0xff86a0 "../../binutils-gdb/gdb/gdbarch.c", line=4312, string=
    0xff866b "%s: Assertion `%s' failed.")
    at ../../binutils-gdb/gdb/utils.c:830
#9  0x000000000076daaf in gdbarch_auto_charset (gdbarch=0x0)
    at ../../binutils-gdb/gdb/gdbarch.c:4312
#10 0x00000000006e0e70 in target_charset (gdbarch=0x0)
    at ../../binutils-gdb/gdb/charset.c:403
#11 0x00000000006865d4 in unicode_to_target_string (unicode_str=u'instance')
    at ../../binutils-gdb/gdb/python/py-utils.c:151
#12 0x000000000068664d in python_string_to_target_string (obj='instance')
    at ../../binutils-gdb/gdb/python/py-utils.c:180
#13 0x0000000000677b0b in frapy_read_var (self=
    <gdb.Frame at remote 0x23a6e70>, args=('instance',))
    at ../../binutils-gdb/gdb/python/py-frame.c:456
#14 0x000000378fadd281 in call_function (oparg=<optimized out>, pp_stack=
    0x7fffffffd128) at /usr/src/debug/Python-2.7.3/Python/ceval.c:4098
#15 PyEval_EvalFrameEx (f=<optimized out>, throwflag=throwflag@entry=0)
    at /usr/src/debug/Python-2.7.3/Python/ceval.c:2740
#16 0x000000378fadcef1 in fast_function (nk=<optimized out>, na=2, 
    n=<optimized out>, pp_stack=0x7fffffffd328, func=
    <function at remote 0x23ae1b8>)
    at /usr/src/debug/Python-2.7.3/Python/ceval.c:4184
#17 call_function (oparg=<optimized out>, pp_stack=0x7fffffffd328)
    at /usr/src/debug/Python-2.7.3/Python/ceval.c:4119
#18 PyEval_EvalFrameEx (f=f@entry=
    Frame 0x28bf2d0, for file /home/tromey/gnu/gnome/install/share/glib-2.0/gdb/gobject.py, line 181, in read_object (self=<SignalFrame(frames=[<FrameDecorator(_base=<gdb.Frame at remote 0x239de30>) at remote 0x23a6ed0>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6ef0>) at remote 0x23a6e50>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6e70>) at remote 0x23a6dd0>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6df0>) at remote 0x23a6d50>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6d70>) at remote 0x23a6cd0>], frame=<...>, _base=<...>) at remote 0x23a6f50>, frame=<...>, name='instance', array=[]), 
    throwflag=throwflag@entry=0)
    at /usr/src/debug/Python-2.7.3/Python/ceval.c:2740
#19 0x000000378faddcbf in PyEval_EvalCodeEx (co=<optimized out>, 
    globals=<optimized out>, locals=locals@entry=0x0, args=<optimized out>, 
    argcount=argcount@entry=4, kws=0x2808980, kwcount=0, defs=0x23a6aa8, 
    defcount=1, closure=0x0) at /usr/src/debug/Python-2.7.3/Python/ceval.c:3330
---Type <return> to continue, or q <return> to quit---
#20 0x000000378fadc2b3 in fast_function (nk=<optimized out>, na=4, 
    n=<optimized out>, pp_stack=0x7fffffffd5d8, func=
    <function at remote 0x23ae410>)
    at /usr/src/debug/Python-2.7.3/Python/ceval.c:4194
#21 call_function (oparg=<optimized out>, pp_stack=0x7fffffffd5d8)
    at /usr/src/debug/Python-2.7.3/Python/ceval.c:4119
#22 PyEval_EvalFrameEx (f=f@entry=
    Frame 0x2808790, for file /home/tromey/gnu/gnome/install/share/glib-2.0/gdb/gobject.py, line 219, in function (self=<SignalFrame(frames=[<FrameDecorator(_base=<gdb.Frame at remote 0x239de30>) at remote 0x23a6ed0>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6ef0>) at remote 0x23a6e50>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6e70>) at remote 0x23a6dd0>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6df0>) at remote 0x23a6d50>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6d70>) at remote 0x23a6cd0>], frame=<...>, _base=<...>) at remote 0x23a6f50>, instances=[], signals=[], frame=<...>, name='signal_emit_unlocked_R'), throwflag=throwflag@entry=0)
    at /usr/src/debug/Python-2.7.3/Python/ceval.c:2740
#23 0x000000378faddcbf in PyEval_EvalCodeEx (co=<optimized out>, 
    globals=<optimized out>, locals=locals@entry=0x0, args=args@entry=
    0x239db68, argcount=1, kws=kws@entry=0x0, kwcount=kwcount@entry=0, 
    defs=defs@entry=0x0, defcount=defcount@entry=0, closure=0x0)
    at /usr/src/debug/Python-2.7.3/Python/ceval.c:3330
#24 0x000000378fa6d926 in function_call (func=<function at remote 0x23ae5f0>, 
    arg=
    (<SignalFrame(frames=[<FrameDecorator(_base=<gdb.Frame at remote 0x239de30>) at remote 0x23a6ed0>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6ef0>) at remote 0x23a6e50>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6e70>) at remote 0x23a6dd0>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6df0>) at remote 0x23a6d50>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6d70>) at remote 0x23a6cd0>], frame=<...>, _base=<...>) at remote 0x23a6f50>,), kw=0x0)
    at /usr/src/debug/Python-2.7.3/Objects/funcobject.c:526
#25 0x000000378fa49c0e in PyObject_Call (func=func@entry=
    <function at remote 0x23ae5f0>, arg=arg@entry=
    (<SignalFrame(frames=[<FrameDecorator(_base=<gdb.Frame at remote 0x239de30>) at remote 0x23a6ed0>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6ef0>) at remote 0x23a6e50>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6e70>) at remote 0x23a6dd0>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6df0>) at remote 0x23a6d50>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6d70>) at remote 0x23a6cd0>], frame=<...>, _base=<...>) at remote 0x23a6f50>,), kw=kw@entry=0x0)
    at /usr/src/debug/Python-2.7.3/Objects/abstract.c:2529
#26 0x000000378fa58200 in instancemethod_call (func=
    <function at remote 0x23ae5f0>, arg=
    (<SignalFrame(frames=[<FrameDecorator(_base=<gdb.Frame at remote 0x239de30>) at remote 0x23a6ed0>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6ef0>) at remote 0x23a6e50>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6e70>) at remote 0x23a6dd0>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6df0>) at remote 0x23a6d50>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6d70>) at remote 0x23a6cd0>], frame=<...>, _base=<...>) at remote 0x23a6f50>,), kw=0x0)
    at /usr/src/debug/Python-2.7.3/Objects/classobject.c:2578
#27 0x000000378fa49c0e in PyObject_Call (func=func@entry=
    <instancemethod at remote 0x7ffff1b8d5f0>, arg=arg@entry=(), kw=kw@entry=
    0x0) at /usr/src/debug/Python-2.7.3/Objects/abstract.c:2529
#28 0x000000378fa49cf1 in call_function_tail (callable=
    <instancemethod at remote 0x7ffff1b8d5f0>, args=())
    at /usr/src/debug/Python-2.7.3/Objects/abstract.c:2561
#29 0x000000378fa4a135 in _PyObject_CallMethod_SizeT (o=<optimized out>, name=
    0xfaca65 "function", format=0x0)
    at /usr/src/debug/Python-2.7.3/Objects/abstract.c:2677
#30 0x000000000067a0d9 in py_print_frame (filter=
    <SignalFrame(frames=[<FrameDecorator(_base=<gdb.Frame at remote 0x239de30>) at remote 0x23a6ed0>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6ef0>) at remote 0x23a6e50>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6e70>) at remote 0x23a6dd0>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6df0>) at remote---Type <return> to continue, or q <return> to quit---
 0x23a6d50>, <FrameDecorator(_base=<gdb.Frame at remote 0x23a6d70>) at remote 0x23a6cd0>], frame=<...>, _base=<...>) at remote 0x23a6f50>, flags=7, 
    args_type=CLI_SCALAR_VALUES, out=0x23d8220, indent=0, 
    levels_printed=0x28446e0)
    at ../../binutils-gdb/gdb/python/py-framefilter.c:1165
#31 0x000000000067ab9c in apply_frame_filter (frame=0x2234bd0, flags=7, 
    args_type=CLI_SCALAR_VALUES, out=0x23d8220, frame_low=0, frame_high=-1)
    at ../../binutils-gdb/gdb/python/py-framefilter.c:1532
#32 0x000000000074ec38 in backtrace_command_1 (count_exp=0x0, show_locals=0, 
    no_filters=0, from_tty=1) at ../../binutils-gdb/gdb/stack.c:1797
#33 0x000000000074f097 in backtrace_command (arg=0x0, from_tty=1)
    at ../../binutils-gdb/gdb/stack.c:1911
#34 0x0000000000646bde in do_cfunc (c=0x221a8b0, args=0x0, from_tty=1)
    at ../../binutils-gdb/gdb/cli/cli-decode.c:107
#35 0x0000000000649d1c in cmd_func (cmd=0x221a8b0, args=0x0, from_tty=1)
    at ../../binutils-gdb/gdb/cli/cli-decode.c:1886
#36 0x000000000085bdd3 in execute_command (p=0x1fac6c2 "", from_tty=1)
    at ../../binutils-gdb/gdb/top.c:458
#37 0x0000000000760337 in command_handler (command=0x1fac6c0 "bt")
    at ../../binutils-gdb/gdb/event-top.c:435
#38 0x00000000007608f6 in command_line_handler (rl=0x2628570 "bt")
    at ../../binutils-gdb/gdb/event-top.c:632
#39 0x00000000008b95f9 in rl_callback_read_char ()
    at ../../binutils-gdb/readline/callback.c:220
#40 0x000000000075fe59 in rl_callback_read_char_wrapper (client_data=0x0)
    at ../../binutils-gdb/gdb/event-top.c:164
#41 0x000000000076024e in stdin_event_handler (error=0, client_data=0x0)
    at ../../binutils-gdb/gdb/event-top.c:375
#42 0x000000000075edde in handle_file_event (data=...)
    at ../../binutils-gdb/gdb/event-loop.c:768
#43 0x000000000075e287 in process_event ()
    at ../../binutils-gdb/gdb/event-loop.c:342
#44 0x000000000075e34e in gdb_do_one_event ()
    at ../../binutils-gdb/gdb/event-loop.c:406
#45 0x000000000075e39f in start_event_loop ()
    at ../../binutils-gdb/gdb/event-loop.c:431
#46 0x000000000075fe8b in cli_command_loop (data=0x0)
    at ../../binutils-gdb/gdb/event-top.c:179
#47 0x000000000075636b in current_interp_command_loop ()
    at ../../binutils-gdb/gdb/interps.c:327
#48 0x000000000075743b in captured_command_loop (data=0x0)
    at ../../binutils-gdb/gdb/main.c:267
#49 0x0000000000754783 in catch_errors (func=0x757420 <captured_command_loop>, 
    func_args=0x0, errstring=0xff5975 "", mask=RETURN_MASK_ALL)
    at ../../binutils-gdb/gdb/exceptions.c:524
#50 0x0000000000758812 in captured_main (data=0x7fffffffe400)
    at ../../binutils-gdb/gdb/main.c:1055
#51 0x0000000000754783 in catch_errors (func=0x7576d7 <captured_main>, 
    func_args=0x7fffffffe400, errstring=0xff5975 "", mask=RETURN_MASK_ALL)
    at ../../binutils-gdb/gdb/exceptions.c:524
#52 0x000000000075883b in gdb_main (args=0x7fffffffe400)
    at ../../binutils-gdb/gdb/main.c:1063
#53 0x0000000000490ef3 in main (argc=2, argv=0x7fffffffe508)
    at ../../binutils-gdb/gdb/gdb.c:33
(top) frame 31
#31 0x000000000067ab9c in apply_frame_filter (frame=0x2234bd0, flags=7, 
    args_type=CLI_SCALAR_VALUES, out=0x23d8220, frame_low=0, frame_high=-1)
    at ../../binutils-gdb/gdb/python/py-framefilter.c:1532
1532	      success = py_print_frame (item, flags, args_type, out, 0,
(top) p gdbarch
$1 = (struct gdbarch *) 0x241c690
(top) p python_gdbarch
$2 = (struct gdbarch *) 0x0
(top) up
#32 0x000000000074ec38 in backtrace_command_1 (count_exp=0x0, show_locals=0, 
    no_filters=0, from_tty=1) at ../../binutils-gdb/gdb/stack.c:1797
1797	      result = apply_frame_filter (get_current_frame (), flags, arg_type,



Basically this code calls ensure_python_env before computing the
gdbarch.
I'm working on a patch.
Comment 1 Tom Tromey 2014-01-22 15:41:49 UTC
Mine.
Comment 2 cvs-commit@gcc.gnu.org 2014-01-23 15:09:45 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  83b645b833a4c137441b2ba1c03206371b28c9db (commit)
       via  0740f8d82dd18e48d1531c8d86b531341fc9e099 (commit)
       via  21909fa1c6d934bfa0c7ad3ef95909db48f6f756 (commit)
      from  17fde6d091a9a661119d152e2304012de5fce056 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=83b645b833a4c137441b2ba1c03206371b28c9db

commit 83b645b833a4c137441b2ba1c03206371b28c9db
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Jan 22 08:52:15 2014 -0700

    avoid python exception in FrameDecorator.py
    
    This fixes a bug in FrameDecorator.py.
    
    FrameVars seems to assume that Frame.block can return None if there is
    no block.  However, it actually throws an exception.
    
    I saw this bug while developing a frame filter, but unfortunately I
    don't know how to reproduce it.  It seems to me that the SAL tests in
    _is_limited_frame should exclude the bad cases; and in my attempts to
    write a test they do.
    
    Nevertheless I think the fix is reasonably obvious and ought to go in.
    
    2014-01-23  Tom Tromey  <tromey@redhat.com>
    
    	PR python/16485:
    	* python/lib/gdb/FrameDecorator.py: (FrameVars.fetch_frame_args):
    	Handle exception from frame.block.
    	(FrameVars.fetch_frame_locals): Likewise.

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0740f8d82dd18e48d1531c8d86b531341fc9e099

commit 0740f8d82dd18e48d1531c8d86b531341fc9e099
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Jan 22 08:44:41 2014 -0700

    fix erroneous error-handling in frame filter code
    
    This fixes PR python/16487.
    
    The bug here is that the function-name-handling code in py_print_frame
    had a small logic error (really a misplaced closing brace).  This
    error could lead to a Py_DECREF(NULL), which crashes.
    
    This patch fixes the bug in the obvious way.
    
    Built and regtested on x86-64 Fedora 18.  New test case included.
    
    2014-01-23  Tom Tromey  <tromey@redhat.com>
    
    	PR python/16487:
    	* python/py-framefilter.c (py_print_frame): Don't call Py_DECREF
    	on a NULL pointer.  Move "goto error" to correct place.
    
    2014-01-23  Tom Tromey  <tromey@redhat.com>
    
    	PR python/16487:
    	* gdb.python/py-framefilter.exp: Add test using "Error" filter.
    	* gdb.python/py-framefilter.py (ErrorInName, ErrorFilter): New
    	classes.

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=21909fa1c6d934bfa0c7ad3ef95909db48f6f756

commit 21909fa1c6d934bfa0c7ad3ef95909db48f6f756
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Jan 22 08:10:01 2014 -0700

    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.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog                                  |   19 ++++++++++++++++++
 gdb/python/lib/gdb/FrameDecorator.py           |   12 +++++++++-
 gdb/python/py-framefilter.c                    |   14 ++++++------
 gdb/testsuite/ChangeLog                        |   14 +++++++++++++
 gdb/testsuite/gdb.python/py-framefilter-mi.exp |    4 +-
 gdb/testsuite/gdb.python/py-framefilter.exp    |   11 ++++++++++
 gdb/testsuite/gdb.python/py-framefilter.py     |   25 +++++++++++++++++++++++-
 7 files changed, 87 insertions(+), 12 deletions(-)
Comment 3 cvs-commit@gcc.gnu.org 2014-01-23 15:27:45 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, gdb-7.7-branch has been updated
       via  56d4c712a8fa3a3e06a2ae91881ef4d702e5b491 (commit)
       via  4c9a21f6a57e0e2e382aac327f6edaa1475dd3f1 (commit)
       via  fc4475140dfddf8b10e73a2908cc3ab690641261 (commit)
      from  4492782b126d30cd3c6af9e9b9ac80057528a32a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=56d4c712a8fa3a3e06a2ae91881ef4d702e5b491

commit 56d4c712a8fa3a3e06a2ae91881ef4d702e5b491
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Jan 22 08:52:15 2014 -0700

    avoid python exception in FrameDecorator.py
    
    This fixes a bug in FrameDecorator.py.
    
    FrameVars seems to assume that Frame.block can return None if there is
    no block.  However, it actually throws an exception.
    
    I saw this bug while developing a frame filter, but unfortunately I
    don't know how to reproduce it.  It seems to me that the SAL tests in
    _is_limited_frame should exclude the bad cases; and in my attempts to
    write a test they do.
    
    Nevertheless I think the fix is reasonably obvious and ought to go in.
    
    2014-01-23  Tom Tromey  <tromey@redhat.com>
    
    	PR python/16485:
    	* python/lib/gdb/FrameDecorator.py: (FrameVars.fetch_frame_args):
    	Handle exception from frame.block.
    	(FrameVars.fetch_frame_locals): Likewise.

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4c9a21f6a57e0e2e382aac327f6edaa1475dd3f1

commit 4c9a21f6a57e0e2e382aac327f6edaa1475dd3f1
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Jan 22 08:44:41 2014 -0700

    fix erroneous error-handling in frame filter code
    
    This fixes PR python/16487.
    
    The bug here is that the function-name-handling code in py_print_frame
    had a small logic error (really a misplaced closing brace).  This
    error could lead to a Py_DECREF(NULL), which crashes.
    
    This patch fixes the bug in the obvious way.
    
    Built and regtested on x86-64 Fedora 18.  New test case included.
    
    2014-01-23  Tom Tromey  <tromey@redhat.com>
    
    	PR python/16487:
    	* python/py-framefilter.c (py_print_frame): Don't call Py_DECREF
    	on a NULL pointer.  Move "goto error" to correct place.
    
    2014-01-23  Tom Tromey  <tromey@redhat.com>
    
    	PR python/16487:
    	* gdb.python/py-framefilter.exp: Add test using "Error" filter.
    	* gdb.python/py-framefilter.py (ErrorInName, ErrorFilter): New
    	classes.

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fc4475140dfddf8b10e73a2908cc3ab690641261

commit fc4475140dfddf8b10e73a2908cc3ab690641261
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Jan 22 08:10:01 2014 -0700

    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.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog                                  |   19 ++++++++++++++++++
 gdb/python/lib/gdb/FrameDecorator.py           |   12 +++++++++-
 gdb/python/py-framefilter.c                    |   14 ++++++------
 gdb/testsuite/ChangeLog                        |   14 +++++++++++++
 gdb/testsuite/gdb.python/py-framefilter-mi.exp |    4 +-
 gdb/testsuite/gdb.python/py-framefilter.exp    |   11 ++++++++++
 gdb/testsuite/gdb.python/py-framefilter.py     |   25 +++++++++++++++++++++++-
 7 files changed, 87 insertions(+), 12 deletions(-)
Comment 4 Tom Tromey 2014-01-23 15:36:31 UTC
Fixed.