diff options
author | David Taylor <taylor@redhat.com> | 2000-10-30 15:32:51 +0000 |
---|---|---|
committer | David Taylor <taylor@redhat.com> | 2000-10-30 15:32:51 +0000 |
commit | bb518678acdf8bdf3c7640c8d1dea7bba35e176a (patch) | |
tree | 085bacf758e7c90690c25e32a44bcec3232e0367 /gdb | |
parent | 4291c3fa65b2a9f4eb66aa8921e6163b3e7e7b53 (diff) | |
download | gdb-bb518678acdf8bdf3c7640c8d1dea7bba35e176a.zip gdb-bb518678acdf8bdf3c7640c8d1dea7bba35e176a.tar.gz gdb-bb518678acdf8bdf3c7640c8d1dea7bba35e176a.tar.bz2 |
* 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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 17 | ||||
-rw-r--r-- | gdb/breakpoint.c | 4 | ||||
-rw-r--r-- | gdb/command.c | 6 | ||||
-rw-r--r-- | gdb/eval.c | 15 | ||||
-rw-r--r-- | gdb/infcmd.c | 6 | ||||
-rw-r--r-- | gdb/infrun.c | 2 | ||||
-rw-r--r-- | gdb/stack.c | 8 | ||||
-rw-r--r-- | gdb/tracepoint.c | 4 | ||||
-rw-r--r-- | gdb/valprint.c | 2 | ||||
-rw-r--r-- | gdb/value.h | 2 | ||||
-rw-r--r-- | gdb/values.c | 2 |
11 files changed, 51 insertions, 17 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7f0703e..c819b1b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 31c6c6e..6f648f6 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -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); } diff --git a/gdb/command.c b/gdb/command.c index 4fc9aa1..3b59d33 100644 --- a/gdb/command.c +++ b/gdb/command.c @@ -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: { @@ -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) { diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 97a9b28..d20cb43 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -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; diff --git a/gdb/infrun.c b/gdb/infrun.c index 4ff0fad..c3cf023 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -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; diff --git a/gdb/stack.c b/gdb/stack.c index 3e81f62..8596276 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -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) diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 02cf5f8..0f52a17 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -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); diff --git a/gdb/valprint.c b/gdb/valprint.c index d40688a..1ca46be 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -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) diff --git a/gdb/value.h b/gdb/value.h index da95462..5b9188f 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -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); diff --git a/gdb/values.c b/gdb/values.c index 1ed843d..3f7c2d5 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -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 { |