* ax-gdb.c (gen_var_ref): Unconditionally call via computed ops,

if possible.
	* dwarf2read.c (read_func_scope): Remove old FIXME.
	* eval.c (evaluate_subexp_standard): Check SYMBOL_COMPUTED_OPS,
	not LOC_COMPUTED.
	* findvar.c (symbol_read_needs_frame, default_read_var_value):
	Unconditionally call via computed ops, if possible.
	* printcmd.c (address_info): Unconditionally call via computed ops,
	if possible.
	* stack.c (read_frame_arg): Unconditionally call via computed ops,
	if possible.
	* symtab.c (register_symbol_computed_impl): Sanity check 'ops'.
	* tracepoint.c (scope_info): Unconditionally call via computed ops,
	if possible.
This commit is contained in:
Tom Tromey 2013-03-20 18:35:22 +00:00
parent f1e6e0721c
commit 24d6c2a0bb
9 changed files with 148 additions and 129 deletions

View file

@ -1,3 +1,20 @@
2013-03-20 Tom Tromey <tromey@redhat.com>
* ax-gdb.c (gen_var_ref): Unconditionally call via computed ops,
if possible.
* dwarf2read.c (read_func_scope): Remove old FIXME.
* eval.c (evaluate_subexp_standard): Check SYMBOL_COMPUTED_OPS,
not LOC_COMPUTED.
* findvar.c (symbol_read_needs_frame, default_read_var_value):
Unconditionally call via computed ops, if possible.
* printcmd.c (address_info): Unconditionally call via computed ops,
if possible.
* stack.c (read_frame_arg): Unconditionally call via computed ops,
if possible.
* symtab.c (register_symbol_computed_impl): Sanity check 'ops'.
* tracepoint.c (scope_info): Unconditionally call via computed ops,
if possible.
2013-03-20 Jan Kratochvil <jan.kratochvil@redhat.com>
Tom Tromey <tromey@redhat.com>

View file

@ -662,6 +662,12 @@ gen_var_ref (struct gdbarch *gdbarch, struct agent_expr *ax,
value->type = check_typedef (SYMBOL_TYPE (var));
value->optimized_out = 0;
if (SYMBOL_COMPUTED_OPS (var) != NULL)
{
SYMBOL_COMPUTED_OPS (var)->tracepoint_var_ref (var, gdbarch, ax, value);
return;
}
/* I'm imitating the code in read_var_value. */
switch (SYMBOL_CLASS (var))
{
@ -750,13 +756,7 @@ gen_var_ref (struct gdbarch *gdbarch, struct agent_expr *ax,
break;
case LOC_COMPUTED:
/* FIXME: cagney/2004-01-26: It should be possible to
unconditionally call the SYMBOL_COMPUTED_OPS method when available.
Unfortunately DWARF 2 stores the frame-base (instead of the
function) location in a function's symbol. Oops! For the
moment enable this when/where applicable. */
SYMBOL_COMPUTED_OPS (var)->tracepoint_var_ref (var, gdbarch, ax, value);
break;
gdb_assert_not_reached (_("LOC_COMPUTED variable missing a method"));
case LOC_OPTIMIZED_OUT:
/* Flag this, but don't say anything; leave it up to callers to

View file

@ -9522,15 +9522,6 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
it. */
attr = dwarf2_attr (die, DW_AT_frame_base, cu);
if (attr)
/* FIXME: cagney/2004-01-26: The DW_AT_frame_base's location
expression is being recorded directly in the function's symbol
and not in a separate frame-base object. I guess this hack is
to avoid adding some sort of frame-base adjunct/annex to the
function's symbol :-(. The problem with doing this is that it
results in a function symbol with a location expression that
has nothing to do with the location of the function, ouch! The
relationship should be: a function's symbol has-a frame base; a
frame-base has-a location expression. */
dwarf2_symbol_mark_computed (attr, new->name, cu, 1);
cu->list_in_scope = &local_symbols;

View file

@ -792,7 +792,7 @@ evaluate_subexp_standard (struct type *expect_type,
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (SYMBOL_TYPE (sym), not_lval);
if (SYMBOL_CLASS (sym) != LOC_COMPUTED
if (SYMBOL_COMPUTED_OPS (sym) == NULL
|| SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry == NULL)
error (_("Symbol \"%s\" does not have any specific entry value"),
SYMBOL_PRINT_NAME (sym));

View file

@ -367,17 +367,15 @@ address_to_signed_pointer (struct gdbarch *gdbarch, struct type *type,
int
symbol_read_needs_frame (struct symbol *sym)
{
if (SYMBOL_COMPUTED_OPS (sym) != NULL)
return SYMBOL_COMPUTED_OPS (sym)->read_needs_frame (sym);
switch (SYMBOL_CLASS (sym))
{
/* All cases listed explicitly so that gcc -Wall will detect it if
we failed to consider one. */
case LOC_COMPUTED:
/* FIXME: cagney/2004-01-26: It should be possible to
unconditionally call the SYMBOL_COMPUTED_OPS method when available.
Unfortunately DWARF 2 stores the frame-base (instead of the
function) location in a function's symbol. Oops! For the
moment enable this when/where applicable. */
return SYMBOL_COMPUTED_OPS (sym)->read_needs_frame (sym);
gdb_assert_not_reached (_("LOC_COMPUTED variable missing a method"));
case LOC_REGISTER:
case LOC_ARG:
@ -456,6 +454,9 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
if (symbol_read_needs_frame (var))
gdb_assert (frame);
if (SYMBOL_COMPUTED_OPS (var) != NULL)
return SYMBOL_COMPUTED_OPS (var)->read_variable (var, frame);
switch (SYMBOL_CLASS (var))
{
case LOC_CONST:
@ -578,12 +579,7 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
break;
case LOC_COMPUTED:
/* FIXME: cagney/2004-01-26: It should be possible to
unconditionally call the SYMBOL_COMPUTED_OPS method when available.
Unfortunately DWARF 2 stores the frame-base (instead of the
function) location in a function's symbol. Oops! For the
moment enable this when/where applicable. */
return SYMBOL_COMPUTED_OPS (var)->read_variable (var, frame);
gdb_assert_not_reached (_("LOC_COMPUTED variable missing a method"));
case LOC_UNRESOLVED:
{

View file

@ -1251,6 +1251,14 @@ address_info (char *exp, int from_tty)
section = SYMBOL_OBJ_SECTION (sym);
gdbarch = get_objfile_arch (SYMBOL_SYMTAB (sym)->objfile);
if (SYMBOL_COMPUTED_OPS (sym) != NULL)
{
SYMBOL_COMPUTED_OPS (sym)->describe_location (sym, context_pc,
gdb_stdout);
printf_filtered (".\n");
return;
}
switch (SYMBOL_CLASS (sym))
{
case LOC_CONST:
@ -1273,14 +1281,7 @@ address_info (char *exp, int from_tty)
break;
case LOC_COMPUTED:
/* FIXME: cagney/2004-01-26: It should be possible to
unconditionally call the SYMBOL_COMPUTED_OPS method when available.
Unfortunately DWARF 2 stores the frame-base (instead of the
function) location in a function's symbol. Oops! For the
moment enable this when/where applicable. */
SYMBOL_COMPUTED_OPS (sym)->describe_location (sym, context_pc,
gdb_stdout);
break;
gdb_assert_not_reached (_("LOC_COMPUTED variable missing a method"));
case LOC_REGISTER:
/* GDBARCH is the architecture associated with the objfile the symbol

View file

@ -323,7 +323,8 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
}
}
if (SYMBOL_CLASS (sym) == LOC_COMPUTED
if (SYMBOL_COMPUTED_OPS (sym) != NULL
&& SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry != NULL
&& print_entry_values != print_entry_values_no
&& (print_entry_values != print_entry_values_if_needed
|| !val || value_optimized_out (val)))

View file

@ -5053,6 +5053,13 @@ register_symbol_computed_impl (enum address_class aclass,
symbol_impl[result].aclass = aclass;
symbol_impl[result].ops_computed = ops;
/* Sanity check OPS. */
gdb_assert (ops != NULL);
gdb_assert (ops->tracepoint_var_ref != NULL);
gdb_assert (ops->describe_location != NULL);
gdb_assert (ops->read_needs_frame != NULL);
gdb_assert (ops->read_variable != NULL);
return result;
}

View file

@ -2678,6 +2678,13 @@ scope_info (char *args, int from_tty)
gdbarch = get_objfile_arch (SYMBOL_SYMTAB (sym)->objfile);
printf_filtered ("Symbol %s is ", symname);
if (SYMBOL_COMPUTED_OPS (sym) != NULL)
SYMBOL_COMPUTED_OPS (sym)->describe_location (sym,
BLOCK_START (block),
gdb_stdout);
else
{
switch (SYMBOL_CLASS (sym))
{
default:
@ -2762,17 +2769,16 @@ scope_info (char *args, int from_tty)
{
printf_filtered ("static storage at address ");
printf_filtered ("%s",
paddress (gdbarch, SYMBOL_VALUE_ADDRESS (msym)));
paddress (gdbarch,
SYMBOL_VALUE_ADDRESS (msym)));
}
break;
case LOC_OPTIMIZED_OUT:
printf_filtered ("optimized out.\n");
continue;
case LOC_COMPUTED:
SYMBOL_COMPUTED_OPS (sym)->describe_location (sym,
BLOCK_START (block),
gdb_stdout);
break;
gdb_assert_not_reached (_("LOC_COMPUTED variable missing a method"));
}
}
if (SYMBOL_TYPE (sym))
printf_filtered (", length %d.\n",