From: Andrew Burgess <aburgess@redhat.com>
To: Aditya Kamath1 <Aditya.Kamath1@ibm.com>,
Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
Aditya Kamath1 via Gdb-patches <gdb-patches@sourceware.org>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: Fix max-depth test case for AIX.
Date: Wed, 03 Apr 2024 15:13:56 +0100 [thread overview]
Message-ID: <87wmpe355n.fsf@redhat.com> (raw)
In-Reply-To: <CH2PR15MB3544170C89923A2904619784D63F2@CH2PR15MB3544.namprd15.prod.outlook.com>
Aditya Kamath1 <Aditya.Kamath1@ibm.com> writes:
> Respected community members,
>
> Please find attached a patch. (See: 0001-Fix-max-depth-test-case-for-AIX.patch)
>
> This patch is a small fix to ensure max-depth test case is passing all test cases in AIX.
>
> In AIX, if in the main program the variables are unused then the linker optimises
> these variables and the dwarf will not have proper address to the same. Hence, we cannot access these
> variables.
>
> Breakpoint 1, main () at /current_gdb/binutils-gdb/gdb/testsuite/gdb.base/max-depth.c:231
> 231 return 0;
> (gdb) set print max-depth 0
> (gdb) p s1
> Cannot access memory at address 0xefffffff
> (gdb) FAIL: gdb.base/max-depth-c.exp: exp='s1': depth=0: p s1
> set print max-depth 1
> (gdb) p s1
> Cannot access memory at address 0xefffffff
> (gdb) FAIL: gdb.base/max-depth-c.exp: exp='s1': depth=1: p s1
> set print max-depth 2
> (gdb) p s1
> Cannot access memory at address 0xefffffff
>
> In the log above we can see the address getting assigned is incorrect.
>
> So, can we use this fix? The idea is just to stop the linker from optimizing unused varaibles out in AIX. Let me know what you think.
>
> Have a nice day ahead.
>
> Thanks and regards,
> Aditya.
> From da0e236d30473eea91766e124d49a2256b7cf398 Mon Sep 17 00:00:00 2001
> From: Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>
> Date: Mon, 1 Apr 2024 03:12:29 -0500
> Subject: [PATCH] Fix max-depth test case for AIX.
>
> In AIX, if in the main program the variables are unused then the linker optimises
> these variables and the dwarf will not have proper address to the same. Hence we cannot access these
> variables.
>
> This patch is a fix to the same so that all the test case of max-depth can passs in AIX as well.
> ---
> gdb/testsuite/gdb.base/max-depth.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/gdb/testsuite/gdb.base/max-depth.c b/gdb/testsuite/gdb.base/max-depth.c
> index fee5de5af34..e4b4459eed5 100644
> --- a/gdb/testsuite/gdb.base/max-depth.c
> +++ b/gdb/testsuite/gdb.base/max-depth.c
> @@ -228,5 +228,9 @@ struct V7 : virtual V4, virtual V5, virtual V6 { int v7 = 1; } v7;
> int
> main ()
> {
> + #ifdef _AIX
> + s1.x = 0;
> + #endif
Is it only `s1` that's a problem? None of the other variables are used
either, and the they are all checked by the test.
Given what the test is doing I don't think there's any need for the
#ifdef, I'd suggest just adding a comment explaining why we need to
ensure the variables are referenced, and reference them.
Thanks,
Andrew
> +
> return 0;
> }
> --
> 2.41.0
next prev parent reply other threads:[~2024-04-03 14:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 9:00 Aditya Kamath1
2024-04-03 14:13 ` Andrew Burgess [this message]
2024-04-03 14:58 ` Tom Tromey
2024-04-10 6:01 ` Aditya Kamath1
2024-04-16 17:24 ` Tom Tromey
2024-04-17 10:40 ` Aditya Kamath1
2024-04-17 10:44 ` Ulrich Weigand
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=87wmpe355n.fsf@redhat.com \
--to=aburgess@redhat.com \
--cc=Aditya.Kamath1@ibm.com \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=sangamesh.swamy@in.ibm.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).