This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Fix verification of changed values for big values.
- From: Tom Tromey <tromey at redhat dot com>
- To: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- Cc: gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Thu, 04 Jun 2009 11:54:30 -0600
- Subject: Re: [RFC] Fix verification of changed values for big values.
- References: <1243802866.26363.35.camel@hactar>
- Reply-to: tromey at redhat dot com
>>>>> "Thiago" == Thiago Jung Bauermann <bauerman@br.ibm.com> writes:
Thiago> Right now, GDB calls value_equal when comparing the old and new values
Thiago> of a watchpoint. IMO this is not correct, since that function will call
Thiago> coerce_array and effectively just compare the addresses of arrays being
Thiago> watched.
Thiago> This patch introduces a new value comparison function which works in the
Thiago> mentioned case, and a testcase which fails without the patch and passes
Thiago> with it. Ok to commit?
This makes sense to me.
Thiago> + return TYPE_CODE (type1) == TYPE_CODE (type2)
Thiago> + && TYPE_LENGTH (type1) == TYPE_LENGTH (type2)
Thiago> + && memcmp (value_contents (arg1), value_contents (arg2),
Thiago> + TYPE_LENGTH (type1)) == 0;
A style nit: multi-line expressions should be wrapped in parens, and
the continuation lines here should be indented more deeply.
Also, I think value_equal_watchpoint should be in one of the
value-related files. My reasoning is that I've occasionally run
across code duplication because some function like this was defined in
an obscure place.
Tom