public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 3/3] move the "main" data into the per-BFD object
Date: Mon, 06 Jan 2014 17:39:00 -0000	[thread overview]
Message-ID: <CADPb22T4fBYr_BEELyju=p8ORPbvBMQTvnrQim6KYcDT9n+SRg@mail.gmail.com> (raw)
In-Reply-To: <1389028297-16977-4-git-send-email-tromey@redhat.com>

On Mon, Jan 6, 2014 at 9:11 AM, Tom Tromey <tromey@redhat.com> wrote:
> This adds the "main"-related data into the per-BFD.  This is needed
> because once symbol sharing across objfiles is complete, computing the
> main name as a side effect of symbol reading will no longer work --
> the symbols simply won't be re-read.
>
> After this change, set_main_name is only used by the main_name
> machinery itself, so this patch makes it static.
>
> 2014-01-06  Tom Tromey  <tromey@redhat.com>
>
>         * dbxread.c (process_one_symbol): Use set_objfile_main_name.
>         * dwarf2read.c (read_partial_die): Use set_objfile_main_name.
>         * objfiles.c (get_objfile_bfd_data): Initialize language_of_main.
>         (set_objfile_main_name): New function.
>         * objfiles.h (struct objfile_per_bfd_storage) <name_of_main,
>         language_of_main>: New fields.
>         (set_objfile_main_name): Declare.
>         * symtab.c (find_main_name): Loop over objfiles to find the main
>         name and language.
>         (set_main_name): Now static.
>         * symtab.h (set_main_name): Don't declare.
> [...]
> --- a/gdb/symtab.c
> +++ b/gdb/symtab.c
> @@ -5057,7 +5057,7 @@ main_info_cleanup (struct program_space *pspace, void *data)
>    xfree (info);
>  }
>
> -void
> +static void
>  set_main_name (const char *name, enum language lang)
>  {
>    struct main_info *info = get_main_info ();
> @@ -5082,6 +5082,17 @@ static void
>  find_main_name (void)
>  {
>    const char *new_main_name;
> +  struct objfile *objfile;
> +
> +  ALL_OBJFILES (objfile)
> +  {
> +    if (objfile->per_bfd->name_of_main != NULL)
> +      {
> +       set_main_name (objfile->per_bfd->name_of_main,
> +                      objfile->per_bfd->language_of_main);
> +       return;
> +      }
> +  }
>
>    /* Try to see if the main procedure is in Ada.  */
>    /* FIXME: brobecker/2005-03-07: Another way of doing this would

Hi.

[setting aside a day when there are multiple main names,]
Seems like there ought to be an invariant that there is only one main name.
I ask because it's not clear this invariant is enforced (or if it is
it's too subtle) and thus what if this loop finds the wrong one?

  reply	other threads:[~2014-01-06 17:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-06 17:11 [PATCH 0/3] main_name cleanups Tom Tromey
2014-01-06 17:11 ` [PATCH 1/3] make language_of_main static Tom Tromey
2014-01-06 17:11 ` [PATCH 2/3] move main name into the progspace Tom Tromey
2014-01-06 17:11 ` [PATCH 3/3] move the "main" data into the per-BFD object Tom Tromey
2014-01-06 17:39   ` Doug Evans [this message]
2014-01-06 18:00     ` Tom Tromey
2014-01-06 18:23       ` Doug Evans
2014-01-06 21:11         ` Tom Tromey
2014-01-13 20:21           ` Tom Tromey
2014-01-06 19:02 ` [PATCH 0/3] main_name cleanups Pedro Alves
2014-01-13 20:31   ` Tom Tromey
2014-01-15 18:01 ` 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='CADPb22T4fBYr_BEELyju=p8ORPbvBMQTvnrQim6KYcDT9n+SRg@mail.gmail.com' \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.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).