This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/2] use zuinteger_unlimited for some remote commands
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 04 Mar 2013 13:19:42 +0000
- Subject: Re: [PATCH 1/2] use zuinteger_unlimited for some remote commands
- References: <1360934868-5807-1-git-send-email-yao@codesourcery.com> <1360934868-5807-2-git-send-email-yao@codesourcery.com>
On 02/15/2013 01:27 PM, Yao Qi wrote:
> -int remote_hw_watchpoint_limit = -1;
> -int remote_hw_watchpoint_length_limit = -1;
> -int remote_hw_breakpoint_limit = -1;
> +static unsigned int remote_hw_watchpoint_limit = UINT_MAX;
> +static unsigned int remote_hw_watchpoint_length_limit = UINT_MAX;
> +static unsigned int remote_hw_breakpoint_limit = UINT_MAX;
...
> @@ -8259,7 +8255,7 @@ remote_check_watch_resources (int type, int cnt, int ot)
> {
> if (remote_hw_watchpoint_limit == 0)
> return 0;
> - else if (remote_hw_watchpoint_limit < 0)
> + else if (remote_hw_watchpoint_limit == UINT_MAX)
This made me notice something with var_zuinteger_unlimited.
What's the point of making it work with unsigned variables,
and UINT_MAX, if the contents of the variable are actually
treated as int everywhere in cli-setshow.c? (and val is
still cut at INT_MAX). Vis, e.g.,
case var_zuinteger_unlimited:
{
LONGEST val;
if (arg == NULL)
error_no_arg (_("integer to set it to."));
val = parse_and_eval_long (arg);
if (val >= INT_MAX)
error (_("integer %s out of range"), plongest (val));
else if (val < -1)
error (_("only -1 is allowed to set as unlimited"));
if (*(int *) c->var != val)
{
*(int *) c->var = val;
option_changed = 1;
}
If reads like cli-setshow.c's handling of
var_zuinteger_unlimited was never fully finished?
--
Pedro Alves