[PATCH 47/57][Arm][OBJDUMP] Add support for MVE instructions: vaddv, vmlaldav, vmlada...
[binutils-gdb.git] / gdb / proc-why.c
blob214f1ad37b057f7a6a321bcb14fd3553b3920beb
1 /* Machine-independent support for Solaris /proc (process file system)
3 Copyright (C) 1999-2019 Free Software Foundation, Inc.
5 Written by Michael Snyder at Cygnus Solutions.
6 Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
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/>. */
21 #include "defs.h"
23 #define _STRUCTURED_PROC 1
25 #include <sys/types.h>
26 #include <sys/procfs.h>
28 #include "proc-utils.h"
30 /* Much of the information used in the /proc interface, particularly
31 for printing status information, is kept as tables of structures of
32 the following form. These tables can be used to map numeric values
33 to their symbolic names and to a string that describes their
34 specific use. */
36 struct trans
38 int value; /* The numeric value. */
39 const char *name; /* The equivalent symbolic value. */
40 const char *desc; /* Short description of value. */
43 /* Translate values in the pr_why field of a `struct prstatus' or
44 `struct lwpstatus'. */
46 static struct trans pr_why_table[] =
48 { PR_REQUESTED, "PR_REQUESTED",
49 "Directed to stop by debugger via P(IO)CSTOP or P(IO)CWSTOP" },
50 { PR_SIGNALLED, "PR_SIGNALLED", "Receipt of a traced signal" },
51 { PR_SYSENTRY, "PR_SYSENTRY", "Entry to a traced system call" },
52 { PR_SYSEXIT, "PR_SYSEXIT", "Exit from a traced system call" },
53 { PR_JOBCONTROL, "PR_JOBCONTROL", "Default job control stop signal action" },
54 { PR_FAULTED, "PR_FAULTED", "Incurred a traced hardware fault" },
55 { PR_SUSPENDED, "PR_SUSPENDED", "Process suspended" },
56 { PR_CHECKPOINT, "PR_CHECKPOINT", "Process stopped at checkpoint" },
59 /* Pretty-print the pr_why field of a `struct prstatus' or `struct
60 lwpstatus'. */
62 void
63 proc_prettyfprint_why (FILE *file, unsigned long why, unsigned long what,
64 int verbose)
66 int i;
68 if (why == 0)
69 return;
71 for (i = 0; i < ARRAY_SIZE (pr_why_table); i++)
72 if (why == pr_why_table[i].value)
74 fprintf (file, "%s ", pr_why_table[i].name);
75 if (verbose)
76 fprintf (file, ": %s ", pr_why_table[i].desc);
78 switch (why) {
79 case PR_REQUESTED:
80 break; /* Nothing more to print. */
81 case PR_SIGNALLED:
82 proc_prettyfprint_signal (file, what, verbose);
83 break;
84 case PR_FAULTED:
85 proc_prettyfprint_fault (file, what, verbose);
86 break;
87 case PR_SYSENTRY:
88 fprintf (file, "Entry to ");
89 proc_prettyfprint_syscall (file, what, verbose);
90 break;
91 case PR_SYSEXIT:
92 fprintf (file, "Exit from ");
93 proc_prettyfprint_syscall (file, what, verbose);
94 break;
95 case PR_JOBCONTROL:
96 proc_prettyfprint_signal (file, what, verbose);
97 break;
98 default:
99 fprintf (file, "Unknown why %ld, what %ld\n", why, what);
100 break;
102 fprintf (file, "\n");
104 return;
107 fprintf (file, "Unknown pr_why.\n");
110 void
111 proc_prettyprint_why (unsigned long why, unsigned long what, int verbose)
113 proc_prettyfprint_why (stdout, why, what, verbose);