2005-11-08 Kevin Buettner <kevinb@redhat.com>
+ * linux-target.c (am33_singlestep_okay): Use `pid', not
+ `process->pid' when reading and writing memory since the
+ latter may refer to an already running thread.
+
+2005-11-08 Kevin Buettner <kevinb@redhat.com>
+
* diagnostics.h: New file.
* gdbserv-thread-db.h (debug_get_pc): Move declaration to new
file diagnostics.h.
int displ;
static char bp_inst = 0xff;
static int hw_singlestep_okay = 1;
+ pid_t save_pid;
if (hw_singlestep_okay)
{
/* Fall through into software singlestep code. */
}
+ /* In a multi-threaded program, process->pid might be a running thread
+ and we can't read / write into running threads. So set process->pid
+ to the lwp. */
+ save_pid = process->pid;
+ process->pid = pid;
+
pc = am33_get_register (serv, pid, PC_REGNUM);
opcode = am33_read_byte (serv, pc);
if (errno)
fprintf (stderr, "PTRACE_CONT (am33) error: %s in %d\n",
strerror (errno), pid);
+
+ /* Restore the saved pid. */
+ process->pid = save_pid;
}
#endif