public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Aditya Kamath1 <Aditya.Kamath1@ibm.com>
To: Tom Tromey <tom@tromey.com>, Andrew Burgess <aburgess@redhat.com>
Cc: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
	Aditya Kamath1 via Gdb-patches <gdb-patches@sourceware.org>,
	Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: RE: Fix max-depth test case for AIX.
Date: Wed, 10 Apr 2024 06:01:19 +0000	[thread overview]
Message-ID: <CH2PR15MB3544F0D92DD53DFF687AB9D4D6062@CH2PR15MB3544.namprd15.prod.outlook.com> (raw)
In-Reply-To: <87edbm8pdh.fsf@tromey.com>


[-- Attachment #1.1: Type: text/plain, Size: 2283 bytes --]

Respected Tom, Andrew and community members,

Hi,

Thank you for your feedback.

Please find attached a patch. (See: 0001-Fix-max-depth-test-case-for-AIX.patch)

Andrew> Given what the test is doing I don't think there's any need for the
Andrew> #ifdef, I'd suggest just adding a comment explaining why we need to
Andrew> ensure the variables are referenced, and reference them.

>Agreed.  Look for 'Do_Nothing' in the Ada tests to see how this is
>handled for Ada programs.  I feel like we've done something similar in
>some cases for C as well.

Thank you Tom. I referred the gdb.ada/varsize_limit/pck.adb file for the Do_nothing function.

package body Pck is
   procedure Do_Nothing (A : System.Address) is
   begin
      null;
   end Do_Nothing;
   function Ident (S : String) return String is
   begin
      return S;
   end Ident;
end Pck;

Here Do_nothing is doing nothing. Did something similar. Let me know if any changes needed.

Output in AIX after this patch is applied.

/current_gdb/binutils-gdb/gdb/gdb version  15.0.50.20240325-git -nw -nx -q -iex "set height 0" -iex "set width 0" -data-directory /current_gdb/binutils-gdb/gdb/data-directory

                === gdb Summary ===

# of expected passes            92
/current_gdb/binutils-gdb/gdb/gdb version  15.0.50.20240325-git -nw -nx -q -iex "set height 0" -iex "set width 0" -data-directory /current_gdb/binutils-gdb/gdb/data-directory

Have a nice day ahead.

Thanks and regards,
Aditya.


From: Tom Tromey <tom@tromey.com>
Date: Wednesday, 3 April 2024 at 8:28 PM
To: Andrew Burgess <aburgess@redhat.com>
Cc: Aditya Kamath1 <Aditya.Kamath1@ibm.com>, Ulrich Weigand <Ulrich.Weigand@de.ibm.com>, Aditya Kamath1 via Gdb-patches <gdb-patches@sourceware.org>, Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: [EXTERNAL] Re: Fix max-depth test case for AIX.
Andrew> Given what the test is doing I don't think there's any need for the
Andrew> #ifdef, I'd suggest just adding a comment explaining why we need to
Andrew> ensure the variables are referenced, and reference them.

Agreed.  Look for 'Do_Nothing' in the Ada tests to see how this is
handled for Ada programs.  I feel like we've done something similar in
some cases for C as well.

Tom

[-- Attachment #2: 0001-Fix-max-depth-test-case-for-AIX.patch --]
[-- Type: application/octet-stream, Size: 1223 bytes --]

From 3117e666bad264e460596903acbcd008dc3f9287 Mon Sep 17 00:00:00 2001
From: Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>
Date: Wed, 10 Apr 2024 00:52:05 -0500
Subject: [PATCH] Fix max-depth test case for AIX.

In AIX, if in the main program the global 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 | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gdb/testsuite/gdb.base/max-depth.c b/gdb/testsuite/gdb.base/max-depth.c
index fee5de5af34..7e46b134c10 100644
--- a/gdb/testsuite/gdb.base/max-depth.c
+++ b/gdb/testsuite/gdb.base/max-depth.c
@@ -225,8 +225,17 @@ struct V7 : virtual V4, virtual V5, virtual V6 { int v7 = 1; } v7;
 
 #endif /* __cplusplus */
 
+void Do_nothing (struct s1 sone)
+{
+  /*  This Function does nothing.  */
+}
+
 int
 main ()
 {
+  /*  In targets like AIX, linker optimises out unused global
+      variables.  The do_nothing () function stops the linker
+      from doing so.  */
+  Do_nothing (s1);
   return 0;
 }
-- 
2.41.0


  reply	other threads:[~2024-04-10  6:01 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
2024-04-03 14:58   ` Tom Tromey
2024-04-10  6:01     ` Aditya Kamath1 [this message]
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=CH2PR15MB3544F0D92DD53DFF687AB9D4D6062@CH2PR15MB3544.namprd15.prod.outlook.com \
    --to=aditya.kamath1@ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sangamesh.swamy@in.ibm.com \
    --cc=tom@tromey.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).