public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom Tromey <tom@tromey.com>,
	Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Cc: Andrew Burgess <aburgess@redhat.com>,
	Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH v2] gdb/dwarf: dump cooked index contents in cooked_index_functions::dump
Date: Tue, 31 Jan 2023 10:35:28 -0500	[thread overview]
Message-ID: <4d2c3ae1-d07e-2545-d72b-66d2f3cdfe23@polymtl.ca> (raw)
In-Reply-To: <87ilgmn5w7.fsf@tromey.com>

On 1/31/23 09:19, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Simon> See the patch below for a quick prototype.
> Simon> quick_symbol_functions::read_partial_symbols now returns a bool, and if
> Simon> it returns false (failure), objfile::require_partial_symbols removes
> Simon> that quick symbol instance from the qf list.
> 
> I'm working to get rid of this lazy symbol stuff.  So I'd rather not add
> another meaning to it.  You can see the WIP on t/bg-dwarf-reading, but
> the basic idea is that instead of delaying the reading of DWARF, start
> the reading early and just delay the completion of it.  I haven't sent
> this yet because it currently crashes, I think it will benefit from
> being rebased on the write-index-in-background patch.
> 
> All the other methods in cooked_index_functions already do:
> 
>   dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
>   if (per_objfile->per_bfd->index_table == nullptr)
>     return;

Ah ok, I had not seen that.  Then it makes sense to follow that paradigm
in dump too.

> So maybe this would be an ok choice for dump.
> 
> As an aside the code is doing:
> 
>   if (per_bfd->index_table == nullptr)
>     return nullptr;
>   cooked_index_vector *table
>     = (gdb::checked_static_cast<cooked_index_vector *>
>        (per_bfd->index_table.get ()));
> 
> It seems to me that it would be fine if checked_static_cast passed
> through null in this case -- that is, do not assert when the result is
> null if the parameter is also null.

I think that would make sense.  Both static_cast and dynamic_cast return
nullptr if passed nullptr, so checked_static_cast should too.

However, in my case it would have crashed anyway on the following line
dereferencing the table variable.

Simon

      reply	other threads:[~2023-01-31 15:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30 16:03 Simon Marchi
2023-01-30 16:08 ` Simon Marchi
2023-01-30 19:07 ` Tom Tromey
2023-01-30 20:08   ` Simon Marchi
2023-01-30 21:35 ` Andrew Burgess
2023-01-31  3:06   ` Simon Marchi
2023-01-31  9:21     ` Andrew Burgess
2023-01-31 15:49       ` Simon Marchi
2023-01-31 17:27         ` Tom Tromey
2023-01-31 14:19     ` Tom Tromey
2023-01-31 15:35       ` Simon Marchi [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=4d2c3ae1-d07e-2545-d72b-66d2f3cdfe23@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).