2001-10-12 Daniel Jacobowitz <drow@mvista.com>
* symtab.h (struct block): (ALL_BLOCK_SYMBOLS): New macro. * symtab.c (find_pc_sect_symtab): Use ALL_BLOCK_SYMBOLS. (make_symbol_completion_list): Likewise. (make_symbol_overload_list): Likewise. * buildsym.c (finish_block): Likewise. * breakpoint.c (get_catch_sals): Likewise. * mdebugread.c (mylookup_symbol): Likewise. * objfiles.c (objfile_relocate): Likewise. * printcmd.c (print_frame_args): Likewise. * stack.c (print_block_frame_locals): Likewise. (print_block_frame_labels): Likewise. (print_frame_arg_vars): Likewise. * symmisc.c (dump_symtab): Likewise. * tracepoint.c (add_local_symbols): Likewise. (scope_info): Likewise. 2001-10-12 Daniel Jacobowitz <drow@mvista.com> * mi-cmd-stack.c (list_args_or_locals): Use ALL_BLOCK_SYMBOLS. 2001-10-12 Daniel Jacobowitz <drow@mvista.com> * generic/gdbtk-cmds.c (gdb_listfuncs): Use ALL_BLOCK_SYMBOLS. * generic/gdbtk-stack.c (gdb_block_vars): Likewise. (gdb_get_blocks): Likewise. (gdb_get_vars_command): Likewise. 5~
This commit is contained in:
parent
f4846649b3
commit
e88c90f2c5
13 changed files with 63 additions and 68 deletions
|
@ -1,3 +1,22 @@
|
|||
2001-10-12 Daniel Jacobowitz <drow@mvista.com>
|
||||
|
||||
* symtab.h (struct block): (ALL_BLOCK_SYMBOLS): New macro.
|
||||
|
||||
* symtab.c (find_pc_sect_symtab): Use ALL_BLOCK_SYMBOLS.
|
||||
(make_symbol_completion_list): Likewise.
|
||||
(make_symbol_overload_list): Likewise.
|
||||
* buildsym.c (finish_block): Likewise.
|
||||
* breakpoint.c (get_catch_sals): Likewise.
|
||||
* mdebugread.c (mylookup_symbol): Likewise.
|
||||
* objfiles.c (objfile_relocate): Likewise.
|
||||
* printcmd.c (print_frame_args): Likewise.
|
||||
* stack.c (print_block_frame_locals): Likewise.
|
||||
(print_block_frame_labels): Likewise.
|
||||
(print_frame_arg_vars): Likewise.
|
||||
* symmisc.c (dump_symtab): Likewise.
|
||||
* tracepoint.c (add_local_symbols): Likewise.
|
||||
(scope_info): Likewise.
|
||||
|
||||
2001-10-12 Daniel Jacobowitz <drow@mvista.com>
|
||||
|
||||
* minsyms.c (msymbol_hash): Use better hash function.
|
||||
|
|
|
@ -5871,15 +5871,11 @@ get_catch_sals (int this_level_only)
|
|||
if (blocks_searched[index] == 0)
|
||||
{
|
||||
struct block *b = BLOCKVECTOR_BLOCK (bl, index);
|
||||
int nsyms;
|
||||
register int i;
|
||||
register struct symbol *sym;
|
||||
|
||||
nsyms = BLOCK_NSYMS (b);
|
||||
|
||||
for (i = 0; i < nsyms; i++)
|
||||
ALL_BLOCK_SYMBOLS (b, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (b, i);
|
||||
if (STREQ (SYMBOL_NAME (sym), "default"))
|
||||
{
|
||||
if (have_default)
|
||||
|
|
|
@ -275,9 +275,8 @@ finish_block (struct symbol *symbol, struct pending **listhead,
|
|||
parameter symbols. */
|
||||
int nparams = 0, iparams;
|
||||
struct symbol *sym;
|
||||
for (i = 0; i < BLOCK_NSYMS (block); i++)
|
||||
ALL_BLOCK_SYMBOLS (block, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (block, i);
|
||||
switch (SYMBOL_CLASS (sym))
|
||||
{
|
||||
case LOC_ARG:
|
||||
|
|
|
@ -3853,22 +3853,19 @@ static struct symbol *
|
|||
mylookup_symbol (char *name, register struct block *block,
|
||||
namespace_enum namespace, enum address_class class)
|
||||
{
|
||||
register int bot, top, inc;
|
||||
register struct symbol *sym;
|
||||
int i, inc;
|
||||
struct symbol *sym;
|
||||
|
||||
bot = 0;
|
||||
top = BLOCK_NSYMS (block);
|
||||
inc = name[0];
|
||||
while (bot < top)
|
||||
ALL_BLOCK_SYMBOLS (block, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (block, bot);
|
||||
if (SYMBOL_NAME (sym)[0] == inc
|
||||
&& SYMBOL_NAMESPACE (sym) == namespace
|
||||
&& SYMBOL_CLASS (sym) == class
|
||||
&& strcmp (SYMBOL_NAME (sym), name) == 0)
|
||||
return sym;
|
||||
bot++;
|
||||
}
|
||||
|
||||
block = BLOCK_SUPERBLOCK (block);
|
||||
if (block)
|
||||
return mylookup_symbol (name, block, namespace, class);
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2001-10-12 Daniel Jacobowitz <drow@mvista.com>
|
||||
|
||||
* mi-cmd-stack.c (list_args_or_locals): Use ALL_BLOCK_SYMBOLS.
|
||||
|
||||
2001-09-18 Andrew Cagney <ac131313@redhat.com>
|
||||
|
||||
* mi-main.c (mi_cmd_thread_select): Pass uiout to
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "value.h"
|
||||
#include "mi-cmds.h"
|
||||
#include "ui-out.h"
|
||||
#include "symtab.h"
|
||||
|
||||
#ifdef UI_OUT
|
||||
/* FIXME: these should go in some .h file but stack.c doesn't have a
|
||||
|
@ -226,10 +227,8 @@ list_args_or_locals (int locals, int values, struct frame_info *fi)
|
|||
|
||||
while (block != 0)
|
||||
{
|
||||
nsyms = BLOCK_NSYMS (block);
|
||||
for (i = 0; i < nsyms; i++)
|
||||
ALL_BLOCK_SYMBOLS (block, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (block, i);
|
||||
switch (SYMBOL_CLASS (sym))
|
||||
{
|
||||
default:
|
||||
|
|
|
@ -557,16 +557,15 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
|
|||
for (i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i)
|
||||
{
|
||||
struct block *b;
|
||||
struct symbol *sym;
|
||||
int j;
|
||||
|
||||
b = BLOCKVECTOR_BLOCK (bv, i);
|
||||
BLOCK_START (b) += ANOFFSET (delta, s->block_line_section);
|
||||
BLOCK_END (b) += ANOFFSET (delta, s->block_line_section);
|
||||
|
||||
for (j = 0; j < BLOCK_NSYMS (b); ++j)
|
||||
ALL_BLOCK_SYMBOLS (b, j, sym)
|
||||
{
|
||||
struct symbol *sym = BLOCK_SYM (b, j);
|
||||
|
||||
fixup_symbol_section (sym, objfile);
|
||||
|
||||
/* The RS6000 code from which this was taken skipped
|
||||
|
|
|
@ -1783,7 +1783,6 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
|
|||
struct ui_file *stream)
|
||||
{
|
||||
struct block *b = NULL;
|
||||
int nsyms = 0;
|
||||
int first = 1;
|
||||
register int i;
|
||||
register struct symbol *sym;
|
||||
|
@ -1806,12 +1805,9 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
|
|||
if (func)
|
||||
{
|
||||
b = SYMBOL_BLOCK_VALUE (func);
|
||||
nsyms = BLOCK_NSYMS (b);
|
||||
|
||||
for (i = 0; i < nsyms; i++)
|
||||
ALL_BLOCK_SYMBOLS (b, i, sym)
|
||||
{
|
||||
QUIT;
|
||||
sym = BLOCK_SYM (b, i);
|
||||
|
||||
/* Keep track of the highest stack argument offset seen, and
|
||||
skip over any kinds of symbols we don't care about. */
|
||||
|
|
19
gdb/stack.c
19
gdb/stack.c
|
@ -1207,16 +1207,12 @@ static int
|
|||
print_block_frame_locals (struct block *b, register struct frame_info *fi,
|
||||
int num_tabs, register struct ui_file *stream)
|
||||
{
|
||||
int nsyms;
|
||||
register int i, j;
|
||||
register struct symbol *sym;
|
||||
register int values_printed = 0;
|
||||
|
||||
nsyms = BLOCK_NSYMS (b);
|
||||
|
||||
for (i = 0; i < nsyms; i++)
|
||||
ALL_BLOCK_SYMBOLS (b, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (b, i);
|
||||
switch (SYMBOL_CLASS (sym))
|
||||
{
|
||||
case LOC_LOCAL:
|
||||
|
@ -1246,16 +1242,12 @@ static int
|
|||
print_block_frame_labels (struct block *b, int *have_default,
|
||||
register struct ui_file *stream)
|
||||
{
|
||||
int nsyms;
|
||||
register int i;
|
||||
register struct symbol *sym;
|
||||
register int values_printed = 0;
|
||||
|
||||
nsyms = BLOCK_NSYMS (b);
|
||||
|
||||
for (i = 0; i < nsyms; i++)
|
||||
ALL_BLOCK_SYMBOLS (b, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (b, i);
|
||||
if (STREQ (SYMBOL_NAME (sym), "default"))
|
||||
{
|
||||
if (*have_default)
|
||||
|
@ -1432,7 +1424,6 @@ print_frame_arg_vars (register struct frame_info *fi,
|
|||
{
|
||||
struct symbol *func = get_frame_function (fi);
|
||||
register struct block *b;
|
||||
int nsyms;
|
||||
register int i;
|
||||
register struct symbol *sym, *sym2;
|
||||
register int values_printed = 0;
|
||||
|
@ -1444,11 +1435,8 @@ print_frame_arg_vars (register struct frame_info *fi,
|
|||
}
|
||||
|
||||
b = SYMBOL_BLOCK_VALUE (func);
|
||||
nsyms = BLOCK_NSYMS (b);
|
||||
|
||||
for (i = 0; i < nsyms; i++)
|
||||
ALL_BLOCK_SYMBOLS (b, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (b, i);
|
||||
switch (SYMBOL_CLASS (sym))
|
||||
{
|
||||
case LOC_ARG:
|
||||
|
@ -1483,7 +1471,6 @@ print_frame_arg_vars (register struct frame_info *fi,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!values_printed)
|
||||
{
|
||||
fprintf_filtered (stream, "No arguments.\n");
|
||||
|
|
|
@ -410,6 +410,7 @@ dump_symtab (struct objfile *objfile, struct symtab *symtab,
|
|||
int len, blen;
|
||||
register struct linetable *l;
|
||||
struct blockvector *bv;
|
||||
struct symbol *sym;
|
||||
register struct block *b;
|
||||
int depth;
|
||||
|
||||
|
@ -471,11 +472,12 @@ dump_symtab (struct objfile *objfile, struct symtab *symtab,
|
|||
if (BLOCK_GCC_COMPILED (b))
|
||||
fprintf_filtered (outfile, ", compiled with gcc%d", BLOCK_GCC_COMPILED (b));
|
||||
fprintf_filtered (outfile, "\n");
|
||||
/* Now print each symbol in this block */
|
||||
for (j = 0; j < blen; j++)
|
||||
/* Now print each symbol in this block. */
|
||||
/* FIXMED: Sort? */
|
||||
ALL_BLOCK_SYMBOLS (b, j, sym)
|
||||
{
|
||||
struct print_symbol_args s;
|
||||
s.symbol = BLOCK_SYM (b, j);
|
||||
s.symbol = sym;
|
||||
s.depth = depth + 1;
|
||||
s.outfile = outfile;
|
||||
catch_errors (print_symbol, &s, "Error printing symbol:\n",
|
||||
|
|
24
gdb/symtab.c
24
gdb/symtab.c
|
@ -2992,9 +2992,8 @@ make_symbol_completion_list (char *text, char *word)
|
|||
/* Also catch fields of types defined in this places which match our
|
||||
text string. Only complete on types visible from current context. */
|
||||
|
||||
for (i = 0; i < BLOCK_NSYMS (b); i++)
|
||||
ALL_BLOCK_SYMBOLS (b, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (b, i);
|
||||
COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
|
||||
if (SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
||||
{
|
||||
|
@ -3023,9 +3022,8 @@ make_symbol_completion_list (char *text, char *word)
|
|||
{
|
||||
QUIT;
|
||||
b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
|
||||
for (i = 0; i < BLOCK_NSYMS (b); i++)
|
||||
ALL_BLOCK_SYMBOLS (b, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (b, i);
|
||||
COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
|
||||
}
|
||||
}
|
||||
|
@ -3037,9 +3035,8 @@ make_symbol_completion_list (char *text, char *word)
|
|||
/* Don't do this block twice. */
|
||||
if (b == surrounding_static_block)
|
||||
continue;
|
||||
for (i = 0; i < BLOCK_NSYMS (b); i++)
|
||||
ALL_BLOCK_SYMBOLS (b, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (b, i);
|
||||
COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
|
||||
}
|
||||
}
|
||||
|
@ -3143,16 +3140,14 @@ make_file_symbol_completion_list (char *text, char *word, char *srcfile)
|
|||
symbols which match. */
|
||||
|
||||
b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
|
||||
for (i = 0; i < BLOCK_NSYMS (b); i++)
|
||||
ALL_BLOCK_SYMBOLS (b, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (b, i);
|
||||
COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
|
||||
}
|
||||
|
||||
b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
|
||||
for (i = 0; i < BLOCK_NSYMS (b); i++)
|
||||
ALL_BLOCK_SYMBOLS (b, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (b, i);
|
||||
COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
|
||||
}
|
||||
|
||||
|
@ -3530,9 +3525,8 @@ make_symbol_overload_list (struct symbol *fsym)
|
|||
/* Also catch fields of types defined in this places which match our
|
||||
text string. Only complete on types visible from current context. */
|
||||
|
||||
for (i = 0; i < BLOCK_NSYMS (b); i++)
|
||||
ALL_BLOCK_SYMBOLS (b, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (b, i);
|
||||
overload_list_add_symbol (sym, oload_name);
|
||||
}
|
||||
}
|
||||
|
@ -3544,9 +3538,8 @@ make_symbol_overload_list (struct symbol *fsym)
|
|||
{
|
||||
QUIT;
|
||||
b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
|
||||
for (i = 0; i < BLOCK_NSYMS (b); i++)
|
||||
ALL_BLOCK_SYMBOLS (b, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (b, i);
|
||||
overload_list_add_symbol (sym, oload_name);
|
||||
}
|
||||
}
|
||||
|
@ -3558,9 +3551,8 @@ make_symbol_overload_list (struct symbol *fsym)
|
|||
/* Don't do this block twice. */
|
||||
if (b == surrounding_static_block)
|
||||
continue;
|
||||
for (i = 0; i < BLOCK_NSYMS (b); i++)
|
||||
ALL_BLOCK_SYMBOLS (b, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (b, i);
|
||||
overload_list_add_symbol (sym, oload_name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -467,6 +467,14 @@ struct block
|
|||
#define BLOCK_SUPERBLOCK(bl) (bl)->superblock
|
||||
#define BLOCK_GCC_COMPILED(bl) (bl)->gcc_compile_flag
|
||||
|
||||
/* Macro to loop through all symbols in a block BL.
|
||||
i counts which symbol we are looking at, and sym points to the current
|
||||
symbol. */
|
||||
#define ALL_BLOCK_SYMBOLS(bl, i, sym) \
|
||||
for ((i) = 0, (sym) = BLOCK_SYM ((bl), (i)); \
|
||||
(i) < BLOCK_NSYMS ((bl)); \
|
||||
++(i), (sym) = BLOCK_SYM ((bl), (i)))
|
||||
|
||||
/* Nonzero if symbols of block BL should be sorted alphabetically.
|
||||
Don't sort a block which corresponds to a function. If we did the
|
||||
sorting would have to preserve the order of the symbols for the
|
||||
|
|
|
@ -1296,16 +1296,14 @@ add_local_symbols (struct collection_list *collect, CORE_ADDR pc,
|
|||
{
|
||||
struct symbol *sym;
|
||||
struct block *block;
|
||||
int i, nsyms, count = 0;
|
||||
int i, count = 0;
|
||||
|
||||
block = block_for_pc (pc);
|
||||
while (block != 0)
|
||||
{
|
||||
QUIT; /* allow user to bail out with ^C */
|
||||
nsyms = BLOCK_NSYMS (block);
|
||||
for (i = 0; i < nsyms; i++)
|
||||
ALL_BLOCK_SYMBOLS (block, i, sym)
|
||||
{
|
||||
sym = BLOCK_SYM (block, i);
|
||||
switch (SYMBOL_CLASS (sym))
|
||||
{
|
||||
default:
|
||||
|
@ -2335,7 +2333,7 @@ scope_info (char *args, int from_tty)
|
|||
struct minimal_symbol *msym;
|
||||
struct block *block;
|
||||
char **canonical, *symname, *save_args = args;
|
||||
int i, j, nsyms, count = 0;
|
||||
int i, j, count = 0;
|
||||
|
||||
if (args == 0 || *args == 0)
|
||||
error ("requires an argument (function, line or *addr) to define a scope");
|
||||
|
@ -2351,14 +2349,13 @@ scope_info (char *args, int from_tty)
|
|||
while (block != 0)
|
||||
{
|
||||
QUIT; /* allow user to bail out with ^C */
|
||||
nsyms = BLOCK_NSYMS (block);
|
||||
for (i = 0; i < nsyms; i++)
|
||||
ALL_BLOCK_SYMBOLS (block, i, sym)
|
||||
{
|
||||
QUIT; /* allow user to bail out with ^C */
|
||||
if (count == 0)
|
||||
printf_filtered ("Scope for %s:\n", save_args);
|
||||
count++;
|
||||
sym = BLOCK_SYM (block, i);
|
||||
|
||||
symname = SYMBOL_NAME (sym);
|
||||
if (symname == NULL || *symname == '\0')
|
||||
continue; /* probably botched, certainly useless */
|
||||
|
|
Loading…
Reference in a new issue