From: Aditya Vidyadhar Kamath Date: Wed, 10 Apr 2024 05:52:05 +0000 (-0500) Subject: Fix max-depth test case for AIX. X-Git-Tag: gdb-15-branchpoint~373 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4d76c39f751dda04a386ca8ce5203e34bd0341fe;p=thirdparty%2Fbinutils-gdb.git 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. --- 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; }