public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Aaron Merey <amerey@redhat.com>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org, Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH 1/2] [gdb/symtab] Add name_of_main and language_of_main to the DWARF index
Date: Tue, 24 Oct 2023 18:04:18 -0400	[thread overview]
Message-ID: <CAJDtP-T00FBndD5vLP_MuDFyYxVcLWWE0gTqqO-J=v+=kAzS7Q@mail.gmail.com> (raw)
In-Reply-To: <a1abb05b-a98f-4560-9d1a-db7510fca108@suse.de>

Hi Tom,

On Tue, Oct 24, 2023 at 3:43 AM Tom de Vries <tdevries@suse.de> wrote:
>
> There are two paths to writing a .gdb_index:
> - the save gdb-index command
> - the index-cache.
>
> In the former case, it's probably fairly easy to infer the main name and
> language from the current progspace, as you suggest, since
> set_initial_language has been executed already.
>
> In the latter case, writing the index-cache is executed asap in the
> background, and it only waits for the cooked-index to become available.
> So it would have to wait for the result of set_initial_language as well.

Given the possible speed up from having main info in the index,
maybe we are better off waiting for set_initial_language.  If we
are still worried about this delay, we could introduce a gdb command
to control this setting and note somewhere that if disabled the index
may lack main name and language info.

Another approach could be for gcc to emit DW_AT_main_subprogram
for C/C++. I'm not too familiar with that gcc code so I'm not sure how
feasible this is.

> Also (for both cases) some thought will have to go into how to handle
> the case that the initial language is set by the user.  Is that the
> language we want to write into the .gdb_index?  Or do we skip writing it
> in that case?  Or do we try to get the auto-detected initial language by
> running set_initial_language on the main thread at the point that we
> need it?  Or do we try to get the auto-detected initial language in the
> background on a worker thread?

Hmm I'm not sure here. I think we'd be justified in insisting that index
contents should be determined only by the contents of the relevant
binaries.

Aaron


  parent reply	other threads:[~2023-10-24 22:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06 18:31 [PATCH 0/2] " Tom de Vries
2023-10-06 18:31 ` [PATCH 1/2] [gdb/symtab] " Tom de Vries
2023-10-10 19:19   ` Tom Tromey
2023-10-10 19:22     ` Tom Tromey
2023-10-11 15:37     ` Tom de Vries
2023-10-23 16:26       ` Aaron Merey
2023-10-24  7:43         ` Tom de Vries
2023-10-24  8:04           ` Tom de Vries
2023-10-24  8:20           ` Tom de Vries
2023-10-24 22:04           ` Aaron Merey [this message]
2023-10-06 18:31 ` [PATCH 2/2] [readelf] Handle .gdb_index section version 9 Tom de Vries
2023-10-06 18:33 ` [PATCH 0/2] Add name_of_main and language_of_main to the DWARF index Tom de Vries

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='CAJDtP-T00FBndD5vLP_MuDFyYxVcLWWE0gTqqO-J=v+=kAzS7Q@mail.gmail.com' \
    --to=amerey@redhat.com \
    --cc=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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).