From: Daniel Jacobowitz <drow@false.org>
To: Aleksandar Ristovski <aristovski@qnx.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Do not add partial_symbol again and again to the list
Date: Sat, 03 May 2008 21:32:00 -0000 [thread overview]
Message-ID: <20080503205413.GA22704@caradoc.them.org> (raw)
In-Reply-To: <47B27EB1.6030606@qnx.com>
On Wed, Feb 13, 2008 at 12:22:57AM -0500, Aleksandar Ristovski wrote:
> 3. lookup_partial_symbol
> Function looks up global or static list of objfile, but only subset of it
> determined by partial symtab's offset and number of symbols. Returns partial
> symbol found. This function is always called from a loop through all partial
> symtabs (this fact is important).
Ah! That's the part I didn't understand before.
I was worried about the construct tested in scope.exp, "print
'scope0.c'::filelocal". But it uses full symtabs, not partial
symtabs.
> 2008-02-12 Aleksandar Ristovski <aristovski@qnx.com>
>
> * bcache.c (bcache_data): Call bcache_added function.
> (bcache_added): New function name. Body of function bcache_data
> is used here with the addition of 'added' argument. The argument
> is optional and if specified, bcache_added returns 1 if the data
> was added and 0 if it was found in the hash.
Whenever you find yourself writing this sort of explanation in the
changelog, it's a sign that you should have a shorter changelog entry
and a long comment in the source code. Please move the explanation to
bcache.h.
> * symfile.c (add_psymbol_to_bcache): New helper function, takes part of
> work from add_psymbol_to_list - initialises partial symbol and stashes
> it in objfile's cache.
> (append_psymbol_to_list): New helper function, takes other part of
> work from add_psymbol_to_list - adds partial symbol to the given list.
> (add_psymbol_to_list): Call helper functions instead of doing work
> here. Functionally, the function hasn't changed.
> (add_psymbol_to_global_list): New function, adds partial symbol to
> global list and does it only once per objfile.
Same thing for these.
> +const void *
> +bcache (const void *addr, int length, struct bcache *bcache)
> +{
> + return bcache_data (addr, length, bcache);
> +}
> +
> +void *
> +bcache_added (const void *addr, int length, struct bcache *bcache,
> + int *added)
It should return a const pointer, like bcache. Also the indentation
on the second line is too deep.
> case DW_TAG_namespace:
> - add_psymbol_to_list (actual_name, strlen (actual_name),
> + add_psymbol_to_global_list (actual_name, strlen (actual_name),
> VAR_DOMAIN, LOC_TYPEDEF,
> - &objfile->global_psymbols,
> 0, (CORE_ADDR) 0, cu->language, objfile);
Please adjust indentation on the subsequent lines, since the open
paren moved over.
> if (cu->language == language_cplus
> || cu->language == language_java
> || cu->language == language_ada)
> {
> /* For C++ and Java, these implicitly act as typedefs as well. */
> - add_psymbol_to_list (actual_name, strlen (actual_name),
> - VAR_DOMAIN, LOC_TYPEDEF,
> - &objfile->global_psymbols,
> - 0, (CORE_ADDR) 0, cu->language, objfile);
> + add_psymbol_to_global_list (actual_name, strlen (actual_name),
> + VAR_DOMAIN, LOC_TYPEDEF,
> + 0, (CORE_ADDR) 0, cu->language, objfile);
> }
You've deleted this bit in your other patch fortunately :-)
> case DW_TAG_enumerator:
> - add_psymbol_to_list (actual_name, strlen (actual_name),
> + if (cu->language == language_cplus
> + || cu->language == language_java)
> + add_psymbol_to_global_list (actual_name, strlen (actual_name),
> + VAR_DOMAIN, LOC_CONST,
> + 0, (CORE_ADDR) 0, cu->language, objfile);
This part I don't understand. Why does the behavior of enumerators
depend on the language? The logic for finding them during lookup is
the same.
In fact, if lookup_partial_symbol will never find a global symbol
with an identical name why do we need them for any duplicated symbol,
even legitimately duplicated things like static functions? Well,
the check in cp-support.c is one reason for functions. And I can
imagine other valid reasons in the future. So functions are special.
But for things other than functions.
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2008-05-03 20:54 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-11 20:23 Aleksandar Ristovski
2008-02-11 20:38 ` Daniel Jacobowitz
2008-02-11 20:52 ` Aleksandar Ristovski
2008-02-11 21:09 ` Daniel Jacobowitz
2008-02-11 21:41 ` Aleksandar Ristovski
2008-02-11 21:48 ` Daniel Jacobowitz
2008-02-11 22:10 ` Aleksandar Ristovski
2008-02-11 22:31 ` Daniel Jacobowitz
2008-02-11 22:43 ` Aleksandar Ristovski
2008-02-11 22:53 ` Daniel Jacobowitz
2008-02-12 1:08 ` Aleksandar Ristovski
2008-02-12 2:12 ` Daniel Jacobowitz
2008-02-12 5:35 ` Aleksandar Ristovski
2008-02-12 13:26 ` Daniel Jacobowitz
2008-02-12 15:54 ` Aleksandar Ristovski
2008-02-13 5:23 ` Aleksandar Ristovski
2008-02-14 1:31 ` Aleksandar Ristovski
2008-05-02 18:11 ` Aleksandar Ristovski
2008-05-03 21:32 ` Daniel Jacobowitz [this message]
2008-05-05 19:41 ` Aleksandar Ristovski
2008-05-05 19:38 ` Aleksandar Ristovski
2008-05-06 15:47 ` Daniel Jacobowitz
2008-05-06 18:45 ` Aleksandar Ristovski
2008-05-06 18:39 ` Aleksandar Ristovski
2008-05-06 18:50 ` Daniel Jacobowitz
2008-05-07 8:22 ` Aleksandar Ristovski
2008-05-07 9:01 ` Aleksandar Ristovski
2008-06-05 18:17 ` Daniel Jacobowitz
2008-06-05 19:26 ` Aleksandar Ristovski
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=20080503205413.GA22704@caradoc.them.org \
--to=drow@false.org \
--cc=aristovski@qnx.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