Commit | Line | Data |
---|---|---|
5f572dec JK |
1 | /* Linux-specific ptrace manipulation routines. |
2 | Copyright (C) 2012 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GDB. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 3 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
18 | ||
19 | #ifdef GDBSERVER | |
20 | #include "server.h" | |
21 | #else | |
22 | #include "defs.h" | |
23 | #include "gdb_string.h" | |
24 | #endif | |
25 | ||
26 | #include "linux-ptrace.h" | |
87b0bb13 JK |
27 | #include "linux-procfs.h" |
28 | #include "buffer.h" | |
29 | ||
30 | /* Find all possible reasons we could fail to attach PID and append these | |
31 | newline terminated reason strings to initialized BUFFER. '\0' termination | |
32 | of BUFFER must be done by the caller. */ | |
33 | ||
34 | void | |
35 | linux_ptrace_attach_warnings (pid_t pid, struct buffer *buffer) | |
36 | { | |
37 | pid_t tracerpid; | |
38 | ||
39 | tracerpid = linux_proc_get_tracerpid (pid); | |
40 | if (tracerpid > 0) | |
41 | buffer_xml_printf (buffer, _("warning: process %d is already traced " | |
42 | "by process %d\n"), | |
43 | (int) pid, (int) tracerpid); | |
44 | ||
45 | if (linux_proc_pid_is_zombie (pid)) | |
46 | buffer_xml_printf (buffer, _("warning: process %d is a zombie " | |
47 | "- the process has already terminated\n"), | |
48 | (int) pid); | |
49 | } |