public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Fix max-depth test case for AIX.
@ 2024-04-03  9:00 Aditya Kamath1
  2024-04-03 14:13 ` Andrew Burgess
  0 siblings, 1 reply; 7+ messages in thread
From: Aditya Kamath1 @ 2024-04-03  9:00 UTC (permalink / raw)
  To: Ulrich Weigand, Aditya Kamath1 via Gdb-patches; +Cc: Sangamesh Mallayya


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

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.

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

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
+
   return 0;
 }
-- 
2.41.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-17 10:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-03  9:00 Fix max-depth test case for AIX Aditya Kamath1
2024-04-03 14:13 ` Andrew Burgess
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

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).