]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/proc-flags.c
libctf: lookup_by_name: do not return success for nonexistent pointer types
[thirdparty/binutils-gdb.git] / gdb / proc-flags.c
CommitLineData
44122162 1/* Machine independent support for Solaris /proc (process file system) for GDB.
3666a048 2 Copyright (C) 1999-2021 Free Software Foundation, Inc.
0fda6bd2
JM
3 Written by Michael Snyder at Cygnus Solutions.
4 Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
5
a9762ec7
JB
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/>. */
0fda6bd2
JM
20
21/*
22 * Pretty-print the prstatus flags.
23 *
24 * Arguments: unsigned long flags, int verbose
25 *
26 */
27
28#include "defs.h"
29
0fda6bd2
JM
30#include <sys/types.h>
31#include <sys/procfs.h>
32
a0911fd0
MR
33#include "proc-utils.h"
34
0fda6bd2
JM
35/* Much of the information used in the /proc interface, particularly for
36 printing status information, is kept as tables of structures of the
37 following form. These tables can be used to map numeric values to
0df8b418 38 their symbolic names and to a string that describes their specific use. */
0fda6bd2
JM
39
40struct trans {
41 int value; /* The numeric value */
995816ba
PA
42 const char *name; /* The equivalent symbolic value */
43 const char *desc; /* Short description of value */
0fda6bd2
JM
44};
45
46/* Translate bits in the pr_flags member of the prstatus structure,
0df8b418 47 into the names and desc information. */
0fda6bd2
JM
48
49static struct trans pr_flag_table[] =
50{
44122162 51 /* lwp is stopped */
0fda6bd2 52 { PR_STOPPED, "PR_STOPPED", "Process (LWP) is stopped" },
44122162 53 /* lwp is stopped on an event of interest */
0fda6bd2 54 { PR_ISTOP, "PR_ISTOP", "Stopped on an event of interest" },
44122162 55 /* lwp has a stop directive in effect */
0fda6bd2 56 { PR_DSTOP, "PR_DSTOP", "A stop directive is in effect" },
44122162 57 /* lwp has a single-step directive in effect */
0fda6bd2 58 { PR_STEP, "PR_STEP", "A single step directive is in effect" },
44122162 59 /* lwp is sleeping in a system call */
0fda6bd2 60 { PR_ASLEEP, "PR_ASLEEP", "Sleeping in an (interruptible) system call" },
44122162 61 /* contents of pr_instr undefined */
0fda6bd2 62 { PR_PCINVAL, "PR_PCINVAL", "PC (pr_instr) is invalid" },
44122162 63 /* this lwp is the aslwp */
0fda6bd2 64 { PR_ASLWP, "PR_ASLWP", "This is the asynchronous signal LWP" },
44122162 65 /* this lwp is the /proc agent lwp */
0fda6bd2 66 { PR_AGENT, "PR_AGENT", "This is the /proc agent LWP" },
44122162 67 /* this is a system process */
0fda6bd2 68 { PR_ISSYS, "PR_ISSYS", "Is a system process/thread" },
44122162 69 /* process is the parent of a vfork()d child */
0fda6bd2 70 { PR_VFORKP, "PR_VFORKP", "Process is the parent of a vforked child" },
44122162 71 /* process's process group is orphaned */
0fda6bd2 72 { PR_ORPHAN, "PR_ORPHAN", "Process's process group is orphaned" },
44122162 73 /* inherit-on-fork is in effect */
0fda6bd2 74 { PR_FORK, "PR_FORK", "Inherit-on-fork is in effect" },
44122162 75 /* run-on-last-close is in effect */
0fda6bd2 76 { PR_RLC, "PR_RLC", "Run-on-last-close is in effect" },
44122162 77 /* kill-on-last-close is in effect */
0fda6bd2 78 { PR_KLC, "PR_KLC", "Kill-on-last-close is in effect" },
44122162 79 /* asynchronous-stop is in effect */
0fda6bd2 80 { PR_ASYNC, "PR_ASYNC", "Asynchronous stop is in effect" },
44122162 81 /* micro-state usage accounting is in effect */
0fda6bd2 82 { PR_MSACCT, "PR_MSACCT", "Microstate accounting enabled" },
44122162 83 /* breakpoint trap pc adjustment is in effect */
0fda6bd2 84 { PR_BPTADJ, "PR_BPTADJ", "Breakpoint PC adjustment in effect" },
44122162 85 /* ptrace-compatibility mode is in effect */
0fda6bd2 86 { PR_PTRACE, "PR_PTRACE", "Process is being controlled by ptrace" },
44122162 87 /* micro-state accounting inherited on fork */
0fda6bd2 88 { PR_MSFORK, "PR_PCOMPAT", "Micro-state accounting inherited on fork" },
0fda6bd2
JM
89};
90
91void
fba45db2 92proc_prettyfprint_flags (FILE *file, unsigned long flags, int verbose)
0fda6bd2
JM
93{
94 int i;
95
96 for (i = 0; i < sizeof (pr_flag_table) / sizeof (pr_flag_table[0]); i++)
97 if (flags & pr_flag_table[i].value)
98 {
99 fprintf (file, "%s ", pr_flag_table[i].name);
100 if (verbose)
101 fprintf (file, "%s\n", pr_flag_table[i].desc);
102 }
103 if (!verbose)
104 fprintf (file, "\n");
105}
106
107void
fba45db2 108proc_prettyprint_flags (unsigned long flags, int verbose)
0fda6bd2
JM
109{
110 proc_prettyfprint_flags (stdout, flags, verbose);
111}