From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: "Agovic, Sanimir" <sanimir.agovic@intel.com>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>,
"Boell, Keven" <keven.boell@intel.com>
Subject: Re: Variable Length Arrays (VLA) proposal
Date: Tue, 02 Jul 2013 19:21:00 -0000 [thread overview]
Message-ID: <20130702192037.GA21818@host2.jankratochvil.net> (raw)
In-Reply-To: <20130702133712.GA17311@host2.jankratochvil.net>
On Tue, 02 Jul 2013 15:37:12 +0200, Jan Kratochvil wrote:
> > (2)
> > Type normalization:
> >
> > This proposal is similar to Jan's approach [1] in transforming dynamic values
> > of attributes into static ones:
> >
> > 1) resolve all dynamic attributes
> > 2) create a copy of the type and assign the resolved attributes from step 1)
> >
> > This proposal doesn't require to change check_typdef completely nor changing,
> > the TYPE_* macros, which makes this solution very isolated and lean.
> > Instead of hijacking check_typedef we hook into value_type() to normalize the
> > type. Since inferior types depend on a context - namely an address - to be
> > resolvable this seems a good place to hook into. In addition all expression
> > evaluations are routed via parse_and_eval() which returns a value, which may be
> > associated with an address. Also the TYPE_* macros in gdbtypes.h could be left
> > as-is. As a side effect gdb is now constantly creating types during the
> > normalization process and will increase the memory consumption constantly as
> > well. To avoid this behavior a garbage collector would be needed, which frees
> > the memory again when required. This could be done for example when GDB returns
> > to its main loop. Nevertheless, such a garbage collector can result in a
> > performance overhead, which is expected to be very small.
>
> I find this proposal interesting as hooking into value_type may be the right
> spot where one still has the address for DW_OP_push_object_address and where
> one can create appropriate static type. Current archer-jankratochvil-vla
> really usually calls object_address_set() close to value_type() anyway.
> This way one can avoid the difficulty of one global object address variable in
> archer-jankratochvil-vla when dealing with multiple variables at once.
>
> Implementation may not be so simple as for example
> dwarf2_evaluate_loc_desc_full case DWARF_VALUE_MEMORY sets value address
> added with its element offset which is wrong when one deals with
> DW_AT_push_object_address. In general in GDB there is value_address,
> value_raw_address, value_embedded_offset and value_pointed_to_offset which may
> the value address more difficult to get and set.
[...]
> One needs to be careful about item (1) of my "plan": val_print / c_val_print
> / LA_VAL_PRINT passing address and type passed separately. But it may work.
> Current archer-jankratochvil-vla has some hack for it in pascal_val_print;
> FYI pascal (fpc) needs similar dynamic types for its strings.
One issue is that value_type() returns even typedefs. But the dynamic types
needing to be converted to static form may be hidden after the typedefs.
That should be still easy.
If you have TYPE_CODE_ARRAY -> TYPE_CODE_STRUCT ->
-> one of the fields dynamic TYPE_CODE_ARRAY then you cannot make the inner
TYPE_CODE_ARRAY static but LA_VAL_PRINT will access it without new
value_type() as LA_VAL_PRINT already passes around separate type and separate
address. You cannot make the inner TYPE_CODE_ARRAY static apparently because
the type differs according to which outer TYPE_CODE_ARRAY element you access.
This is why I was thinking getting rid of things like LA_VAL_PRINT (converting
them to some form of LA_VALUE_PRINT, my item (5)) first may make the VLA task
easier.
Regards,
Jan
next prev parent reply other threads:[~2013-07-02 19:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-28 13:03 Agovic, Sanimir
2013-06-28 15:40 ` Chris January
2013-07-01 1:55 ` Joel Brobecker
2013-07-01 8:01 ` Chris January
2013-07-01 15:32 ` Agovic, Sanimir
2013-07-04 8:18 ` Agovic, Sanimir
2013-07-04 9:13 ` Chris January
2013-07-04 11:49 ` Agovic, Sanimir
2013-07-04 16:55 ` Chris January
2013-07-26 11:44 ` Agovic, Sanimir
[not found] ` <1372928011.2796.13.camel@gumtree>
2013-07-04 10:00 ` Chris January
2013-07-02 13:37 ` Jan Kratochvil
2013-07-02 19:21 ` Jan Kratochvil [this message]
2013-07-02 22:22 ` Joel Brobecker
2013-07-04 12:32 ` Keven Boell
2013-08-04 19:33 ` Jan Kratochvil
2013-08-07 5:25 ` Keven Boell
2013-08-04 19:02 ` 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=20130702192037.GA21818@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb@sourceware.org \
--cc=keven.boell@intel.com \
--cc=sanimir.agovic@intel.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