Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH][gdb/symtab] Force usage of all_comp_units.size (CU/TU/CUTU)
Date: Mon, 8 Aug 2022 16:26:54 +0200	[thread overview]
Message-ID: <ef70b95b-0cac-dfa0-30b4-41613072e6d1@suse.de> (raw)
In-Reply-To: <20220714144351.GA31826@delia.home>

On 7/14/22 16:43, Tom de Vries wrote:
> It's hard to produce a test-case for this, but let's try at least to trigger
> the complaint somehow.  We start out by creating an exec with .debug_types and
> .debug_names:
> ...
> $ gcc -g ~/hello.c -fdebug-types-section
> $ gdb-add-index -dwarf-5 a.out
> ...
> and verify that we don't see any complaints:
> ...
> $ gdb -q -batch -iex "set complaints 100" ./a.out
> ...
> 
> We look at the CU and TU table using readelf -w and conclude that we have
> nr_cus == 6 and nr_tus == 1.
> 
> Now override ull in dw2_debug_names_iterator::next for the DW_IDX_compile_unit
> case to 6, and we have:
> ...
> $ gdb -q -batch -iex "set complaints 100" ./a.out
> During symbol reading: .debug_names entry has bad CU index 6 [in module a.out]
> ...
> 
> [ After this, it still crashes because this code in
> dw2_debug_names_iterator::next:
> ...
>    /* Skip if already read in.  */
>    if (m_per_objfile->symtab_set_p (per_cu))
>      goto again;
> ...
> is called with per_cu == nullptr, but I consider this a separate issue. ]
> 
> Now revert the fix (all_comp_units.size (CU) -> all_comp_units.size (CUTU))
> and observe that the complaint disappears, so we've confirmed that the fix is
> required.

I've submitted a test-case for this here ( 
https://sourceware.org/pipermail/gdb-patches/2022-August/191274.html ).

Thanks,
- Tom

      parent reply	other threads:[~2022-08-08 14:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 14:43 Tom de Vries via Gdb-patches
2022-07-21 11:10 ` [committed][gdb/symtab] Fix bad compile unit index complaint Tom de Vries via Gdb-patches
2022-07-21 11:20   ` [PATCH, v2][gdb/symtab] Force usage of all_comp_units.size (CU/TU/CUTU) Tom de Vries via Gdb-patches
2022-08-08 14:26 ` Tom de Vries via Gdb-patches [this message]

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=ef70b95b-0cac-dfa0-30b4-41613072e6d1@suse.de \
    --to=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    --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