This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 3/3] PR python/19293 - invalidate frame cache when unwinders change
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Fri, 17 Jun 2016 20:11:24 +0100
- Subject: Re: [RFA 3/3] PR python/19293 - invalidate frame cache when unwinders change
- Authentication-results: sourceware.org; auth=none
- References: <1465612923-24880-1-git-send-email-tom at tromey dot com> <1465612923-24880-4-git-send-email-tom at tromey dot com>
On 06/11/2016 03:42 AM, Tom Tromey wrote:
> PR python/19293 notes that when a Python unwinder is disabled, the
> frame cache is not invalidated. This means that disabling an unwinder
> doesn't have any immediate effect -- but in my experience it's often
> the case that I want to enable or disable an unwinder in order to see
> what happens.
>
> This patch adds a new gdb.invalidate_cached_frames function and
> arranges for the relevant bits of library code to call it. I've only
> partially documented this function, considering a warning sufficient
> without going into all the reasons ordinary code should not call it.
> The name of the new function was taken from a comment in frame.h next
> to reinit_frame_cache.
Seems reasonable to me. Couple nits below.
> --- a/gdb/doc/python.texi
> +++ b/gdb/doc/python.texi
> @@ -3838,6 +3838,15 @@ frames, as expressed by the given @var{reason} code (an integer, see the
> @code{unwind_stop_reason} method further down in this section).
> @end defun
>
> +@findex gdb.invalidate_cached_frames
> +@defun gdb.invalidate_cached_frames
> +@value{GDBN} internally keeps a cache of the frames that have been
> +unwound. This function causes invalidates this cache.
s/causes// ?
> +
> +This function should not generally be called by ordinary Python code.
> +It is documented for the sake of completeness.
> +@end defun
> diff --git a/gdb/python/lib/gdb/unwinder.py b/gdb/python/lib/gdb/unwinder.py
> index 14b2758..67a37cb 100644
> --- a/gdb/python/lib/gdb/unwinder.py
> +++ b/gdb/python/lib/gdb/unwinder.py
> @@ -92,3 +92,4 @@ def register_unwinder(locus, unwinder, replace=False):
> unwinder.name)
> i += 1
> locus.frame_unwinders.insert(0, unwinder)
> + gdb.invalidate_cached_frames()
> diff --git a/gdb/python/python.c b/gdb/python/python.c
> index 9c4ddda..62c9bde 100644
> --- a/gdb/python/python.c
> +++ b/gdb/python/python.c
> @@ -884,6 +884,13 @@ gdbpy_find_pc_line (PyObject *self, PyObject *args)
> return result;
> }
>
> +static PyObject *
> +gdbpy_invalidate_cached_frames (PyObject *self, PyObject *args)
Intro comment?
Thanks,
Pedro Alves