* value.h (struct internalvar): Remove.

(get_internalvar_integer): Add prototype.
	(set_internalvar_integer): Add prototype.
	(clear_internalvar): Add prototype.

	* value.c (struct internalvar): Move here.  Add type member.  Remove
	endian member.  Add union_internalvar member instead of value member.
	(init_if_undefined_command): Use intvar->type.
	(create_internalvar): Do not initialize value/endian, but type.
	(create_internalvar_type_lazy): Call create_internalvar.
	(value_of_internalvar): Handle host-side internalvar contents.
	(set_internalvar_component): Likewise.
	(set_internalvar): Likewise.
	(get_internalvar_integer): New function.
	(clear_internalvar): Likewise.
	(set_internalvar_integer): Likewise.
	(preserve_values): Handle host-side internalvar contents.

	* breakpoint.c (set_breakpoint_count, set_tracepoint_count): Call
	set_internalvar_integer instead of set_internalvar.
	* findcmd.c (find_command): Likewise.
	* infrun.c (handle_inferior_event): Likewise.
	* source.c (forward_search_command, reverse_search_command): Likewise.
	* tracepoint.c (set_traceframe_num, set_tracepoint_num,
	set_traceframe_context): Likewise.

	* printcmd.c (x_command): Call clear_internalvar instead of
	set_internalvar.
	* tracepoint.c (set_traceframe_context): Likewise.

	* breakpoint.c (get_number_trailer): Call get_internalvar_integer
	instead of value_of_internalvar.
	* linespec.c (decode_dollar): Likewise.

	* expprint.c (dump_subexp_body_standard): Use internalvar_name
	instead of accessing internalvar private elements.
	* valops.c (value_assign): Copy from original source instead of
	accessing internalvar private elements.
This commit is contained in:
Ulrich Weigand
2009-06-03 18:16:44 +00:00
parent 6ceaaae577
commit 4fa6249465
12 changed files with 306 additions and 159 deletions

View File

@@ -1669,7 +1669,7 @@ static struct symtabs_and_lines
decode_dollar (char *copy, int funfirstline, struct symtab *default_symtab,
char ***canonical, struct symtab *file_symtab)
{
struct value *valx;
LONGEST valx;
int index = 0;
int need_canonical = 0;
struct symtabs_and_lines values;
@@ -1684,10 +1684,12 @@ decode_dollar (char *copy, int funfirstline, struct symtab *default_symtab,
if (!*p) /* Reached end of token without hitting non-digit. */
{
/* We have a value history reference. */
struct value *val_history;
sscanf ((copy[1] == '$') ? copy + 2 : copy + 1, "%d", &index);
valx = access_value_history ((copy[1] == '$') ? -index : index);
if (TYPE_CODE (value_type (valx)) != TYPE_CODE_INT)
val_history = access_value_history ((copy[1] == '$') ? -index : index);
if (TYPE_CODE (value_type (val_history)) != TYPE_CODE_INT)
error (_("History values used in line specs must have integer values."));
valx = value_as_long (val_history);
}
else
{
@@ -1709,8 +1711,7 @@ decode_dollar (char *copy, int funfirstline, struct symtab *default_symtab,
return minsym_found (funfirstline, msymbol);
/* Not a user variable or function -- must be convenience variable. */
valx = value_of_internalvar (lookup_internalvar (copy + 1));
if (TYPE_CODE (value_type (valx)) != TYPE_CODE_INT)
if (!get_internalvar_integer (lookup_internalvar (copy + 1), &valx))
error (_("Convenience variables used in line specs must have integer values."));
}
@@ -1718,7 +1719,7 @@ decode_dollar (char *copy, int funfirstline, struct symtab *default_symtab,
/* Either history value or convenience value from above, in valx. */
val.symtab = file_symtab ? file_symtab : default_symtab;
val.line = value_as_long (valx);
val.line = valx;
val.pc = 0;
values.sals = (struct symtab_and_line *) xmalloc (sizeof val);