diff options
author | Thiago Jung Bauermann <bauerman@br.ibm.com> | 2009-12-30 17:33:33 +0000 |
---|---|---|
committer | Thiago Jung Bauermann <bauerman@br.ibm.com> | 2009-12-30 17:33:33 +0000 |
commit | f48749608cbe3e5ea4da08c2b86ac575f9ba12cb (patch) | |
tree | 6957fa4ddb6399e3ee9aeef6fa7dc9cec23ee726 /gdb/valarith.c | |
parent | 94c0f1804049a742c977ebb024effd14ad08168b (diff) | |
download | gdb-f48749608cbe3e5ea4da08c2b86ac575f9ba12cb.tar.gz |
gdb/
* valarith.c (value_equal_contents): New function.
* value.h (value_equal_contents): Declare.
* breakpoint.c (watchpoint_check): Use value_equal_contents
instead of value_equal.
gdb/testsuite/
* gdb.base/watchpoint.exp (test_watchpoint_in_big_blob): New function.
(top level): Call test_watchpoint_in_big_blob.
* gdb.base/watchpoint.c (buf): Change size to value too big for hardware
watchpoints.
(func3): Write to buf.
Diffstat (limited to 'gdb/valarith.c')
-rw-r--r-- | gdb/valarith.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/valarith.c b/gdb/valarith.c index a9c875d907a..2b5d116e493 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -1397,6 +1397,24 @@ value_equal (struct value *arg1, struct value *arg2) } } +/* Compare values based on their raw contents. Useful for arrays since + value_equal coerces them to pointers, thus comparing just the address + of the array instead of its contents. */ + +int +value_equal_contents (struct value *arg1, struct value *arg2) +{ + struct type *type1, *type2; + + type1 = check_typedef (value_type (arg1)); + type2 = check_typedef (value_type (arg2)); + + return (TYPE_CODE (type1) == TYPE_CODE (type2) + && TYPE_LENGTH (type1) == TYPE_LENGTH (type2) + && memcmp (value_contents (arg1), value_contents (arg2), + TYPE_LENGTH (type1)) == 0); +} + /* Simulate the C operator < by returning 1 iff ARG1's contents are less than ARG2's. */ |