From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: pedro@codesourcery.com
Cc: gdb-patches@sourceware.org
Subject: Re: PR 8507 - Remote watchpoint limit really large
Date: Mon, 29 Dec 2008 12:26:00 -0000 [thread overview]
Message-ID: <200812291222.mBTCMuZt004718@brahms.sibelius.xs4all.nl> (raw)
In-Reply-To: <200812290525.11823.pedro@codesourcery.com> (message from Pedro Alves on Mon, 29 Dec 2008 05:25:11 +0000)
> From: Pedro Alves <pedro@codesourcery.com>
> Date: Mon, 29 Dec 2008 05:25:11 +0000
>
> PR 8507 is about this command:
>
> (gdb) help show remote hardware-watchpoint-limit
> Show the maximum number of target hardware watchpoints.
> Specify a negative limit for unlimited.
>
> And the fact that a negative value (default is -1), shows
> through as a large positive value, which is somewhat confusing:
>
> (gdb) show remote hardware-watchpoint-limit
> The maximum number of target hardware watchpoints is 4294967295.
>
> Notice that the "show" help explicitly mentioned "Specify a negative
> limit for unlimited.".
>
> This patch fixes it to show:
>
> (gdb) set remote hardware-watchpoint-limit -1
> (gdb) show remote hardware-watchpoint-limit
> The maximum number of target hardware watchpoints is unlimited.
>
> There's no current enum var_types for this integer usage, where
> 0 really means zero, and negatives mean unlimited, so I've added one.
Hmm, I'm not sure I like the name. How about var_zuinteger, for
zeroable unsigned Integer?
Interesting enough, the existing usage of var_zinteger in alpha-tdep.c
and mips-tdep.c looks like it should really be var_zuinteger too. I
bet there are more cases.
I'm also not sure your implementation will actually work. Especially
the statement:
> + *(int *) c->var = UINT_MAX;
looks very suspicious to me. I suspect you are having problems
converting the variables set by this command from 'int' to 'unsigned
int'. I actually think it would make sense to treat var_uinteger and
var_zuinteger variables as 'int' ans set them to INT_MAX to mean
unlimited. I don't think the loss of range is a big loss. For all
practical purposes INT_MAX is just as much infinty as UINT_MAX.
This would probably fix a few bugs as well, since eventually you're
going to compare these to signed integers anyway, and having your
"unsigned" integers in the range [0, INT_MAX] prevents a lot of
accidents from happening there. (Do you fully understand the C rules
for integer type promotion?).
Mark
next prev parent reply other threads:[~2008-12-29 12:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-29 5:25 Pedro Alves
2008-12-29 12:26 ` Mark Kettenis [this message]
2008-12-29 19:13 ` Pedro Alves
2008-12-29 19:30 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200812291222.mBTCMuZt004718@brahms.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox