Many changes to procfs.c, mostly to expand the "info proc" command and to

fix a couple of small bugs.  Changes to other files mostly to fix minor
things pointed out by the SGI compiler.  See ChangeLog for complete details.
This commit is contained in:
Fred Fish 1992-04-01 19:46:14 +00:00
parent 6b80138803
commit cc221e76d6
6 changed files with 2140 additions and 125 deletions

View File

@ -1,3 +1,70 @@
Wed Apr 1 11:39:52 1992 Fred Fish (fnf@cygnus.com)
* breakpoint.h (bpdisp, bptype): Remove trailing comma.
* symtab.h (current_source_symtab): Make extern
* symtab.h (current_source_line): Make extern
* inferior.h: Move all procfs.c prototypes to one place, add
prototype for proc_signal_handling_change. Add prototypes for
signal_stop_state, signal_print_state, and signal_pass_state.
* inferior.h (stop_soon_quietly): Make extern
* inferior.h (attach_flag): Make extern
* infrun.c (NOTICE_SIGNAL_HANDLING_CHANGE): Default is null.
* infrun.c (signal_stop_state, signal_print_state,
signal_pass_state): New functions to query specific signal
handling flags.
* infrun.c (handle_command): Minor error message change, add
NOTICE_SIGNAL_HANDLING_CHANGE.
* procfs.c (open_proc_file): Remove iris specific reset of
inherit-on-fork flag, moved to proc_set_exec_trap().
* procfs.c (proc_set_exec_trap): Add SVR4 and iris code
to reset inherit-on-fork flag, bash comment to GNU form.
* procfs.c (proc_base_address, set_proc_siginfo,
fetch_core_registers): Conform to code style.
* procfs.c (signame.h): Include.
* procfs.c (MAX_SYSCALLS, syscall_table[], init_syscalltable(),
syscallname(), info_proc_syscalls()): New macros, tables, and
functions to organize and report system call information.
* procfs.c (saved_fltset, saved_trace, saved_sighold,
saved_exitset, saved_entryset): Add to procinfo struct.
* procfs.c (struct trans): Add.
* procfs.c (pr_flag_table, pr_why_table, faults_table,
siginfo_table, errno_table): Tables to translate numeric values
to symbolic names and short descriptions.
* procfs.c (signalname, info_proc_signals): Add function and
prototype.
* procfs.c (proc_info): Now info_proc.
* procfs.c (proc_info_address_map): Now info_proc_mappings.
* procfs.c (info_proc_flags, info_proc_stop, info_proc_siginfo,
info_proc_faults, lookupname, lookupdesc, sigcodename,
sigcodedesc): New functions.
* procfs.c (proc_signal_handling_change): New function to set
the trace flags based on the state of gdb's signal handling flags.
* procfs.c (inferior_proc_init): Call proc_signal_handling_change
and remove code to do PIOCSTRACE ioctl.
* procfs.c (attach, detach): Preserve and restore process flags
using saved_* fields in procinfo struct.
* procfs.c (attach): Call proc_signal_handling_change.
* procfs.c (info_proc): Major rework to expand "info proc" cmd.
* procfs.c (proc_desc): Update for latest changes.
* xm-irix4.h (CREATE_INFERIOR_HOOK): Protect by USE_PROC_FS.
* xm-irix4.h (NOTICE_SIGNAL_HANDLING_CHANGE): Add definition.
* xm-sysv4.h (NOTICE_SIGNAL_HANDLING_CHANGE): Add definition.
Tue Mar 31 18:38:28 1992 Fred Fish (fnf@cygnus.com)
* procfs.c (set_proc_siginfo): Add prototype and new function.
* procfs.c (detach, child_resume): Call set_proc_siginfo to set
up inferior siginfo struct.
* elfread.c (elf_symfile_read): Compute the relocation amount
by subtracting off the address of the ".text" section.
* solib.c: Add pointer to ".text" section to so_list struct.
* solib.c (solib_map_sections): Initialize pointer to ".text"
section in so_list struct.
* solib.c (symbol_add_stub): Pass base address of ".text"
section to symbol_file_add, rather than the load address of
the shared library. On SunOS they are the same. On SVR4 they
are not.
Tue Mar 31 17:48:15 1992 Stu Grossman (grossman at cygnus.com)
* mipsread.c (parse_procedure): PDR.isym should get pointer to

View File

@ -1,6 +1,6 @@
/* Variables that describe the inferior process running under GDB:
Where it is, why it stopped, and how to step it.
Copyright (C) 1986, 1989 Free Software Foundation, Inc.
Copyright 1986, 1989, 1992 Free Software Foundation, Inc.
This file is part of GDB.
@ -18,6 +18,12 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (INFERIOR_H)
#define INFERIOR_H 1
/* For symtab_and_line */
#include "symtab.h"
/* For bpstat. */
#include "breakpoint.h"
@ -57,7 +63,11 @@ struct inferior_status {
int proceed_to_finish;
};
void save_inferior_status (), restore_inferior_status ();
extern void
save_inferior_status PARAMS ((struct inferior_status *, int));
extern void
restore_inferior_status PARAMS ((struct inferior_status *));
/* File name for default use for standard in/out in the inferior. */
@ -71,29 +81,142 @@ extern int inferior_pid;
extern char registers[];
extern void clear_proceed_status ();
extern void start_inferior ();
extern void proceed ();
extern void kill_inferior ();
extern void kill_inferior_fast ();
extern void generic_mourn_inferior ();
extern void terminal_ours ();
extern void detach ();
extern void run_stack_dummy ();
extern CORE_ADDR read_pc ();
extern void write_pc ();
extern void wait_for_inferior ();
extern void init_wait_for_inferior ();
extern void close_exec_file ();
extern void reopen_exec_file ();
extern void
clear_proceed_status PARAMS ((void));
extern void
proceed PARAMS ((CORE_ADDR, int, int));
extern void
kill_inferior PARAMS ((void));
extern void
kill_inferior_fast PARAMS ((void));
extern void
generic_mourn_inferior PARAMS ((void));
extern void
terminal_ours PARAMS ((void));
extern void
run_stack_dummy PARAMS ((CORE_ADDR, char [REGISTER_BYTES]));
extern CORE_ADDR
read_pc PARAMS ((void));
extern void
write_pc PARAMS ((CORE_ADDR));
extern void
wait_for_inferior PARAMS ((void));
extern void
init_wait_for_inferior PARAMS ((void));
extern void
close_exec_file PARAMS ((void));
extern void
reopen_exec_file PARAMS ((void));
/* From misc files */
extern void
store_inferior_registers PARAMS ((int));
extern void
fetch_inferior_registers PARAMS ((int));
extern void
solib_create_inferior_hook PARAMS ((void));
extern void
child_mourn_inferior PARAMS ((void));
extern void
child_terminal_info PARAMS ((char *, int));
extern void
term_info PARAMS ((char *, int));
extern void
terminal_ours_for_output PARAMS ((void));
extern void
terminal_inferior PARAMS ((void));
extern void
terminal_init_inferior PARAMS ((void));
/* From infptrace.c or procfs.c */
extern int
attach PARAMS ((int));
void
detach PARAMS ((int));
extern void
child_resume PARAMS ((int, int));
/* From procfs.c */
#ifdef USE_PROC_FS
extern int
proc_iterate_over_mappings PARAMS ((int (*) (int, CORE_ADDR)));
extern int
proc_wait PARAMS ((int *));
extern void
inferior_proc_init PARAMS ((int));
extern void
proc_signal_handling_change PARAMS ((void));
extern void
proc_set_exec_trap PARAMS ((void));
#endif
/* From inflow.c */
extern void
new_tty_prefork PARAMS ((char *));
/* From infrun.c */
extern void
start_remote PARAMS ((void));
extern void
child_create_inferior PARAMS ((char *, char *, char **));
extern void
child_attach PARAMS ((char *, int));
extern void
normal_stop PARAMS ((void));
extern int
signal_stop_state PARAMS ((int));
extern int
signal_print_state PARAMS ((int));
extern int
signal_pass_state PARAMS ((int));
/* From infcmd.c */
void attach_command (
#ifdef __STDC__
char *arg, int from_tty
#endif
);
extern void
tty_command PARAMS ((char *, int));
extern void
attach_command PARAMS ((char *, int));
/* Last signal that the inferior received (why it stopped). */
extern int stop_signal;
@ -157,7 +280,7 @@ extern int step_multi;
when running in the shell before the child program has been exec'd;
and when running some kinds of remote stuff (FIXME?). */
int stop_soon_quietly;
extern int stop_soon_quietly;
/* Nonzero if proceed is being used for a "finish" command or a similar
situation when stop_registers should be saved. */
@ -179,7 +302,7 @@ extern int pc_changed;
/* Nonzero if the child process in inferior_pid was attached rather
than forked. */
int attach_flag;
extern int attach_flag;
/* Possible values for CALL_DUMMY_LOCATION. */
#define ON_STACK 1
@ -195,11 +318,13 @@ int attach_flag;
subtracted out. */
#if !defined (PC_IN_CALL_DUMMY)
#if CALL_DUMMY_LOCATION == BEFORE_TEXT_END
extern CORE_ADDR text_end;
#define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
((pc) >= text_end - CALL_DUMMY_LENGTH \
&& (pc) < text_end + DECR_PC_AFTER_BREAK)
#else /* Not before text_end. */
#if CALL_DUMMY_LOCATION == AFTER_TEXT_END
extern CORE_ADDR text_end;
#define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
((pc) >= text_end \
&& (pc) < text_end + CALL_DUMMY_LENGTH + DECR_PC_AFTER_BREAK)
@ -209,3 +334,5 @@ int attach_flag;
#endif /* On stack. */
#endif /* Not before text_end. */
#endif /* No PC_IN_CALL_DUMMY. */
#endif /* !defined (INFERIOR_H) */

View File

@ -158,6 +158,9 @@ resume_cleanups PARAMS ((int));
extern char **environ;
extern int sys_nerr;
extern char *sys_errlist[];
extern struct target_ops child_ops; /* In inftarg.c */
/* Sigtramp is a routine that the kernel calls (which then calls the
@ -198,6 +201,12 @@ extern struct target_ops child_ops; /* In inftarg.c */
#define IN_SOLIB_TRAMPOLINE(pc,name) 0
#endif
/* Notify other parts of gdb that might care that signal handling may
have changed for one or more signals. */
#ifndef NOTICE_SIGNAL_HANDLING_CHANGE
#define NOTICE_SIGNAL_HANDLING_CHANGE /* No actions */
#endif
#ifdef TDESC
#include "tdesc.h"
int safe_to_init_tdesc_context = 0;
@ -466,8 +475,6 @@ child_create_inferior (exec_file, allargs, env)
{
int pid;
char *shell_command;
extern int sys_nerr;
extern char *sys_errlist[];
char *shell_file;
static char default_shell_file[] = SHELL_FILE;
int len;
@ -1128,7 +1135,7 @@ wait_for_inferior ()
#if 0
if (* step_frame_address == 0
|| (step_frame_address == stop_frame_address))
#endif 0
#endif
{
remove_step_breakpoint ();
step_resume_break_address = 0;
@ -1579,6 +1586,24 @@ remove_step_breakpoint ()
step_resume_break_shadow);
}
int signal_stop_state (signo)
int signo;
{
return ((signo >= 0 && signo < NSIG) ? signal_stop[signo] : 0);
}
int signal_print_state (signo)
int signo;
{
return ((signo >= 0 && signo < NSIG) ? signal_print[signo] : 0);
}
int signal_pass_state (signo)
int signo;
{
return ((signo >= 0 && signo < NSIG) ? signal_program[signo] : 0);
}
static void
sig_print_header ()
{
@ -1688,7 +1713,7 @@ handle_command (args, from_tty)
/* Not a number and not a recognized flag word => complain. */
else
{
error ("Unrecognized flag word: \"%s\".", p);
error ("Unrecognized or ambiguous flag word: \"%s\".", p);
}
/* Find start of next word. */
@ -1696,6 +1721,8 @@ handle_command (args, from_tty)
while (*p == ' ' || *p == '\t') p++;
}
NOTICE_SIGNAL_HANDLING_CHANGE;
if (from_tty)
{
/* Show the results. */

File diff suppressed because it is too large Load Diff

View File

@ -42,9 +42,27 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
*/
#define USE_PROC_FS
#define PROC_NAME_FMT "/debug/%d"
/* If we are using SVR4 /proc instead of ptrace, use CREATE_INFERIOR_HOOK
to do internal /proc initialization. */
#ifdef USE_PROC_FS
#define CREATE_INFERIOR_HOOK(pid) inferior_proc_init(pid)
#endif
/* Irix defines psignal() in signal.h, which gets gcc rather angry at us
* because their definition is markedly different.
*/
#define PSIGNAL_IN_SIGNAL_H
/* If gdb's signal handling changes (due to a "handle" command), then
this macro expands to an action to perform to notify other parts of
gdb that might care, that signal handling has changed. For hosts using
the /proc interface, gdb has more control over which signals cause the
inferior to stop and which do not. In some cases, it is desirable to
have signals delivered directly to the inferior without involving the
debugger at all. */
#ifdef USE_PROC_FS
#define NOTICE_SIGNAL_HANDLING_CHANGE proc_signal_handling_change()
#endif
#define BROKEN_SIGINFO_H /* <sys/siginfo.h> si_pid & si_uid are bogus */

View File

@ -65,3 +65,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Use setpgid(0,0) to run inferior in a separate process group */
#define NEED_POSIX_SETPGID
/* If gdb's signal handling changes (due to a "handle" command), then
this macro expands to an action to perform to notify other parts of
gdb that might care, that signal handling has changed. For hosts using
the /proc interface, gdb has more control over which signals cause the
inferior to stop and which do not. In some cases, it is desirable to
have signals delivered directly to the inferior without involving the
debugger at all. */
#ifdef USE_PROC_FS
#define NOTICE_SIGNAL_HANDLING_CHANGE proc_signal_handling_change()
#endif