From: Simon Marchi <simark@simark.ca>
To: Christian Biesinger <cbiesinger@google.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2] Factor out the common code in lookup_{static,global}_symbol
Date: Mon, 26 Aug 2019 02:20:00 -0000 [thread overview]
Message-ID: <45f47d3b-c9f5-5419-517f-31a4a4b5d046@simark.ca> (raw)
In-Reply-To: <20190805153326.95512-1-cbiesinger@google.com>
On 2019-08-05 11:33 a.m., Christian Biesinger via gdb-patches wrote:
> @@ -2614,6 +2576,9 @@ struct global_sym_lookup_data
> /* The domain to use for our search. */
> domain_enum domain;
>
> + /* The block index in which to search */
Period and two spaces:
/* The block index in which to search. */
> -struct block_symbol
> -lookup_global_symbol (const char *name,
> - const struct block *block,
> - const domain_enum domain)
> +static struct block_symbol
> +lookup_global_symbol_internal (const char *name,
> + enum block_enum block_index,
> + const struct block *block,
> + const domain_enum domain)
I'd rename that to lookup_symbol_internal, since it's used both in lookup_global_symbol and
lookup_static_symbol. If you think it's too general (the function doesn't look up local symbols),
Maybe "lookup_global_or_static_symbol"? And global_sym_lookup_data should be renamed accordingly.
And since BLOCK is only used for looking up an objfile in the global case, I would suggest
making this function accept the objfile instead of a block. Otherwise, it could be confused
as "lookup symbol in this block". Also, if some code already has the objfile handy, they can
pass it down, in which case we avoid the cost of lookup_objfile_from_block.
> +/* See symtab.h. */
> +
> +struct block_symbol
> +lookup_static_symbol (const char *name, const domain_enum domain)
> +{
> + /* TODO: Should static symbol lookup start with a block as well, so we can
> + prefer a static symbol in the current CU? */
> + return lookup_global_symbol_internal (name, STATIC_BLOCK, nullptr, domain);
I'd say that we can add another argument when the need comes, it's not a stable API.
Simon
next prev parent reply other threads:[~2019-08-26 2:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-01 21:25 [PATCH] Merge lookup_global_symbol and lookup_static_symbol Christian Biesinger via gdb-patches
2019-08-02 5:49 ` Aktemur, Tankut Baris
2019-08-03 1:04 ` [PATCH] Factor out the common code in lookup_{static,global}_symbol Christian Biesinger via gdb-patches
2019-08-03 23:41 ` Simon Marchi
2019-08-05 15:33 ` Christian Biesinger via gdb-patches
2019-08-05 15:33 ` [PATCH v2] " Christian Biesinger via gdb-patches
2019-08-16 17:40 ` [PING] " Christian Biesinger via gdb-patches
2019-08-26 2:20 ` Simon Marchi [this message]
2019-08-26 18:28 ` Christian Biesinger via gdb-patches
2019-08-26 18:29 ` [PATCH] " Christian Biesinger via gdb-patches
2019-08-26 19:06 ` Simon Marchi
2019-08-26 21:23 ` Christian Biesinger via gdb-patches
2019-08-09 15:28 ` Christian Biesinger via gdb-patches
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=45f47d3b-c9f5-5419-517f-31a4a4b5d046@simark.ca \
--to=simark@simark.ca \
--cc=cbiesinger@google.com \
--cc=gdb-patches@sourceware.org \
/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