aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2022-01-27 22:06:47 -0500
committerSimon Marchi <simon.marchi@efficios.com>2022-02-06 16:03:46 -0500
commitd9743061f92738a6c3f311d640e614a5a2f01b1e (patch)
tree526c9f1911ab21c38bcee992174f7a7457bba773 /gdb
parent7b3ecc7555438f05dda657d0ed6a43ee71a3901d (diff)
downloadgdb-d9743061f92738a6c3f311d640e614a5a2f01b1e.zip
gdb-d9743061f92738a6c3f311d640e614a5a2f01b1e.tar.gz
gdb-d9743061f92738a6c3f311d640e614a5a2f01b1e.tar.bz2
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
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ada-lang.c6
-rw-r--r--gdb/block.c2
-rw-r--r--gdb/buildsym.c4
-rw-r--r--gdb/c-exp.y2
-rw-r--r--gdb/coffread.c4
-rw-r--r--gdb/dwarf2/read.c2
-rw-r--r--gdb/go-exp.y2
-rw-r--r--gdb/guile/scm-symbol.c4
-rw-r--r--gdb/infrun.c2
-rw-r--r--gdb/mdebugread.c4
-rw-r--r--gdb/mi/mi-cmd-stack.c10
-rw-r--r--gdb/printcmd.c2
-rw-r--r--gdb/python/py-framefilter.c4
-rw-r--r--gdb/python/py-symbol.c4
-rw-r--r--gdb/stabsread.c10
-rw-r--r--gdb/stack.c8
-rw-r--r--gdb/symmisc.c2
-rw-r--r--gdb/symtab.h15
-rw-r--r--gdb/tracepoint.c2
19 files changed, 49 insertions, 40 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 77d6c07..636ae90 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -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
{
diff --git a/gdb/block.c b/gdb/block.c
index 7ec56c7..f753212 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -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;
}
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 27206f9..51764a6 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -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;
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 7334724..6d4cb47 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -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\""),
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 8bf7421..e4db4fd 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -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;
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index b62252e..259401f 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -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)
{
diff --git a/gdb/go-exp.y b/gdb/go-exp.y
index 5436072..fed7fe5 100644
--- a/gdb/go-exp.y
+++ b/gdb/go-exp.y
@@ -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\""),
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index caad90f..32ef336 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -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));
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 2e7ed15..f9420d5 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -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)
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 0a2a4c3..a295878 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -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;
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 0c2172f..ed22f34 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -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);
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 787d8d7..6f9be82 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -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
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index 70fec4a..e6eb1ec 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -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;
}
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 7084743..c756870 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -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));
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 38e9481..33fcc92 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -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). */
diff --git a/gdb/stack.c b/gdb/stack.c
index fcdcd35..834e016 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -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
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index cb16b5c..328230a 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -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
diff --git a/gdb/symtab.h b/gdb/symtab.h
index ef9e653..f565f12 100644
--- a/gdb/symtab.h
+++ b/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)
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 807f5a3..d8577dc 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -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