Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Andreas Arnez <arnez@linux.vnet.ibm.com>
Cc: gdb@sourceware.org, Eric Botcazou <botcazou@adacore.com>
Subject: Re: Unexpected DW_AT_type for Ada strings on s390x?
Date: Tue, 04 Dec 2012 12:11:00 -0000	[thread overview]
Message-ID: <20121204121036.GK18566@adacore.com> (raw)
In-Reply-To: <87fw3mhxbb.fsf@linux.vnet.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1474 bytes --]

[Cc'ing Eric, as he is the compiler expert - GDB just represents what
the compiler tells us]

> Upstream gnat seems to create different debug data for string parameters
> on s390x than on x86, x86_64 or s390.  On s390x the DW_AT_type of a
> string parameter is a constant /reference/ to the two-element structure
> "string___XUP".  On the other platforms it is the constant structure,
> not a reference.

My first guess is that the variantion in type definition is caused
by differences in ABI. I don't know s390 platforms, so I can't
confirm offhand. But it seems like a plausible way to pass the
argument.

If Eric confirms my guess, the attached patch should fix the problem.

[the rest of your email is kept below - as a reference for Eric, in case
he needs it]

> Is the DW_AT_type output intentional?  Why does it depend on the
> architecture?  Note that for C or C++, gcc correctly declares structure
> parameters as /structures/ (not references) in their DW_AT_type.

> 
> If the output is intentional, I suggest to relax the pattern in the test
> case accordingly.  In any case it would be nice to differentiate the two
> "backtrace" test points, e.g. like this:
> 
> 
> --- a/gdb/testsuite/gdb.ada/lang_switch.exp
> +++ b/gdb/testsuite/gdb.ada/lang_switch.exp
> @@ -43,5 +43,5 @@ gdb_test "bt" \
>  gdb_test "set lang c"
>  gdb_test "bt" \
>           ".*#1.*lang_switch\\.ada_procedure\\s*\\(msg={.*\\).*" \
> -         "backtrace"
> +	 "backtrace (C)"

-- 
Joel

[-- Attachment #2: 0001-gdb.ada-lang_switch-Allow-msg-parameter-to-be-a-refe.patch --]
[-- Type: text/x-diff, Size: 987 bytes --]

From cdb4ea7d663ca7eab453f31a45f6fae068753803 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Tue, 4 Dec 2012 16:04:26 +0400
Subject: [PATCH] gdb.ada/lang_switch: Allow msg parameter to be a reference.

gdb/testsuite/ChangeLog:

        * gdb.ada/lang_switch.exp: The "msg" parameter may be a reference.
---
 gdb/testsuite/gdb.ada/lang_switch.exp |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/lang_switch.exp b/gdb/testsuite/gdb.ada/lang_switch.exp
index 6ee4c23..a217d2e 100644
--- a/gdb/testsuite/gdb.ada/lang_switch.exp
+++ b/gdb/testsuite/gdb.ada/lang_switch.exp
@@ -42,6 +42,5 @@ gdb_test "bt" \
 # if the current language is not "auto".
 gdb_test "set lang c"
 gdb_test "bt" \
-         ".*#1.*lang_switch\\.ada_procedure\\s*\\(msg={.*\\).*" \
-         "backtrace"
-
+         ".*#1.*lang_switch\\.ada_procedure\\s*\\(msg=(@$hex: +)?{.*\\).*" \
+         "backtrace with lang set to C"
-- 
1.7.10.4


  reply	other threads:[~2012-12-04 12:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-04 11:27 Andreas Arnez
2012-12-04 12:11 ` Joel Brobecker [this message]
2012-12-05  9:22   ` Andreas Arnez
2012-12-05  9:33     ` Eric Botcazou
2012-12-06  4:52     ` Joel Brobecker
2012-12-06 13:40       ` Andreas Arnez
2012-12-07  3:03         ` Joel Brobecker

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=20121204121036.GK18566@adacore.com \
    --to=brobecker@adacore.com \
    --cc=arnez@linux.vnet.ibm.com \
    --cc=botcazou@adacore.com \
    --cc=gdb@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