public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Joost van der Sluis <joost@cnoc.nl>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Project Archer <archer@sourceware.org>
Subject: Re: Patch for pascal-dynamic arrays
Date: Wed, 14 Apr 2010 10:35:00 -0000	[thread overview]
Message-ID: <1271241292.21465.18.camel@wsjoost.cnoc.lan> (raw)
In-Reply-To: <20100412195106.GA32767@host0.dyn.jankratochvil.net>

[-- Attachment #1: Type: text/plain, Size: 2231 bytes --]

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.



[-- Attachment #2: computed_values.diff --]
[-- Type: text/x-patch, Size: 739 bytes --]

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;
 }

  reply	other threads:[~2010-04-14 10:35 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-14 14:45 Joost van der Sluis
2009-09-16 15:45 ` Jan Kratochvil
2009-09-16 18:18   ` Joost van der Sluis
2009-09-16 18:41     ` Jan Kratochvil
2009-09-16 19:09       ` Joost van der Sluis
2009-09-30 16:00   ` Joost van der Sluis
2009-10-04 14:17     ` Jan Kratochvil
2009-10-05 10:08       ` Joost van der Sluis
     [not found]       ` <1254737231.3257.20.camel@wsjoost.cnoc.lan>
2009-10-05 14:43         ` Jan Kratochvil
2009-10-28 17:35       ` Joost van der Sluis
2009-10-30  9:47         ` Jan Kratochvil
2009-11-07 21:49           ` Joost van der Sluis
2010-04-12 11:25             ` Joost van der Sluis
2010-04-12 19:51               ` Jan Kratochvil
2010-04-14 10:35                 ` Joost van der Sluis [this message]
2010-05-06 23:05                   ` Jan Kratochvil
2010-05-14 21:58                     ` Joost van der Sluis
2010-05-14 22:46                       ` Jan Kratochvil
2010-05-15 20:24                         ` Joost van der Sluis
2010-05-15 21:44                           ` Jan Kratochvil
2010-05-16 12:04                             ` Jonas Maebe
2010-05-16 17:06                               ` Joost van der Sluis
2010-05-16 17:31                                 ` Jan Kratochvil
2010-05-16 21:49                                   ` Jonas Maebe
2010-05-16 21:55                                     ` Jonas Maebe
2010-05-16 18:31                               ` Jan Kratochvil

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=1271241292.21465.18.camel@wsjoost.cnoc.lan \
    --to=joost@cnoc.nl \
    --cc=archer@sourceware.org \
    --cc=jan.kratochvil@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).