From: Yao Qi <yao@codesourcery.com>
To: Doug Evans <xdje42@gmail.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH 7/9] Rewrite lookup_static_symbol to use gdbarch routine
Date: Tue, 28 Oct 2014 03:16:00 -0000 [thread overview]
Message-ID: <87d29cvqfu.fsf@codesourcery.com> (raw)
In-Reply-To: <m3tx2qjee1.fsf@sspiff.org> (Doug Evans's message of "Sun, 26 Oct 2014 22:00:22 -0700")
Doug Evans <xdje42@gmail.com> writes:
> struct symbol *
> lookup_static_symbol_aux (const char *name, const domain_enum domain)
> {
> struct objfile *objfile;
> struct symbol *sym;
>
> sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, domain);
> if (sym != NULL)
> return sym;
>
> ALL_OBJFILES (objfile)
> {
> sym = lookup_symbol_aux_quick (objfile, STATIC_BLOCK, name, domain);
> if (sym != NULL)
> return sym;
> }
>
> return NULL;
> }
>
> Note what we're doing here.
> First we're searching over all expanded symtabs in all objfiles,
> and then we search partial/gdb_index tables in all objfiles. Eh?
>
> Normally when looking up a symbol in a particular objfile
> we first list in expanded symtabs and then look in partial/gdb_index
> tables. And *then* we try the next objfile.
>
> I can't think of any justification for the current behaviour.
>
> This patch changes things to be consistent,
> but it is a behavioural change.
Yes, it changes the behavior. Here is an example in my mind, but not
sure it is correct or not, say, we have a static int foo defined in two
objfiles respectively (1.c and 2.c), foo is in the partial table of two
objfiles, but is only expanded to the full symtab of *one* objfile (2.c).
1.c 2.c
partial foo foo
full foo
before your patch, GDB gets foo from 2.c full table, and after it, GDB
gets foo from 1.c partial table. Is it possible?
Regarding the change, we also need to update the comments to
iterate_over_objfiles_in_search_order in gdbarch.sh,
# Iterate over all objfiles in the order that makes the most sense
# for the architecture to make global symbol searches.
^^^^^^^^^^^^^
> The testsuite passes, and any noticeable difference
> by this change would be dependent on the order in which
> symtabs got expanded. Thus I can't think of a reason to not
> apply this change.
If read this
<https://www.sourceware.org/ml/gdb-patches/2012-05/msg00204.html>
correctly, Joel expressed the same intention there.
Since gdbarch method iterate_over_objfiles_in_search_order was added for
windows target and this patch uses it, we need to test it on windows target.
If you don't have mingw testing env, let me know, I'll see if I can do
the test.
--
Yao (齐尧)
next prev parent reply other threads:[~2014-10-28 3:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-27 5:01 Doug Evans
2014-10-28 3:16 ` Yao Qi [this message]
2014-11-05 20:25 ` Doug Evans
2014-11-07 9:08 ` Doug Evans
2014-11-07 16:29 ` Doug Evans
2014-11-08 19:31 ` Doug Evans
2014-11-11 2:42 ` Doug Evans
2014-11-13 12:52 ` Yao Qi
2014-11-14 17:23 ` Doug Evans
2014-11-15 18:27 ` Doug Evans
2014-11-16 3:22 ` Joel Brobecker
2014-11-16 21:54 ` Doug Evans
2014-11-17 1:34 ` Doug Evans
2014-11-17 3:14 ` Joel Brobecker
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=87d29cvqfu.fsf@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=xdje42@gmail.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