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

Subversion Repositories openrisc

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

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

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

powered by: WebSVN 2.1.0

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