This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] use zuinteger_unlimited for some remote commands


On 03/04/2013 09:19 PM, Pedro Alves wrote:
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.,


Yes, in cli-setshow.c, the val is treated as signed integer, because -1 stands for unlimited. Outside of cli, var_zuinteger_unlimited is about a unsigned integer with a unlimited state. That is reason I change type of "remote_hw_watchpoint_limit" from signed to unsigned. Their default value is unlimited (-1), so I initialize them to UINT_MAX. Originally I used "(unsigned int) -1", but UINT_MAX is better as "unlimited" here.


--
Yao (éå)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]