From: Klee Dienes <klee@apple.com>
To: Eli Zaretskii <eliz@is.elta.co.il>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Compare contents when evaluating an array watchpoint
Date: Mon, 07 Oct 2002 11:50:00 -0000 [thread overview]
Message-ID: <A0CAB39E-DA25-11D6-BDB2-00039396EEB8@apple.com> (raw)
In-Reply-To: <Pine.SUN.3.91.1021007162044.11283A@is>
Sure: breakpoint.c:984 (in insert_breakpoints), and breakpoint.c:5480
(in can_use_hardware_watchpoint).
Here's the relevant code from breakpoint.c:984:
/* Look at each value on the value chain. */
for (; v; v = v->next)
{
/* If it's a memory location, and GDB actually needed
its contents to evaluate the expression, then we
must watch it. */
if (VALUE_LVAL (v) == lval_memory
&& ! VALUE_LAZY (v))
{
struct type *vtype = check_typedef (VALUE_TYPE (v));
/* We only watch structs and arrays if user asked
for it explicitly, never if they just happen to
appear in the middle of some value chain. */
if (v == b->val_chain
|| (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
&& TYPE_CODE (vtype) != TYPE_CODE_ARRAY))
{
CORE_ADDR addr;
int len, type;
addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
len = TYPE_LENGTH (VALUE_TYPE (v));
type = hw_write;
if (b->type == bp_read_watchpoint)
type = hw_read;
else if (b->type == bp_access_watchpoint)
type = hw_access;
val = target_insert_watchpoint (addr, len,
type);
On Monday, October 7, 2002, at 10:26 AM, Eli Zaretskii wrote:
>
> On Mon, 7 Oct 2002, Klee Dienes wrote:
>
>> My patch doesn't change the behavior
>> of the trigger phase at all --- this phase has always set the trigger
>> to watch the entire contents of the array.
>
> IIRC, that's not true: what you call ``the trigger phase'' was watching
> the address of the array, not its contents. To watch the contents, you
> needed to watch specific array elements.
>
> In other words, "watch my_array" would break when the pointer to
> the first element of my_array[] changed to point to a different memory
> location. If you want to watch array contents, you need to say
> "watch my_array[0]", "watch my_array[1]", etc.
>
> Of course, it's been a while since I looked at that code, so I might be
> mistaken. If so, could you please tell where's the code in the current
> CVS sources which is watching the entire contents of the array?
next prev parent reply other threads:[~2002-10-07 18:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-06 2:16 Klee Dienes
2002-10-06 22:53 ` Eli Zaretskii
2002-10-06 23:12 ` Klee Dienes
2002-10-07 7:26 ` Eli Zaretskii
2002-10-07 11:50 ` Klee Dienes [this message]
2002-10-09 12:42 ` Eli Zaretskii
2002-10-21 17:44 ` Andrew Cagney
2002-11-04 18:27 ` [RFA] " Klee Dienes
2002-11-18 9:52 ` [PATCH] " Jim Blandy
2003-01-08 0:46 ` Andrew Cagney
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=A0CAB39E-DA25-11D6-BDB2-00039396EEB8@apple.com \
--to=klee@apple.com \
--cc=eliz@is.elta.co.il \
--cc=gdb-patches@sources.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