{
if (m_core_gdbarch != nullptr
&& gdbarch_core_thread_name_p (m_core_gdbarch))
- return gdbarch_core_thread_name (m_core_gdbarch, thr);
+ {
+ bfd *cbfd = current_program_space->core_bfd ();
+ gdb_assert (cbfd != nullptr);
+ return gdbarch_core_thread_name (m_core_gdbarch, *cbfd, thr);
+ }
return NULL;
}
string in a static buffer. */
static const char *
-fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
+fbsd_core_thread_name (struct gdbarch *gdbarch, bfd &cbfd,
+ struct thread_info *thr)
{
static char buf[80];
struct bfd_section *section;
extract the null-terminated name from the start of the
note. */
thread_section_name section_name (".thrmisc", thr->ptid);
- bfd *cbfd = current_program_space->core_bfd ();
- section = bfd_get_section_by_name (cbfd, section_name.c_str ());
+ section = bfd_get_section_by_name (&cbfd, section_name.c_str ());
if (section != NULL && bfd_section_size (section) > 0)
{
/* Truncate the name if it is longer than "buf". */
size = bfd_section_size (section);
if (size > sizeof buf - 1)
size = sizeof buf - 1;
- if (bfd_get_section_contents (cbfd, section, buf, (file_ptr) 0, size)
+ if (bfd_get_section_contents (&cbfd, section, buf, (file_ptr) 0, size)
&& buf[0] != '\0')
{
buf[size] = '\0';
as its thread name instead of an empty name if a name
has not been set explicitly. Return a NULL name in
that case. */
- if (strcmp (buf, elf_tdata (cbfd)->core->program) != 0)
+ if (strcmp (buf, elf_tdata (&cbfd)->core->program) != 0)
return buf;
}
}
}
const char *
-gdbarch_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
+gdbarch_core_thread_name (struct gdbarch *gdbarch, struct bfd &cbfd, struct thread_info *thr)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->core_thread_name != NULL);
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_core_thread_name called\n");
- return gdbarch->core_thread_name (gdbarch, thr);
+ return gdbarch->core_thread_name (gdbarch, cbfd, thr);
}
void
extern std::string gdbarch_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid);
extern void set_gdbarch_core_pid_to_str (struct gdbarch *gdbarch, gdbarch_core_pid_to_str_ftype *core_pid_to_str);
-/* How the core target extracts the name of a thread from a core file. */
+/* How the core target extracts the name of a thread from core file CBFD. */
extern bool gdbarch_core_thread_name_p (struct gdbarch *gdbarch);
-typedef const char * (gdbarch_core_thread_name_ftype) (struct gdbarch *gdbarch, struct thread_info *thr);
-extern const char * gdbarch_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr);
+typedef const char * (gdbarch_core_thread_name_ftype) (struct gdbarch *gdbarch, struct bfd &cbfd, struct thread_info *thr);
+extern const char * gdbarch_core_thread_name (struct gdbarch *gdbarch, struct bfd &cbfd, struct thread_info *thr);
extern void set_gdbarch_core_thread_name (struct gdbarch *gdbarch, gdbarch_core_thread_name_ftype *core_thread_name);
/* Read offset OFFSET of TARGET_OBJECT_SIGNAL_INFO signal information
Method(
comment="""
-How the core target extracts the name of a thread from a core file.
+How the core target extracts the name of a thread from core file CBFD.
""",
type="const char *",
name="core_thread_name",
- params=[("struct thread_info *", "thr")],
+ params=[("struct bfd &", "cbfd"), ("struct thread_info *", "thr")],
predicate=True,
)