* Unexpected DW_AT_type for Ada strings on s390x?
@ 2012-12-04 11:27 Andreas Arnez
2012-12-04 12:11 ` Joel Brobecker
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Arnez @ 2012-12-04 11:27 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb
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.
Due to this indirection the second "bt" in "lang_switch.exp" generates
unexpected output; gdb now shows the "msg" parameter with an address
like this:
msg=@0x3ffffffdc48: {...}
The test case fails on s390x because of that.
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)"
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: Unexpected DW_AT_type for Ada strings on s390x?
2012-12-04 11:27 Unexpected DW_AT_type for Ada strings on s390x? Andreas Arnez
@ 2012-12-04 12:11 ` Joel Brobecker
2012-12-05 9:22 ` Andreas Arnez
0 siblings, 1 reply; 7+ messages in thread
From: Joel Brobecker @ 2012-12-04 12:11 UTC (permalink / raw)
To: Andreas Arnez; +Cc: gdb, Eric Botcazou
[-- 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
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: Unexpected DW_AT_type for Ada strings on s390x?
2012-12-04 12:11 ` Joel Brobecker
@ 2012-12-05 9:22 ` Andreas Arnez
2012-12-05 9:33 ` Eric Botcazou
2012-12-06 4:52 ` Joel Brobecker
0 siblings, 2 replies; 7+ messages in thread
From: Andreas Arnez @ 2012-12-05 9:22 UTC (permalink / raw)
To: Eric Botcazou; +Cc: Joel Brobecker, gdb
Joel Brobecker <brobecker@adacore.com> writes:
> [Cc'ing Eric, as he is the compiler expert - GDB just represents what
> the compiler tells us]
Sure. Should we also CC the gcc mailing list?
> 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.
Right, the two-element structure is passed by reference on s390x. But
that also applies to the same structure in C/C++. Nevertheless, with C
the argument's DW_AT_type reflects the real type and gcc adjusts the
DW_AT_location instead.
> If Eric confirms my guess, the attached patch should fix the problem.
Thanks. Eric, do you confirm that it's intentional to adjust the
DW_AT_type based on ABI?
Joel, in the meantime I suggest to commit the second line of your patch.
It's independent of the outcome, and we might otherwise lose track of
it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Unexpected DW_AT_type for Ada strings on s390x?
2012-12-05 9:22 ` Andreas Arnez
@ 2012-12-05 9:33 ` Eric Botcazou
2012-12-06 4:52 ` Joel Brobecker
1 sibling, 0 replies; 7+ messages in thread
From: Eric Botcazou @ 2012-12-05 9:33 UTC (permalink / raw)
To: Andreas Arnez; +Cc: Joel Brobecker, gdb
> Right, the two-element structure is passed by reference on s390x. But
> that also applies to the same structure in C/C++. Nevertheless, with C
> the argument's DW_AT_type reflects the real type and gcc adjusts the
> DW_AT_location instead.
It's passed by invisible reference in C and explicit reference in Ada.
> Thanks. Eric, do you confirm that it's intentional to adjust the
> DW_AT_type based on ABI?
The ABIs are indeed different so the debug info will be different.
--
Eric Botcazou
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Unexpected DW_AT_type for Ada strings on s390x?
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
1 sibling, 1 reply; 7+ messages in thread
From: Joel Brobecker @ 2012-12-06 4:52 UTC (permalink / raw)
To: Andreas Arnez; +Cc: Eric Botcazou, gdb
> Joel, in the meantime I suggest to commit the second line of your patch.
> It's independent of the outcome, and we might otherwise lose track of
> it.
I'm just waiting for you to confirm that the patch fixes the FAIL,
and I will commit the whole patch. (I have been very busy these days)
--
Joel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-12-07 3:03 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-04 11:27 Unexpected DW_AT_type for Ada strings on s390x? Andreas Arnez
2012-12-04 12:11 ` Joel Brobecker
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox