From 16ca38abaa67b0c02f7f6f504cfeb55f75ec1344 Mon Sep 17 00:00:00 2001 From: Aditya Vidyadhar Kamath Date: Fri, 10 Oct 2025 06:31:06 -0500 Subject: [PATCH] Fix AIX CI build break. Recently AIX internal CI is broken. The error is as follows: -------------------------------- aix-thread.c: In function 'void sync_threadlists(pid_t)': aix-thread.c:857:53: error: cannot convert 'thread_info' to 'thread_info*' in initialization 857 | for (struct thread_info *it : all_threads_safe ()) | ^ aix-thread.c: In lambda function: aix-thread.c:899:61: warning: declaration of 'thread' shadows a previous local [-Wshadow=compatible-local] 899 | thread = iterate_over_threads ([&] (struct thread_info *thread) ---------------------------------- This patch is similar to the commit https://urldefense.proofpoint.com/v2/url?u=https-3A__sourceware.org_git_-3Fp-3Dbinutils-2Dgdb.git-3Ba-3Dcommitdiff-3Bh-3D675a17a8a5cde1d8be86536df2ae6366ef0ec759&d=DwIDAg&c=BSDicqBQBDjDI9RkVyTcHQ&r=f-oUQ8ByG1nZ71OI9p76qywCPh7mxzU69hBYnkP9Nis&m=qpgW6gyN_lC_b0fBRhcWkqlvNDmUtHBTvyqGcCZxnuN6vnvJaehZ2WVuFVicJ9oD&s=UtdzAKmXnBH1ZTFOUTmFC9vTwxxralJIDjbYWsCsLYA&e= all_threads_safe() returns an all_threads_safe_range which is like an iterator to iterate for loops. AIX is adjusting its code in aix-thread.c for the same. After applying this patch, Sample test case output: ------------ gmake check RUNTESTFLAGS='gdb.threads/thread_events.exp CC_FOR_TARGET="/opt/freeware/bin/gcc" CXX_FOR_TARGET="/opt/freeware/bin/g++" CXXFLAGS_FOR_TARGET="-O0 -w -g -gdwarf -maix64" CFLAGS_FOR_TARGET="-O0 -w -g -gdwarf -maix64"' gmake check-single gmake[1]: Entering directory '/upstream_gdb/binutils-gdb/gdb/testsuite' rm -f *core* gdb.sum gdb.log === gdb tests === Schedule of variations: unix Running target unix Using /opt/freeware/share/dejagnu/baseboards/unix.exp as board description file for target. Using /opt/freeware/share/dejagnu/config/unix.exp as generic interface file for target. Using /upstream_gdb/binutils-gdb/gdb/testsuite/config/unix.exp as tool-and-target-specific interface file. Running /upstream_gdb/binutils-gdb/gdb/testsuite/gdb.threads/thread_events.exp ... === gdb Summary === /upstream_gdb/binutils-gdb/gdb/gdb version 18.0.50.20251010-git -nw -nx -q -iex "set height 0" -iex "set width 0" -data-directory /upstream_gdb/binutils-gdb/gdb/data-directory -iex "set interactive-mode on" === gdb Summary === /upstream_gdb/binutils-gdb/gdb/gdb version 18.0.50.20251010-git -nw -nx -q -iex "set height 0" -iex "set width 0" -data-directory /upstream_gdb/binutils-gdb/gdb/data-directory -iex "set interactive-mode on" gmake[1]: Leaving directory '/upstream_gdb/binutils-gdb/gdb/testsuite' Approved By: Ulrich Weigand --- gdb/aix-thread.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 1e3015d77b0..7007f76b85a 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -854,14 +854,14 @@ sync_threadlists (pid_t pid) thread exits and gets into a PST_UNKNOWN state. So this thread will not run in the above for loop. Therefore the below for loop is to manually delete such threads. */ - for (struct thread_info *it : all_threads_safe ()) + for (thread_info &it : all_threads_safe ()) { - aix_thread_info *priv = get_aix_thread_info (it); + aix_thread_info *priv = get_aix_thread_info (&it); if (in_queue_threads.count (priv->pdtid) == 0 - && in_thread_list (proc_target, it->ptid) - && pid == it->ptid.pid ()) + && in_thread_list (proc_target, it.ptid) + && pid == it.ptid.pid ()) { - delete_thread (it); + delete_thread (&it); data->exited_threads.insert (priv->pdtid); } } -- 2.47.3