[binutils-gdb] Make target shareable accross fork inferiors in AIX.

Aditya Kamath via Gdb-cvs <[email protected]> Wed, 24 Jun 2026 09:10:51 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f0769adf6fb5afeb6826982990afad8e6260b1bc

commit f0769adf6fb5afeb6826982990afad8e6260b1bc
Author: Aditya Kamath <[email protected]>
Date:   Tue Jun 16 12:59:06 2026 -0500

    Make target shareable accross fork inferiors in AIX.
    
    Currently in AIX when we follow a child or do not dtach the child during multi-process debugging we get,
    
    (gdb) set detach-on-fork off
    (gdb) r
    Starting program: /gdb_tests/multi-thread-fork
    [New inferior 2 (process 32965026)]
    target.c:1194: internal-error: Attempt to push unshareable target: native.
    A problem internal to GDB has been detected,
    further debugging may prove unreliable.
    ----- Backtrace -----
    0x10092c69b gdb_internal_backtrace_1
            /home/binutils-gdb/gdb/bt-utils.c:122
    0x10092c7bf _Z22gdb_internal_backtracev
            /home/binutils-gdb/gdb/bt-utils.c:175
    0x10004fdef internal_vproblem
            /home/binutils-gdb/gdb/utils.c:424
    0x100050307 _Z15internal_verrorPKciS0_Pc
            /home/binutils-gdb/gdb/utils.c:504
    
    The reason being AIX missed out on making the rs6000_nat_target sharable for the child.
    
    So align AIX native fork handling with Linux by marking rs6000_nat_target shareable.
    This avoids internal errors during fork (), during detach-on-fork off and follow-fork-mode child.
    
    Approved By: Ulrich Weigand <[email protected]>

Diff:
---
 gdb/rs6000-aix-nat.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gdb/rs6000-aix-nat.c b/gdb/rs6000-aix-nat.c
index 57eb428cc37..276df378824 100644
--- a/gdb/rs6000-aix-nat.c
+++ b/gdb/rs6000-aix-nat.c
@@ -101,6 +101,11 @@ public:
      support.  */
   void follow_fork (inferior *, ptid_t, target_waitkind, bool, bool) override;
 
+  /* Keep AIX as well sharable across inferiors while following fork()
+     like child process in sync with Linux.  */
+  bool is_shareable () override
+  { return true; }
+
   const struct target_desc *read_description ()  override;
 
   int insert_fork_catchpoint (int) override;