/* Defines ps_err_e, struct ps_prochandle. */
#include "gdb_proc_service.h"
+#include "inf-ptrace.h"
+
#ifndef PTRACE_GET_THREAD_AREA
#define PTRACE_GET_THREAD_AREA 25
#endif
struct gdbarch *gdbarch = get_regcache_arch (regcache);
long regaddr, val;
int i;
- gdb_byte buf[MAX_REGISTER_SIZE];
- int tid;
-
- /* Overload thread id onto process id. */
- tid = ptid_get_lwp (inferior_ptid);
- if (tid == 0)
- tid = ptid_get_pid (inferior_ptid); /* no thread id, just use
- process id. */
+ gdb_byte buf[M68K_MAX_REGISTER_SIZE];
+ pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
regaddr = 4 * regmap[regno];
for (i = 0; i < register_size (gdbarch, regno); i += sizeof (long))
struct gdbarch *gdbarch = get_regcache_arch (regcache);
long regaddr, val;
int i;
- int tid;
- gdb_byte buf[MAX_REGISTER_SIZE];
-
- /* Overload thread id onto process id. */
- tid = ptid_get_lwp (inferior_ptid);
- if (tid == 0)
- tid = ptid_get_pid (inferior_ptid); /* no thread id, just use
- process id. */
+ gdb_byte buf[M68K_MAX_REGISTER_SIZE];
+ pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
regaddr = 4 * regmap[regno];
m68k_linux_fetch_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int regno)
{
- int tid;
+ pid_t tid;
/* Use the old method of peeking around in `struct user' if the
GETREGS request isn't available. */
return;
}
- /* GNU/Linux LWP ID's are process ID's. */
- tid = ptid_get_lwp (inferior_ptid);
- if (tid == 0)
- tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
+ tid = get_ptrace_pid (regcache_get_ptid (regcache));
/* Use the PTRACE_GETFPXREGS request whenever possible, since it
transfers more registers in one system call, and we'll cache the
m68k_linux_store_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int regno)
{
- int tid;
+ pid_t tid;
/* Use the old method of poking around in `struct user' if the
SETREGS request isn't available. */
return;
}
- /* GNU/Linux LWP ID's are process ID's. */
- tid = ptid_get_lwp (inferior_ptid);
- if (tid == 0)
- tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
+ tid = get_ptrace_pid (regcache_get_ptid (regcache));
/* Use the PTRACE_SETFPREGS requests whenever possible, since it
transfers more registers in one system call. But remember that