OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [proc-flags.c] - Blame information for rev 862

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
/* Machine independent support for SVR4 /proc (process file system) for GDB.
2
   Copyright (C) 1999, 2000, 2007, 2008, 2009, 2010
3
   Free Software Foundation, Inc.
4
   Written by Michael Snyder at Cygnus Solutions.
5
   Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
6
 
7
   This file is part of GDB.
8
 
9
   This program is free software; you can redistribute it and/or modify
10
   it under the terms of the GNU General Public License as published by
11
   the Free Software Foundation; either version 3 of the License, or
12
   (at your option) any later version.
13
 
14
   This program is distributed in the hope that it will be useful,
15
   but WITHOUT ANY WARRANTY; without even the implied warranty of
16
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
   GNU General Public License for more details.
18
 
19
   You should have received a copy of the GNU General Public License
20
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21
 
22
/*
23
 * Pretty-print the prstatus flags.
24
 *
25
 * Arguments: unsigned long flags, int verbose
26
 *
27
 */
28
 
29
#include "defs.h"
30
 
31
#if defined (NEW_PROC_API)
32
#define _STRUCTURED_PROC 1
33
#endif
34
 
35
#include <stdio.h>
36
#include <sys/types.h>
37
#include <sys/procfs.h>
38
 
39
/*  Much of the information used in the /proc interface, particularly for
40
    printing status information, is kept as tables of structures of the
41
    following form.  These tables can be used to map numeric values to
42
    their symbolic names and to a string that describes their specific use. */
43
 
44
struct trans {
45
  int value;                    /* The numeric value */
46
  char *name;                   /* The equivalent symbolic value */
47
  char *desc;                   /* Short description of value */
48
};
49
 
50
/* Translate bits in the pr_flags member of the prstatus structure,
51
   into the names and desc information. */
52
 
53
static struct trans pr_flag_table[] =
54
{
55
#if defined (PR_STOPPED)
56
  /* Sol2.5: lwp is stopped
57
   * Sol2.6: lwp is stopped
58
   * Sol2.7: lwp is stopped
59
   * IRIX6:  process is stopped
60
   * OSF:    task/thread is stopped
61
   * UW:     LWP is stopped
62
   */
63
  { PR_STOPPED, "PR_STOPPED", "Process (LWP) is stopped" },
64
#endif
65
#if defined (PR_ISTOP)
66
  /* Sol2.5: lwp is stopped on an event of interest
67
   * Sol2.6: lwp is stopped on an event of interest
68
   * Sol2.7: lwp is stopped on an event of interest
69
   * IRIX6:  process is stopped on event of interest
70
   * OSF:    task/thread stopped on event of interest
71
   * UW:     LWP stopped on an event of interest
72
   */
73
  { PR_ISTOP, "PR_ISTOP", "Stopped on an event of interest" },
74
#endif
75
#if defined (PR_DSTOP)
76
  /* Sol2.5: lwp has a stop directive in effect
77
   * Sol2.6: lwp has a stop directive in effect
78
   * Sol2.7: lwp has a stop directive in effect
79
   * IRIX6:  process has stop directive in effect
80
   * OSF:    task/thread has stop directive in effect
81
   * UW:     A stop directive is in effect
82
   */
83
  { PR_DSTOP, "PR_DSTOP", "A stop directive is in effect" },
84
#endif
85
#if defined (PR_STEP)
86
  /* Sol2.5: lwp has a single-step directive in effect
87
   * Sol2.6: lwp has a single-step directive in effect
88
   * Sol2.7: lwp has a single-step directive in effect
89
   * IRIX6:  process has single step pending
90
   */
91
  { PR_STEP, "PR_STEP", "A single step directive is in effect" },
92
#endif
93
#if defined (PR_ASLEEP)
94
  /* Sol2.5: lwp is sleeping in a system call
95
   * Sol2.6: lwp is sleeping in a system call
96
   * Sol2.7: lwp is sleeping in a system call
97
   * IRIX6:  process is in an interruptible sleep
98
   * OSF:    task/thread is asleep within a system call
99
   * UW:     LWP is sleep()ing in a system call
100
   */
101
  { PR_ASLEEP, "PR_ASLEEP", "Sleeping in an (interruptible) system call" },
102
#endif
103
#if defined (PR_PCINVAL)
104
  /* Sol2.5: contents of pr_instr undefined
105
   * Sol2.6: contents of pr_instr undefined
106
   * Sol2.7: contents of pr_instr undefined
107
   * IRIX6:  current pc is invalid
108
   * OSF:    program counter contains invalid address
109
   * UW:     %pc refers to an invalid virtual address
110
   */
111
  { PR_PCINVAL, "PR_PCINVAL", "PC (pr_instr) is invalid" },
112
#endif
113
#if defined (PR_ASLWP)
114
  /* Sol2.5: this lwp is the aslwp
115
   * Sol2.6: this lwp is the aslwp
116
   * Sol2.7: this lwp is the aslwp
117
   */
118
  { PR_ASLWP, "PR_ASLWP", "This is the asynchronous signal LWP" },
119
#endif
120
#if defined (PR_AGENT)
121
  /* Sol2.6: this lwp is the /proc agent lwp
122
   * Sol2.7: this lwp is the /proc agent lwp
123
   */
124
  { PR_AGENT, "PR_AGENT", "This is the /proc agent LWP" },
125
#endif
126
#if defined (PR_ISSYS)
127
  /* Sol2.5: system process
128
   * Sol2.6: this is a system process
129
   * Sol2.7: this is a system process
130
   * IRIX6:  process is a system process
131
   * OSF:    task/thread is a system task/thread
132
   * UW:     System process
133
   */
134
  { PR_ISSYS, "PR_ISSYS", "Is a system process/thread" },
135
#endif
136
#if defined (PR_VFORKP)
137
  /* Sol2.6: process is the parent of a vfork()d child
138
   * Sol2.7: process is the parent of a vfork()d child
139
   */
140
  { PR_VFORKP, "PR_VFORKP", "Process is the parent of a vforked child" },
141
#endif
142
#ifdef PR_ORPHAN
143
  /* Sol2.6: process's process group is orphaned
144
   * Sol2.7: process's process group is orphaned
145
   */
146
  { PR_ORPHAN, "PR_ORPHAN", "Process's process group is orphaned" },
147
#endif
148
#if defined (PR_FORK)
149
  /* Sol2.5: inherit-on-fork is in effect
150
   * Sol2.6: inherit-on-fork is in effect
151
   * Sol2.7: inherit-on-fork is in effect
152
   * IRIX6:  process has inherit-on-fork flag set
153
   * OSF:    task/thread has inherit-on-fork flag set
154
   * UW:     inherit-on-fork is in effect
155
   */
156
  { PR_FORK, "PR_FORK", "Inherit-on-fork is in effect" },
157
#endif
158
#if defined (PR_RLC)
159
  /* Sol2.5: run-on-last-close is in effect
160
   * Sol2.6: run-on-last-close is in effect
161
   * Sol2.7: run-on-last-close is in effect
162
   * IRIX6:  process has run-on-last-close flag set
163
   * OSF:    task/thread has run-on-last-close flag set
164
   * UW:     Run-on-last-close is in effect
165
   */
166
  { PR_RLC, "PR_RLC", "Run-on-last-close is in effect" },
167
#endif
168
#if defined (PR_KLC)
169
  /* Sol2.5: kill-on-last-close is in effect
170
   * Sol2.6: kill-on-last-close is in effect
171
   * Sol2.7: kill-on-last-close is in effect
172
   * IRIX6:  process has kill-on-last-close flag set
173
   * OSF:    kill-on-last-close, superceeds RLC
174
   * UW:     kill-on-last-close is in effect
175
   */
176
  { PR_KLC, "PR_KLC", "Kill-on-last-close is in effect" },
177
#endif
178
#if defined (PR_ASYNC)
179
  /* Sol2.5: asynchronous-stop is in effect
180
   * Sol2.6: asynchronous-stop is in effect
181
   * Sol2.7: asynchronous-stop is in effect
182
   * OSF:    asynchronous stop mode is in effect
183
   * UW:     asynchronous stop mode is in effect
184
   */
185
  { PR_ASYNC, "PR_ASYNC", "Asynchronous stop is in effect" },
186
#endif
187
#if defined (PR_MSACCT)
188
  /* Sol2.5: micro-state usage accounting is in effect
189
   * Sol2.6: micro-state usage accounting is in effect
190
   * Sol2.7: micro-state usage accounting is in effect
191
   */
192
  { PR_MSACCT, "PR_MSACCT", "Microstate accounting enabled" },
193
#endif
194
#if defined (PR_BPTADJ)
195
  /* Sol2.5: breakpoint trap pc adjustment is in effect
196
   * Sol2.6: breakpoint trap pc adjustment is in effect
197
   * Sol2.7: breakpoint trap pc adjustment is in effect
198
   */
199
  { PR_BPTADJ, "PR_BPTADJ", "Breakpoint PC adjustment in effect" },
200
#endif
201
#if defined (PR_PTRACE)
202
  /* Note: different meanings on Solaris and Irix 6
203
   * Sol2.5: obsolete, never set in SunOS5.0
204
   * Sol2.6: ptrace-compatibility mode is in effect
205
   * Sol2.7: ptrace-compatibility mode is in effect
206
   * IRIX6:  process is traced with ptrace() too
207
   * OSF:    task/thread is being traced by ptrace
208
   * UW:     Process is being controlled by ptrace(2)
209
   */
210
  { PR_PTRACE, "PR_PTRACE", "Process is being controlled by ptrace" },
211
#endif
212
#if defined (PR_PCOMPAT)
213
  /* Note: PCOMPAT on Sol2.5 means same thing as PTRACE on Sol2.6
214
   * Sol2.5 (only): ptrace-compatibility mode is in effect
215
   */
216
  { PR_PCOMPAT, "PR_PCOMPAT", "Ptrace compatibility mode in effect" },
217
#endif
218
#ifdef PR_MSFORK
219
  /* Sol2.6: micro-state accounting inherited on fork
220
   * Sol2.7: micro-state accounting inherited on fork
221
   */
222
  { PR_MSFORK, "PR_PCOMPAT", "Micro-state accounting inherited on fork" },
223
#endif
224
 
225
#ifdef PR_ISKTHREAD
226
  /* Irix6: process is a kernel thread */
227
  { PR_ISKTHREAD, "PR_KTHREAD", "Process is a kernel thread" },
228
#endif
229
 
230
#ifdef PR_ABORT
231
  /* OSF (only): abort the current stop condition */
232
  { PR_ABORT, "PR_ABORT", "Abort the current stop condition" },
233
#endif
234
 
235
#ifdef PR_TRACING
236
  /* OSF: task is traced */
237
  { PR_TRACING, "PR_TRACING", "Task is traced" },
238
#endif
239
 
240
#ifdef PR_STOPFORK
241
  /* OSF: stop child on fork */
242
  { PR_STOPFORK, "PR_STOPFORK", "Stop child on fork" },
243
#endif
244
 
245
#ifdef PR_STOPEXEC
246
  /* OSF: stop on exec */
247
  { PR_STOPEXEC, "PR_STOPEXEC", "Stop on exec" },
248
#endif
249
 
250
#ifdef PR_STOPTERM
251
  /* OSF: stop on task exit */
252
  { PR_STOPTERM, "PR_STOPTERM", "Stop on task exit" },
253
#endif
254
 
255
#ifdef PR_STOPTCR
256
  /* OSF: stop on thread creation */
257
  { PR_STOPTCR, "PR_STOPTCR", "Stop on thread creation" },
258
#endif
259
 
260
#ifdef PR_STOPTTERM
261
  /* OSF: stop on thread exit */
262
  { PR_STOPTTERM, "PR_STOPTTERM", "Stop on thread exit" },
263
#endif
264
 
265
#ifdef PR_USCHED
266
  /* OSF: user level scheduling is in effect */
267
  { PR_USCHED, "PR_USCHED", "User level scheduling is in effect" },
268
#endif
269
};
270
 
271
void
272
proc_prettyfprint_flags (FILE *file, unsigned long flags, int verbose)
273
{
274
  int i;
275
 
276
  for (i = 0; i < sizeof (pr_flag_table) / sizeof (pr_flag_table[0]); i++)
277
    if (flags & pr_flag_table[i].value)
278
      {
279
        fprintf (file, "%s ", pr_flag_table[i].name);
280
        if (verbose)
281
          fprintf (file, "%s\n", pr_flag_table[i].desc);
282
      }
283
  if (!verbose)
284
    fprintf (file, "\n");
285
}
286
 
287
void
288
proc_prettyprint_flags (unsigned long flags, int verbose)
289
{
290
  proc_prettyfprint_flags (stdout, flags, verbose);
291
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.