public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "xdje42 at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug symtab/17799] tracking bug for symbol lookup cache patch
Date: Sun, 11 Jan 2015 23:02:00 -0000	[thread overview]
Message-ID: <bug-17799-4717-C7AddmzYeC@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-17799-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=17799

--- Comment #3 from Doug Evans <xdje42 at gmail dot com> ---
Bleah.
breakpoint_re_set is called before observer_notify_new_objfile(NULL)
in clear_symtab_users.

This means that the symbol lookup that breakpoint_re_set does
will get stale data and can cause a gdb crash.

Filing for reference sake.

2015-01-11  Doug Evans  <xdje42@gmail.com>

        * symfile.c (clear_symtab_users): Call observer_notify_new_objfile
        before calling breakpoint_re_set.

diff --git a/gdb/symfile.c b/gdb/symfile.c
index d55e361..3242ba1 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3027,12 +3027,17 @@ clear_symtab_users (int add_flags)
      breakpoint_re_set may try to access the current symtab.  */
   clear_current_source_symtab_and_line ();

+  /* Notify anyone listening that the previous loaded symtab(s) are invalid.
+     It is important to do this before calling breakpoint_re_set as the latter
+     will try to look up symbols, and for example the symbol cache needs to
+     be flushed first.  */
+  observer_notify_new_objfile (NULL);
+
   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);

   /* Clear globals which might have pointed into a removed objfile.
      FIXME: It's not clear which of these are supposed to persist

-- 
You are receiving this mail because:
You are on the CC list for the bug.


  parent reply	other threads:[~2015-01-11 23:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05 19:28 [Bug symtab/17799] New: " dje at google dot com
2015-01-11 20:00 ` [Bug symtab/17799] " xdje42 at gmail dot com
2015-01-11 23:01 ` xdje42 at gmail dot com
2015-01-11 23:02 ` xdje42 at gmail dot com [this message]
2015-01-11 23:22 ` xdje42 at gmail dot com
2023-03-05 23:17 ` tromey at sourceware dot org

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=bug-17799-4717-C7AddmzYeC@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).