1 /* Machine independent support for SVR4 /proc (process file system) for GDB.
2 Copyright (C) 1999-2000, 2007-2012 Free Software Foundation, Inc.
3 Written by Michael Snyder at Cygnus Solutions.
4 Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 * Pretty-print the prstatus flags.
24 * Arguments: unsigned long flags, int verbose
30 #if defined (NEW_PROC_API)
31 #define _STRUCTURED_PROC 1
35 #include <sys/types.h>
36 #include <sys/procfs.h>
38 #include "proc-utils.h"
40 /* Much of the information used in the /proc interface, particularly for
41 printing status information, is kept as tables of structures of the
42 following form. These tables can be used to map numeric values to
43 their symbolic names and to a string that describes their specific use. */
46 int value
; /* The numeric value */
47 char *name
; /* The equivalent symbolic value */
48 char *desc
; /* Short description of value */
51 /* Translate bits in the pr_flags member of the prstatus structure,
52 into the names and desc information. */
54 static struct trans pr_flag_table
[] =
56 #if defined (PR_STOPPED)
57 /* Sol2.5: lwp is stopped
58 * Sol2.6: lwp is stopped
59 * Sol2.7: lwp is stopped
60 * IRIX6: process is stopped
61 * OSF: task/thread is stopped
64 { PR_STOPPED
, "PR_STOPPED", "Process (LWP) is stopped" },
66 #if defined (PR_ISTOP)
67 /* Sol2.5: lwp is stopped on an event of interest
68 * Sol2.6: lwp is stopped on an event of interest
69 * Sol2.7: lwp is stopped on an event of interest
70 * IRIX6: process is stopped on event of interest
71 * OSF: task/thread stopped on event of interest
72 * UW: LWP stopped on an event of interest
74 { PR_ISTOP
, "PR_ISTOP", "Stopped on an event of interest" },
76 #if defined (PR_DSTOP)
77 /* Sol2.5: lwp has a stop directive in effect
78 * Sol2.6: lwp has a stop directive in effect
79 * Sol2.7: lwp has a stop directive in effect
80 * IRIX6: process has stop directive in effect
81 * OSF: task/thread has stop directive in effect
82 * UW: A stop directive is in effect
84 { PR_DSTOP
, "PR_DSTOP", "A stop directive is in effect" },
87 /* Sol2.5: lwp has a single-step directive in effect
88 * Sol2.6: lwp has a single-step directive in effect
89 * Sol2.7: lwp has a single-step directive in effect
90 * IRIX6: process has single step pending
92 { PR_STEP
, "PR_STEP", "A single step directive is in effect" },
94 #if defined (PR_ASLEEP)
95 /* Sol2.5: lwp is sleeping in a system call
96 * Sol2.6: lwp is sleeping in a system call
97 * Sol2.7: lwp is sleeping in a system call
98 * IRIX6: process is in an interruptible sleep
99 * OSF: task/thread is asleep within a system call
100 * UW: LWP is sleep()ing in a system call
102 { PR_ASLEEP
, "PR_ASLEEP", "Sleeping in an (interruptible) system call" },
104 #if defined (PR_PCINVAL)
105 /* Sol2.5: contents of pr_instr undefined
106 * Sol2.6: contents of pr_instr undefined
107 * Sol2.7: contents of pr_instr undefined
108 * IRIX6: current pc is invalid
109 * OSF: program counter contains invalid address
110 * UW: %pc refers to an invalid virtual address
112 { PR_PCINVAL
, "PR_PCINVAL", "PC (pr_instr) is invalid" },
114 #if defined (PR_ASLWP)
115 /* Sol2.5: this lwp is the aslwp
116 * Sol2.6: this lwp is the aslwp
117 * Sol2.7: this lwp is the aslwp
119 { PR_ASLWP
, "PR_ASLWP", "This is the asynchronous signal LWP" },
121 #if defined (PR_AGENT)
122 /* Sol2.6: this lwp is the /proc agent lwp
123 * Sol2.7: this lwp is the /proc agent lwp
125 { PR_AGENT
, "PR_AGENT", "This is the /proc agent LWP" },
127 #if defined (PR_ISSYS)
128 /* Sol2.5: system process
129 * Sol2.6: this is a system process
130 * Sol2.7: this is a system process
131 * IRIX6: process is a system process
132 * OSF: task/thread is a system task/thread
135 { PR_ISSYS
, "PR_ISSYS", "Is a system process/thread" },
137 #if defined (PR_VFORKP)
138 /* Sol2.6: process is the parent of a vfork()d child
139 * Sol2.7: process is the parent of a vfork()d child
141 { PR_VFORKP
, "PR_VFORKP", "Process is the parent of a vforked child" },
144 /* Sol2.6: process's process group is orphaned
145 * Sol2.7: process's process group is orphaned
147 { PR_ORPHAN
, "PR_ORPHAN", "Process's process group is orphaned" },
149 #if defined (PR_FORK)
150 /* Sol2.5: inherit-on-fork is in effect
151 * Sol2.6: inherit-on-fork is in effect
152 * Sol2.7: inherit-on-fork is in effect
153 * IRIX6: process has inherit-on-fork flag set
154 * OSF: task/thread has inherit-on-fork flag set
155 * UW: inherit-on-fork is in effect
157 { PR_FORK
, "PR_FORK", "Inherit-on-fork is in effect" },
160 /* Sol2.5: run-on-last-close is in effect
161 * Sol2.6: run-on-last-close is in effect
162 * Sol2.7: run-on-last-close is in effect
163 * IRIX6: process has run-on-last-close flag set
164 * OSF: task/thread has run-on-last-close flag set
165 * UW: Run-on-last-close is in effect
167 { PR_RLC
, "PR_RLC", "Run-on-last-close is in effect" },
170 /* Sol2.5: kill-on-last-close is in effect
171 * Sol2.6: kill-on-last-close is in effect
172 * Sol2.7: kill-on-last-close is in effect
173 * IRIX6: process has kill-on-last-close flag set
174 * OSF: kill-on-last-close, superceeds RLC
175 * UW: kill-on-last-close is in effect
177 { PR_KLC
, "PR_KLC", "Kill-on-last-close is in effect" },
179 #if defined (PR_ASYNC)
180 /* Sol2.5: asynchronous-stop is in effect
181 * Sol2.6: asynchronous-stop is in effect
182 * Sol2.7: asynchronous-stop is in effect
183 * OSF: asynchronous stop mode is in effect
184 * UW: asynchronous stop mode is in effect
186 { PR_ASYNC
, "PR_ASYNC", "Asynchronous stop is in effect" },
188 #if defined (PR_MSACCT)
189 /* Sol2.5: micro-state usage accounting is in effect
190 * Sol2.6: micro-state usage accounting is in effect
191 * Sol2.7: micro-state usage accounting is in effect
193 { PR_MSACCT
, "PR_MSACCT", "Microstate accounting enabled" },
195 #if defined (PR_BPTADJ)
196 /* Sol2.5: breakpoint trap pc adjustment is in effect
197 * Sol2.6: breakpoint trap pc adjustment is in effect
198 * Sol2.7: breakpoint trap pc adjustment is in effect
200 { PR_BPTADJ
, "PR_BPTADJ", "Breakpoint PC adjustment in effect" },
202 #if defined (PR_PTRACE)
203 /* Note: different meanings on Solaris and Irix 6
204 * Sol2.5: obsolete, never set in SunOS5.0
205 * Sol2.6: ptrace-compatibility mode is in effect
206 * Sol2.7: ptrace-compatibility mode is in effect
207 * IRIX6: process is traced with ptrace() too
208 * OSF: task/thread is being traced by ptrace
209 * UW: Process is being controlled by ptrace(2)
211 { PR_PTRACE
, "PR_PTRACE", "Process is being controlled by ptrace" },
213 #if defined (PR_PCOMPAT)
214 /* Note: PCOMPAT on Sol2.5 means same thing as PTRACE on Sol2.6
215 * Sol2.5 (only): ptrace-compatibility mode is in effect
217 { PR_PCOMPAT
, "PR_PCOMPAT", "Ptrace compatibility mode in effect" },
220 /* Sol2.6: micro-state accounting inherited on fork
221 * Sol2.7: micro-state accounting inherited on fork
223 { PR_MSFORK
, "PR_PCOMPAT", "Micro-state accounting inherited on fork" },
227 /* Irix6: process is a kernel thread */
228 { PR_ISKTHREAD
, "PR_KTHREAD", "Process is a kernel thread" },
232 /* OSF (only): abort the current stop condition */
233 { PR_ABORT
, "PR_ABORT", "Abort the current stop condition" },
237 /* OSF: task is traced */
238 { PR_TRACING
, "PR_TRACING", "Task is traced" },
242 /* OSF: stop child on fork */
243 { PR_STOPFORK
, "PR_STOPFORK", "Stop child on fork" },
247 /* OSF: stop on exec */
248 { PR_STOPEXEC
, "PR_STOPEXEC", "Stop on exec" },
252 /* OSF: stop on task exit */
253 { PR_STOPTERM
, "PR_STOPTERM", "Stop on task exit" },
257 /* OSF: stop on thread creation */
258 { PR_STOPTCR
, "PR_STOPTCR", "Stop on thread creation" },
262 /* OSF: stop on thread exit */
263 { PR_STOPTTERM
, "PR_STOPTTERM", "Stop on thread exit" },
267 /* OSF: user level scheduling is in effect */
268 { PR_USCHED
, "PR_USCHED", "User level scheduling is in effect" },
273 proc_prettyfprint_flags (FILE *file
, unsigned long flags
, int verbose
)
277 for (i
= 0; i
< sizeof (pr_flag_table
) / sizeof (pr_flag_table
[0]); i
++)
278 if (flags
& pr_flag_table
[i
].value
)
280 fprintf (file
, "%s ", pr_flag_table
[i
].name
);
282 fprintf (file
, "%s\n", pr_flag_table
[i
].desc
);
285 fprintf (file
, "\n");
289 proc_prettyprint_flags (unsigned long flags
, int verbose
)
291 proc_prettyfprint_flags (stdout
, flags
, verbose
);
This page took 0.036505 seconds and 4 git commands to generate.