Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: partially fix empty DW_OP_piece
Date: Wed, 02 Jun 2010 18:54:00 -0000	[thread overview]
Message-ID: <20100602185354.GA11125@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <m3d3wa7lio.fsf@fleche.redhat.com>

On Tue, 01 Jun 2010 18:41:51 +0200, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> Tom> The other way is to simply remove val_print entirely and make all of
> Tom> printing work using values.  I think this is the route I would prefer.
> 
> Jan> That could hopefully solve the problem of missing type-associated object
> Jan> address for DW_OP_push_object_address for the VLA (variable length arrays)
> Jan> patch.
> 
> I am curious to know what you need here.

I do not understand the prototype:
int
val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
           CORE_ADDR address, struct ui_file *stream, int recurse,
           const struct value_print_options *options,
           const struct language_defn *language)
struct language_defn:
    int (*la_val_print) (struct type *type,
                         const gdb_byte *contents,
                         int embedded_offset, CORE_ADDR address,
                         struct ui_file *stream, int recurse,
                         const struct value_print_options *options);

There cannot be any `const gdb_byte *contents' for types with DWARF_block* as
their attribute (=TYPE_DYNAMIC from archer-jankratochvil-vla) as DWARF
expression evaluation arbitrarily accesses inferior memory during DWARF_block*
evaluation for DW_AT_upper_bound and others.  VLA patchset also deals with two
ADDRESSes - object address (needed for DWARF_block*'s
DW_OP_push_object_address evaluation) and data address (DW_AT_data_location,
neede for the content printing - but data address can be derived from the
object address; apparently data address cannot be converted to object
address).

OTOH there cannot be any `CORE_ADDR address' where the content could be read
from - for example for internal variables.

Therefore we need to use both accesses depending on the object class.
I believe `struct value' stricly being LAZY can be used for inferior objects
(and non-LAZY `struct value' for internal variables).  Only in some final
moment (of arrays dereferencing etc.) the inferior LAZY vary can be fetched.


> I started by looking briefly at replacing val_print.

Here you probably mean la_val_print->la_value_print unification:
struct language_defn:
    int (*la_val_print) (struct type *type,
                         const gdb_byte *contents,
                         int embedded_offset, CORE_ADDR address,
                         struct ui_file *stream, int recurse,
                         const struct value_print_options *options);

by keeping only existing:
struct language_defn:
    int (*la_value_print) (struct value *, struct ui_file *,
                           const struct value_print_options *);


> This looks pretty big, though.  So I looked into other solutions.

I believe it will need to be done anyway for the sane integration of the VLA
patchset.


> So, currently I am thinking I will go through my existing patch and have
> it pass a value instead of lval_funcs.  Of course this means a lot of
> redundant info, which is ugly.

Do you mean the unification proposed above or some other extension?


> There are barriers to removing val_print.  I think the biggest one,
> conceptually, is that recursion in val_print means making new values,

Yes, I think it is required for the case of Pascal arrays of strings - each
element of Pascal array is a VLA array (=string); gdb.pascal/arrays.exp by
Joost van der Sluis in archer-jankratochvil-vla.  Each element is a full-blown
dynamic objects without much possibilities of a simplication.


> which means copying the value contents.  This can be expensive.  (Of
> course there are solutions to that, reference counting the value
> contents comes to mind.)

Couldn't be just the `struct value' kept LAZY and creating struct values for
the dereferenced elements only with properly adjusted object address?


Thanks,
Jan


  reply	other threads:[~2010-06-02 18:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-14  6:39 Tom Tromey
2010-05-14 22:51 ` Jan Kratochvil
2010-05-21 19:48   ` Tom Tromey
2010-06-01 17:34   ` Tom Tromey
2010-06-02 18:54     ` Jan Kratochvil [this message]
2010-06-02 20:07       ` Tom Tromey
2010-06-03 17:46         ` Jan Kratochvil
2010-06-04 19:05           ` Tom Tromey
2010-06-04 19:10             ` Jan Kratochvil
2010-06-04 21:39               ` Tom Tromey
2010-06-04 21:47                 ` Jan Kratochvil
2010-05-20 23:04 ` Joel Brobecker

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=20100602185354.GA11125@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@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