From: Joel Brobecker <brobecker@adacore.com>
To: Doug Evans <xdje42@gmail.com>
Cc: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH][PR symtab/17855] Fix.
Date: Thu, 29 Jan 2015 08:12:00 -0000 [thread overview]
Message-ID: <20150129071929.GE5193@adacore.com> (raw)
In-Reply-To: <m3egqe83x3.fsf@sspiff.org>
[-- Attachment #1: Type: text/plain, Size: 2115 bytes --]
Aargh - I was working on it just now because I wasn't sure if anyone
felt they "had the ball on their court".
> Like so?
>
> 2015-01-28 Doug Evans <xdje42@gmail.com>
>
> PR symtab/17855
> * symfile.c (clear_symtab_users): Move call to breakpoint_re_set
> closer to end.
What I've tested is moving the call last, as shown in the attached
diff. Not technically necessarily better, but as the comment explains,
I move it last so that it's after we've purged all relevant caches.
That way, the function is organized in two rough sections:
- do purges first;
- do updates next.
Your comment is a lot more detailed, I like it.
> diff --git a/gdb/symfile.c b/gdb/symfile.c
> index d55e361..bad244c 100644
> --- a/gdb/symfile.c
> +++ b/gdb/symfile.c
> @@ -3023,13 +3023,8 @@ clear_symtab_users (int add_flags)
> /* Someday, we should do better than this, by only blowing away
> the things that really need to be blown. */
>
> - /* Clear the "current" symtab first, because it is no longer valid.
> - breakpoint_re_set may try to access the current symtab. */
> clear_current_source_symtab_and_line ();
> -
> clear_displays ();
> - if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0)
> - breakpoint_re_set ();
> clear_last_displayed_sal ();
> clear_pc_function_cache ();
> observer_notify_new_objfile (NULL);
> @@ -3040,9 +3035,19 @@ clear_symtab_users (int add_flags)
> expression_context_block = NULL;
> innermost_block = NULL;
>
> + /* Now that most everything has been reset, reset any existing breakpoints.
> + Reasons for doing this after the above are that breakpoint resetting may
> + involve:
> + - reading the current source symtab and line,
> + - reading the last displayed sal,
> + - reading the pc function cache,
> + - symbol lookup which requires, for example, invalidating any caches
> + first. */
> + if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0)
> + breakpoint_re_set ();
> +
> /* Varobj may refer to old symbols, perform a cleanup. */
> varobj_invalidate ();
> -
> }
>
> static void
>
>
>
--
Joel
[-- Attachment #2: bp-re-set.diff --]
[-- Type: text/x-diff, Size: 789 bytes --]
diff --git a/gdb/symfile.c b/gdb/symfile.c
index d55e361..04a5c58 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3028,8 +3028,6 @@ clear_symtab_users (int add_flags)
clear_current_source_symtab_and_line ();
clear_displays ();
- if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0)
- breakpoint_re_set ();
clear_last_displayed_sal ();
clear_pc_function_cache ();
observer_notify_new_objfile (NULL);
@@ -3043,6 +3041,10 @@ clear_symtab_users (int add_flags)
/* Varobj may refer to old symbols, perform a cleanup. */
varobj_invalidate ();
+ /* Now that the various caches have been cleared, we can re_set
+ our breakpoints without risking it using stale data. */
+ if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0)
+ breakpoint_re_set ();
}
static void
next prev parent reply other threads:[~2015-01-29 7:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-20 6:27 Doug Evans
2015-01-22 11:42 ` Pedro Alves
2015-01-22 15:37 ` Doug Evans
2015-01-29 8:00 ` Doug Evans
2015-01-29 8:12 ` Joel Brobecker [this message]
2015-01-29 10:01 ` Doug Evans
[not found] ` <m3r3ualkvb.fsf@sspiff.org>
2015-02-03 17:02 ` Pedro Alves
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=20150129071929.GE5193@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=xdje42@gmail.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