diff --git a/dev-util/gdb/gdb-15.2.recipe b/dev-util/gdb/gdb-16.3.recipe similarity index 95% rename from dev-util/gdb/gdb-15.2.recipe rename to dev-util/gdb/gdb-16.3.recipe index f3e89c301..78a973822 100644 --- a/dev-util/gdb/gdb-15.2.recipe +++ b/dev-util/gdb/gdb-16.3.recipe @@ -22,18 +22,19 @@ LICENSE="GNU GPL v2 GNU GPL v3" REVISION="1" SOURCE_URI="https://ftp.gnu.org/gnu/gdb/gdb-$portVersion.tar.xz" -CHECKSUM_SHA256="83350ccd35b5b5a0cba6b334c41294ea968158c573940904f00b92f76345314d" +CHECKSUM_SHA256="bcfcd095528a987917acf9fff3f1672181694926cc18d609c99d0042c00224c5" PATCHES="gdb-$portVersion.patchset" ARCHITECTURES="x86_64 ?x86 !x86_gcc2" -binutilsVersion="2.42" +binutilsVersion="2.43" PROVIDES=" gdb = $portVersion cmd:gdb = $portVersion cmd:gdb_add_index = $portVersion cmd:gdbserver = $portVersion + cmd:gstack = $portVersion devel:libbfd = $binutilsVersion devel:libctf = $binutilsVersion devel:libctf_nobfd = $binutilsVersion diff --git a/dev-util/gdb/patches/gdb-15.2.patchset b/dev-util/gdb/patches/gdb-16.3.patchset similarity index 93% rename from dev-util/gdb/patches/gdb-15.2.patchset rename to dev-util/gdb/patches/gdb-16.3.patchset index 8c9eff2b1..4da2ea53b 100644 --- a/dev-util/gdb/patches/gdb-15.2.patchset +++ b/dev-util/gdb/patches/gdb-16.3.patchset @@ -1,7 +1,7 @@ -From 9c9cd5cf820ea4f83b72409dcaaa797f351d2ea1 Mon Sep 17 00:00:00 2001 +From e524cecc46de3ec07141e8ffa5e23739a6714a95 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 29 Jul 2024 22:55:42 +1000 -Subject: [PATCH 1/3] gdb/remote: fix assertion failure during startup +Subject: gdb/remote: fix assertion failure during startup Ensure that calls to `remote_state::mark_async_event_handler` are only made when the target is in async mode: @@ -104,15 +104,12 @@ further debugging may prove unreliable. 0x7f6328d9f9b4 _Z8cmd_funcP16cmd_list_elementPKci ../../gdb-haiku/gdb/cli/cli-decode.c:2741 0x7f6329102e64 _Z15execute_commandPKci ---- - gdb/remote.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c -index 42b446c7e27..4e81ccc33bc 100644 +index e00ddc0..d2f1c6e 100644 --- a/gdb/remote.c +++ b/gdb/remote.c -@@ -7704,8 +7704,11 @@ remote_notif_stop_can_get_pending_events (remote_target *remote, +@@ -7738,8 +7738,11 @@ remote_notif_stop_can_get_pending_events (remote_target *remote, instead. If we fetch all queued events from stub, remote stub may exit and we have no chance to process them back in remote_wait_ns. */ @@ -126,7 +123,7 @@ index 42b446c7e27..4e81ccc33bc 100644 return 0; } -@@ -7902,7 +7905,7 @@ remote_target::queued_stop_reply (ptid_t ptid) +@@ -7936,7 +7939,7 @@ remote_target::queued_stop_reply (ptid_t ptid) remote_state *rs = get_remote_state (); stop_reply_up r = remote_notif_remove_queued_reply (ptid); @@ -136,46 +133,18 @@ index 42b446c7e27..4e81ccc33bc 100644 /* There's still at least an event left. */ rs->mark_async_event_handler (); -- -2.39.2 +2.51.0 -From b7d9ee77c52a4faca1eea9967635a52942abe395 Mon Sep 17 00:00:00 2001 +From 1d046da9f6aeee3b1137dcc5100dbac1049b8c91 Mon Sep 17 00:00:00 2001 From: Trung Nguyen <57174311+trungnt2910@users.noreply.github.com> Date: Tue, 28 May 2024 22:31:22 +1000 -Subject: [PATCH 2/3] gdbserver: Initial Haiku support +Subject: gdbserver: Initial Haiku support ---- - gdb/nat/haiku-debug.c | 43 + - gdb/nat/haiku-nat.c | 2808 ++++++++++++++++++++++++++++++++++ - gdb/nat/haiku-nat.h | 429 ++++++ - gdb/nat/haiku-nub-message.c | 50 + - gdb/nat/haiku-nub-message.h | 141 ++ - gdb/nat/haiku-osdata.c | 445 ++++++ - gdb/nat/haiku-osdata.h | 26 + - gdbserver/Makefile.in | 6 + - gdbserver/configure | 2 +- - gdbserver/configure.srv | 9 + - gdbserver/haiku-amd64-low.cc | 262 ++++ - gdbserver/haiku-low.cc | 609 ++++++++ - gdbserver/haiku-low.h | 100 ++ - gdbserver/remote-utils.cc | 4 + - gdbsupport/signals.cc | 10 + - include/gdb/signals.def | 4 +- - 16 files changed, 4946 insertions(+), 2 deletions(-) - create mode 100644 gdb/nat/haiku-debug.c - create mode 100644 gdb/nat/haiku-nat.c - create mode 100644 gdb/nat/haiku-nat.h - create mode 100644 gdb/nat/haiku-nub-message.c - create mode 100644 gdb/nat/haiku-nub-message.h - create mode 100644 gdb/nat/haiku-osdata.c - create mode 100644 gdb/nat/haiku-osdata.h - create mode 100644 gdbserver/haiku-amd64-low.cc - create mode 100644 gdbserver/haiku-low.cc - create mode 100644 gdbserver/haiku-low.h diff --git a/gdb/nat/haiku-debug.c b/gdb/nat/haiku-debug.c new file mode 100644 -index 00000000000..d1796a403f6 +index 0000000..d1796a4 --- /dev/null +++ b/gdb/nat/haiku-debug.c @@ -0,0 +1,43 @@ @@ -224,7 +193,7 @@ index 00000000000..d1796a403f6 +} diff --git a/gdb/nat/haiku-nat.c b/gdb/nat/haiku-nat.c new file mode 100644 -index 00000000000..30f00926710 +index 0000000..30f0092 --- /dev/null +++ b/gdb/nat/haiku-nat.c @@ -0,0 +1,2808 @@ @@ -3038,7 +3007,7 @@ index 00000000000..30f00926710 +} diff --git a/gdb/nat/haiku-nat.h b/gdb/nat/haiku-nat.h new file mode 100644 -index 00000000000..4a057a45523 +index 0000000..4a057a4 --- /dev/null +++ b/gdb/nat/haiku-nat.h @@ -0,0 +1,429 @@ @@ -3473,7 +3442,7 @@ index 00000000000..4a057a45523 +#endif /* NAT_HAIKU_NAT_H */ diff --git a/gdb/nat/haiku-nub-message.c b/gdb/nat/haiku-nub-message.c new file mode 100644 -index 00000000000..815377d5826 +index 0000000..815377d --- /dev/null +++ b/gdb/nat/haiku-nub-message.c @@ -0,0 +1,50 @@ @@ -3529,7 +3498,7 @@ index 00000000000..815377d5826 +} diff --git a/gdb/nat/haiku-nub-message.h b/gdb/nat/haiku-nub-message.h new file mode 100644 -index 00000000000..04212a3a06c +index 0000000..04212a3 --- /dev/null +++ b/gdb/nat/haiku-nub-message.h @@ -0,0 +1,141 @@ @@ -3676,7 +3645,7 @@ index 00000000000..04212a3a06c +#endif /* NAT_HAIKU_NUB_MESSAGE_H */ diff --git a/gdb/nat/haiku-osdata.c b/gdb/nat/haiku-osdata.c new file mode 100644 -index 00000000000..1f295c454d8 +index 0000000..1f295c4 --- /dev/null +++ b/gdb/nat/haiku-osdata.c @@ -0,0 +1,445 @@ @@ -4127,7 +4096,7 @@ index 00000000000..1f295c454d8 +} diff --git a/gdb/nat/haiku-osdata.h b/gdb/nat/haiku-osdata.h new file mode 100644 -index 00000000000..01e87e4d2ed +index 0000000..01e87e4 --- /dev/null +++ b/gdb/nat/haiku-osdata.h @@ -0,0 +1,26 @@ @@ -4158,7 +4127,7 @@ index 00000000000..01e87e4d2ed + +#endif /* NAT_HAIKU_OSDATA_H */ diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in -index 6148ccf9121..b33d3e8f37b 100644 +index 365dcf2..7460650 100644 --- a/gdbserver/Makefile.in +++ b/gdbserver/Makefile.in @@ -600,6 +600,12 @@ gdbreplay.o: gdbreplay.cc @@ -4175,10 +4144,10 @@ index 6148ccf9121..b33d3e8f37b 100644 # Dependency tracking. # diff --git a/gdbserver/configure b/gdbserver/configure -index 3abc647acda..ff0718eea6f 100755 +index 32980e5..6855a18 100755 --- a/gdbserver/configure +++ b/gdbserver/configure -@@ -8704,7 +8704,7 @@ return socketpair (); +@@ -8722,7 +8722,7 @@ return socketpair (); return 0; } _ACEOF @@ -4188,10 +4157,10 @@ index 3abc647acda..ff0718eea6f 100755 ac_res="none required" else diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv -index 9e861a75088..34740727037 100644 +index ffc8494..48cc5e7 100644 --- a/gdbserver/configure.srv +++ b/gdbserver/configure.srv -@@ -400,6 +400,15 @@ case "${gdbserver_host}" in +@@ -405,6 +405,15 @@ case "${gdbserver_host}" in srv_tgtobj="${srv_tgtobj} nat/netbsd-nat.o" srv_tgtobj="${srv_tgtobj} arch/amd64.o" ;; @@ -4209,7 +4178,7 @@ index 9e861a75088..34740727037 100644 srv_tgtobj="$srv_linux_obj linux-xtensa-low.o" diff --git a/gdbserver/haiku-amd64-low.cc b/gdbserver/haiku-amd64-low.cc new file mode 100644 -index 00000000000..0e6e0adeade +index 0000000..0e6e0ad --- /dev/null +++ b/gdbserver/haiku-amd64-low.cc @@ -0,0 +1,262 @@ @@ -4477,7 +4446,7 @@ index 00000000000..0e6e0adeade +haiku_process_target *the_haiku_target = &the_haiku_amd64_target; diff --git a/gdbserver/haiku-low.cc b/gdbserver/haiku-low.cc new file mode 100644 -index 00000000000..41295d58561 +index 0000000..41295d5 --- /dev/null +++ b/gdbserver/haiku-low.cc @@ -0,0 +1,609 @@ @@ -5092,7 +5061,7 @@ index 00000000000..41295d58561 +} diff --git a/gdbserver/haiku-low.h b/gdbserver/haiku-low.h new file mode 100644 -index 00000000000..1167305586a +index 0000000..1167305 --- /dev/null +++ b/gdbserver/haiku-low.h @@ -0,0 +1,100 @@ @@ -5197,10 +5166,10 @@ index 00000000000..1167305586a + +#endif /* GDBSERVER_HAIKU_LOW_H */ diff --git a/gdbserver/remote-utils.cc b/gdbserver/remote-utils.cc -index 5a8eb9ae52a..7dabee6a72d 100644 +index 67225c5..133b4f1 100644 --- a/gdbserver/remote-utils.cc +++ b/gdbserver/remote-utils.cc -@@ -109,6 +109,10 @@ static int listen_desc = -1; +@@ -111,6 +111,10 @@ static int listen_desc = -1; # define write(fd, buf, len) send (fd, (char *) buf, len, 0) #endif @@ -5212,10 +5181,10 @@ index 5a8eb9ae52a..7dabee6a72d 100644 gdb_connected (void) { diff --git a/gdbsupport/signals.cc b/gdbsupport/signals.cc -index 4989b3fc28b..a46d74c37bc 100644 +index 2cf641b..be2df0b 100644 --- a/gdbsupport/signals.cc +++ b/gdbsupport/signals.cc -@@ -335,6 +335,11 @@ gdb_signal_from_host (int hostsig) +@@ -333,6 +333,11 @@ gdb_signal_from_host (int hostsig) return GDB_SIGNAL_LIBRT; #endif @@ -5227,7 +5196,7 @@ index 4989b3fc28b..a46d74c37bc 100644 #if defined (REALTIME_LO) if (hostsig >= REALTIME_LO && hostsig < REALTIME_HI) { -@@ -592,6 +597,11 @@ do_gdb_signal_to_host (enum gdb_signal oursig, +@@ -590,6 +595,11 @@ do_gdb_signal_to_host (enum gdb_signal oursig, return SIGLIBRT; #endif @@ -5240,7 +5209,7 @@ index 4989b3fc28b..a46d74c37bc 100644 #if defined (REALTIME_LO) retsig = 0; diff --git a/include/gdb/signals.def b/include/gdb/signals.def -index 677b01e7f40..d21d3390df2 100644 +index 677b01e..d21d339 100644 --- a/include/gdb/signals.def +++ b/include/gdb/signals.def @@ -196,7 +196,9 @@ SET (GDB_EXC_BREAKPOINT, 150, "EXC_BREAKPOINT", "Breakpoint") @@ -5255,49 +5224,20 @@ index 677b01e7f40..d21d3390df2 100644 -SET (GDB_SIGNAL_LAST, 152, NULL, "GDB_SIGNAL_LAST") +SET (GDB_SIGNAL_LAST, 153, NULL, "GDB_SIGNAL_LAST") -- -2.39.2 +2.51.0 -From 019ad2f8cffccb9ab8608034455165135d2e116c Mon Sep 17 00:00:00 2001 +From 3d16f65608526c71104e8bd77d7a57088950fd44 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 1 Jul 2024 10:32:51 +0700 -Subject: [PATCH 3/3] gdb: Initial Haiku support +Subject: gdb: Initial Haiku support ---- - gdb/Makefile.in | 20 ++ - gdb/amd64-haiku-nat.c | 153 ++++++++ - gdb/amd64-haiku-tdep.c | 144 ++++++++ - gdb/configure | 2 +- - gdb/configure.host | 2 + - gdb/configure.nat | 25 ++ - gdb/configure.tgt | 11 + - gdb/haiku-nat.c | 778 +++++++++++++++++++++++++++++++++++++++++ - gdb/haiku-nat.h | 75 ++++ - gdb/haiku-tdep.c | 193 ++++++++++ - gdb/haiku-tdep.h | 44 +++ - gdb/i386-haiku-nat.c | 39 +++ - gdb/i386-haiku-tdep.c | 61 ++++ - gdb/osabi.c | 1 + - gdb/osabi.h | 1 + - gdb/solib-haiku.c | 115 ++++++ - gdb/solib-haiku.h | 27 ++ - 17 files changed, 1690 insertions(+), 1 deletion(-) - create mode 100644 gdb/amd64-haiku-nat.c - create mode 100644 gdb/amd64-haiku-tdep.c - create mode 100644 gdb/haiku-nat.c - create mode 100644 gdb/haiku-nat.h - create mode 100644 gdb/haiku-tdep.c - create mode 100644 gdb/haiku-tdep.h - create mode 100644 gdb/i386-haiku-nat.c - create mode 100644 gdb/i386-haiku-tdep.c - create mode 100644 gdb/solib-haiku.c - create mode 100644 gdb/solib-haiku.h diff --git a/gdb/Makefile.in b/gdb/Makefile.in -index 84bc54b303e..9138849cc0a 100644 +index 6d627b6..509a1af 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in -@@ -611,6 +611,14 @@ GDB_CFLAGS = \ +@@ -613,6 +613,14 @@ GDB_CFLAGS = \ -DLOCALEDIR="\"$(localedir)\"" \ $(DEFS) @@ -5312,7 +5252,7 @@ index 84bc54b303e..9138849cc0a 100644 # MH_CFLAGS, if defined, has host-dependent CFLAGS from the config directory. GLOBAL_CFLAGS = $(MH_CFLAGS) -@@ -737,6 +745,7 @@ ALL_64_TARGET_OBS = \ +@@ -739,6 +747,7 @@ ALL_64_TARGET_OBS = \ amd64-darwin-tdep.o \ amd64-dicos-tdep.o \ amd64-fbsd-tdep.o \ @@ -5320,7 +5260,7 @@ index 84bc54b303e..9138849cc0a 100644 amd64-linux-tdep.o \ amd64-netbsd-tdep.o \ amd64-obsd-tdep.o \ -@@ -815,6 +824,7 @@ ALL_TARGET_OBS = \ +@@ -821,6 +830,7 @@ ALL_TARGET_OBS = \ ft32-tdep.o \ glibc-tdep.o \ h8300-tdep.o \ @@ -5328,15 +5268,15 @@ index 84bc54b303e..9138849cc0a 100644 hppa-bsd-tdep.o \ hppa-linux-tdep.o \ hppa-netbsd-tdep.o \ -@@ -826,6 +836,7 @@ ALL_TARGET_OBS = \ +@@ -832,6 +842,7 @@ ALL_TARGET_OBS = \ i386-fbsd-tdep.o \ i386-gnu-tdep.o \ i386-go32-tdep.o \ + i386-haiku-tdep.o \ i386-linux-tdep.o \ i386-netbsd-tdep.o \ - i386-nto-tdep.o \ -@@ -884,6 +895,7 @@ ALL_TARGET_OBS = \ + i386-obsd-tdep.o \ +@@ -886,6 +897,7 @@ ALL_TARGET_OBS = \ solib-darwin.o \ solib-dsbt.o \ solib-frv.o \ @@ -5352,7 +5292,7 @@ index 84bc54b303e..9138849cc0a 100644 solib-svr4.h \ solib-target.h \ solist.h \ -@@ -1688,6 +1701,8 @@ ALLDEPFILES = \ +@@ -1698,6 +1711,8 @@ ALLDEPFILES = \ amd64-dicos-tdep.c \ amd64-fbsd-nat.c \ amd64-fbsd-tdep.c \ @@ -5361,7 +5301,7 @@ index 84bc54b303e..9138849cc0a 100644 amd64-linux-nat.c \ amd64-linux-tdep.c \ amd64-nat.c \ -@@ -1728,6 +1743,8 @@ ALLDEPFILES = \ +@@ -1738,6 +1753,8 @@ ALLDEPFILES = \ glibc-tdep.c \ go32-nat.c \ h8300-tdep.c \ @@ -5370,7 +5310,7 @@ index 84bc54b303e..9138849cc0a 100644 hppa-bsd-tdep.c \ hppa-linux-nat.c \ hppa-linux-tdep.c \ -@@ -1745,6 +1762,8 @@ ALLDEPFILES = \ +@@ -1755,6 +1772,8 @@ ALLDEPFILES = \ i386-fbsd-tdep.c \ i386-gnu-nat.c \ i386-gnu-tdep.c \ @@ -5379,7 +5319,7 @@ index 84bc54b303e..9138849cc0a 100644 i386-linux-nat.c \ i386-linux-tdep.c \ i386-netbsd-nat.c \ -@@ -1840,6 +1859,7 @@ ALLDEPFILES = \ +@@ -1848,6 +1867,7 @@ ALLDEPFILES = \ sh-tdep.c \ sol2-tdep.c \ solib-aix.c \ @@ -5389,7 +5329,7 @@ index 84bc54b303e..9138849cc0a 100644 sparc-linux-nat.c \ diff --git a/gdb/amd64-haiku-nat.c b/gdb/amd64-haiku-nat.c new file mode 100644 -index 00000000000..e622e660dcf +index 0000000..e622e66 --- /dev/null +++ b/gdb/amd64-haiku-nat.c @@ -0,0 +1,153 @@ @@ -5548,7 +5488,7 @@ index 00000000000..e622e660dcf +} diff --git a/gdb/amd64-haiku-tdep.c b/gdb/amd64-haiku-tdep.c new file mode 100644 -index 00000000000..086e63183af +index 0000000..086e631 --- /dev/null +++ b/gdb/amd64-haiku-tdep.c @@ -0,0 +1,144 @@ @@ -5697,10 +5637,10 @@ index 00000000000..086e63183af + amd64_haiku_init_abi); +} diff --git a/gdb/configure b/gdb/configure -index 66a7ad8d256..7073871283f 100755 +index 1531f62..4ead228 100755 --- a/gdb/configure +++ b/gdb/configure -@@ -19997,7 +19997,7 @@ return socketpair (); +@@ -20016,7 +20016,7 @@ return socketpair (); return 0; } _ACEOF @@ -5710,18 +5650,18 @@ index 66a7ad8d256..7073871283f 100755 ac_res="none required" else diff --git a/gdb/configure.host b/gdb/configure.host -index da71675b201..0dbbb699405 100644 +index 22855cd..52fb68b 100644 --- a/gdb/configure.host +++ b/gdb/configure.host -@@ -112,6 +112,7 @@ i[34567]86-*-linux*) gdb_host=linux ;; +@@ -111,6 +111,7 @@ i[34567]86-*-msdosdjgpp*) gdb_host=go32 ;; + i[34567]86-*-linux*) gdb_host=linux ;; i[34567]86-*-gnu*) gdb_host=i386gnu ;; - i[3456]86-*-nto*) gdb_host=nto ;; i[34567]86-*-openbsd*) gdb_host=obsd ;; +i[34567]86-*-haiku*) gdb_host=haiku ;; i[34567]86-*-solaris2* | x86_64-*-solaris2*) gdb_host=sol2 ;; i[34567]86-*-cygwin*) gdb_host=cygwin ;; -@@ -180,6 +181,7 @@ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) +@@ -179,6 +180,7 @@ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu) gdb_host=nbsd64 ;; x86_64-*-openbsd*) gdb_host=obsd64 ;; @@ -5730,7 +5670,7 @@ index da71675b201..0dbbb699405 100644 gdb_host_obs=mingw-hdep.o ;; diff --git a/gdb/configure.nat b/gdb/configure.nat -index 8b98511cef7..6e7670c9cfa 100644 +index 9e78091..fffac27 100644 --- a/gdb/configure.nat +++ b/gdb/configure.nat @@ -74,6 +74,11 @@ case ${gdb_host} in @@ -5745,7 +5685,7 @@ index 8b98511cef7..6e7670c9cfa 100644 cygwin*) NATDEPFILES='x86-nat.o nat/x86-dregs.o windows-nat.o nat/windows-nat.o' ;; -@@ -479,6 +484,26 @@ case ${gdb_host} in +@@ -475,6 +480,26 @@ case ${gdb_host} in ;; esac ;; @@ -5773,10 +5713,10 @@ index 8b98511cef7..6e7670c9cfa 100644 case ${gdb_host_cpu} in powerpc) diff --git a/gdb/configure.tgt b/gdb/configure.tgt -index 47a674201f9..37eb03a1437 100644 +index f7b9e32..eb65890 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt -@@ -127,6 +127,8 @@ case "${targ}" in +@@ -128,6 +128,8 @@ case "${targ}" in os_obs="netbsd-tdep.o solib-svr4.o";; *-*-openbsd*) os_obs="obsd-tdep.o solib-svr4.o";; @@ -5785,7 +5725,7 @@ index 47a674201f9..37eb03a1437 100644 esac # 3. Get the rest of objects. -@@ -304,6 +306,10 @@ i[34567]86-*-openbsd*) +@@ -305,6 +307,10 @@ i[34567]86-*-openbsd*) # Target: OpenBSD/i386 gdb_target_obs="i386-bsd-tdep.o i386-obsd-tdep.o bsd-uthread.o" ;; @@ -5793,10 +5733,10 @@ index 47a674201f9..37eb03a1437 100644 + # Target: Haiku/i386 + gdb_target_obs="i386-haiku-tdep.o" + ;; - i[34567]86-*-nto*) - # Target: Intel 386 running qnx6. - gdb_target_obs="solib-svr4.o \ -@@ -741,6 +747,11 @@ x86_64-*-openbsd*) + i[34567]86-*-solaris2* | x86_64-*-solaris2*) + # Target: Solaris x86_64 + gdb_target_obs="${i386_tobjs} ${amd64_tobjs} \ +@@ -731,6 +737,11 @@ x86_64-*-openbsd*) i386-bsd-tdep.o i386-obsd-tdep.o \ bsd-uthread.o" ;; @@ -5810,7 +5750,7 @@ index 47a674201f9..37eb03a1437 100644 ;; diff --git a/gdb/haiku-nat.c b/gdb/haiku-nat.c new file mode 100644 -index 00000000000..3faab245b98 +index 0000000..3faab24 --- /dev/null +++ b/gdb/haiku-nat.c @@ -0,0 +1,778 @@ @@ -6594,7 +6534,7 @@ index 00000000000..3faab245b98 +} diff --git a/gdb/haiku-nat.h b/gdb/haiku-nat.h new file mode 100644 -index 00000000000..6e900fb365b +index 0000000..6e900fb --- /dev/null +++ b/gdb/haiku-nat.h @@ -0,0 +1,75 @@ @@ -6675,7 +6615,7 @@ index 00000000000..6e900fb365b +extern haiku_nat_target *haiku_target; diff --git a/gdb/haiku-tdep.c b/gdb/haiku-tdep.c new file mode 100644 -index 00000000000..3b866a580e3 +index 0000000..3b866a5 --- /dev/null +++ b/gdb/haiku-tdep.c @@ -0,0 +1,193 @@ @@ -6874,7 +6814,7 @@ index 00000000000..3b866a580e3 +} diff --git a/gdb/haiku-tdep.h b/gdb/haiku-tdep.h new file mode 100644 -index 00000000000..b53e3fbe6fe +index 0000000..b53e3fb --- /dev/null +++ b/gdb/haiku-tdep.h @@ -0,0 +1,44 @@ @@ -6924,7 +6864,7 @@ index 00000000000..b53e3fbe6fe +#endif /* HAIKU_TDEP_H */ diff --git a/gdb/i386-haiku-nat.c b/gdb/i386-haiku-nat.c new file mode 100644 -index 00000000000..b41fcca1689 +index 0000000..b41fcca --- /dev/null +++ b/gdb/i386-haiku-nat.c @@ -0,0 +1,39 @@ @@ -6969,7 +6909,7 @@ index 00000000000..b41fcca1689 +} diff --git a/gdb/i386-haiku-tdep.c b/gdb/i386-haiku-tdep.c new file mode 100644 -index 00000000000..fd8011f758c +index 0000000..fd8011f --- /dev/null +++ b/gdb/i386-haiku-tdep.c @@ -0,0 +1,61 @@ @@ -7034,33 +6974,9 @@ index 00000000000..fd8011f758c + gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_HAIKU, + i386_haiku_init_abi); +} -diff --git a/gdb/osabi.c b/gdb/osabi.c -index d494d899623..011731cdd6e 100644 ---- a/gdb/osabi.c -+++ b/gdb/osabi.c -@@ -68,6 +68,7 @@ static const struct osabi_names gdb_osabi_names[] = - { "FreeBSD", NULL }, - { "NetBSD", NULL }, - { "OpenBSD", NULL }, -+ { "Haiku", NULL }, - { "WindowsCE", NULL }, - { "DJGPP", NULL }, - { "QNX-Neutrino", NULL }, -diff --git a/gdb/osabi.h b/gdb/osabi.h -index c1a85d1b9a3..29f8b20783c 100644 ---- a/gdb/osabi.h -+++ b/gdb/osabi.h -@@ -33,6 +33,7 @@ enum gdb_osabi - GDB_OSABI_FREEBSD, - GDB_OSABI_NETBSD, - GDB_OSABI_OPENBSD, -+ GDB_OSABI_HAIKU, - GDB_OSABI_WINCE, - GDB_OSABI_GO32, - GDB_OSABI_QNXNTO, diff --git a/gdb/solib-haiku.c b/gdb/solib-haiku.c new file mode 100644 -index 00000000000..ba9e548f9e4 +index 0000000..ba9e548 --- /dev/null +++ b/gdb/solib-haiku.c @@ -0,0 +1,115 @@ @@ -7181,7 +7097,7 @@ index 00000000000..ba9e548f9e4 +}; diff --git a/gdb/solib-haiku.h b/gdb/solib-haiku.h new file mode 100644 -index 00000000000..5f6a90fef2c +index 0000000..5f6a90f --- /dev/null +++ b/gdb/solib-haiku.h @@ -0,0 +1,27 @@ @@ -7212,6 +7128,348 @@ index 00000000000..5f6a90fef2c +extern const struct solib_ops haiku_so_ops; + +#endif /* solib-haiku.h */ +diff --git a/gdbsupport/osabi.def b/gdbsupport/osabi.def +index 637da26..ae994f8 100644 +--- a/gdbsupport/osabi.def ++++ b/gdbsupport/osabi.def +@@ -41,6 +41,7 @@ GDB_OSABI_DEF (LINUX, "GNU/Linux", "linux(-gnu[^-]*)?") + GDB_OSABI_DEF (FREEBSD, "FreeBSD", nullptr) + GDB_OSABI_DEF (NETBSD, "NetBSD", nullptr) + GDB_OSABI_DEF (OPENBSD, "OpenBSD", nullptr) ++GDB_OSABI_DEF (HAIKU, "Haiku", nullptr) + GDB_OSABI_DEF (WINCE, "WindowsCE", nullptr) + GDB_OSABI_DEF (GO32, "DJGPP", nullptr) + GDB_OSABI_DEF (CYGWIN, "Cygwin", nullptr) -- -2.39.2 +2.51.0 + + +From 6401432b070fe0196a6ff7caa438132198f6b259 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= +Date: Sat, 7 Mar 2026 21:55:17 +0100 +Subject: gdb: Update Haiku support for 16.x + + +diff --git a/gdb/haiku-nat.c b/gdb/haiku-nat.c +index 3faab24..c1d768c 100644 +--- a/gdb/haiku-nat.c ++++ b/gdb/haiku-nat.c +@@ -635,7 +635,7 @@ haiku_relocate_main_executable (inferior *inf) + } + + if (inf->pspace->symfile_object_file == nullptr) +- symbol_file_add_main (inf->pspace->exec_filename.get (), ++ symbol_file_add_main (inf->pspace->exec_filename (), + SYMFILE_DEFER_BP_RESET); + + objfile *objf = inf->pspace->symfile_object_file; +@@ -650,7 +650,7 @@ static void + haiku_enable_breakpoints_if_ready (inferior *inf) + { + if (strcmp (haiku_nat::pid_to_exec_file (inf->pid), +- inf->pspace->exec_filename.get ()) ++ inf->pspace->exec_filename ()) + != 0) + { + /* Not ready yet. The inferior is still executing a wrapper +diff --git a/gdb/haiku-tdep.h b/gdb/haiku-tdep.h +index b53e3fb..2efc2f6 100644 +--- a/gdb/haiku-tdep.h ++++ b/gdb/haiku-tdep.h +@@ -17,8 +17,8 @@ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +-#ifndef HAIKU_TDEP_H +-#define HAIKU_TDEP_H ++#ifndef GDB_HAIKU_TDEP_H ++#define GDB_HAIKU_TDEP_H + + #include "gdb_bfd.h" + +@@ -41,4 +41,4 @@ gdb_bfd_ref_ptr haiku_bfd_open_commpage (); + + CORE_ADDR haiku_get_commpage_address (); + +-#endif /* HAIKU_TDEP_H */ ++#endif /* GDB_HAIKU_TDEP_H */ +diff --git a/gdb/nat/haiku-nat.h b/gdb/nat/haiku-nat.h +index 4a057a4..189027f 100644 +--- a/gdb/nat/haiku-nat.h ++++ b/gdb/nat/haiku-nat.h +@@ -17,8 +17,8 @@ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +-#ifndef NAT_HAIKU_NAT_H +-#define NAT_HAIKU_NAT_H ++#ifndef GDB_NAT_HAIKU_NAT_H ++#define GDB_NAT_HAIKU_NAT_H + + #include + +@@ -426,4 +426,4 @@ extern bool debug_haiku_nat; + #define HAIKU_NAT_SCOPED_DEBUG_ENTER_EXIT \ + scoped_debug_enter_exit (debug_haiku_nat, "haiku-nat") + +-#endif /* NAT_HAIKU_NAT_H */ ++#endif /* GDB_NAT_HAIKU_NAT_H */ +diff --git a/gdb/nat/haiku-nub-message.h b/gdb/nat/haiku-nub-message.h +index 04212a3..fc41efe 100644 +--- a/gdb/nat/haiku-nub-message.h ++++ b/gdb/nat/haiku-nub-message.h +@@ -17,8 +17,8 @@ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +-#ifndef NAT_HAIKU_NUB_MESSAGE_H +-#define NAT_HAIKU_NUB_MESSAGE_H ++#ifndef GDB_NAT_HAIKU_NUB_MESSAGE_H ++#define GDB_NAT_HAIKU_NUB_MESSAGE_H + + #include "gnulib/config.h" + +@@ -138,4 +138,4 @@ haiku_send_nub_message (port_id nub_port, + return (result < B_OK) ? result : reply.error; + } + +-#endif /* NAT_HAIKU_NUB_MESSAGE_H */ ++#endif /* GDB_NAT_HAIKU_NUB_MESSAGE_H */ +diff --git a/gdb/nat/haiku-osdata.h b/gdb/nat/haiku-osdata.h +index 01e87e4..182ecfa 100644 +--- a/gdb/nat/haiku-osdata.h ++++ b/gdb/nat/haiku-osdata.h +@@ -17,10 +17,10 @@ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +-#ifndef NAT_HAIKU_OSDATA_H +-#define NAT_HAIKU_OSDATA_H ++#ifndef GDB_NAT_HAIKU_OSDATA_H ++#define GDB_NAT_HAIKU_OSDATA_H + + extern LONGEST haiku_common_xfer_osdata (const char *annex, gdb_byte *readbuf, + ULONGEST offset, ULONGEST len); + +-#endif /* NAT_HAIKU_OSDATA_H */ ++#endif /* GDB_NAT_HAIKU_OSDATA_H */ +diff --git a/gdb/solib-haiku.c b/gdb/solib-haiku.c +index ba9e548..0ec56b5 100644 +--- a/gdb/solib-haiku.c ++++ b/gdb/solib-haiku.c +@@ -75,7 +75,7 @@ haiku_solib_create_inferior_hook (int from_tty) + solib_target_so_ops.solib_create_inferior_hook (from_tty); + } + +-static intrusive_list ++static owning_intrusive_list + haiku_current_sos () + { + return solib_target_so_ops.current_sos (); +@@ -112,4 +112,9 @@ const struct solib_ops haiku_so_ops = { + .open_symbol_file_object = haiku_open_symbol_file_object, + .in_dynsym_resolve_code = haiku_in_dynsym_resolve_code, + .bfd_open = haiku_bfd_open, ++ nullptr, ++ nullptr, ++ nullptr, ++ nullptr, ++ default_find_solib_addr, + }; +diff --git a/gdb/solib-haiku.h b/gdb/solib-haiku.h +index 5f6a90f..bd023f5 100644 +--- a/gdb/solib-haiku.h ++++ b/gdb/solib-haiku.h +@@ -17,11 +17,11 @@ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +-#ifndef SOLIB_HAIKU_H +-#define SOLIB_HAIKU_H ++#ifndef GDB_SOLIB_HAIKU_H ++#define GDB_SOLIB_HAIKU_H + + struct solib_ops; + + extern const struct solib_ops haiku_so_ops; + +-#endif /* solib-haiku.h */ ++#endif /* GDB_SOLIB_HAIKU_H */ +-- +2.51.0 + + +From 5a6a53cd454f6d400bd5c46698a847d00fd9fb2a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= +Date: Sat, 7 Mar 2026 21:56:27 +0100 +Subject: gdbserver: Update Haiku support for 16.x + + +diff --git a/gdbserver/haiku-amd64-low.cc b/gdbserver/haiku-amd64-low.cc +index 0e6e0ad..3503d5c 100644 +--- a/gdbserver/haiku-amd64-low.cc ++++ b/gdbserver/haiku-amd64-low.cc +@@ -155,7 +155,7 @@ haiku_amd64_target::fetch_registers (struct regcache *regcache, int regno) + { + char regs[sizeof (x86_64_debug_cpu_state)]; + +- if (haiku_nat::get_cpu_state (ptid_of (current_thread), ®s) < 0) ++ if (haiku_nat::get_cpu_state (current_thread->id, ®s) < 0) + { + /* This happens when the inferior is killed by another process + while being stopped. The nub port has been deleted, so we cannot +@@ -196,7 +196,7 @@ haiku_amd64_target::store_registers (struct regcache *regcache, int regno) + { + char regs[sizeof (x86_64_debug_cpu_state)]; + +- if (haiku_nat::get_cpu_state (ptid_of (current_thread), ®s) < 0) ++ if (haiku_nat::get_cpu_state (current_thread->id, ®s) < 0) + { + haiku_nat_debug_printf ("Failed to get actual CPU state: %s", + strerror (errno)); +@@ -220,7 +220,7 @@ haiku_amd64_target::store_registers (struct regcache *regcache, int regno) + } + } + +- if (haiku_nat::set_cpu_state (ptid_of (current_thread), ®s) < 0) ++ if (haiku_nat::set_cpu_state (current_thread->id, ®s) < 0) + perror_with_name (("haiku_nat::set_cpu_state")); + } + +@@ -248,7 +248,7 @@ haiku_amd64_target::low_arch_setup (process_info *process) + target_desc *tdesc = amd64_create_target_description (X86_XSTATE_AVX_MASK, + false, false, false); + +- init_target_desc (tdesc, amd64_expedite_regs); ++ init_target_desc (tdesc, amd64_expedite_regs, GDB_OSABI_HAIKU); + + process->tdesc = tdesc; + } +diff --git a/gdbserver/haiku-low.cc b/gdbserver/haiku-low.cc +index 41295d5..b0551b8 100644 +--- a/gdbserver/haiku-low.cc ++++ b/gdbserver/haiku-low.cc +@@ -168,7 +168,7 @@ haiku_process_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, + + /* Add at least the child's main thread. Otherwise, gdbserver would + think we have no more inferiors attached and quit. */ +- add_thread (ptid_t (pid, 0, pid), nullptr); ++ find_process_pid (pid)->add_thread (ptid_t (pid, 0, pid), nullptr); + }; + + client_state &cs = get_client_state (); +@@ -193,7 +193,7 @@ haiku_process_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, + thread that was not fully initialized during the attach stage. */ + if (wptid.tid () != 0 && !find_thread_ptid (wptid) + && ourstatus->kind () != TARGET_WAITKIND_THREAD_EXITED) +- add_thread (wptid, nullptr); ++ find_process_pid (wptid.pid())->add_thread (wptid, nullptr); + + switch (ourstatus->kind ()) + { +@@ -247,7 +247,9 @@ haiku_process_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, + return wptid; + break; + case TARGET_WAITKIND_THREAD_EXITED: +- remove_thread (find_thread_ptid (wptid)); ++ { ++ thread_info *info = find_thread_ptid (wptid); ++ info->process ()->remove_thread (info); + + if (cs.report_thread_events) + return wptid; +@@ -255,6 +257,7 @@ haiku_process_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, + /* The thread is dead so we cannot resume the the same wptid. */ + wptid = ptid; + break; ++ } + default: + gdb_assert_not_reached ("Unknown stopped status"); + } +@@ -272,7 +275,7 @@ haiku_process_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, + int + haiku_process_target::kill (process_info *process) + { +- if (haiku_nat::kill (pid_of (process)) < 0) ++ if (haiku_nat::kill (process->pid) < 0) + return -1; + + mourn (process); +@@ -284,7 +287,7 @@ haiku_process_target::kill (process_info *process) + int + haiku_process_target::detach (process_info *process) + { +- if (haiku_nat::detach (pid_of (process)) < 0) ++ if (haiku_nat::detach (process->pid) < 0) + return -1; + + mourn (process); +@@ -296,7 +299,10 @@ haiku_process_target::detach (process_info *process) + void + haiku_process_target::mourn (struct process_info *proc) + { +- for_each_thread (pid_of (proc), remove_thread); ++ proc->for_each_thread ([proc] (thread_info *thread) ++ { ++ proc->remove_thread (thread); ++ }); + + remove_process (proc); + } +@@ -306,7 +312,7 @@ haiku_process_target::mourn (struct process_info *proc) + void + haiku_process_target::join (int pid) + { +- gdb::handle_eintr (-1, ::waitpid, pid, nullptr, 0); ++ gdb::waitpid (pid, nullptr, 0); + } + + /* Implement the thread_alive target_ops method. */ +@@ -323,7 +329,7 @@ int + haiku_process_target::read_memory (CORE_ADDR memaddr, unsigned char *myaddr, + int size) + { +- if (haiku_nat::read_memory (pid_of (current_process ()), memaddr, myaddr, ++ if (haiku_nat::read_memory (current_process ()->pid, memaddr, myaddr, + &size) + < 0) + { +@@ -340,7 +346,7 @@ int + haiku_process_target::write_memory (CORE_ADDR memaddr, + const unsigned char *myaddr, int size) + { +- if (haiku_nat::write_memory (pid_of (current_process ()), memaddr, myaddr, ++ if (haiku_nat::write_memory (current_process ()->pid, memaddr, myaddr, + &size) + < 0) + { +@@ -361,7 +367,7 @@ haiku_process_target::request_interrupt () + if (thread == nullptr) + return; + +- ::kill (pid_of (thread), SIGINT); ++ ::kill (thread->id.pid(), SIGINT); + } + + /* Implement the read_offsets target_ops method. */ +@@ -369,7 +375,7 @@ haiku_process_target::request_interrupt () + int + haiku_process_target::read_offsets (CORE_ADDR *text, CORE_ADDR *data) + { +- if (haiku_nat::read_offsets (pid_of (current_process ()), text, data) < 0) ++ if (haiku_nat::read_offsets (current_process ()->pid, text, data) < 0) + return 0; + return 1; + } +@@ -438,7 +444,7 @@ haiku_process_target::start_non_stop (bool enable) + bool + haiku_process_target::thread_stopped (thread_info *thread) + { +- return haiku_nat::thread_stopped (ptid_of (thread)); ++ return haiku_nat::thread_stopped (thread->id); + } + + /* Implement the pid_to_exec_file target_ops method. */ +-- +2.51.0