Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: possible fix for PR symtab/23010
Date: Tue, 17 Apr 2018 19:17:00 -0000	[thread overview]
Message-ID: <f163fa84-eb60-ac12-dedb-b6970b799165@redhat.com> (raw)
In-Reply-To: <87po34kzxh.fsf@tromey.com>

On 04/12/2018 12:06 PM, Tom Tromey wrote:
> I was talking with Keith & Pedro about PR symtab/23010 on irc this week,
> because it was the bug at the base of the Rust -readnow problem that Jan
> reported.
> 
> I came up with this patch yesterday.  It fixes the problem, but I didn't
> write a test and also I'm not sure if it is the best way to go.
> 
> So, I thought I'd send it for commentary.

I've looked into this quite a bit, too. In my case, I was looking specifically at the assertion caused by passing "-readnow" with libwebkit.so.debug on Fedora (Jan's reproducer).

I tried for darn near a week to come up with an isolated reproducer to no avail. :-(

Based on what I was seeing, I came up with a different approach, but I don't care for it at all. I find the proposed solution a whole lot less risky. [My approach was to have language_minimal CUs "inherit" the importing CU's language in inherit_abstract_dies. I can dream up a few instances where this might be problematic. I don't know if they're really legitimate use cases, but nothing in the standard specifically discredits my imaginings.]

>     There are two problems with this patch:
>     
>     1. It is difficult to reason about.  There are many cases where I've
>        patched the code to call init_cutu_and_read_dies with the flag set
>        to "please do read partial units" -- but I find it difficult to be
>        sure that this is always correct.
>     
>     2. It is still missing a standalone test case.  This seemed hard.

It is. :-)

>     2018-04-12  Tom Tromey  <tom@tromey.com>
>     
>             PR symtab/23010:
>             * dwarf2read.c (load_cu, dw2_do_instantiate_symtab)
>             (dw2_instantiate_symtab): Add skip_partial parameter.
>             (dw2_find_last_source_symtab, dw2_map_expand_apply)
>             (dw2_lookup_symbol, dw2_expand_symtabs_for_function)
>             (dw2_expand_all_symtabs, dw2_expand_symtabs_with_fullname)
>             (dw2_expand_symtabs_matching_one)
>             (dw2_find_pc_sect_compunit_symtab)
>             (dw2_debug_names_lookup_symbol)
>             (dw2_debug_names_expand_symtabs_for_function): Update.
>             (init_cutu_and_read_dies): Add skip_partial parameter.
>             (process_psymtab_comp_unit, build_type_psymtabs_1)
>             (process_skeletonless_type_unit, load_partial_comp_unit)
>             (psymtab_to_symtab_1): Update.
>             (load_full_comp_unit): Add skip_partial parameter.
>             (process_imported_unit_die, dwarf2_read_addr_index)
>             (follow_die_offset, dwarf2_fetch_die_loc_sect_off)
>             (dwarf2_fetch_constant_bytes, dwarf2_fetch_die_type_sect_off)
>             (read_signatured_type): Update.

Aside: didn't we decide that "update all callers" was sufficient? [I'm only curious -- not asking for changes to a silly ChangeLog.]

This patch looks reasonable to me, but I would ask you to consider mentioning why partial_units are skipped where they are (even if to just reference the problem or bug?). That's these two hunks, I think:

> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> index e3f544a6a4..406aa0d52e 100644
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -2870,7 +2870,7 @@ dw2_do_instantiate_symtab (struct dwarf2_per_cu_data *per_cu)
>        : (per_cu->v.psymtab == NULL || !per_cu->v.psymtab->readin))
>      {
>        queue_comp_unit (per_cu, language_minimal);
> -      load_cu (per_cu);
> +      load_cu (per_cu, true);
>  
>        /* If we just loaded a CU from a DWO, and we're working with an index
>  	 that may badly handle TUs, load all the TUs in that DWO as well.

and

> @@ -4144,7 +4144,7 @@ dw2_expand_all_symtabs (struct objfile *objfile)
>      {
>        dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cutu (i);
>  
> -      dw2_instantiate_symtab (per_cu);
> +      dw2_instantiate_symtab (per_cu, true);
>      }
>  }
>  

I've been manually testing this patch with everything that I can think of on libwebkit.so, and I cannot trigger anything ill-behaved at all.

I recommend a maintainer approve this, even if it is more a band-aid than a "proper" fix. It fixes a fairly big (and maybe even common) problem with minimal impact/risk.

Keith


  reply	other threads:[~2018-04-17 19:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-12 19:06 Tom Tromey
2018-04-17 19:17 ` Keith Seitz [this message]
2018-04-19 20:39   ` Tom Tromey
2018-04-30 22:44   ` Joel Brobecker
2018-05-07 17:13     ` Joel Brobecker
2018-05-14 19:43       ` Joel Brobecker
2018-05-18  1:22       ` Sergio Durigan Junior
2018-05-24  4:08         ` Tom Tromey
2018-05-24 10:50           ` Sergio Durigan Junior
2018-05-24 10:50             ` Tom Tromey
2018-05-24 15:54               ` Keith Seitz
2018-05-26  0:24                 ` Keith Seitz
2018-05-27 15:20                   ` Tom Tromey
2018-05-30 22:26                   ` Joel Brobecker
2018-05-17 17:16   ` 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=f163fa84-eb60-ac12-dedb-b6970b799165@redhat.com \
    --to=keiths@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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