diff options
author | Joel Brobecker <brobecker@gnat.com> | 2011-07-01 18:36:12 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2011-07-01 18:36:12 +0000 |
commit | 5e9bc145ee7e5d1e5651a996bcf81d9888b34cf1 (patch) | |
tree | e420d8c9edfddcb21728b8db9294979dee099e43 | |
parent | 00eb2c4ae81736e51d2bac0fbab4f8b04ab3d319 (diff) | |
download | gdb-5e9bc145ee7e5d1e5651a996bcf81d9888b34cf1.zip gdb-5e9bc145ee7e5d1e5651a996bcf81d9888b34cf1.tar.gz gdb-5e9bc145ee7e5d1e5651a996bcf81d9888b34cf1.tar.bz2 |
Darwin/detach: Do not resume inferior after ptrace detach
When trying to detach from an inferior that we start from the debugger,
GDB prints the following warning:
(gdb) detach
Detaching from program: /[...]/foo, process 74593
warning: Mach error at "/[...]/darwin-nat.c:445" in function "darwin_resume_inferior": (os/kern) failure (0x5)
The warning comes from the following code in darwin_detach:
darwin_resume_inferior (inf);
This is because the process has already been resumed by the
PT_DETACH ptrace operation that has just been performed.
On the other hand, when trying to detach from an inferior that
was started outside of debugger control (thus after having attached
the debugger to that inferior), things go smoothly. That's because
we don't use ptrace to control the process in that case, and so
the resume is perfectly justified.
This patch makes sure that we resume the inferior during the detach
only when we're NOT using ptrace.
gdb/ChangeLog:
* darwin-nat.c (darwin_detach): Call darwin_resume_inferior
only when inf->private->no_ptrace.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/darwin-nat.c | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index eacb247..423ada3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2011-07-01 Joel Brobecker <brobecker@adacore.com> + * darwin-nat.c (darwin_detach): Call darwin_resume_inferior + only when inf->private->no_ptrace. + +2011-07-01 Joel Brobecker <brobecker@adacore.com> + * ada-lang.c (print_it_exception): Print temporary catchpoints as "Temporary catchpoint". (print_mention_exception): Likewise. diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index 7be85d5..fc5263a 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -1601,7 +1601,11 @@ darwin_detach (struct target_ops *ops, char *args, int from_tty) darwin_reply_to_all_pending_messages (inf); - darwin_resume_inferior (inf); + /* When using ptrace, we have just performed a PT_DETACH, which + resumes the inferior. On the other hand, when we are not using + ptrace, we need to resume its execution ourselves. */ + if (inf->private->no_ptrace) + darwin_resume_inferior (inf); darwin_mourn_inferior (ops); } |