Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Phil Muldoon <pmuldoon@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/3] fix crash in frame filters
Date: Wed, 22 Jan 2014 19:58:00 -0000	[thread overview]
Message-ID: <20140122195759.GE24832@localhost.localdomain> (raw)
In-Reply-To: <1390406399-26664-2-git-send-email-tromey@redhat.com>

On Wed, 22 Jan 2014, Tom Tromey wrote:

> 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-22  Tom Tromey  <tromey@redhat.com>
> 
> 	PR python/16491:
> 	* python/py-framefilter.c (apply_frame_filter): Call
> 	ensure_python_env after computing gdbarch.
> 
> 2014-01-22  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.

These are all fine, and thanks for fixing them.  I think they should
proceed into 7.7 too.  Especially this one:

> 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);
> +

Ugh ugly. Ssing gdbarch when it is NULL before querying the frame for an
architecture is especially clumsy.  :( mea culpa.

Cheers,

Phil


  reply	other threads:[~2014-01-22 19:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-22 17:51 [PATCH 0/3] frame filter fixes, proposed for 7.7 Tom Tromey
2014-01-22 16:00 ` [PATCH 1/3] fix crash in frame filters Tom Tromey
2014-01-22 19:58   ` Phil Muldoon [this message]
2014-01-23  6:04     ` Joel Brobecker
2014-01-22 16:00 ` [PATCH 3/3] avoid python exception in FrameDecorator.py Tom Tromey
2014-01-22 16:50 ` [PATCH 2/3] fix erroneous error-handling in frame filter code Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140122195759.GE24832@localhost.localdomain \
    --to=pmuldoon@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox