diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2008-08-05 22:13:23 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2008-08-05 22:13:23 +0000 |
commit | 3221518cf232554d249736f83cf728df8942c68d (patch) | |
tree | 9ac03ff8818853583906ca3911733b24f7d687f8 /gdb | |
parent | fb6d93b2a9f208a8f521f84ea18b2e9acb776dc3 (diff) | |
download | gdb-3221518cf232554d249736f83cf728df8942c68d.zip gdb-3221518cf232554d249736f83cf728df8942c68d.tar.gz gdb-3221518cf232554d249736f83cf728df8942c68d.tar.bz2 |
* linux-low.c (linux_resume_one_process): Ignore ESRCH.
(usr_store_inferior_registers): Likewise.
(regsets_store_inferior_registers): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/gdbserver/linux-low.c | 27 |
2 files changed, 33 insertions, 1 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index df51593..715cc9f 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,10 @@ +2008-08-05 Ulrich Weigand <uweigand@de.ibm.com> + Daniel Jacobowitz <dan@codesourcery.com> + + * linux-low.c (linux_resume_one_process): Ignore ESRCH. + (usr_store_inferior_registers): Likewise. + (regsets_store_inferior_registers): Likewise. + 2008-07-31 Rolf Jansen <rj@surtec.com> Pedro Alves <pedro@codesourcery.com> diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index fe4cd97..722953e 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -1193,7 +1193,19 @@ linux_resume_one_process (struct inferior_list_entry *entry, current_inferior = saved_inferior; if (errno) - perror_with_name ("ptrace"); + { + /* ESRCH from ptrace either means that the thread was already + running (an error) or that it is gone (a race condition). If + it's gone, we will get a notification the next time we wait, + so we can ignore the error. We could differentiate these + two, but it's tricky without waiting; the thread still exists + as a zombie, so sending it signal 0 would succeed. So just + ignore ESRCH. */ + if (errno == ESRCH) + return; + + perror_with_name ("ptrace"); + } } static struct thread_resume *resume_ptr; @@ -1462,6 +1474,12 @@ usr_store_inferior_registers (int regno) *(PTRACE_XFER_TYPE *) (buf + i)); if (errno != 0) { + /* At this point, ESRCH should mean the process is already gone, + in which case we simply ignore attempts to change its registers. + See also the related comment in linux_resume_one_process. */ + if (errno == ESRCH) + return; + if ((*the_low_target.cannot_store_register) (regno) == 0) { char *err = strerror (errno); @@ -1578,6 +1596,13 @@ regsets_store_inferior_registers () disabled_regsets[regset - target_regsets] = 1; continue; } + else if (errno == ESRCH) + { + /* At this point, ESRCH should mean the process is already gone, + in which case we simply ignore attempts to change its registers. + See also the related comment in linux_resume_one_process. */ + return 0; + } else { perror ("Warning: ptrace(regsets_store_inferior_registers)"); |