diff options
author | Mark Kettenis <kettenis@gnu.org> | 2004-09-25 12:32:01 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2004-09-25 12:32:01 +0000 |
commit | 6e1e94ea268a2f8a21319645c7feaec18ffe2f66 (patch) | |
tree | 55bac5e86aed3c117212effc5b58438903437db5 /gdb/inf-ptrace.c | |
parent | 8b9cf735409903b446ab3fd11960104e4d948dee (diff) | |
download | gdb-6e1e94ea268a2f8a21319645c7feaec18ffe2f66.zip gdb-6e1e94ea268a2f8a21319645c7feaec18ffe2f66.tar.gz gdb-6e1e94ea268a2f8a21319645c7feaec18ffe2f66.tar.bz2 |
* inf-ptrace.c (inf_ptrace_attach): Remove redundant parenthesis.
Inline attach call.
(inf_ptrace_detach): Inline detach call.
Diffstat (limited to 'gdb/inf-ptrace.c')
-rw-r--r-- | gdb/inf-ptrace.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index 234c26b..f0da821 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -336,7 +336,7 @@ inf_ptrace_attach (char *args, int from_tty) dummy = args; pid = strtol (args, &dummy, 0); /* Some targets don't set errno on errors, grrr! */ - if ((pid == 0) && (args == dummy)) + if (pid == 0 && args == dummy) error ("Illegal process-id: %s\n", args); if (pid == getpid ()) /* Trying to masturbate? */ @@ -356,7 +356,15 @@ inf_ptrace_attach (char *args, int from_tty) gdb_flush (gdb_stdout); } - attach (pid); +#ifdef PT_ATTACH + errno = 0; + ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3) 0, 0); + if (errno != 0) + perror_with_name ("ptrace"); + attach_flag = 1; +#else + error ("This system does not support attaching to a process"); +#endif inferior_ptid = pid_to_ptid (pid); push_target (ptrace_ops_hack); @@ -379,7 +387,7 @@ inf_ptrace_post_attach (int pid) static void inf_ptrace_detach (char *args, int from_tty) { - int siggnal = 0; + int sig = 0; int pid = PIDGET (inferior_ptid); if (from_tty) @@ -392,9 +400,17 @@ inf_ptrace_detach (char *args, int from_tty) gdb_flush (gdb_stdout); } if (args) - siggnal = atoi (args); + sig = atoi (args); - detach (siggnal); +#ifdef PT_DETACH + errno = 0; + ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3) 1, sig); + if (errno != 0) + perror_with_name ("ptrace"); + attach_flag = 0; +#else + error ("This system does not support detaching from a process"); +#endif inferior_ptid = null_ptid; unpush_target (ptrace_ops_hack); |