This is the mail archive of the
mailing list for the GDB project.
Re: [RFA] Rework symbol searches to move Ada-specific stuff to ada-lang.c.
- From: Tom Tromey <tromey at redhat dot com>
- To: Hilfinger at adacore dot com
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 06 Oct 2010 16:51:38 -0600
- Subject: Re: [RFA] Rework symbol searches to move Ada-specific stuff to ada-lang.c.
- References: <201010050842.o958gDNO002818@syracuse.mckusick.com>
>>>>> "Paul" == Paul Hilfinger <email@example.com> writes:
Paul> Having added this general routine to psymtab.c, we use it in ada-lang.c
Paul> to rework add_non_local_symbols (now renamed add_nonlocal_symbols).
I don't think I should approve the ada-specific changes -- and I was
wrong to do so in my last review, I'll send a follow-up.
The psymtab / symfile / dwarf2read changes seem fine though. I have a
few little nits.
Paul> +dw2_map_matching_symbols (const char* name, domain_enum namespace,
"const char *name"
Paul> /* Lookup a partial symbol. */
Paul> +static struct partial_symbol *match_partial_symbol (struct partial_symtab *,
Paul> + int,
Paul> + const char *, domain_enum,
Paul> + int (*) (const char *,
Paul> + const char *),
Paul> + int (*) (const char *,
Paul> + const char *));
Paul> static struct partial_symbol *lookup_partial_symbol (struct partial_symtab *,
This insertion separates a comment from the declaration it comments.
I think it is fine to just remove that comment, though. It doesn't
really add anything.
Paul> +/* Look in PST for a symbol in DOMAIN whose name matches NAME. Search
Paul> + the global block of PST if GLOBAL, and otherwise the static block.
Paul> + MATCH is the comparison operation that returns true iff MATCH (s,
Paul> + NAME), where s is a SYMBOL_SEARCH_NAME. If ORDERED_COMPARE is
Paul> + non-null, the symbols in the block are assumed to be ordered
Paul> + according to it (allowing binary search). It must be compatible
Paul> + with MATCH. Returns the symbol, if found, and otherwise NULL. */
Paul> +static struct partial_symbol *
Paul> +match_partial_symbol (struct partial_symtab *pst, int global,
We've recently started trying to enforce the rule about having a blank
line between a function comment and the start of the function
Paul> + return (*top);
A few places have parens here, but they aren't needed.
Just write "return *top;".
Paul> + /* Find global or static symbols in all tables that are in NAMESPACE
Paul> + and for which MATCH (symbol name, NAME) == 0, passing each to
Paul> + CALLBACK, reading in partial symbol symbol tables as needed. Look
Paul> + through global symbols if GLOBAL and otherwise static symbols.
Paul> + Passes NAME, NAMESPACE, and DATA to CALLBACK with each symbol
Paul> + found. After each block is processed, passes NULL to CALLBACK.
Paul> + MATCH must be weaker than strcmp_iw in the sense that
Paul> + strcmp_iw(x,y) == 0 --> MATCH(x,y) == 0. ORDERED_COMPARE, if
Paul> + non-null, must be an ordering relation compatible with strcmp_iw
Paul> + in the sense that
Paul> + strcmp(x,y) == 0 --> ORDERED_COMPARE(x,y) == 0
Paul> + and
Paul> + strcmp(x,y) <= 0 --> ORDERED_COMPARE(x,y) <= 0
Paul> + (allowing strcmp(x,y) < 0 while ORDERED_COMPARE(x, y) == 0).
Paul> + CALLBACK returns 0 to indicate that the scan should continue, or
Paul> + non-zero to indicate that the scan should be terminated. */
Thanks for being so thorough in this comment.