1 /* Machine independent support for SVR4 /proc (process file system) for GDB.
2 Copyright 1999 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 2 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, write to the Free Software Foundation,
20 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
23 * Pretty-print the pr_why value.
25 * Arguments: unsigned long flags, int verbose
31 #if defined(NEW_PROC_API)
32 #define _STRUCTURED_PROC 1
36 #include <sys/types.h>
37 #include <sys/procfs.h>
39 #include "proc-utils.h"
41 /* Much of the information used in the /proc interface, particularly for
42 printing status information, is kept as tables of structures of the
43 following form. These tables can be used to map numeric values to
44 their symbolic names and to a string that describes their specific use. */
47 int value
; /* The numeric value */
48 char *name
; /* The equivalent symbolic value */
49 char *desc
; /* Short description of value */
52 /* Translate values in the pr_why field of the prstatus struct. */
54 static struct trans pr_why_table
[] =
56 #if defined (PR_REQUESTED)
58 { PR_REQUESTED
, "PR_REQUESTED",
59 "Directed to stop by debugger via P(IO)CSTOP or P(IO)CWSTOP" },
61 #if defined (PR_SIGNALLED)
63 { PR_SIGNALLED
, "PR_SIGNALLED", "Receipt of a traced signal" },
65 #if defined (PR_SYSENTRY)
67 { PR_SYSENTRY
, "PR_SYSENTRY", "Entry to a traced system call" },
69 #if defined (PR_SYSEXIT)
71 { PR_SYSEXIT
, "PR_SYSEXIT", "Exit from a traced system call" },
73 #if defined (PR_JOBCONTROL)
75 { PR_JOBCONTROL
, "PR_JOBCONTROL", "Default job control stop signal action" },
77 #if defined (PR_FAULTED)
79 { PR_FAULTED
, "PR_FAULTED", "Incurred a traced hardware fault" },
81 #if defined (PR_SUSPENDED)
82 /* Solaris and UnixWare */
83 { PR_SUSPENDED
, "PR_SUSPENDED", "Process suspended" },
85 #if defined (PR_CHECKPOINT)
87 { PR_CHECKPOINT
, "PR_CHECKPOINT", "Process stopped at checkpoint" },
89 #if defined (PR_FORKSTOP)
91 { PR_FORKSTOP
, "PR_FORKSTOP", "Process stopped at end of fork call" },
93 #if defined (PR_TCRSTOP)
95 { PR_TCRSTOP
, "PR_TCRSTOP", "Process stopped on thread creation" },
97 #if defined (PR_TTSTOP)
99 { PR_TTSTOP
, "PR_TTSTOP", "Process stopped on thread termination" },
101 #if defined (PR_DEAD)
103 { PR_DEAD
, "PR_DEAD", "Process stopped in exit system call" },
108 proc_prettyfprint_why (file
, why
, what
, verbose
)
119 for (i
= 0; i
< sizeof (pr_why_table
) / sizeof (pr_why_table
[0]); i
++)
120 if (why
== pr_why_table
[i
].value
)
122 fprintf (file
, "%s ", pr_why_table
[i
].name
);
124 fprintf (file
, ": %s ", pr_why_table
[i
].desc
);
129 break; /* Nothing more to print. */
133 proc_prettyfprint_signal (file
, what
, verbose
);
138 proc_prettyfprint_fault (file
, what
, verbose
);
143 fprintf (file
, "Entry to ");
144 proc_prettyfprint_syscall (file
, what
, verbose
);
149 fprintf (file
, "Exit from ");
150 proc_prettyfprint_syscall (file
, what
, verbose
);
155 proc_prettyfprint_signal (file
, what
, verbose
);
160 fprintf (file
, "Exit status: %d\n", what
);
164 fprintf (file
, "Unknown why %ld, what %ld\n", why
, what
);
167 fprintf (file
, "\n");
171 fprintf (file
, "Unknown pr_why.\n");
175 proc_prettyprint_why (why
, what
, verbose
)
180 proc_prettyfprint_why (stdout
, why
, what
, verbose
);
This page took 0.031693 seconds and 4 git commands to generate.