From: "Jérôme Duval" <jerome.duval@gmail.com>
To: gdb-patches@sourceware.org
Cc: "Jérôme Duval" <jerome.duval@gmail.com>
Subject: [PATCH 5/8] gdb: Update Haiku support for 17.x
Date: Thu, 12 Mar 2026 18:23:33 +0100 [thread overview]
Message-ID: <20260312172336.15450-6-jerome.duval@gmail.com> (raw)
In-Reply-To: <20260312172336.15450-1-jerome.duval@gmail.com>
---
gdb/amd64-haiku-nat.c | 4 +-
gdb/amd64-haiku-tdep.c | 4 +-
gdb/haiku-nat.c | 4 +-
gdb/haiku-tdep.c | 2 +-
gdb/i386-haiku-nat.c | 4 +-
gdb/i386-haiku-tdep.c | 4 +-
gdb/solib-haiku.c | 96 +++++++++++++++++++++++-------------------
gdb/solib-haiku.h | 6 ++-
8 files changed, 62 insertions(+), 62 deletions(-)
diff --git a/gdb/amd64-haiku-nat.c b/gdb/amd64-haiku-nat.c
index e622e660..6ce9fc7e 100644
--- a/gdb/amd64-haiku-nat.c
+++ b/gdb/amd64-haiku-nat.c
@@ -143,9 +143,7 @@ amd64_haiku_nat_target::store_registers (struct regcache *regcache, int regno)
static amd64_haiku_nat_target the_amd64_haiku_nat_target;
-void _initialize_amd64_haiku_nat ();
-void
-_initialize_amd64_haiku_nat ()
+INIT_GDB_FILE (amd64_haiku_nat)
{
haiku_target = &the_amd64_haiku_nat_target;
diff --git a/gdb/amd64-haiku-tdep.c b/gdb/amd64-haiku-tdep.c
index 086e6318..476d6db9 100644
--- a/gdb/amd64-haiku-tdep.c
+++ b/gdb/amd64-haiku-tdep.c
@@ -132,9 +132,7 @@ amd64_haiku_osabi_sniffer (bfd *abfd)
return GDB_OSABI_HAIKU;
}
-void _initialize_amd64_haiku_tdep ();
-void
-_initialize_amd64_haiku_tdep ()
+INIT_GDB_FILE (amd64_haiku_tdep)
{
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
amd64_haiku_osabi_sniffer);
diff --git a/gdb/haiku-nat.c b/gdb/haiku-nat.c
index c1d768c9..4dcaf236 100644
--- a/gdb/haiku-nat.c
+++ b/gdb/haiku-nat.c
@@ -733,9 +733,7 @@ is_catching_syscalls_for (ptid_t ptid)
/* Initialization. */
-void _initialize_haiku_nat ();
-void
-_initialize_haiku_nat ()
+INIT_GDB_FILE (haiku_nat)
{
/* We cannot do this in target_op's own callbacks, since they are called too
early after attaching or an exec event. At that point, symfile_object_file
diff --git a/gdb/haiku-tdep.c b/gdb/haiku-tdep.c
index 3b866a58..f0fd1d2f 100644
--- a/gdb/haiku-tdep.c
+++ b/gdb/haiku-tdep.c
@@ -32,7 +32,7 @@
void
haiku_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- set_gdbarch_so_ops (gdbarch, &haiku_so_ops);
+ set_gdbarch_make_solib_ops (gdbarch, make_haiku_solib_ops);
}
/* See haiku-tdep.h. */
diff --git a/gdb/i386-haiku-nat.c b/gdb/i386-haiku-nat.c
index b41fcca1..7f00e54b 100644
--- a/gdb/i386-haiku-nat.c
+++ b/gdb/i386-haiku-nat.c
@@ -29,9 +29,7 @@ struct i386_haiku_nat_target final : public haiku_nat_target
static i386_haiku_nat_target the_i386_haiku_nat_target;
-void _initialize_i386_haiku_nat ();
-void
-_initialize_i386_haiku_nat ()
+INIT_GDB_FILE (i386_haiku_nat)
{
haiku_target = &the_i386_haiku_nat_target;
diff --git a/gdb/i386-haiku-tdep.c b/gdb/i386-haiku-tdep.c
index fd8011f7..38ddefbb 100644
--- a/gdb/i386-haiku-tdep.c
+++ b/gdb/i386-haiku-tdep.c
@@ -49,9 +49,7 @@ i386_haiku_osabi_sniffer (bfd *abfd)
return GDB_OSABI_HAIKU;
}
-void _initialize_i386_haiku_tdep ();
-void
-_initialize_i386_haiku_tdep ()
+INIT_GDB_FILE (i386_haiku_tdep)
{
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
i386_haiku_osabi_sniffer);
diff --git a/gdb/solib-haiku.c b/gdb/solib-haiku.c
index 0ec56b5c..588bbc0f 100644
--- a/gdb/solib-haiku.c
+++ b/gdb/solib-haiku.c
@@ -23,9 +23,34 @@
#include "haiku-tdep.h"
#include "inferior.h"
#include "objfiles.h"
+#include "solib.h"
#include "solib-haiku.h"
#include "solib-target.h"
-#include "solist.h"
+
+
+/* solib_ops for Haiku systems. */
+
+struct haiku_solib_ops : public target_solib_ops
+{
+ using target_solib_ops::target_solib_ops;
+
+ void relocate_section_addresses (solib &so, target_section *) const override;
+ void clear_solib (program_space *pspace) const override;
+ void create_inferior_hook (int from_tty) const override;
+ owning_intrusive_list<solib> current_sos () const override;
+ bool open_symbol_file_object (int from_tty) const override;
+ bool in_dynsym_resolve_code (CORE_ADDR pc) const override;
+ gdb_bfd_ref_ptr bfd_open (const char *pathname) const override;
+};
+
+/* See solib-haiku.h. */
+
+solib_ops_up
+make_haiku_solib_ops (program_space *pspace)
+{
+ return std::make_unique<haiku_solib_ops> (pspace);
+}
+
/* For other targets, the solib implementation usually reads hints from the
dynamic linker in the active address space, which could be anything from a
@@ -37,10 +62,10 @@
This is basically a wrapper around solib-target.c. */
-static void
-haiku_relocate_section_addresses (solib &so, struct target_section *sec)
+void
+haiku_solib_ops::relocate_section_addresses (solib &so, struct target_section *sec) const
{
- if (so.so_name == "commpage")
+ if (so.name == "commpage")
{
CORE_ADDR commpage_address = haiku_get_commpage_address ();
sec->addr = commpage_address;
@@ -49,72 +74,55 @@ haiku_relocate_section_addresses (solib &so, struct target_section *sec)
so.addr_low = commpage_address;
so.addr_high = commpage_address + HAIKU_COMMPAGE_SIZE;
}
- else
+ /*else
{
- solib_target_so_ops.relocate_section_addresses (so, sec);
- }
+ solib_target_so_ops::relocate_section_addresses (so, sec);
+ }*/
}
-static void
+/*static void
haiku_clear_so (const solib &so)
{
if (solib_target_so_ops.clear_so != nullptr)
solib_target_so_ops.clear_so (so);
-}
+}*/
-static void
-haiku_clear_solib (program_space *pspace)
+void
+haiku_solib_ops::clear_solib (program_space *pspace) const
{
- if (solib_target_so_ops.clear_solib != nullptr)
- solib_target_so_ops.clear_solib (pspace);
+ target_solib_ops::clear_solib (pspace);
}
-static void
-haiku_solib_create_inferior_hook (int from_tty)
+void
+haiku_solib_ops::create_inferior_hook (int from_tty) const
{
- solib_target_so_ops.solib_create_inferior_hook (from_tty);
+ target_solib_ops::create_inferior_hook (from_tty);
}
-static owning_intrusive_list<solib>
-haiku_current_sos ()
+owning_intrusive_list<solib>
+haiku_solib_ops::current_sos () const
{
- return solib_target_so_ops.current_sos ();
+ return target_solib_ops::current_sos ();
}
-static int
-haiku_open_symbol_file_object (int from_tty)
+bool
+haiku_solib_ops::open_symbol_file_object (int from_tty) const
{
- return solib_target_so_ops.open_symbol_file_object (from_tty);
+ return target_solib_ops::open_symbol_file_object (from_tty);
}
-static int
-haiku_in_dynsym_resolve_code (CORE_ADDR pc)
+bool
+haiku_solib_ops::in_dynsym_resolve_code (CORE_ADDR pc) const
{
/* No dynamic resolving implemented in Haiku yet.
Return what the generic code has to say. */
- return solib_target_so_ops.in_dynsym_resolve_code (pc);
+ return target_solib_ops::in_dynsym_resolve_code (pc);
}
-static gdb_bfd_ref_ptr
-haiku_bfd_open (const char *pathname)
+gdb_bfd_ref_ptr
+haiku_solib_ops::bfd_open (const char *pathname) const
{
if (strcmp (pathname, "commpage") == 0)
return haiku_bfd_open_commpage ();
- return solib_target_so_ops.bfd_open (pathname);
+ return target_solib_ops::bfd_open (pathname);
}
-
-const struct solib_ops haiku_so_ops = {
- .relocate_section_addresses = haiku_relocate_section_addresses,
- .clear_so = haiku_clear_so,
- .clear_solib = haiku_clear_solib,
- .solib_create_inferior_hook = haiku_solib_create_inferior_hook,
- .current_sos = haiku_current_sos,
- .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 bd023f5b..092b2c5b 100644
--- a/gdb/solib-haiku.h
+++ b/gdb/solib-haiku.h
@@ -20,8 +20,10 @@
#ifndef GDB_SOLIB_HAIKU_H
#define GDB_SOLIB_HAIKU_H
-struct solib_ops;
+#include "solib.h"
-extern const struct solib_ops haiku_so_ops;
+/* Return a new solib_ops for Haiku systems. */
+
+extern solib_ops_up make_haiku_solib_ops (program_space *pspace);
#endif /* GDB_SOLIB_HAIKU_H */
--
2.43.0
next prev parent reply other threads:[~2026-03-12 17:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 17:23 [PATCH 0/8] Support for Haiku/x86-64 in GDB Jérôme Duval
2026-03-12 17:23 ` [PATCH 1/8] gdbserver: Initial Haiku support Jérôme Duval
2026-03-12 19:06 ` Kevin Buettner
2026-03-12 17:23 ` [PATCH 2/8] gdb: " Jérôme Duval
2026-03-12 18:31 ` Eli Zaretskii
2026-03-12 17:23 ` [PATCH 3/8] gdb: Update Haiku support for 16.x Jérôme Duval
2026-03-12 17:23 ` [PATCH 4/8] gdbserver: " Jérôme Duval
2026-03-12 17:23 ` Jérôme Duval [this message]
2026-03-12 17:58 ` [PATCH 5/8] gdb: Update Haiku support for 17.x Tom Tromey
2026-03-12 17:23 ` [PATCH 6/8] gdbserver: " Jérôme Duval
2026-03-12 17:23 ` [PATCH 7/8] gdb: Update Haiku support for 18.x Jérôme Duval
2026-03-12 17:23 ` [PATCH 8/8] gdbserver: " Jérôme Duval
2026-03-12 17:37 ` [PATCH 0/8] Support for Haiku/x86-64 in GDB Tom Tromey
[not found] ` <CAPZRpdPY4Uzwu5BinMEDcU=0SQEXU0ca31-p_X_ZOJzdGcobkQ@mail.gmail.com>
2026-03-12 21:42 ` Trung Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260312172336.15450-6-jerome.duval@gmail.com \
--to=jerome.duval@gmail.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox