From: Daniel Jacobowitz <drow@false.org>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Warn on constant value watchpoints
Date: Thu, 26 Jun 2008 15:01:00 -0000 [thread overview]
Message-ID: <20080626142731.GK22726@caradoc.them.org> (raw)
In-Reply-To: <20080609061414.GA19316@host0.dyn.jankratochvil.net>
On Mon, Jun 09, 2008 at 08:14:14AM +0200, Jan Kratochvil wrote:
> @@ -5903,7 +5903,27 @@ watch_command_1 (char *arg, int accessfl
> exp_end = arg;
> exp_valid_block = innermost_block;
> mark = value_mark ();
> - fetch_watchpoint_value (exp, &val, NULL, NULL);
> + fetch_watchpoint_value (exp, &val, &val_result, NULL);
> +
> + /* VAL may be unset for unreachable final values. */
> + while (val_result != NULL)
> + {
> + if (VALUE_LVAL (val_result) == lval_memory
> + || VALUE_LVAL (val_result) == lval_register)
> + break;
> + val_result = value_next (val_result);
> + }
val_result is the same as val, except possibly lazy. value_next
(val_result) will always be NULL, won't it? The chain goes the other
way - next from the oldest value (*val_chain argument, or the first
value after the saved mark).
If I'm right it seems like this patch will break "watch a + 1".
Also, I don't know how useful this feature is, but what happens with
"watch foo()"?
> + if (val_result == NULL)
> + {
> + int len;
> +
> + len = exp_end - exp_start;
> + while (len > 0 && isspace (exp_start[len - 1]))
> + len--;
> + error (_("Cannot watch constant value %.*s."), len, exp_start);
> + }
If an intermediate value could not be read, val_result may be NULL.
So this will stop us watching such expressions before they become
readable.
> +If you watch for a change in a numerically entered address you need to
> +dereference it as the address itself is just a constant number which will never
> +change. @value{GDBN} refuses to create a never invokable watchpoint:
never-changing?
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2008-06-26 14:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-08 15:53 Jan Kratochvil
2008-06-08 18:05 ` Eli Zaretskii
2008-06-08 18:09 ` Daniel Jacobowitz
2008-06-08 18:50 ` Eli Zaretskii
2008-06-08 19:28 ` Jan Kratochvil
2008-06-09 6:14 ` Jan Kratochvil
2008-06-26 15:01 ` Daniel Jacobowitz [this message]
2008-06-26 19:40 ` Eli Zaretskii
2008-07-10 9:00 ` Jan Kratochvil
2008-07-10 9:02 ` Jan Kratochvil
2008-07-10 9:06 ` Jan Kratochvil
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=20080626142731.GK22726@caradoc.them.org \
--to=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.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