gdb: remove SYMBOL_IS_ARGUMENT macro
Add a getter and a setter for whether a symbol is an argument. Remove the corresponding macro and adjust all callers. Change-Id: I71b4f0465f3dfd2ed8b9e140bd3f7d5eb8d9ee81
This commit is contained in:
parent
7b3ecc7555
commit
d9743061f9
19 changed files with 49 additions and 40 deletions
|
@ -5053,7 +5053,7 @@ match_data::operator() (struct block_symbol *bsym)
|
|||
{
|
||||
if (sym->aclass () == LOC_UNRESOLVED)
|
||||
return true;
|
||||
else if (SYMBOL_IS_ARGUMENT (sym))
|
||||
else if (sym->is_argument ())
|
||||
arg_sym = sym;
|
||||
else
|
||||
{
|
||||
|
@ -5744,7 +5744,7 @@ ada_add_block_symbols (std::vector<struct block_symbol> &result,
|
|||
{
|
||||
if (sym->aclass () != LOC_UNRESOLVED)
|
||||
{
|
||||
if (SYMBOL_IS_ARGUMENT (sym))
|
||||
if (sym->is_argument ())
|
||||
arg_sym = sym;
|
||||
else
|
||||
{
|
||||
|
@ -5798,7 +5798,7 @@ ada_add_block_symbols (std::vector<struct block_symbol> &result,
|
|||
{
|
||||
if (sym->aclass () != LOC_UNRESOLVED)
|
||||
{
|
||||
if (SYMBOL_IS_ARGUMENT (sym))
|
||||
if (sym->is_argument ())
|
||||
arg_sym = sym;
|
||||
else
|
||||
{
|
||||
|
|
|
@ -753,7 +753,7 @@ block_lookup_symbol (const struct block *block, const char *name,
|
|||
sym->domain (), domain))
|
||||
{
|
||||
sym_found = sym;
|
||||
if (!SYMBOL_IS_ARGUMENT (sym))
|
||||
if (!sym->is_argument ())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ buildsym_compunit::finish_block_internal
|
|||
we haven't fully initialized the block yet. */
|
||||
ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (block), miter, sym)
|
||||
{
|
||||
if (SYMBOL_IS_ARGUMENT (sym))
|
||||
if (sym->is_argument ())
|
||||
nparams++;
|
||||
}
|
||||
if (nparams > 0)
|
||||
|
@ -284,7 +284,7 @@ buildsym_compunit::finish_block_internal
|
|||
if (iparams == nparams)
|
||||
break;
|
||||
|
||||
if (SYMBOL_IS_ARGUMENT (sym))
|
||||
if (sym->is_argument ())
|
||||
{
|
||||
ftype->field (iparams).set_type (SYMBOL_TYPE (sym));
|
||||
TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
|
||||
|
|
|
@ -1102,7 +1102,7 @@ block : block COLONCOLON name
|
|||
variable: name_not_typename ENTRY
|
||||
{ struct symbol *sym = $1.sym.symbol;
|
||||
|
||||
if (sym == NULL || !SYMBOL_IS_ARGUMENT (sym)
|
||||
if (sym == NULL || !sym->is_argument ()
|
||||
|| !symbol_read_needs_frame (sym))
|
||||
error (_("@entry can be used only for function "
|
||||
"parameters, not for \"%s\""),
|
||||
|
|
|
@ -1640,13 +1640,13 @@ process_coff_symbol (struct coff_symbol *cs,
|
|||
|
||||
case C_ARG:
|
||||
sym->set_aclass_index (LOC_ARG);
|
||||
SYMBOL_IS_ARGUMENT (sym) = 1;
|
||||
sym->set_is_argument (1);
|
||||
add_symbol_to_list (sym, get_local_symbols ());
|
||||
break;
|
||||
|
||||
case C_REGPARM:
|
||||
sym->set_aclass_index (coff_register_index);
|
||||
SYMBOL_IS_ARGUMENT (sym) = 1;
|
||||
sym->set_is_argument (1);
|
||||
SYMBOL_VALUE (sym) = cs->c_value;
|
||||
add_symbol_to_list (sym, get_local_symbols ());
|
||||
break;
|
||||
|
|
|
@ -21934,7 +21934,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
|
|||
struct context_stack *curr
|
||||
= cu->get_builder ()->get_current_context_stack ();
|
||||
if (curr != nullptr && curr->name != nullptr)
|
||||
SYMBOL_IS_ARGUMENT (sym) = 1;
|
||||
sym->set_is_argument (1);
|
||||
attr = dwarf2_attr (die, DW_AT_location, cu);
|
||||
if (attr != nullptr)
|
||||
{
|
||||
|
|
|
@ -545,7 +545,7 @@ variable: name_not_typename ENTRY
|
|||
{ struct symbol *sym = $1.sym.symbol;
|
||||
|
||||
if (sym == NULL
|
||||
|| !SYMBOL_IS_ARGUMENT (sym)
|
||||
|| !sym->is_argument ()
|
||||
|| !symbol_read_needs_frame (sym))
|
||||
error (_("@entry can be used only for function "
|
||||
"parameters, not for \"%s\""),
|
||||
|
|
|
@ -424,7 +424,7 @@ gdbscm_symbol_argument_p (SCM self)
|
|||
= syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
|
||||
const struct symbol *symbol = s_smob->symbol;
|
||||
|
||||
return scm_from_bool (SYMBOL_IS_ARGUMENT (symbol));
|
||||
return scm_from_bool (symbol->is_argument ());
|
||||
}
|
||||
|
||||
/* (symbol-constant? <gdb:symbol>) -> boolean */
|
||||
|
@ -469,7 +469,7 @@ gdbscm_symbol_variable_p (SCM self)
|
|||
|
||||
theclass = symbol->aclass ();
|
||||
|
||||
return scm_from_bool (!SYMBOL_IS_ARGUMENT (symbol)
|
||||
return scm_from_bool (!symbol->is_argument ()
|
||||
&& (theclass == LOC_LOCAL || theclass == LOC_REGISTER
|
||||
|| theclass == LOC_STATIC || theclass == LOC_COMPUTED
|
||||
|| theclass == LOC_OPTIMIZED_OUT));
|
||||
|
|
|
@ -7935,7 +7935,7 @@ check_exception_resume (struct execution_control_state *ecs,
|
|||
b = SYMBOL_BLOCK_VALUE (func);
|
||||
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
||||
{
|
||||
if (!SYMBOL_IS_ARGUMENT (sym))
|
||||
if (!sym->is_argument ())
|
||||
continue;
|
||||
|
||||
if (argno == 0)
|
||||
|
|
|
@ -676,7 +676,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
|||
s = new_symbol (name);
|
||||
|
||||
s->set_domain (VAR_DOMAIN);
|
||||
SYMBOL_IS_ARGUMENT (s) = 1;
|
||||
s->set_is_argument (1);
|
||||
switch (sh->sc)
|
||||
{
|
||||
case scRegister:
|
||||
|
@ -1202,7 +1202,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
|||
if (iparams == nparams)
|
||||
break;
|
||||
|
||||
if (SYMBOL_IS_ARGUMENT (sym))
|
||||
if (sym->is_argument ())
|
||||
{
|
||||
ftype->field (iparams).set_type (SYMBOL_TYPE (sym));
|
||||
TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
|
||||
|
|
|
@ -520,7 +520,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
|
|||
stb.puts ("@entry");
|
||||
uiout->field_stream ("name", stb);
|
||||
|
||||
if (what == all && SYMBOL_IS_ARGUMENT (arg->sym))
|
||||
if (what == all && arg->sym->is_argument ())
|
||||
uiout->field_signed ("arg", 1);
|
||||
|
||||
if (values == PRINT_SIMPLE_VALUES)
|
||||
|
@ -623,9 +623,9 @@ list_args_or_locals (const frame_print_options &fp_opts,
|
|||
if (what == all)
|
||||
print_me = 1;
|
||||
else if (what == locals)
|
||||
print_me = !SYMBOL_IS_ARGUMENT (sym);
|
||||
print_me = !sym->is_argument ();
|
||||
else
|
||||
print_me = SYMBOL_IS_ARGUMENT (sym);
|
||||
print_me = sym->is_argument ();
|
||||
break;
|
||||
}
|
||||
if (print_me)
|
||||
|
@ -633,7 +633,7 @@ list_args_or_locals (const frame_print_options &fp_opts,
|
|||
struct symbol *sym2;
|
||||
struct frame_arg arg, entryarg;
|
||||
|
||||
if (SYMBOL_IS_ARGUMENT (sym))
|
||||
if (sym->is_argument ())
|
||||
sym2 = lookup_symbol_search_name (sym->search_name (),
|
||||
block, VAR_DOMAIN).symbol;
|
||||
else
|
||||
|
@ -654,7 +654,7 @@ list_args_or_locals (const frame_print_options &fp_opts,
|
|||
&& type->code () != TYPE_CODE_UNION)
|
||||
{
|
||||
case PRINT_ALL_VALUES:
|
||||
if (SYMBOL_IS_ARGUMENT (sym))
|
||||
if (sym->is_argument ())
|
||||
read_frame_arg (fp_opts, sym2, fi, &arg, &entryarg);
|
||||
else
|
||||
read_frame_local (sym2, fi, &arg);
|
||||
|
|
|
@ -1735,7 +1735,7 @@ info_address_command (const char *exp, int from_tty)
|
|||
in that objfile. */
|
||||
regno = SYMBOL_REGISTER_OPS (sym)->register_number (sym, gdbarch);
|
||||
|
||||
if (SYMBOL_IS_ARGUMENT (sym))
|
||||
if (sym->is_argument ())
|
||||
printf_filtered (_("an argument in register %s"),
|
||||
gdbarch_register_name (gdbarch, regno));
|
||||
else
|
||||
|
|
|
@ -191,9 +191,9 @@ mi_should_print (struct symbol *sym, enum mi_print_types type)
|
|||
case LOC_REGISTER: /* register */
|
||||
case LOC_COMPUTED: /* computed location */
|
||||
if (type == MI_PRINT_LOCALS)
|
||||
print_me = ! SYMBOL_IS_ARGUMENT (sym);
|
||||
print_me = ! sym->is_argument ();
|
||||
else
|
||||
print_me = SYMBOL_IS_ARGUMENT (sym);
|
||||
print_me = sym->is_argument ();
|
||||
}
|
||||
return print_me;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ sympy_is_argument (PyObject *self, void *closure)
|
|||
|
||||
SYMPY_REQUIRE_VALID (self, symbol);
|
||||
|
||||
return PyBool_FromLong (SYMBOL_IS_ARGUMENT (symbol));
|
||||
return PyBool_FromLong (symbol->is_argument ());
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -180,7 +180,7 @@ sympy_is_variable (PyObject *self, void *closure)
|
|||
|
||||
theclass = symbol->aclass ();
|
||||
|
||||
return PyBool_FromLong (!SYMBOL_IS_ARGUMENT (symbol)
|
||||
return PyBool_FromLong (!symbol->is_argument ()
|
||||
&& (theclass == LOC_LOCAL || theclass == LOC_REGISTER
|
||||
|| theclass == LOC_STATIC || theclass == LOC_COMPUTED
|
||||
|| theclass == LOC_OPTIMIZED_OUT));
|
||||
|
|
|
@ -1067,7 +1067,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
|
|||
sym->set_aclass_index (LOC_ARG);
|
||||
SYMBOL_VALUE (sym) = valu;
|
||||
sym->set_domain (VAR_DOMAIN);
|
||||
SYMBOL_IS_ARGUMENT (sym) = 1;
|
||||
sym->set_is_argument (1);
|
||||
add_symbol_to_list (sym, get_local_symbols ());
|
||||
|
||||
if (gdbarch_byte_order (gdbarch) != BFD_ENDIAN_BIG)
|
||||
|
@ -1114,7 +1114,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
|
|||
/* Parameter which is in a register. */
|
||||
SYMBOL_TYPE (sym) = read_type (&p, objfile);
|
||||
sym->set_aclass_index (stab_register_index);
|
||||
SYMBOL_IS_ARGUMENT (sym) = 1;
|
||||
sym->set_is_argument (1);
|
||||
SYMBOL_VALUE (sym) = valu;
|
||||
sym->set_domain (VAR_DOMAIN);
|
||||
add_symbol_to_list (sym, get_local_symbols ());
|
||||
|
@ -1352,7 +1352,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
|
|||
/* Reference parameter */
|
||||
SYMBOL_TYPE (sym) = read_type (&p, objfile);
|
||||
sym->set_aclass_index (LOC_REF_ARG);
|
||||
SYMBOL_IS_ARGUMENT (sym) = 1;
|
||||
sym->set_is_argument (1);
|
||||
SYMBOL_VALUE (sym) = valu;
|
||||
sym->set_domain (VAR_DOMAIN);
|
||||
add_symbol_to_list (sym, get_local_symbols ());
|
||||
|
@ -1362,7 +1362,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
|
|||
/* Reference parameter which is in a register. */
|
||||
SYMBOL_TYPE (sym) = read_type (&p, objfile);
|
||||
sym->set_aclass_index (stab_regparm_index);
|
||||
SYMBOL_IS_ARGUMENT (sym) = 1;
|
||||
sym->set_is_argument (1);
|
||||
SYMBOL_VALUE (sym) = valu;
|
||||
sym->set_domain (VAR_DOMAIN);
|
||||
add_symbol_to_list (sym, get_local_symbols ());
|
||||
|
@ -1394,7 +1394,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
|
|||
register or on the stack) instead of the structure itself. */
|
||||
|
||||
if (gdbarch_stabs_argument_has_addr (gdbarch, SYMBOL_TYPE (sym))
|
||||
&& SYMBOL_IS_ARGUMENT (sym))
|
||||
&& sym->is_argument ())
|
||||
{
|
||||
/* We have to convert LOC_REGISTER to LOC_REGPARM_ADDR (for
|
||||
variables passed in a register). */
|
||||
|
|
|
@ -763,7 +763,7 @@ print_frame_args (const frame_print_options &fp_opts,
|
|||
/* Keep track of the highest stack argument offset seen, and
|
||||
skip over any kinds of symbols we don't care about. */
|
||||
|
||||
if (!SYMBOL_IS_ARGUMENT (sym))
|
||||
if (!sym->is_argument ())
|
||||
continue;
|
||||
|
||||
if (!print_names)
|
||||
|
@ -829,7 +829,7 @@ print_frame_args (const frame_print_options &fp_opts,
|
|||
b, VAR_DOMAIN).symbol;
|
||||
gdb_assert (nsym != NULL);
|
||||
if (nsym->aclass () == LOC_REGISTER
|
||||
&& !SYMBOL_IS_ARGUMENT (nsym))
|
||||
&& !nsym->is_argument ())
|
||||
{
|
||||
/* There is a LOC_ARG/LOC_REGISTER pair. This means
|
||||
that it was passed on the stack and loaded into a
|
||||
|
@ -2256,7 +2256,7 @@ iterate_over_block_locals (const struct block *b,
|
|||
case LOC_STATIC:
|
||||
case LOC_COMPUTED:
|
||||
case LOC_OPTIMIZED_OUT:
|
||||
if (SYMBOL_IS_ARGUMENT (sym))
|
||||
if (sym->is_argument ())
|
||||
break;
|
||||
if (sym->domain () == COMMON_BLOCK_DOMAIN)
|
||||
break;
|
||||
|
@ -2503,7 +2503,7 @@ iterate_over_block_arg_vars (const struct block *b,
|
|||
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
||||
{
|
||||
/* Don't worry about things which aren't arguments. */
|
||||
if (SYMBOL_IS_ARGUMENT (sym))
|
||||
if (sym->is_argument ())
|
||||
{
|
||||
/* We have to look up the symbol because arguments can have
|
||||
two entries (one a parameter, one a local) and the one we
|
||||
|
|
|
@ -589,7 +589,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
|
|||
break;
|
||||
|
||||
case LOC_REGISTER:
|
||||
if (SYMBOL_IS_ARGUMENT (symbol))
|
||||
if (symbol->is_argument ())
|
||||
fprintf_filtered (outfile, "parameter register %s",
|
||||
plongest (SYMBOL_VALUE (symbol)));
|
||||
else
|
||||
|
|
15
gdb/symtab.h
15
gdb/symtab.h
|
@ -1116,7 +1116,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
|
|||
: m_domain (UNDEF_DOMAIN),
|
||||
m_aclass_index (0),
|
||||
m_is_objfile_owned (1),
|
||||
is_argument (0),
|
||||
m_is_argument (0),
|
||||
is_inlined (0),
|
||||
maybe_copied (0),
|
||||
subclass (SYMBOL_NONE),
|
||||
|
@ -1178,6 +1178,16 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
|
|||
m_is_objfile_owned = is_objfile_owned;
|
||||
}
|
||||
|
||||
bool is_argument () const
|
||||
{
|
||||
return m_is_argument;
|
||||
}
|
||||
|
||||
void set_is_argument (bool is_argument)
|
||||
{
|
||||
m_is_argument = is_argument;
|
||||
}
|
||||
|
||||
/* Data type of value */
|
||||
|
||||
struct type *type = nullptr;
|
||||
|
@ -1213,7 +1223,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
|
|||
|
||||
/* Whether this is an argument. */
|
||||
|
||||
unsigned is_argument : 1;
|
||||
unsigned m_is_argument : 1;
|
||||
|
||||
/* Whether this is an inlined function (class LOC_BLOCK only). */
|
||||
unsigned is_inlined : 1;
|
||||
|
@ -1280,7 +1290,6 @@ struct block_symbol
|
|||
/* Note: There is no accessor macro for symbol.owner because it is
|
||||
"private". */
|
||||
|
||||
#define SYMBOL_IS_ARGUMENT(symbol) (symbol)->is_argument
|
||||
#define SYMBOL_INLINED(symbol) (symbol)->is_inlined
|
||||
#define SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION(symbol) \
|
||||
(((symbol)->subclass) == SYMBOL_TEMPLATE)
|
||||
|
|
|
@ -2586,7 +2586,7 @@ info_scope_command (const char *args_in, int from_tty)
|
|||
regno = SYMBOL_REGISTER_OPS (sym)->register_number (sym,
|
||||
gdbarch);
|
||||
|
||||
if (SYMBOL_IS_ARGUMENT (sym))
|
||||
if (sym->is_argument ())
|
||||
printf_filtered ("an argument in register $%s",
|
||||
gdbarch_register_name (gdbarch, regno));
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue