* eval.c (parse_and_eval_long): New function.

* value.h: Declare it.

	* breakpoint.c (breakpoints_info, maintenance_info_breakpoints):
	Call parse_and_eval_long, not parse_and_eval_address.
	* command.c (do_setshow_command): Ditto.
	* infcmd.c (step_1, signal_command, continue_command): Ditto.
	* infrun.c (signals_info): Ditto.
	* stack.c (set_backtrace_limit_command, backtrace_command_1,
	up_silently_base, down_silently_base): Ditto.
	* tracepoints.c (tracepoints_info, trace_find_command,
 	trace_find_tracepoint_command): Ditto.
	* valprint.c (set_radix): Ditto.
	* values.c (show_values): Ditto.
This commit is contained in:
David Taylor 2000-10-30 15:32:51 +00:00
parent 4291c3fa65
commit bb518678ac
11 changed files with 51 additions and 17 deletions

View File

@ -1,3 +1,20 @@
Mon Oct 30 10:19:01 2000 David Taylor <taylor@redhat.com>
* eval.c (parse_and_eval_long): New function.
* value.h: Declare it.
* breakpoint.c (breakpoints_info, maintenance_info_breakpoints):
Call parse_and_eval_long, not parse_and_eval_address.
* command.c (do_setshow_command): Ditto.
* infcmd.c (step_1, signal_command, continue_command): Ditto.
* infrun.c (signals_info): Ditto.
* stack.c (set_backtrace_limit_command, backtrace_command_1,
up_silently_base, down_silently_base): Ditto.
* tracepoints.c (tracepoints_info, trace_find_command,
trace_find_tracepoint_command): Ditto.
* valprint.c (set_radix): Ditto.
* values.c (show_values): Ditto.
2000-10-28 Kevin Buettner <kevinb@redhat.com>
* symtab.c (decode_line_2, file_matches, search_symbols): Protoize.

View File

@ -3638,7 +3638,7 @@ breakpoints_info (char *bnum_exp, int from_tty)
int bnum = -1;
if (bnum_exp)
bnum = parse_and_eval_address (bnum_exp);
bnum = parse_and_eval_long (bnum_exp);
breakpoint_1 (bnum, 0);
}
@ -3650,7 +3650,7 @@ maintenance_info_breakpoints (char *bnum_exp, int from_tty)
int bnum = -1;
if (bnum_exp)
bnum = parse_and_eval_address (bnum_exp);
bnum = parse_and_eval_long (bnum_exp);
breakpoint_1 (bnum, 1);
}

View File

@ -1622,7 +1622,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
case var_uinteger:
if (arg == NULL)
error_no_arg ("integer to set it to.");
*(unsigned int *) c->var = parse_and_eval_address (arg);
*(unsigned int *) c->var = parse_and_eval_long (arg);
if (*(unsigned int *) c->var == 0)
*(unsigned int *) c->var = UINT_MAX;
break;
@ -1631,7 +1631,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
unsigned int val;
if (arg == NULL)
error_no_arg ("integer to set it to.");
val = parse_and_eval_address (arg);
val = parse_and_eval_long (arg);
if (val == 0)
*(int *) c->var = INT_MAX;
else if (val >= INT_MAX)
@ -1643,7 +1643,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
case var_zinteger:
if (arg == NULL)
error_no_arg ("integer to set it to.");
*(int *) c->var = parse_and_eval_address (arg);
*(int *) c->var = parse_and_eval_long (arg);
break;
case var_enum:
{

View File

@ -103,6 +103,21 @@ parse_and_eval_address_1 (char **expptr)
return addr;
}
/* Like parse_and_eval_address, but treats the value of the expression
as an integer, not an address, returns a LONGEST, not a CORE_ADDR */
LONGEST
parse_and_eval_long (char *exp)
{
struct expression *expr = parse_expression (exp);
register LONGEST retval;
register struct cleanup *old_chain =
make_cleanup (free_current_contents, &expr);
retval = value_as_long (evaluate_expression (expr));
do_cleanups (old_chain);
return (retval);
}
value_ptr
parse_and_eval (char *exp)
{

View File

@ -381,7 +381,7 @@ continue_command (char *proc_count_exp, int from_tty)
while (num != 0)
{
set_ignore_count (num,
parse_and_eval_address (proc_count_exp) - 1,
parse_and_eval_long (proc_count_exp) - 1,
from_tty);
/* set_ignore_count prints a message ending with a period.
So print two spaces before "Continuing.". */
@ -465,7 +465,7 @@ step_1 (int skip_subroutines, int single_inst, char *count_string)
async_disable_stdin ();
}
count = count_string ? parse_and_eval_address (count_string) : 1;
count = count_string ? parse_and_eval_long (count_string) : 1;
if (!single_inst || skip_subroutines) /* leave si command alone */
{
@ -777,7 +777,7 @@ signal_command (char *signum_exp, int from_tty)
if (oursig == TARGET_SIGNAL_UNKNOWN)
{
/* No, try numeric. */
int num = parse_and_eval_address (signum_exp);
int num = parse_and_eval_long (signum_exp);
if (num == 0)
oursig = TARGET_SIGNAL_0;

View File

@ -3899,7 +3899,7 @@ signals_info (char *signum_exp, int from_tty)
{
/* No, try numeric. */
oursig =
target_signal_from_command (parse_and_eval_address (signum_exp));
target_signal_from_command (parse_and_eval_long (signum_exp));
}
sig_print_info (oursig);
return;

View File

@ -1038,7 +1038,7 @@ static int backtrace_limit;
static void
set_backtrace_limit_command (char *count_exp, int from_tty)
{
int count = parse_and_eval_address (count_exp);
int count = parse_and_eval_long (count_exp);
if (count < 0)
error ("Negative argument not meaningful as backtrace limit.");
@ -1086,7 +1086,7 @@ backtrace_command_1 (char *count_exp, int show_locals, int from_tty)
trailing_level = 0;
if (count_exp)
{
count = parse_and_eval_address (count_exp);
count = parse_and_eval_long (count_exp);
if (count < 0)
{
struct frame_info *current;
@ -1740,7 +1740,7 @@ up_silently_base (char *count_exp)
register struct frame_info *fi;
int count = 1, count1;
if (count_exp)
count = parse_and_eval_address (count_exp);
count = parse_and_eval_long (count_exp);
count1 = count;
if (target_has_stack == 0 || selected_frame == 0)
@ -1777,7 +1777,7 @@ down_silently_base (char *count_exp)
register struct frame_info *frame;
int count = -1, count1;
if (count_exp)
count = -parse_and_eval_address (count_exp);
count = -parse_and_eval_long (count_exp);
count1 = count;
if (target_has_stack == 0 || selected_frame == 0)

View File

@ -465,7 +465,7 @@ tracepoints_info (char *tpnum_exp, int from_tty)
int tpnum = -1;
if (tpnum_exp)
tpnum = parse_and_eval_address (tpnum_exp);
tpnum = parse_and_eval_long (tpnum_exp);
ALL_TRACEPOINTS (t)
if (tpnum == -1 || tpnum == t->number)
@ -1986,7 +1986,7 @@ trace_find_command (char *args, int from_tty)
frameno = traceframe_number - 1;
}
else
frameno = parse_and_eval_address (args);
frameno = parse_and_eval_long (args);
if (frameno < -1)
error ("invalid input (%d is less than zero)", frameno);

View File

@ -1416,7 +1416,7 @@ set_radix (char *arg, int from_tty)
{
unsigned radix;
radix = (arg == NULL) ? 10 : parse_and_eval_address (arg);
radix = (arg == NULL) ? 10 : parse_and_eval_long (arg);
set_output_radix_1 (0, radix);
set_input_radix_1 (0, radix);
if (from_tty)

View File

@ -410,6 +410,8 @@ extern CORE_ADDR parse_and_eval_address (char *exp);
extern CORE_ADDR parse_and_eval_address_1 (char **expptr);
extern LONGEST parse_and_eval_long (char *exp);
extern value_ptr access_value_history (int num);
extern value_ptr value_of_internalvar (struct internalvar *var);

View File

@ -351,7 +351,7 @@ show_values (char *num_exp, int from_tty)
/* "info history +" should print from the stored position.
"info history <exp>" should print around value number <exp>. */
if (num_exp[0] != '+' || num_exp[1] != '\0')
num = parse_and_eval_address (num_exp) - 5;
num = parse_and_eval_long (num_exp) - 5;
}
else
{