* [PATCH 5/9] Rename some "aux" functions.
@ 2014-10-27 4:37 Doug Evans
2014-10-28 1:09 ` Yao Qi
0 siblings, 1 reply; 5+ messages in thread
From: Doug Evans @ 2014-10-27 4:37 UTC (permalink / raw)
To: gdb-patches
Hi.
This patch renames some functions with "aux" in the name.
"aux" doesn't provide any descriptive value, and I'm always
spending time wondering how to read/interpret "aux".
This patch doesn't rename lookup_symbol_aux: the handling of symbol lookup
via mangled or natural names is a cleanup topic onto itself.
Left for another day.
This patch doesn't rename lookup_symbol_aux_symtabs as it is
deleted in a later patch.
2014-10-26 Doug Evans <xdje42@gmail.com>
* symtab.c (lookup_local_symbol): Renamed from lookup_symbol_aux_local.
All callers updated.
(lookup_symbol_via_quick_fns): Renamed from lookup_symbol_aux_quick.
All callers updated.
(lookup_symbol_in_symtabs): Renamed from lookup_symbol_aux_objfile.
All callers updated.
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 5786a8e..17f7499 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -74,10 +74,10 @@ static struct symbol *lookup_symbol_aux (const char *name,
struct field_of_this_result *);
static
-struct symbol *lookup_symbol_aux_local (const char *name,
- const struct block *block,
- const domain_enum domain,
- enum language language);
+struct symbol *lookup_local_symbol (const char *name,
+ const struct block *block,
+ const domain_enum domain,
+ enum language language);
static
struct symbol *lookup_symbol_aux_symtabs (int block_index,
@@ -85,10 +85,10 @@ struct symbol *lookup_symbol_aux_symtabs (int block_index,
const domain_enum domain);
static
-struct symbol *lookup_symbol_aux_quick (struct objfile *objfile,
- int block_index,
- const char *name,
- const domain_enum domain);
+struct symbol *lookup_symbol_via_quick_fns (struct objfile *objfile,
+ int block_index,
+ const char *name,
+ const domain_enum domain);
extern initialize_file_ftype _initialize_symtab;
@@ -1424,7 +1424,7 @@ lookup_symbol_aux (const char *name, const struct block *block,
/* Search specified block and its superiors. Don't search
STATIC_BLOCK or GLOBAL_BLOCK. */
- sym = lookup_symbol_aux_local (name, block, domain, language);
+ sym = lookup_local_symbol (name, block, domain, language);
if (sym != NULL)
return sym;
@@ -1488,7 +1488,7 @@ lookup_static_symbol (const char *name, const domain_enum domain)
ALL_OBJFILES (objfile)
{
- sym = lookup_symbol_aux_quick (objfile, STATIC_BLOCK, name, domain);
+ sym = lookup_symbol_via_quick_fns (objfile, STATIC_BLOCK, name, domain);
if (sym != NULL)
return sym;
}
@@ -1500,9 +1500,9 @@ lookup_static_symbol (const char *name, const domain_enum domain)
Don't search STATIC_BLOCK or GLOBAL_BLOCK. */
static struct symbol *
-lookup_symbol_aux_local (const char *name, const struct block *block,
- const domain_enum domain,
- enum language language)
+lookup_local_symbol (const char *name, const struct block *block,
+ const domain_enum domain,
+ enum language language)
{
struct symbol *sym;
const struct block *static_block = block_static_block (block);
@@ -1610,8 +1610,8 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
}
}
- sym = lookup_symbol_aux_quick ((struct objfile *) objfile, GLOBAL_BLOCK,
- name, domain);
+ sym = lookup_symbol_via_quick_fns ((struct objfile *) objfile,
+ GLOBAL_BLOCK, name, domain);
if (sym)
return sym;
}
@@ -1625,8 +1625,8 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
static symbols. */
static struct symbol *
-lookup_symbol_aux_objfile (struct objfile *objfile, int block_index,
- const char *name, const domain_enum domain)
+lookup_symbol_in_symtabs (struct objfile *objfile, int block_index,
+ const char *name, const domain_enum domain)
{
struct symbol *sym = NULL;
const struct blockvector *bv;
@@ -1648,8 +1648,8 @@ lookup_symbol_aux_objfile (struct objfile *objfile, int block_index,
return NULL;
}
-/* Same as lookup_symbol_aux_objfile, except that it searches all
- objfiles. Return the first match found. */
+/* Wrapper around lookup_symbol_in_symtabs to search all objfiles.
+ Returns the first match found. */
static struct symbol *
lookup_symbol_aux_symtabs (int block_index, const char *name,
@@ -1660,7 +1660,7 @@ lookup_symbol_aux_symtabs (int block_index, const char *name,
ALL_OBJFILES (objfile)
{
- sym = lookup_symbol_aux_objfile (objfile, block_index, name, domain);
+ sym = lookup_symbol_in_symtabs (objfile, block_index, name, domain);
if (sym)
return sym;
}
@@ -1668,7 +1668,7 @@ lookup_symbol_aux_symtabs (int block_index, const char *name,
return NULL;
}
-/* Wrapper around lookup_symbol_aux_objfile for search_symbols.
+/* Wrapper around lookup_symbol_in_symtabs for search_symbols.
Look up LINKAGE_NAME in DOMAIN in the global and static blocks of OBJFILE
and all related objfiles. */
@@ -1694,11 +1694,11 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
{
struct symbol *sym;
- sym = lookup_symbol_aux_objfile (cur_objfile, GLOBAL_BLOCK,
- modified_name, domain);
+ sym = lookup_symbol_in_symtabs (cur_objfile, GLOBAL_BLOCK,
+ modified_name, domain);
if (sym == NULL)
- sym = lookup_symbol_aux_objfile (cur_objfile, STATIC_BLOCK,
- modified_name, domain);
+ sym = lookup_symbol_in_symtabs (cur_objfile, STATIC_BLOCK,
+ modified_name, domain);
if (sym != NULL)
{
do_cleanups (cleanup);
@@ -1725,12 +1725,12 @@ Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n\
name, symtab_to_filename_for_display (symtab), name, name);
}
-/* A helper function for lookup_symbol_aux that interfaces with the
- "quick" symbol table functions. */
+/* A helper function for various lookup routines that interfaces with
+ the "quick" symbol table functions. */
static struct symbol *
-lookup_symbol_aux_quick (struct objfile *objfile, int block_index,
- const char *name, const domain_enum domain)
+lookup_symbol_via_quick_fns (struct objfile *objfile, int block_index,
+ const char *name, const domain_enum domain)
{
struct symtab *symtab;
const struct blockvector *bv;
@@ -1840,11 +1840,11 @@ lookup_symbol_global_iterator_cb (struct objfile *objfile,
gdb_assert (data->result == NULL);
- data->result = lookup_symbol_aux_objfile (objfile, GLOBAL_BLOCK,
- data->name, data->domain);
+ data->result = lookup_symbol_in_symtabs (objfile, GLOBAL_BLOCK,
+ data->name, data->domain);
if (data->result == NULL)
- data->result = lookup_symbol_aux_quick (objfile, GLOBAL_BLOCK,
- data->name, data->domain);
+ data->result = lookup_symbol_via_quick_fns (objfile, GLOBAL_BLOCK,
+ data->name, data->domain);
/* If we found a match, tell the iterator to stop. Otherwise,
keep going. */
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 5/9] Rename some "aux" functions.
2014-10-27 4:37 [PATCH 5/9] Rename some "aux" functions Doug Evans
@ 2014-10-28 1:09 ` Yao Qi
2014-10-28 1:36 ` Doug Evans
0 siblings, 1 reply; 5+ messages in thread
From: Yao Qi @ 2014-10-28 1:09 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
Doug Evans <xdje42@gmail.com> writes:
> static struct symbol *
> -lookup_symbol_aux_objfile (struct objfile *objfile, int block_index,
> - const char *name, const domain_enum domain)
> +lookup_symbol_in_symtabs (struct objfile *objfile, int block_index,
> + const char *name, const domain_enum domain)
Hi Doug,
It looks good to remove "aux" from function name, but this function
still has a parameter objfile, so I feel we'd better keep "object" in
function name, such as lookup_symbol_in_objfile, what do you think?
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 5/9] Rename some "aux" functions.
2014-10-28 1:09 ` Yao Qi
@ 2014-10-28 1:36 ` Doug Evans
2014-10-28 3:18 ` Yao Qi
0 siblings, 1 reply; 5+ messages in thread
From: Doug Evans @ 2014-10-28 1:36 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On Mon, Oct 27, 2014 at 6:05 PM, Yao Qi <yao@codesourcery.com> wrote:
> Doug Evans <xdje42@gmail.com> writes:
>
>> static struct symbol *
>> -lookup_symbol_aux_objfile (struct objfile *objfile, int block_index,
>> - const char *name, const domain_enum domain)
>> +lookup_symbol_in_symtabs (struct objfile *objfile, int block_index,
>> + const char *name, const domain_enum domain)
>
> Hi Doug,
> It looks good to remove "aux" from function name, but this function
> still has a parameter objfile, so I feel we'd better keep "object" in
> function name, such as lookup_symbol_in_objfile, what do you think?
Yeah, I thought of this.
The problem is that "lookup symbol in objfile" says nothing about
symtabs vs psymtabs/gdb_index.
If one knows how symbol lookup is done (first look in symtabs, then
look in psymtabs/gdb_index)
then "lookup symbol in objfile" conveys to the reader the wrong thing
because this function only looks in symtabs.
That's the reasoning why I went with _symtabs.
If you want to name it lookup_symbol_in_objfile_symtabs then I'd be ok
with that.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 5/9] Rename some "aux" functions.
2014-10-28 1:36 ` Doug Evans
@ 2014-10-28 3:18 ` Yao Qi
2014-11-07 8:59 ` Doug Evans
0 siblings, 1 reply; 5+ messages in thread
From: Yao Qi @ 2014-10-28 3:18 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
Doug Evans <xdje42@gmail.com> writes:
> If you want to name it lookup_symbol_in_objfile_symtabs then I'd be ok
> with that.
Yes, that is good to me.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 5/9] Rename some "aux" functions.
2014-10-28 3:18 ` Yao Qi
@ 2014-11-07 8:59 ` Doug Evans
0 siblings, 0 replies; 5+ messages in thread
From: Doug Evans @ 2014-11-07 8:59 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
Yao Qi <yao@codesourcery.com> writes:
> Doug Evans <xdje42@gmail.com> writes:
>
>> If you want to name it lookup_symbol_in_objfile_symtabs then I'd be ok
>> with that.
>
> Yes, that is good to me.
Here is what I committed.
2014-11-06 Doug Evans <xdje42@gmail.com>
* symtab.c (lookup_local_symbol): Renamed from lookup_symbol_aux_local.
All callers updated.
(lookup_symbol_in_all_objfiles): Renamed from
lookup_symbol_aux_symtabs. All callers updated.
(lookup_symbol_via_quick_fns): Renamed from lookup_symbol_aux_quick.
All callers updated.
(lookup_symbol_in_objfile_symtabs): Renamed from
lookup_symbol_aux_objfile. All callers updated.
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 3c2e277..6f483bf 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -74,21 +74,21 @@ static struct symbol *lookup_symbol_aux (const char *name,
struct field_of_this_result *);
static
-struct symbol *lookup_symbol_aux_local (const char *name,
- const struct block *block,
- const domain_enum domain,
- enum language language);
+struct symbol *lookup_local_symbol (const char *name,
+ const struct block *block,
+ const domain_enum domain,
+ enum language language);
static
-struct symbol *lookup_symbol_aux_symtabs (int block_index,
- const char *name,
- const domain_enum domain);
+struct symbol *lookup_symbol_in_all_objfiles (int block_index,
+ const char *name,
+ const domain_enum domain);
static
-struct symbol *lookup_symbol_aux_quick (struct objfile *objfile,
- int block_index,
- const char *name,
- const domain_enum domain);
+struct symbol *lookup_symbol_via_quick_fns (struct objfile *objfile,
+ int block_index,
+ const char *name,
+ const domain_enum domain);
extern initialize_file_ftype _initialize_symtab;
@@ -1424,7 +1424,7 @@ lookup_symbol_aux (const char *name, const struct block *block,
/* Search specified block and its superiors. Don't search
STATIC_BLOCK or GLOBAL_BLOCK. */
- sym = lookup_symbol_aux_local (name, block, domain, language);
+ sym = lookup_local_symbol (name, block, domain, language);
if (sym != NULL)
return sym;
@@ -1482,13 +1482,13 @@ lookup_static_symbol (const char *name, const domain_enum domain)
struct objfile *objfile;
struct symbol *sym;
- sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, domain);
+ sym = lookup_symbol_in_all_objfiles (STATIC_BLOCK, name, domain);
if (sym != NULL)
return sym;
ALL_OBJFILES (objfile)
{
- sym = lookup_symbol_aux_quick (objfile, STATIC_BLOCK, name, domain);
+ sym = lookup_symbol_via_quick_fns (objfile, STATIC_BLOCK, name, domain);
if (sym != NULL)
return sym;
}
@@ -1500,9 +1500,9 @@ lookup_static_symbol (const char *name, const domain_enum domain)
Don't search STATIC_BLOCK or GLOBAL_BLOCK. */
static struct symbol *
-lookup_symbol_aux_local (const char *name, const struct block *block,
- const domain_enum domain,
- enum language language)
+lookup_local_symbol (const char *name, const struct block *block,
+ const domain_enum domain,
+ enum language language)
{
struct symbol *sym;
const struct block *static_block = block_static_block (block);
@@ -1612,8 +1612,8 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
}
}
- sym = lookup_symbol_aux_quick ((struct objfile *) objfile, GLOBAL_BLOCK,
- name, domain);
+ sym = lookup_symbol_via_quick_fns ((struct objfile *) objfile,
+ GLOBAL_BLOCK, name, domain);
if (sym)
return sym;
}
@@ -1627,8 +1627,8 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
static symbols. */
static struct symbol *
-lookup_symbol_aux_objfile (struct objfile *objfile, int block_index,
- const char *name, const domain_enum domain)
+lookup_symbol_in_objfile_symtabs (struct objfile *objfile, int block_index,
+ const char *name, const domain_enum domain)
{
struct symbol *sym = NULL;
const struct blockvector *bv;
@@ -1650,19 +1650,20 @@ lookup_symbol_aux_objfile (struct objfile *objfile, int block_index,
return NULL;
}
-/* Same as lookup_symbol_aux_objfile, except that it searches all
- objfiles. Return the first match found. */
+/* Wrapper around lookup_symbol_in_objfile_symtabs to search all objfiles.
+ Returns the first match found. */
static struct symbol *
-lookup_symbol_aux_symtabs (int block_index, const char *name,
- const domain_enum domain)
+lookup_symbol_in_all_objfiles (int block_index, const char *name,
+ const domain_enum domain)
{
struct symbol *sym;
struct objfile *objfile;
ALL_OBJFILES (objfile)
{
- sym = lookup_symbol_aux_objfile (objfile, block_index, name, domain);
+ sym = lookup_symbol_in_objfile_symtabs (objfile, block_index, name,
+ domain);
if (sym)
return sym;
}
@@ -1670,7 +1671,7 @@ lookup_symbol_aux_symtabs (int block_index, const char *name,
return NULL;
}
-/* Wrapper around lookup_symbol_aux_objfile for search_symbols.
+/* Wrapper around lookup_symbol_in_objfile_symtabs for search_symbols.
Look up LINKAGE_NAME in DOMAIN in the global and static blocks of OBJFILE
and all related objfiles. */
@@ -1696,11 +1697,11 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
{
struct symbol *sym;
- sym = lookup_symbol_aux_objfile (cur_objfile, GLOBAL_BLOCK,
- modified_name, domain);
+ sym = lookup_symbol_in_objfile_symtabs (cur_objfile, GLOBAL_BLOCK,
+ modified_name, domain);
if (sym == NULL)
- sym = lookup_symbol_aux_objfile (cur_objfile, STATIC_BLOCK,
- modified_name, domain);
+ sym = lookup_symbol_in_objfile_symtabs (cur_objfile, STATIC_BLOCK,
+ modified_name, domain);
if (sym != NULL)
{
do_cleanups (cleanup);
@@ -1727,12 +1728,12 @@ Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n\
name, symtab_to_filename_for_display (symtab), name, name);
}
-/* A helper function for lookup_symbol_aux that interfaces with the
- "quick" symbol table functions. */
+/* A helper function for various lookup routines that interfaces with
+ the "quick" symbol table functions. */
static struct symbol *
-lookup_symbol_aux_quick (struct objfile *objfile, int block_index,
- const char *name, const domain_enum domain)
+lookup_symbol_via_quick_fns (struct objfile *objfile, int block_index,
+ const char *name, const domain_enum domain)
{
struct symtab *symtab;
const struct blockvector *bv;
@@ -1773,7 +1774,7 @@ basic_lookup_symbol_nonlocal (const char *name,
not it would be appropriate to search the current global block
here as well. (That's what this code used to do before the
is_a_field_of_this check was moved up.) On the one hand, it's
- redundant with the lookup_symbol_aux_symtabs search that happens
+ redundant with the lookup_symbol_in_all_objfiles search that happens
next. On the other hand, if decode_line_1 is passed an argument
like filename:var, then the user presumably wants 'var' to be
searched for in filename. On the third hand, there shouldn't be
@@ -1842,11 +1843,11 @@ lookup_symbol_global_iterator_cb (struct objfile *objfile,
gdb_assert (data->result == NULL);
- data->result = lookup_symbol_aux_objfile (objfile, GLOBAL_BLOCK,
- data->name, data->domain);
+ data->result = lookup_symbol_in_objfile_symtabs (objfile, GLOBAL_BLOCK,
+ data->name, data->domain);
if (data->result == NULL)
- data->result = lookup_symbol_aux_quick (objfile, GLOBAL_BLOCK,
- data->name, data->domain);
+ data->result = lookup_symbol_via_quick_fns (objfile, GLOBAL_BLOCK,
+ data->name, data->domain);
/* If we found a match, tell the iterator to stop. Otherwise,
keep going. */
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-07 8:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-27 4:37 [PATCH 5/9] Rename some "aux" functions Doug Evans
2014-10-28 1:09 ` Yao Qi
2014-10-28 1:36 ` Doug Evans
2014-10-28 3:18 ` Yao Qi
2014-11-07 8:59 ` Doug Evans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox