diff --git a/gdb/testsuite/gdb.threads/thread_info_shared.c b/gdb/testsuite/gdb.threads/thread_info_shared.c
new file mode 100644
index 00000000000..a78f2ffb4e6
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/thread_info_shared.c
@@ -0,0 +1,82 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2015-2023 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <assert.h>
+
+pthread_barrier_t barrier;
+
+#define NUM_THREADS 1 
+
+void
+Do_nothing ()
+{
+  /* Does nothing.  */
+}
+
+void *
+thread_function (void *arg)
+{
+  /* This ensures that the breakpoint is only hit after both threads
+     are born.  */ 
+  pthread_barrier_wait (&barrier);
+
+  pid_t p;
+  p = fork();
+  if (p < 0)
+    {
+      perror("fork fail");
+      exit(1);
+    }
+  // child process because return value zero
+  else if ( p == 0)
+    printf("Hello from Child!\n");
+ 
+  // parent process because return value non-zero.
+  else
+    printf("Hello from Parent!\n");
+
+  Do_nothing (); /* break here.  */
+}
+
+int
+main (void)
+{
+  int i;
+
+  alarm (300);
+
+  pthread_barrier_init (&barrier, NULL, NUM_THREADS);
+
+  for (i = 0; i < NUM_THREADS; i++)
+    {
+      pthread_t thread;
+      int res;
+
+      res = pthread_create (&thread, NULL,
+			    thread_function, NULL);
+      assert (res == 0);
+    }
+
+  while (1)
+    sleep (1);
+
+  return 0;
+}
diff --git a/gdb/testsuite/gdb.threads/thread_info_shared.exp b/gdb/testsuite/gdb.threads/thread_info_shared.exp
new file mode 100644
index 00000000000..94de4b1aca8
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/thread_info_shared.exp
@@ -0,0 +1,84 @@
+# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# This file tests if thread fork event happens correctly when we follow 
+# and child's shared library is loaded correctly. 
+
+# This test has been verified with AIX target, and would need
+# to be generalized to support other targets
+
+require {is_any_target "*-*-aix*"}
+
+# When using the RSP, we don't get notifications about new threads.
+# This is expected, so don't test for that.
+if {[target_info gdb_protocol] == "remote"
+    || [target_info gdb_protocol] == "extended-remote"} {
+    return
+}
+
+standard_testfile
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
+    return -1
+}
+
+global srcdir subdir binfile srcfile
+
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_test "set print thread-events on"
+
+gdb_test "set detach-on-fork off"
+gdb_test "set follow-fork-mode child"
+
+if {![runto_main]} {
+   return 1
+}
+
+gdb_test "break Do_nothing" \
+    "Breakpoint.*at.* file .*$srcfile, line.*" \
+    "breakpoint at Do_nothing"
+
+set any "\[^\r\n\]*"
+
+# If the thread code is handled well we should not see any core dumps
+# Or any different patterns here.
+
+gdb_test "c" \
+      [multi_line \
+       "\\\[New Thread $any\\\]" \
+       "\\\[Attaching after Thread $any fork to child process $any\\\]" \
+       "\\\[New inferior 2 $any\\\]" \
+       "Hello from Child!" \
+       "\\\[Switching to $any\\\]" \
+       "$any" \
+       "$any" \
+       "$any" \
+       ] \
+       "Test for no seg fault after child is born."
+
+#Check if the shared library is loaded for child process.
+# If shared library is not loaded correctly, this test will fail.
+gdb_test "info sharedlibrary /usr/lib/libcrypt.a" \
+     [multi_line \
+     "From                To                  Syms Read   Shared Object Library" \
+     "0x0900000000695420  0x0900000000695c9e  Yes $any" \
+     "\\\(\\\*\\\): Shared library is missing debugging information." \
+     ] \
+     "Test if child shared library is loaded"
+
+delete_breakpoints
