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: gdb-patches@sourceware.org
Subject: Re: [RFA/sparc64] internal-error printing return value (Ada array)
Date: Mon, 13 Nov 2006 21:26:00 -0000	[thread overview]
Message-ID: <14515.82.92.89.47.1163453179.squirrel@webmail.xs4all.nl> (raw)
In-Reply-To: <20061112215542.GB22995@adacore.com>

> > 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.
>
>  Ah, I understand now (sorry). Yes, main_type->nfields is 1, and
>  main_type->fields contains the bounds.

Ok, that's quite different from what we have for TYPE_CODE_STRUCT and
TYPE_CODE_UNION.  This means that adding TYPE_CODE_ARRAY to
sparc64_structure_or_union is the wrong fix.

>  In terms of the argument passing, we don't need to worry in our case,
>  because arrays are passed by reference. In terms of a return value,
>  the ABI says that structs of up to 32 bytes can be returned.
>
>          3.2.3.3. Structure or Union return values
>
>          Structure and union return types up to thirty-two bytes in size
>          are returned in registers. The registers are assigned as if the
>          value was being passed as the first argument to a function with
>          a known prototype.
>
>  This is why I used the magic number of 32 in this case. I still think
>  it is correct, although more comments are certainly required to explain
>  the above.
>
>  What do you think?

Well, we need to worry about argument passing too; Ada might not pass
arrays directly, but other languages might do that.  So I think you should
just add a check for TYPE_CODE_ARRAY to sparc64_extract_return_value() and
sparc64_store_return_value().  You could add it to the same if-block as
the sparc64_structure_of_union() but then you'll need to change the

   if (TYPE_CODE (type) != TYPE_CODE_UNION)

check into

   if (TYPE_CODE (type) == TYPE_CODE_STRUCT)

Mark







      reply	other threads:[~2006-11-13 21:26 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
2006-11-12 21:55       ` Joel Brobecker
2006-11-13 21:26         ` Mark Kettenis [this message]

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=14515.82.92.89.47.1163453179.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