/* BSD user-level threads support.
- Copyright (C) 2005-2020 Free Software Foundation, Inc.
+ Copyright (C) 2005-2022 Free Software Foundation, Inc.
This file is part of GDB.
#include "symfile.h"
#include "target.h"
-#include "gdb_obstack.h"
+#include "gdbsupport/gdb_obstack.h"
#include "bsd-uthread.h"
bsd_uthread_thread_ctx_offset =
bsd_uthread_lookup_offset ("_thread_ctx_offset", objfile);
- push_target (&bsd_uthread_ops);
+ current_inferior ()->push_target (&bsd_uthread_ops);
bsd_uthread_active = 1;
return 1;
}
if (!bsd_uthread_active)
return;
- unpush_target (&bsd_uthread_ops);
+ current_inferior ()->unpush_target (&bsd_uthread_ops);
}
static void
else
{
/* Updating the thread that is currently running; pass the
- request to the layer beneath. */
+ request to the layer beneath. */
beneath ()->store_registers (regcache, regnum);
}
}
/* If the process is no longer alive, there's no point in figuring
out the thread ID. It will fail anyway. */
- if (status->kind == TARGET_WAITKIND_SIGNALLED
- || status->kind == TARGET_WAITKIND_EXITED)
+ if (status->kind () == TARGET_WAITKIND_SIGNALLED
+ || status->kind () == TARGET_WAITKIND_EXITED)
return ptid;
/* Fetch the corresponding thread ID, and augment the returned
gdb_byte buf[4];
/* FIXME: For executables linked statically with the threads
- library, we end up here before the program has actually been
- executed. In that case ADDR will be garbage since it has
- been read from the wrong virtual memory image. */
+ library, we end up here before the program has actually been
+ executed. In that case ADDR will be garbage since it has
+ been read from the wrong virtual memory image. */
if (target_read_memory (addr, buf, 4) == 0)
{
ULONGEST magic = extract_unsigned_integer (buf, 4, byte_order);
bsd_uthread_target::pid_to_str (ptid_t ptid)
{
if (ptid.tid () != 0)
- return string_printf ("process %d, thread 0x%lx",
- ptid.pid (), ptid.tid ());
+ return string_printf ("process %d, thread 0x%s",
+ ptid.pid (),
+ phex_nz (ptid.tid (), sizeof (ULONGEST)));
return normal_pid_to_str (ptid);
}
{
bsd_uthread_data = gdbarch_data_register_pre_init (bsd_uthread_init);
- gdb::observers::inferior_created.attach (bsd_uthread_inferior_created);
- gdb::observers::solib_loaded.attach (bsd_uthread_solib_loaded);
- gdb::observers::solib_unloaded.attach (bsd_uthread_solib_unloaded);
+ gdb::observers::inferior_created.attach (bsd_uthread_inferior_created,
+ "bsd-uthread");
+ gdb::observers::solib_loaded.attach (bsd_uthread_solib_loaded,
+ "bsd-uthread");
+ gdb::observers::solib_unloaded.attach (bsd_uthread_solib_unloaded,
+ "bsd-uthread");
}