Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Mark Kettenis" <mark.kettenis@xs4all.nl>
To: "Joel Brobecker" <brobecker@adacore.com>
Cc: "Mark Kettenis" <mark.kettenis@xs4all.nl>, gdb-patches@sourceware.org
Subject: Re: [RFA/sparc64] internal-error printing return value (Ada array)
Date: Sun, 12 Nov 2006 20:49:00 -0000	[thread overview]
Message-ID: <6654.82.92.89.47.1163364566.squirrel@webmail.xs4all.nl> (raw)
In-Reply-To: <20061112002226.GA22995@adacore.com>

> > To decide what is the right fix, we need to investigate this a bit
> > further.
> > I suspect that Ada arrays arereally treated as structures where all
> > members
> > have the same type.
>
>  In Ada, arrays can take many forms, and as a result, you have
>  3 types of arrays:
>
>    . statically known arrays (where the array bounds are known at
>      compile time), are implemented using a memory buffer. This is
>      our case here.
>
>    . Then we have fat pointers: This is a structure that contains
>      two pointers, one to a structure containing the array bounds,
>      and one pointer to the memory buffer itself. We use that for
>      arrays whose bounds are not known at compile time.
>
>    . Lastly, we have thin pointers: This is a pointer to the second
>      field of a structure that resembles the fat pointer.
>
> > So the first question I have is whether these indeed
> > have "fields".
>
>  Is this question still relevant after the description above?
>  I am not sure I understand it.

Hmm, I gueass I should have asked how a gdb `struct type' looks for
these Ada arrays?  In particular, if main_type->nfields is set and
whether main_type->fields is set to something useful.

> > You should also check how small arrays are passed as arguments to a
> > function.
>
>  This is described by the Ada Reference Manual: Arrays are always
>  passed by reference. So a function taking a parameter of our static
>  array type will have the array passed by reference.  As a result,
>  the the array parameter will be a REF to a TYPE_CODE_ARRAY.

So there is no way to pass a TYPE_CODE_ARRAY directly?

> > Here the magic length will be 16 bytes instead of 32 bytes.
>
>  I don't understand this part. Why 16 bytes instead of 32?
>  If the total size of the array is 32 bytes, shouldn't the compiler
>  return it through %o0 - %o7?

The 16-byte limit is for passing structures as an argument to a function.
I presume this is because function arguments occupy 16-byte slots in the
ABI.

Mark


  reply	other threads:[~2006-11-12 20:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-11  0:26 Joel Brobecker
2006-11-11 17:47 ` Mark Kettenis
2006-11-12  0:22   ` Joel Brobecker
2006-11-12 20:49     ` Mark Kettenis [this message]
2006-11-12 21:55       ` Joel Brobecker
2006-11-13 21:26         ` Mark Kettenis

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=6654.82.92.89.47.1163364566.squirrel@webmail.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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