This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unexpected DW_AT_type for Ada strings on s390x?


[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
>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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]