Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Doug Gilmore <Doug.Gilmore@imgtec.com>
Cc: Luis Machado <lgustavo@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix PR 21337 v2: segfault when re-reading symbols with  remote debugging.
Date: Sat, 22 Apr 2017 02:15:00 -0000	[thread overview]
Message-ID: <5c494cc147f71dd8246572aa0b815c9f@polymtl.ca> (raw)
In-Reply-To: <3c5ce0a0-72e5-4460-5555-ad2214866260@imgtec.com>

On 2017-04-13 14:56, Doug Gilmore wrote:
> I updated and rebased the patch per Luis's comments in:
> 
> https://www.sourceware.org/ml/gdb-patches/2017-04/msg00361.html
> 
> which I attached.  Could a global maintainer review it when they have
> the chance?  The problem is only exposed on MIPS, however the patch
> involves changing code that is not MIPS specific.
> 
> Thanks,
> 
> Doug
> 
> gdb/
> 
> 2017-??-??  Doug Gilmore  <Doug.Gilmore@Doug.Gilmore@imgtec.com>
> 
> 	* symfile.c (reread_symbols): Fix PR 21337.
> ---
>  gdb/symfile.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/gdb/symfile.c b/gdb/symfile.c
> index 846aabe..d57563d 100644
> --- a/gdb/symfile.c
> +++ b/gdb/symfile.c
> @@ -2576,6 +2576,12 @@ reread_symbols (void)
>  	  /* Free the obstacks for non-reusable objfiles.  */
>  	  psymbol_bcache_free (objfile->psymbol_cache);
>  	  objfile->psymbol_cache = psymbol_bcache_init ();
> +
> +	  /* Notify objfiles that we've modified objfile sections, which now
> +	     needs to be done early to ensure that, for the MIPS target,
> +	     find_pc_section won't access stale data.  */
> +	  objfiles_changed ();
> +
>  	  obstack_free (&objfile->objfile_obstack, 0);
>  	  objfile->sections = NULL;
>  	  objfile->compunit_symtabs = NULL;
> @@ -2660,9 +2666,6 @@ reread_symbols (void)
> 
>    if (!new_objfiles.empty ())
>      {
> -      /* Notify objfiles that we've modified objfile sections.  */
> -      objfiles_changed ();
> -
>        clear_symtab_users (0);
> 
>        /* clear_objfile_data for each objfile was called before freeing 
> it and

I don't have the required knowledge to review this properly, but I have 
a question.  From the attachment in Bugzilla, the backtrace where the 
crash happens is:

==19949==    at 0x64D827: bsearch_cmp(void const*, void const*) 
(objfiles.c:1415)
==19949==    by 0x559D247: bsearch (stdlib-bsearch.h:33)
==19949==    by 0x64D9E3: find_pc_section(unsigned long) 
(objfiles.c:1462)
==19949==    by 0x643BDE: lookup_minimal_symbol_by_pc(unsigned long) 
(minsyms.c:785)
==19949==    by 0x40852B: mips_pc_is_mips(unsigned long) 
(mips-tdep.c:1183)
==19949==    by 0x4086EA: mips_adjust_dwarf2_addr(unsigned long) 
(mips-tdep.c:1271)
==19949==    by 0x5E0F98: gdbarch_adjust_dwarf2_addr(gdbarch*, unsigned 
long) (gdbarch.c:3369)
==19949==    by 0x5A24E5: read_attribute_value(die_reader_specs const*, 
attribute*, unsigned int, long, unsigned char const*) 
(dwarf2read.c:16570)
==19949==    by 0x5A2E2E: read_attribute(die_reader_specs const*, 
attribute*, attr_abbrev*, unsigned char const*) (dwarf2read.c:16796)
==19949==    by 0x59FA76: read_full_die_1(die_reader_specs const*, 
die_info**, unsigned char const*, int*, int) (dwarf2read.c:15537)
==19949==    by 0x59FAEB: read_full_die(die_reader_specs const*, 
die_info**, unsigned char const*, int*) (dwarf2read.c:15556)
==19949==    by 0x587B9A: init_cutu_and_read_dies(dwarf2_per_cu_data*, 
abbrev_table*, int, int, void (*)(die_reader_specs const*, unsigned char 
const*, die_info*, int, void*), void*) (dwarf2read.c:5710)


I'd be curious to see the rest of that backtrace to understand better 
when/why it blows up.  It looks like you can use --num-callers with 
valgrind, or simply use GDB :).

Simon


  parent reply	other threads:[~2017-04-22  2:15 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 23:04 [PATCH] [mips] Fix PR 21337 v1: " Doug Gilmore
2017-04-10 16:01 ` Doug Gilmore
2017-04-12 18:52 ` Luis Machado
2017-04-12 21:42   ` Doug Gilmore
2017-04-13 18:56     ` [PATCH] Fix PR 21337 v2: " Doug Gilmore
2017-04-14 15:33       ` Luis Machado
2017-04-22  2:15       ` Simon Marchi [this message]
2017-04-25 18:16         ` Doug Gilmore
2017-04-27 19:46           ` Simon Marchi
2017-04-28 23:44             ` Doug Gilmore
2017-04-29  1:13               ` Luis Machado
2017-04-29  1:42               ` Simon Marchi
2017-04-29 17:12                 ` Doug Gilmore
2017-04-29 23:26                   ` Simon Marchi
2017-04-30  5:14                     ` Doug Gilmore
2017-05-10 23:26                       ` Doug Gilmore
2017-05-12  3:29                         ` Simon Marchi
2017-05-12 19:24                           ` Doug Gilmore
2017-05-16 23:11                           ` [PATCH] Fix PR 21337 (v3): " Doug Gilmore
2017-06-06 16:08                             ` [PING][PATCH] " Doug Gilmore
2017-06-23 18:20                               ` [PING^2][PATCH] " Doug Gilmore
2017-06-25 11:25                             ` [PATCH] " Simon Marchi
2017-06-27 17:29                               ` [PATCH] Fix PR 21337 (v4): " Doug Gilmore
2017-06-27 21:35                                 ` Doug Gilmore
2017-06-28  2:01                                   ` Maciej W. Rozycki

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=5c494cc147f71dd8246572aa0b815c9f@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=Doug.Gilmore@imgtec.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.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