From: Nick Roberts <nickrob@snap.net.nz>
To: Daniel Jacobowitz <drow@false.org>
Cc: Wu Zhou <woodzltc@cn.ibm.com>, gdb-patches@sources.redhat.com
Subject: Re: PATCH: Start Fortran support for variable objects.
Date: Mon, 13 Mar 2006 14:08:00 -0000 [thread overview]
Message-ID: <17428.64494.595245.325277@kahikatea.snap.net.nz> (raw)
In-Reply-To: <20050704034904.GA5802@nevyn.them.org>
> Also, I'm beginning to wonder if you're doing this in the right place.
> Not that it matters a whole lot, but index is 0-based in every other
> case, including for structs. Maybe the children of arr(4) should be
> arr.0 == arr(1), arr.1 == arr(2), arr.2 == arr(3), arr.3 == arr(4).
> Then you'd add the lower bound in c_value_of_child. Does that work?
> Do you have an opinion on which is "more right"?
Here's a new patch which does the same as my last one. So the children map as
before i.e arr.1 == arr(1) because the index for expression "exp" is used to
compute the "name". However this time I've made changes to c_name_of_child
and c_value_of_child instead of varobj_list_children, so hopefully you'll find
it more agreeable.
If I don't change c_name_of_child, I get variable object names like arr.0 as
you suggest. However, then I also get exp="0" which I use for the index of the
watch expression. I think this is confusing.
--
Nick http://www.inet.net.nz/~nickrob
2006-03-13 Nick Roberts <nickrob@snap.net.nz>
* varobj.c (c_name_of_child, c_value_of_child): Allow non-zero
offsets for languages like Fortran.
*** varobj.c 13 Mar 2006 17:21:09 +1300 1.58
--- varobj.c 13 Mar 2006 16:31:26 +1300
*************** c_name_of_child (struct varobj *parent,
*** 1833,1839 ****
switch (TYPE_CODE (type))
{
case TYPE_CODE_ARRAY:
! name = xstrprintf ("%d", index);
break;
case TYPE_CODE_STRUCT:
--- 1833,1839 ----
switch (TYPE_CODE (type))
{
case TYPE_CODE_ARRAY:
! name = xstrprintf ("%d", index + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type)));
break;
case TYPE_CODE_STRUCT:
*************** c_value_of_child (struct varobj *parent,
*** 1931,1936 ****
--- 1931,1937 ----
struct value *indval;
struct type *type, *target;
char *name;
+ int real_index;
type = get_type (parent);
target = get_target_type (type);
*************** c_value_of_child (struct varobj *parent,
*** 1943,1955 ****
switch (TYPE_CODE (type))
{
case TYPE_CODE_ARRAY:
#if 0
/* This breaks if the array lives in a (vector) register. */
! value = value_slice (temp, index, 1);
temp = value_coerce_array (value);
gdb_value_ind (temp, &value);
#else
! indval = value_from_longest (builtin_type_int, (LONGEST) index);
gdb_value_subscript (temp, indval, &value);
#endif
break;
--- 1944,1957 ----
switch (TYPE_CODE (type))
{
case TYPE_CODE_ARRAY:
+ real_index = index + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type));
#if 0
/* This breaks if the array lives in a (vector) register. */
! value = value_slice (temp, real_index, 1);
temp = value_coerce_array (value);
gdb_value_ind (temp, &value);
#else
! indval = value_from_longest (builtin_type_int, (LONGEST) real_index);
gdb_value_subscript (temp, indval, &value);
#endif
break;
next prev parent reply other threads:[~2006-03-13 4:59 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-29 21:28 Nick Roberts
2005-06-30 2:53 ` Daniel Jacobowitz
2005-06-30 9:28 ` Nick Roberts
2005-06-30 13:15 ` Daniel Jacobowitz
2005-06-30 22:21 ` Nick Roberts
2005-06-30 22:23 ` Daniel Jacobowitz
2005-06-30 13:18 ` Daniel Jacobowitz
2005-06-30 22:21 ` Nick Roberts
2005-07-01 3:35 ` Wu Zhou
2005-07-01 5:04 ` Nick Roberts
2005-07-01 12:00 ` Wu Zhou
2005-07-03 16:17 ` Daniel Jacobowitz
2005-07-03 23:40 ` Nick Roberts
2005-07-03 23:47 ` Daniel Jacobowitz
2005-07-04 1:42 ` Nick Roberts
2005-07-04 3:49 ` Daniel Jacobowitz
2005-07-04 7:35 ` Nick Roberts
2005-07-05 3:43 ` Nick Roberts
2006-03-13 14:08 ` Nick Roberts [this message]
2006-03-24 22:58 ` Daniel Jacobowitz
2006-03-27 1:25 ` Nick Roberts
2006-03-27 4:04 ` Daniel Jacobowitz
2006-03-27 4:24 ` Nick Roberts
2006-03-27 11:32 ` Daniel Jacobowitz
2005-07-06 8:31 ` Wu Zhou
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=17428.64494.595245.325277@kahikatea.snap.net.nz \
--to=nickrob@snap.net.nz \
--cc=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
--cc=woodzltc@cn.ibm.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