Remove ioctl-based procfs support on Solaris

This is the previously mentioned patch to get rid of
unstructured/ioctl-based procfs support in procfs.c.  Given that support
for structured procfs was introduced in Solaris 2.6 back in 1997 and
we're just removing support for Solaris < 10, there's no point in
carrying that baggage (and tons of support for IRIX and OSF/1 as well)
around any longer.

Most of the patch should be straightforward (removing support for
!NEW_PROC_API, non-Solaris OSes and pre-Solaris 10 quirks).

Only a few points need explanations:

* <sys/syscall.h> was already included unconditionally in most places,
  so there's no need to have guards in a few remaining ones.

* configure.host already obsoletes i?86-*-sysv4.2, i?86-*-sysv5, so
  NEW_PROC_API detection for those in configure.ac can go.

* I'm still including <sys/procfs.h> with #define _STRUCTURED_PROC 1.
  Theoretically, it would be better to include <procfs.h> on Solaris
  (which includes that define), but that breaks the build over
  <procfs.h> vs. gdb's "procfs.h", and doesn't exist on Linux.

* I've regenerated syscall_table[] in proc-events.c with a small script
  from Solaris 10, 11.3, 11.4 <sys/syscall.h>, so there should be no
  traces of older Solaris versions and other OSes left.

* prsysent_t and DYNAMIC_SYSCALLS was only used for AIX 5, but AIX
  doesn't use procfs.c any longer, so all related code can go.

The patch was generated with diff -w so one can easier see changes
without being distracted by simple reindentations.

So far, it has only been compiled and smoke-tested on
amd64-pc-solaris2.1[01], sparcv9-sun-solaris2.1[01], and
x86_64-pc-linux-gnu.  Certainly needs more testing (Solaris 11.3
vs. 11.4, 32-bit gdb, testsuite once I've figured out what's wrong on
Solaris 10 etc.), but it's enough to get a first impression how much
cleanup is possible here.

	* configure.ac Don't check for sys/fault.h, sys/syscall.h,
	sys/proc.h.
	(NEW_PROC_API): Remove.
	(prsysent_t, pr_sigset_t, pr_sigaction64_t, pr_siginfo64_t):
	Likewise.
	* common/common.m4 (GDB_AC_COMMON): Don't check for sys/syscall.h.
	* configure: Regenerate.
	* config.in: Regenerate.
	* gdbserver/configure: Regenerate.
	* gdbserver/config.in: Regenerate.

	* i386-sol2-nat.c (_initialize_amd64_sol2_nat): Remove
	NEW_PROC_API test.
	* sparc-sol2-nat.c (_initialize_sparc_sol2_nat): Likewise.

	* linux-btrace.c: Remove HAVE_SYS_SYSCALL_H test.

	* proc-api.c: Remove !NEW_PROC_API support.
	Remove HAVE_SYS_PROC_H and HAVE_SYS_USER_H tests.
	Remove tests for macros always defined on Solaris.
	* proc-events.c: Remove !NEW_PROC_API support.
	Remove Remove HAVE_SYS_SYSCALL_H, HAVE_SYS_PROC_H and
	HAVE_SYS_USER_H tests.
	(init_syscall_table): Remove non-Solaris syscalls.
	Remove tests for syscalls present on all Solaris versions.
	Add missing Solaris 10+ syscalls.
	(signal_table): Remove non-Solaris signals.
	Remove tests for signals present on all Solaris versions.
	(fault_table): Remove non-Solaris faults.
	Remove tests for faults present on all Solaris versions.
	* proc-flags.c: Remove !NEW_PROC_API support.
	(pr_flag_table): Remove non-Solaris and pre-Solaris 7 comments.
	Remove non-Solaris flags.
	* proc-why.c: Remove !NEW_PROC_API support.
	(pr_why_table): Remove meaningless comments.
	Remove tests for reasons present on all Solaris versions.
	Remove OSF/1 cases.
	(proc_prettyfprint_why): Likewise.

	* procfs.c: Remove !NEW_PROC_API and DYNAMIC_SYSCALLS support.
	Remove HAVE_SYS_FAULT_H and HAVE_SYS_SYSCALL_H tests.
	Remove WA_READ test, IRIX watchpoint support.
	(gdb_sigset_t, gdb_sigaction_t, gdb_siginfo_t): Replace by base
	types.  Change users.
	(gdb_praddset, gdb_prdelset, gdb_premptysysset, gdb_praddsysset)
	(gdb_prdelset, gdb_pr_issyssetmember): Replace by base macros.
	Change callers.
	Remove CTL_PROC_NAME_FMT tests.
	(gdb_prstatus_t, gdb_lwpstatus_t): Replace by base types.  Change
	users.
	(sysset_t_size): Remove.  Use sizeof (sysset_t) in callers.
	Remove PROCFS_DONT_PIOCSSIG_CURSIG support.
	(proc_modify_flag): Replace GDBRESET by PCUNSET.
	Remove PR_ASYNC, PR_KLC tests.
	(proc_unset_inherit_on_fork): Remove PR_ASYNC test.
	(proc_parent_pid): Remove PCWATCH etc. tests.
	(proc_set_watchpoint): Remove !PCWATCH && !PIOCSWATCH support.
	Remove PCAGENT test.
	(proc_get_nthreads) [PIOCNTHR && PIOCTLIST]: Remove.
	Remove SYS_lwpcreate || SYS_lwp_create test.
	(proc_get_current_thread): Likewise.
	[PIOCNTHR && PIOCTLIST]: Remove.
	[PIOCLSTATUS]: Remove.
	(procfs_debug_inferior): Remove non-Solaris cases, conditionals.
	[PRFS_STOPEXEC]: Remove.
	(syscall_is_lwp_exit): Remove non-Solaris cases, conditionals.
	(syscall_is_exit): Likewise.
	(syscall_is_exec): Likewise.
	(syscall_is_lwp_create): Likewise.
	Remove SYS_syssgi support.
	(procfs_wait): Remove PR_ASYNC, !PIOCSSPCACT tests.
	[SYS_syssgi]: Remove.
	Remove non-Solaris cases, conditionals.
	(unconditionally_kill_inferior) [PROCFS_NEED_PIOCSSIG_FOR_KILL]:
	Remove.
	(procfs_init_inferior) [SYS_syssgi]: Remove.
	(procfs_set_exec_trap) [PRFS_STOPEXEC]: Remove.
	(procfs_inferior_created) [SYS_syssgi]: Remove.
	(procfs_set_watchpoint): Remove !AIX5 test.
	(procfs_stopped_by_watchpoint): Remove FLTWATCH test, FLTKWATCH
	case.
	(mappingflags) [MA_PHYS]: Remove.
	(info_mappings_callback): Remove PCAGENT test.
	Remove PIOCOPENLWP || PCAGENT test.
This commit is contained in:
Rainer Orth
2017-11-30 16:05:30 +01:00
parent 7ac2002247
commit 44122162ae
16 changed files with 442 additions and 3649 deletions

View File

@ -1,4 +1,4 @@
/* Machine independent support for SVR4 /proc (process file system) for GDB.
/* Machine independent support for Solaris /proc (process file system) for GDB.
Copyright (C) 1999-2017 Free Software Foundation, Inc.
Written by Michael Snyder at Cygnus Solutions.
Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
@ -27,9 +27,7 @@
#include "defs.h"
#if defined (NEW_PROC_API)
#define _STRUCTURED_PROC 1
#endif
#include <sys/types.h>
#include <sys/procfs.h>
@ -52,220 +50,44 @@ struct trans {
static struct trans pr_flag_table[] =
{
#if defined (PR_STOPPED)
/* Sol2.5: lwp is stopped
* Sol2.6: lwp is stopped
* Sol2.7: lwp is stopped
* IRIX6: process is stopped
* OSF: task/thread is stopped
* UW: LWP is stopped
*/
/* lwp is stopped */
{ PR_STOPPED, "PR_STOPPED", "Process (LWP) is stopped" },
#endif
#if defined (PR_ISTOP)
/* Sol2.5: lwp is stopped on an event of interest
* Sol2.6: lwp is stopped on an event of interest
* Sol2.7: lwp is stopped on an event of interest
* IRIX6: process is stopped on event of interest
* OSF: task/thread stopped on event of interest
* UW: LWP stopped on an event of interest
*/
/* lwp is stopped on an event of interest */
{ PR_ISTOP, "PR_ISTOP", "Stopped on an event of interest" },
#endif
#if defined (PR_DSTOP)
/* Sol2.5: lwp has a stop directive in effect
* Sol2.6: lwp has a stop directive in effect
* Sol2.7: lwp has a stop directive in effect
* IRIX6: process has stop directive in effect
* OSF: task/thread has stop directive in effect
* UW: A stop directive is in effect
*/
/* lwp has a stop directive in effect */
{ PR_DSTOP, "PR_DSTOP", "A stop directive is in effect" },
#endif
#if defined (PR_STEP)
/* Sol2.5: lwp has a single-step directive in effect
* Sol2.6: lwp has a single-step directive in effect
* Sol2.7: lwp has a single-step directive in effect
* IRIX6: process has single step pending
*/
/* lwp has a single-step directive in effect */
{ PR_STEP, "PR_STEP", "A single step directive is in effect" },
#endif
#if defined (PR_ASLEEP)
/* Sol2.5: lwp is sleeping in a system call
* Sol2.6: lwp is sleeping in a system call
* Sol2.7: lwp is sleeping in a system call
* IRIX6: process is in an interruptible sleep
* OSF: task/thread is asleep within a system call
* UW: LWP is sleep()ing in a system call
*/
/* lwp is sleeping in a system call */
{ PR_ASLEEP, "PR_ASLEEP", "Sleeping in an (interruptible) system call" },
#endif
#if defined (PR_PCINVAL)
/* Sol2.5: contents of pr_instr undefined
* Sol2.6: contents of pr_instr undefined
* Sol2.7: contents of pr_instr undefined
* IRIX6: current pc is invalid
* OSF: program counter contains invalid address
* UW: %pc refers to an invalid virtual address
*/
/* contents of pr_instr undefined */
{ PR_PCINVAL, "PR_PCINVAL", "PC (pr_instr) is invalid" },
#endif
#if defined (PR_ASLWP)
/* Sol2.5: this lwp is the aslwp
* Sol2.6: this lwp is the aslwp
* Sol2.7: this lwp is the aslwp
*/
/* this lwp is the aslwp */
{ PR_ASLWP, "PR_ASLWP", "This is the asynchronous signal LWP" },
#endif
#if defined (PR_AGENT)
/* Sol2.6: this lwp is the /proc agent lwp
* Sol2.7: this lwp is the /proc agent lwp
*/
/* this lwp is the /proc agent lwp */
{ PR_AGENT, "PR_AGENT", "This is the /proc agent LWP" },
#endif
#if defined (PR_ISSYS)
/* Sol2.5: system process
* Sol2.6: this is a system process
* Sol2.7: this is a system process
* IRIX6: process is a system process
* OSF: task/thread is a system task/thread
* UW: System process
*/
/* this is a system process */
{ PR_ISSYS, "PR_ISSYS", "Is a system process/thread" },
#endif
#if defined (PR_VFORKP)
/* Sol2.6: process is the parent of a vfork()d child
* Sol2.7: process is the parent of a vfork()d child
*/
/* process is the parent of a vfork()d child */
{ PR_VFORKP, "PR_VFORKP", "Process is the parent of a vforked child" },
#endif
#ifdef PR_ORPHAN
/* Sol2.6: process's process group is orphaned
* Sol2.7: process's process group is orphaned
*/
/* process's process group is orphaned */
{ PR_ORPHAN, "PR_ORPHAN", "Process's process group is orphaned" },
#endif
#if defined (PR_FORK)
/* Sol2.5: inherit-on-fork is in effect
* Sol2.6: inherit-on-fork is in effect
* Sol2.7: inherit-on-fork is in effect
* IRIX6: process has inherit-on-fork flag set
* OSF: task/thread has inherit-on-fork flag set
* UW: inherit-on-fork is in effect
*/
/* inherit-on-fork is in effect */
{ PR_FORK, "PR_FORK", "Inherit-on-fork is in effect" },
#endif
#if defined (PR_RLC)
/* Sol2.5: run-on-last-close is in effect
* Sol2.6: run-on-last-close is in effect
* Sol2.7: run-on-last-close is in effect
* IRIX6: process has run-on-last-close flag set
* OSF: task/thread has run-on-last-close flag set
* UW: Run-on-last-close is in effect
*/
/* run-on-last-close is in effect */
{ PR_RLC, "PR_RLC", "Run-on-last-close is in effect" },
#endif
#if defined (PR_KLC)
/* Sol2.5: kill-on-last-close is in effect
* Sol2.6: kill-on-last-close is in effect
* Sol2.7: kill-on-last-close is in effect
* IRIX6: process has kill-on-last-close flag set
* OSF: kill-on-last-close, superceeds RLC
* UW: kill-on-last-close is in effect
*/
/* kill-on-last-close is in effect */
{ PR_KLC, "PR_KLC", "Kill-on-last-close is in effect" },
#endif
#if defined (PR_ASYNC)
/* Sol2.5: asynchronous-stop is in effect
* Sol2.6: asynchronous-stop is in effect
* Sol2.7: asynchronous-stop is in effect
* OSF: asynchronous stop mode is in effect
* UW: asynchronous stop mode is in effect
*/
/* asynchronous-stop is in effect */
{ PR_ASYNC, "PR_ASYNC", "Asynchronous stop is in effect" },
#endif
#if defined (PR_MSACCT)
/* Sol2.5: micro-state usage accounting is in effect
* Sol2.6: micro-state usage accounting is in effect
* Sol2.7: micro-state usage accounting is in effect
*/
/* micro-state usage accounting is in effect */
{ PR_MSACCT, "PR_MSACCT", "Microstate accounting enabled" },
#endif
#if defined (PR_BPTADJ)
/* Sol2.5: breakpoint trap pc adjustment is in effect
* Sol2.6: breakpoint trap pc adjustment is in effect
* Sol2.7: breakpoint trap pc adjustment is in effect
*/
/* breakpoint trap pc adjustment is in effect */
{ PR_BPTADJ, "PR_BPTADJ", "Breakpoint PC adjustment in effect" },
#endif
#if defined (PR_PTRACE)
/* Note: different meanings on Solaris and Irix 6
* Sol2.5: obsolete, never set in SunOS5.0
* Sol2.6: ptrace-compatibility mode is in effect
* Sol2.7: ptrace-compatibility mode is in effect
* IRIX6: process is traced with ptrace() too
* OSF: task/thread is being traced by ptrace
* UW: Process is being controlled by ptrace(2)
*/
/* ptrace-compatibility mode is in effect */
{ PR_PTRACE, "PR_PTRACE", "Process is being controlled by ptrace" },
#endif
#if defined (PR_PCOMPAT)
/* Note: PCOMPAT on Sol2.5 means same thing as PTRACE on Sol2.6
* Sol2.5 (only): ptrace-compatibility mode is in effect
*/
{ PR_PCOMPAT, "PR_PCOMPAT", "Ptrace compatibility mode in effect" },
#endif
#ifdef PR_MSFORK
/* Sol2.6: micro-state accounting inherited on fork
* Sol2.7: micro-state accounting inherited on fork
*/
/* micro-state accounting inherited on fork */
{ PR_MSFORK, "PR_PCOMPAT", "Micro-state accounting inherited on fork" },
#endif
#ifdef PR_ISKTHREAD
/* Irix6: process is a kernel thread */
{ PR_ISKTHREAD, "PR_KTHREAD", "Process is a kernel thread" },
#endif
#ifdef PR_ABORT
/* OSF (only): abort the current stop condition */
{ PR_ABORT, "PR_ABORT", "Abort the current stop condition" },
#endif
#ifdef PR_TRACING
/* OSF: task is traced */
{ PR_TRACING, "PR_TRACING", "Task is traced" },
#endif
#ifdef PR_STOPFORK
/* OSF: stop child on fork */
{ PR_STOPFORK, "PR_STOPFORK", "Stop child on fork" },
#endif
#ifdef PR_STOPEXEC
/* OSF: stop on exec */
{ PR_STOPEXEC, "PR_STOPEXEC", "Stop on exec" },
#endif
#ifdef PR_STOPTERM
/* OSF: stop on task exit */
{ PR_STOPTERM, "PR_STOPTERM", "Stop on task exit" },
#endif
#ifdef PR_STOPTCR
/* OSF: stop on thread creation */
{ PR_STOPTCR, "PR_STOPTCR", "Stop on thread creation" },
#endif
#ifdef PR_STOPTTERM
/* OSF: stop on thread exit */
{ PR_STOPTTERM, "PR_STOPTTERM", "Stop on thread exit" },
#endif
#ifdef PR_USCHED
/* OSF: user level scheduling is in effect */
{ PR_USCHED, "PR_USCHED", "User level scheduling is in effect" },
#endif
};
void