This is the mail archive of the gdb-patches@sources.redhat.com 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] |
On Monday, October 21, 2002, at 08:44 PM, Andrew Cagney wrote:
(Like Eli, I'm puzzled by the existing behavior :-)That's exactly correct. The watchpoint code goes through all of the values referenced in evaluating an expression, and sets an OS-level watchpoint on each. Since 'a' evaluates to a value with type ARRAY, the watchpoint code sets a hardware-assisted watchpoint on the full contents of that array.
Just to get this straight. given:
int a[10];
then:
(gdb) watch a
sets up the hardware to look for a change in ``*a@10'' but then evaluates ``a'' and hence, while stopping when ever `a' changes, never trigger the watchpoint?
Would it be better to make it possible for the user to clearly differentiate between these two cases and specify any of:The expression evaluator is perfectly happy to handle *b@10 in a watchpoint. I think that the real issue is that the current mechanism to determine if a watchpoint has changed is:
int a[10];
int *b;
(gdb) watch a
(gdb) watch b
(gdb) watch *b@10
(gdb) watch *a@sizeof(a)
While the existing ``watch a'' might have annoying semantics, it would make its behavior consistent with C. An array is converted to a pointer in an expression. I'm not sure how well this would work with the expression evaluator though.
What ever the outcome, this desperatly needs a testcase. Otherwize we're all going to keep spinning our weels wondering what the behavior was ment to be.Agreed. I wrote this test with the assumption of "arrays compare as their contents in watchpoints", but I'm happy to modify the test if we decide on different semantics.
Attachment:
watchpoint-tests.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |