Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: Wu Zhou <woodzltc@cn.ibm.com>
Cc: Daniel Jacobowitz <drow@false.org>, gdb-patches@sources.redhat.com
Subject: Re: PATCH: Start Fortran support for variable objects.
Date: Fri, 01 Jul 2005 05:04:00 -0000	[thread overview]
Message-ID: <17092.51062.559020.560618@farnswood.snap.net.nz> (raw)
In-Reply-To: <Pine.LNX.4.63.0506300455390.11503@wks190384wss.cn.ibm.com>

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 2300 bytes --]

 > I have two comments below, hope that they might be helpful.  Thanks.
 > 
 > On Fri, 1 Jul 2005, Nick Roberts wrote:
 > 
 > > As in the patch below?  I don't understand the extra cases it appears to
 > > cover, but it worked for the tests I tried.
 > 
 > Maybe it is also helpful to test against such arrays definition as:
 >   
 >   integer array(0:5), integer array(-1:4)
 > 
 > or even
 >   
 >   integer array(0:5,-1:4)
 >
 > (if variable object does support multi-dimension array. I don't know much 
 > about variable object, and MI as a whole.)

Ah!  I see now.  I've not used such arrays in Fortran.  Using

      INTEGER ARRAY1(0:5), ARRAY2(-1:4)
      INTEGER ARRAY3(0:2,-1:1)
      DATA ARRAY1/1,2,3,4,5,6/
      DATA ARRAY2/1,2,3,4,5,6/
      DATA ARRAY3/11,21,31,12,22,32,13,23,33/

the latest patch seems to work (see attached image below).  I am sure
that my original patch would have failed for these cases.

 > The second comment is about the following text in a former mail Nick sent: 
 > 
 > > Fortran:
 > > 
 > > (top-gdb) p TYPE_LOW_BOUND(var->type)
 > > $3 = 0
 ...
 > 
 > For Fortran array such as DIMENSION I(4), the lower bound should be 1 by
 > default.  The following session on my box shows this:
 > 
 > <top-gdb> p type->main_type->fields->type->main_type->fields[0].loc.bitpos
 > $3 = 1
 > <top-gdb> p type->main_type->fields->type->main_type->fields[1].loc.bitpos
 > $4 = 4

So I should have done:

(top-gdb) p TYPE_LOW_BOUND(var->type->main_type->fields->type)
$1 = 1
(top-gdb) p TYPE_HIGH_BOUND(var->type->main_type->fields->type)
$2 = 4

 > I guess there might be some errors in the process of creating varobj for 
 > Fortran array.  

No the information seems to be there.  So maybe:

  for (i = 0; i < var->num_children; i++)
    {
      /* Mark as the end in case we bail out */
      *((*childlist) + i) = NULL;

      j = i + TYPE_LOW_BOUND(var->type->main_type->fields->type);

      /* check if child exists, if not create */
      name = name_of_child (var, j);
      child = child_exists (var, name);
      if (child == NULL)
	child = create_child (var, j, name);

      *((*childlist) + i) = child;
    }

will work in varobj_list_children in a language independent way.

I'll wait to see what Daniel says though, before submitting another patch.

Nick



[-- Attachment #2: fortran watch window --]
[-- Type: image/png, Size: 7841 bytes --]

  reply	other threads:[~2005-07-01  5:04 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 [this message]
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
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=17092.51062.559020.560618@farnswood.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