Re: [PATCH] Handle var_uinteger/var_zuinteger and case var_integer/var_zinteger together.

Yao Qi
2012-07-29T14:25:51Z

On Friday, July 27, 2012 01:40:06 PM Khoo Yit Phang wrote:
> This patch broke "set remote hardware-breakpoint-limit -1" ("integer
4294967295 out of range"), which treats -1 as unlimited. The problem is the
following lines:
> > case var_integer:
> > + case var_zinteger:
> > {
> > unsigned int val;
>
> Since val is unsigned, -1 gets casted to UINT_MAX which subsequently fails:
> > else if (val >= INT_MAX)
> > error (_("integer %u out of range"), val);
>
> I tried changing val to LONGEST, but that subsequently broke the "set
> listsize -1" test in the testsuite (or at least, it fails one of the test
> cases in testsuite/gdb.base/list.exp).
>
> Actually, it's not clear to me what "set listsize -1" is supposed to do: in
> one place in the testsuite, it's supposed to be unlimited and "set listsize
> 0" is supposed to suppress printing, but in another place, "set listsize 0"
> is supposed to be unlimited. But running "set listsize -1", without my
> change, also leads to an error ("integer 4294967295 out of range"). The
> documentation does not make it clear either.

The inconsistency is confusing here. I've started looking at this issue. We
did have a discussion on this problem in 2006. I'll go through the archives,
and give a reasonable fix to this.

--
Yao (齐尧)