From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5924 invoked by alias); 14 Apr 2010 10:35:18 -0000 Mailing-List: contact archer-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: List-Id: Received: (qmail 5913 invoked by uid 22791); 14 Apr 2010 10:35:17 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Subject: Re: Patch for pascal-dynamic arrays From: Joost van der Sluis To: Jan Kratochvil Cc: Project Archer In-Reply-To: <20100412195106.GA32767@host0.dyn.jankratochvil.net> References: <1252939529.28930.33.camel@wsjoost.cnoc.lan> <20090916154453.GA23913@host0.dyn.jankratochvil.net> <1254326374.2755.14.camel@wsjoost.cnoc.lan> <20091004141705.GA18527@host0.dyn.jankratochvil.net> <1256751286.31305.24.camel@wsjoost.cnoc.lan> <20091030094726.GA29758@host0.dyn.jankratochvil.net> <1257630529.27675.26.camel@wsjoost.cnoc.lan> <1271071502.27845.15.camel@wsjoost.cnoc.lan> <20100412195106.GA32767@host0.dyn.jankratochvil.net> Content-Type: multipart/mixed; boundary="=-G6mH4+CwqsbmG4m1uP7f" Date: Wed, 14 Apr 2010 10:35:00 -0000 Message-Id: <1271241292.21465.18.camel@wsjoost.cnoc.lan> Mime-Version: 1.0 X-Language-Detected: en X-Spam-Scanned: InterNLnet Mail Scan System V2.03 X-SW-Source: 2010-q2/txt/msg00011.txt.bz2 --=-G6mH4+CwqsbmG4m1uP7f Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 2231 On Mon, 2010-04-12 at 21:51 +0200, Jan Kratochvil wrote: > On Mon, 12 Apr 2010 13:25:02 +0200, Joost van der Sluis wrote: > > I have a new patch now that doesn't cause any regressions on my system, > > on Fedora 12 for x86_64-m32 and native i386 (but not for x86_64 native 64bit): > -PASS: gdb.base/store.exp: var struct 4 u; print old u, expecting {s = \{0, 0, 0, 0}} > +FAIL: gdb.base/store.exp: var struct 4 u; print old u, expecting {s = \{0, 0, 0, 0}} > -PASS: gdb.base/store.exp: up struct 4 u; print old u, expecting {s = \{0, 0, 0, 0}} > +FAIL: gdb.base/store.exp: up struct 4 u; print old u, expecting {s = \{0, 0, 0, 0}} > > Therefore if you have x86_64 native system reproducible by: > cd gdb/testsuite; make site.exp; runtest --target_board unix/-m32 gdb.base/store.exp Was hard to find, but attached is a patch. On computed values, the pointer to the struct with the functions for calculating the actual value was returned as the data-address. At some point the value struct got lost and re-created using the value contents and (invalid) address. > > Any comments, improvements, suggestions? > > I have to admit I do not fell so comfortable with the part: > > @@ -1045,8 +1045,8 @@ get_array_bounds (struct type *type, long *low_bound, long *high_bound) > > if (TYPE_CODE (index) == TYPE_CODE_RANGE) > { > - low = TYPE_LOW_BOUND (index); > - high = TYPE_HIGH_BOUND (index); > + low = value_lower_bound (type); > + high = value_upper_bound (type); > } > > as it converts the state pre-check_typedef-ed evaluation to a dynamic one. Hard to get around that. Because all array-elements use the same type-struct. But they can have different sizes. > Going to try some alternative adjustment of this part. Another approach could be to do a full check_typedef before the code-block above. But then the OBJECT_ADDRESS (as used by check_typedef to evaluate all dynamic properties) has to be set to the right (=value_data_address) value. Iirc I've already tried that in an earlier patch I've send. But if you have any other suggestions or ideas that's also welcome. I do not care if the problem is solved as I would do it, as long as we can find an acceptable solution. Joost. --=-G6mH4+CwqsbmG4m1uP7f Content-Disposition: attachment; filename="computed_values.diff" Content-Type: text/x-patch; name="computed_values.diff"; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 739 diff --git a/gdb/value.c b/gdb/value.c index cedfc45..bc309d7 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -546,7 +546,8 @@ CORE_ADDR value_address (struct value *value) { if (value->lval == lval_internalvar - || value->lval == lval_internalvar_component) + || value->lval == lval_internalvar_component + || value->lval == lval_computed) return 0; return value->location.address + value->offset; } @@ -555,7 +556,8 @@ CORE_ADDR value_raw_address (struct value *value) { if (value->lval == lval_internalvar - || value->lval == lval_internalvar_component) + || value->lval == lval_internalvar_component + || value->lval == lval_computed) return 0; return value->location.address; } --=-G6mH4+CwqsbmG4m1uP7f--