diff options
author | Kevin Buettner <kevinb@redhat.com> | 2001-05-04 04:15:33 +0000 |
---|---|---|
committer | Kevin Buettner <kevinb@redhat.com> | 2001-05-04 04:15:33 +0000 |
commit | 39f770628a4eaf018fec8d55684bf2ec16ada9cc (patch) | |
tree | 69027cfb7df2ecc521ab2cc1d25a7dd6cbe56632 /gdb/i386-linux-nat.c | |
parent | b1af961c8433821f61dd1849cff9eb9a8bb974e8 (diff) | |
download | gdb-39f770628a4eaf018fec8d55684bf2ec16ada9cc.zip gdb-39f770628a4eaf018fec8d55684bf2ec16ada9cc.tar.gz gdb-39f770628a4eaf018fec8d55684bf2ec16ada9cc.tar.bz2 |
Phase 1 of the ptid_t changes.
Diffstat (limited to 'gdb/i386-linux-nat.c')
-rw-r--r-- | gdb/i386-linux-nat.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index 114e4ce..eb222fd 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -63,7 +63,7 @@ static void dummy_sse_values (void); /* On Linux, threads are implemented as pseudo-processes, in which case we may be tracing more than one process at a time. In that - case, inferior_pid will contain the main process ID and the + case, inferior_ptid will contain the main process ID and the individual thread (process) ID mashed together. These macros are used to separate them out. These definitions should be overridden if thread support is included. */ @@ -198,8 +198,8 @@ fetch_register (int regno) } /* Overload thread id onto process id */ - if ((tid = TIDGET (inferior_pid)) == 0) - tid = inferior_pid; /* no thread id, just use process id */ + if ((tid = TIDGET (inferior_ptid)) == 0) + tid = PIDGET (inferior_ptid); /* no thread id, just use process id */ offset = U_REGS_OFFSET; @@ -261,8 +261,8 @@ store_register (int regno) } /* Overload thread id onto process id */ - if ((tid = TIDGET (inferior_pid)) == 0) - tid = inferior_pid; /* no thread id, just use process id */ + if ((tid = TIDGET (inferior_ptid)) == 0) + tid = PIDGET (inferior_ptid); /* no thread id, just use process id */ offset = U_REGS_OFFSET; @@ -597,8 +597,8 @@ fetch_inferior_registers (int regno) } /* Linux LWP ID's are process ID's. */ - if ((tid = TIDGET (inferior_pid)) == 0) - tid = inferior_pid; /* Not a threaded program. */ + if ((tid = TIDGET (inferior_ptid)) == 0) + tid = PIDGET (inferior_ptid); /* Not a threaded program. */ /* Use the PTRACE_GETFPXREGS request whenever possible, since it transfers more registers in one system call, and we'll cache the @@ -663,8 +663,8 @@ store_inferior_registers (int regno) } /* Linux LWP ID's are process ID's. */ - if ((tid = TIDGET (inferior_pid)) == 0) - tid = inferior_pid; /* Not a threaded program. */ + if ((tid = TIDGET (inferior_ptid)) == 0) + tid = PIDGET (inferior_ptid); /* Not a threaded program. */ /* Use the PTRACE_SETFPXREGS requests whenever possible, since it transfers more registers in one system call. But remember that @@ -710,7 +710,7 @@ i386_linux_dr_get (int regnum) /* FIXME: kettenis/2001-01-29: It's not clear what we should do with multi-threaded processes here. For now, pretend there is just one thread. */ - tid = PIDGET (inferior_pid); + tid = PIDGET (inferior_ptid); /* FIXME: kettenis/2001-03-27: Calling perror_with_name if the ptrace call fails breaks debugging remote targets. The correct @@ -738,7 +738,7 @@ i386_linux_dr_set (int regnum, unsigned long value) /* FIXME: kettenis/2001-01-29: It's not clear what we should do with multi-threaded processes here. For now, pretend there is just one thread. */ - tid = PIDGET (inferior_pid); + tid = PIDGET (inferior_ptid); errno = 0; ptrace (PT_WRITE_U, tid, @@ -879,19 +879,21 @@ static const unsigned char linux_syscall[] = { 0xcd, 0x80 }; If SIGNAL is nonzero, give it that signal. */ void -child_resume (int pid, int step, enum target_signal signal) +child_resume (ptid_t ptid, int step, enum target_signal signal) { + int pid = PIDGET (ptid); + int request = PTRACE_CONT; if (pid == -1) /* Resume all threads. */ /* I think this only gets used in the non-threaded case, where "resume - all threads" and "resume inferior_pid" are the same. */ - pid = inferior_pid; + all threads" and "resume inferior_ptid" are the same. */ + pid = PIDGET (inferior_ptid); if (step) { - CORE_ADDR pc = read_pc_pid (pid); + CORE_ADDR pc = read_pc_pid (pid_to_ptid (pid)); unsigned char buf[LINUX_SYSCALL_LEN]; request = PTRACE_SINGLESTEP; @@ -908,7 +910,8 @@ child_resume (int pid, int step, enum target_signal signal) if (read_memory_nobpt (pc, (char *) buf, LINUX_SYSCALL_LEN) == 0 && memcmp (buf, linux_syscall, LINUX_SYSCALL_LEN) == 0) { - int syscall = read_register_pid (LINUX_SYSCALL_REGNUM, pid); + int syscall = read_register_pid (LINUX_SYSCALL_REGNUM, + pid_to_ptid (pid)); /* Then check the system call number. */ if (syscall == SYS_sigreturn || syscall == SYS_rt_sigreturn) |