Commit Graph

63 Commits

Author SHA1 Message Date
Thomas Lord 199b2450f6 Change the stream argument to _filtered to GDB_FILE *.
Change all references to stdout/stderr to gdb_stdout/gdb_stderr.

Replace all calls to stdio output functions with calls to
corresponding _unfiltered functions (`fprintf_unfiltered')

Replaced calls to fopen for output to gdb_fopen.

Added sufficient goo to utils.c and defs.h to make the above work.

The net effect is that stdio output functions are only directly used
in utils.c.  Elsewhere, the _unfiltered and _filtered functions and
GDB_FILE type are used.

In the near future, GDB_FILE will stop being equivalant to FILE.

The semantics of some commands has changed in a very subtle way:
called in the right context, they may cause new occurences of
prompt_for_continue() behavior.  The testsuite doesn't notice anything
like this, though.

Please respect this change by not reintroducing stdio output
dependencies in the main body of gdb code.  All output from commands
should go to a GDB_FILE.

Target-specific code can still use stdio directly to communicate with
targets.
1993-11-01 22:25:23 +00:00
Jim Kingdon bc28a06cc1 * fork-child.c (fork_inferior): Set inferior_pid before calling
init_trace_fun.  Move the code which gets us through the shell
	to new function startup_inferior.
	* inferior.h: Declare startup_inferior.
	* procfs.c (procfs_init_inferior), inftarg.c (ptrace_him):
	Call startup_inferior.
	* m3-nat.c (m3_trace_him): Call intercept_exec_calls.
	* config/nm-m3.h: Don't define STARTUP_INFERIOR.
	* config/i386/tm-i386m3.h, config/ns32k/tm-ns32k.h,
	config/mips/tm-mipsm3.h: Don't define START_INFERIOR_TRAPS_EXPECTED.
1993-10-27 19:30:27 +00:00
Jim Kingdon 100f92e2de * Makefile.in (c-exp.tab.o): Remove notice about shift/reduce conflicts
which no longer occur.

	gcc -Wall lint:
	* findvar.c (symbol_read_needs_frame), corelow.c (ignore),
	inflow.c (gdb_has_a_terminal): Make sure to return a value.
	* regex.h: Declare re_set_syntax.
	* printcmd.c: Include valprint.h.
	* infcmd.c, exec.c, maint.c, core.c: Include language.h.
	* maint.c: Include expression.h.
	* infrun.c, fork-child.c, corelow.c, inflow.c: Include thread.h.
	* inftarg.c: Include command.h.
	* coredep.c: Include value.h.
	* c-exp.y, m2-exp.y, ch-exp.y: Include bfd.h, symfile.h and objfiles.h.
	* ch-typeprint.c: Include typeprint.h.
	* ch-valprint.c: Include c-lang.h.
	* nlmread.c: Include buildsym.h.
	* environ.c: Include gdbcore.h.  Only include defs.h once.
	(set_in_environ): Cast const char * to char * when passing to
	set_gnutarget.
	Remove unused variables:
	* printcmd.c (printf_command): args_to_vprintf.
	* coffread.c (coff_symfile_init): strsection.
	Move variables to within the #ifdefs where they are used:
	* symtab.c (gdb_mangle_name): opname.
	* inftarg.c (child_attach): pid and exec_file.
	* inftarg.c (child_detach): siggnal.
	* objfiles.c (allocate_objfile): mapto, md, and fd.
	* objfiles.c (free_objfile): mmfd.
	* infrun.c (wait_for_inferior): Include BPSTAT_WHAT_LAST in switch.
	* infrun.c (wait_for_inferior): Remove unused same_pid label.
	* inferior.h: Declare set_sigint_trap and clear_sigint_trap.
	* parser-defs.h: Declare write_exp_elt_block.
	* stabsread.h: Declare elfstab_offset_sections and
	coffstab_build_psymtabs.
1993-10-21 20:41:50 +00:00
Jim Kingdon 749e538bc8 * infrun.c: Add comment about signals.
* fork-child.c (fork_inferior): Remove CREATE_INFERIOR_HOOK again.
	Stu reinstated it (accidently I assume).
1993-10-17 01:56:01 +00:00
Stu Grossman de43d7d005 * breakpoint.c (breakpoint_thread_match break_command_1):
Thread-specific breakpoint support.
* breakpoint.h (struct breakpoint):  Add thread id field.
* fork-child.c (fork_inferior):  Move call to init_thread_list()
back a bit so that init_trace_fun can do thread functions.
* hppa-tdep.c (restore_pc_queue):  Add pid to call to target_wait.
* hppab-nat.c (child_resume):  Handle default pid.
* hppah-nat.c (child_resume):  Handle default pid.
* i386lynx-nat.c (child_wait):  New arg pid.
* inflow.c (kill_command):  Reset thread list.
* infptrace.c (child_resume):  Handle default pid.
* infrun.c:  Thread-specific breakpoint support.
* inftarg.c (child_wait):  Add pid arg.
* osfsolib.c (solib_create_inferior_hook):  Add pid to call to
target_resume.
* procfs.c:  Multi-thread support.
* remote-bug.c (bug_wait):  Add pid arg.
* remote-hms.c (hms_wait):  Add pid arg.
* remote-mips.c (mips_wait):  Add pid arg.
* remote-mon.c (monitor_wait):  Add pid arg.
* remote-nindy.c (nindy_wait):  Add pid arg.
* remote-sim.c (gdbsim_wait):  Add pid arg.
* remote-udi.c (udi_wait):  Add pid arg.
* remote-vx.c (vx_wait):  Add pid arg.
* remote-z8k.c (sim_wait):  Add pid arg.
* remote.c (remote_wait):  Add pid arg.
* solib.c (solib_create_inferior_hook):  Add pid to call to
target_resume.
* target.h (struct target_ops):  Add pid arg to to_wait and
to_notice_signals.
* thread.c (valid_thread_id):  New func to validate thread #s.
* (pid_to_thread_id):  New func to do the obvious.
* thread.h:  Prototypes for above.

* coff-solib.c (coff_solib_add):  Use nameoffset field to locate
filename.
1993-10-16 06:42:02 +00:00
Jim Kingdon 5d76c8e662 * fork-child.c (fork_inferior), remote-eb.c (eb_create_inferior),
remote-mon.c (monitor_create_inferior), remote-nindy.c
	(nindy_create_inferior), remote-st.c (st2000_create_inferior),
	remote-vx.c (vx_create_inferior): Remove CREATE_INFERIOR_HOOK; it
	is replaced by init_trace_fun.
	* config/convex/xm-convex.h, convex-xdep.c: Add comments explaining
	how to do without CREATE_INFERIOR_HOOK for whoever fixes the Convex
	port.

	* Makefile.in: Add Mach files to ALLDEPFILES, etc.
	* m3-nat.c: Clean up more hair--message(), cprocs.
	* configure.in: Recognize Mach targets and hosts.
	* config/ns32k/tm-umax.h: Add some #ifndef's so tm-ns32km3.h can
	include this file.
	* Mach headers in config/*/tm-*.h: Fix includes to match correct
	locations of files.
1993-10-15 04:26:06 +00:00
Jim Kingdon c18b613acd * inflow.c: Remove unused includes of sys/param.h and sys/types.h.
* inflow.c, ser-unix.c, ser-go32.c, ser-tcp.c, serial.h,
	terminal.h, fork-child.c, main.c, utils.c: Move all the process
	group stuff back to inflow.c and terminal.h; that's a better place
	for it and fixes problems with trying to get/set the process group
	of a tty we're doing remote debugging on.
	* terminal.h: Skip the redefines and includes if HAVE_TERMIOS.
1993-10-09 00:00:56 +00:00
Jim Kingdon 01dfd41513 * fork-child.c (fork_inferior): Don't call target_terminal_init
and target_terminal_inferior until we are sure that the inferior
	has called gdb_setpgid.  This fixes PR 2900 (Schauer tracked it
	down and was able to reliably reproduce it by putting a sleep()
	before the gdb_setpgid()).
1993-09-30 20:41:17 +00:00
Stu Grossman 25286543da Sun Aug 1 22:58:18 1993 Stu Grossman (grossman at cygnus.com)
* Makefile.in (CLIBS):  Reorder to make Lynx ld happy.
	* (HFILES):  New file thread.h.
	* (OBS):  New file thread.c.
	* configure.in:  Host config for Lynx/386.
	* fork-child.c (fork_inferior):  Call init_thread_list().
	* infrun.c (resume):  Add pid to invocation of target_resume().
	* (wait_for_inferior): Pay attention to pid from target_wait().
	Multi-threading code now uses this to determine what to do.
	* inftarg.c (child_wait):  Conditionalize based on CHILD_WAIT macro.
	Use target_pid_to_str() macro throughout when printing pid.
	* inferior.h (child_resume):  Add pid to prototype.
	* hppab-nat.c hppah-nat.c infptrace.c (child_resume):  Pass in pid as
	argument, instead of using inferior_pid.
	* procfs.c (procfs_resume):  Pass in pid as argument.  Ignored for
	now.  Use target_pid_to_str() macro throughout for printing process id.
	* remote-adapt.c (adapt_resume):  Pass in pid as argument.
	* remote-eb.c (eb_resume):  Pass in pid as argument.
	* remote-es.c (es1800_resume):  Pass in pid as argument.
	* remote-hms.c (hms_resume):  Pass in pid as argument.
	* remote-mips.c (mips_resume):  Pass in pid as argument.
	* remote-mm.c (mm_resume):  Pass in pid as argument.
	* remote-monitor.c (monitor_resume):  Pass in pid as argument.
	* remote-nindy.c (nindy_resume):  Pass in pid as argument.
	* remote-sa.sparc.c (remote_resume):  Pass in pid as argument.
	* remote-sim.c (rem_resume):  Pass in pid as argument.
	* remote-sp64sim.c (simif_resume):  Pass in pid as argument.
	* remote-st.c (st2000_resume):  Pass in pid as argument.
	* remote-udi.c (udi_resume):  Pass in pid as argument.
	* remote-vx.c (vx_resume):  Pass in pid as argument.
	* remote-z8k.c (rem_resume):  Pass in pid as argument.
	* remote.c (remote_resume):  Pass in pid as argument.
	* solib.c (solid_create_inferior_hook):  Pass inferior_pid to
	target_resume().
	* target.c (normal_pid_to_str):  New routine to print out process
	ID normally.
	* target.h (struct target_ops):  Add pid to prototype at
	to_resume().  (target_resume):  Add pid argument.
	* (target_pid_to_str):  Default definition for normal type pids.
	* thread.c, thread.c:  New modules for multi thread/process control.
1993-08-02 06:25:36 +00:00
Jim Kingdon 38bbfd3795 * fork-child.c (fork_inferior): Only quote exec file if needed.
* mipsread.c (parse_symbol): Remove 21 Jul 93 change with
	stTypedef inside an stBlock.
1993-07-27 17:43:09 +00:00
Jim Kingdon c2e247c4ff * inftarg.c: Remove unused include of terminal.h.
* signals.h: Don't undefine signals anymore.
	* main.c: Use job_control from serial.h.
	* fork-child.c (fork_inferior): Use gdb_setpgid.
	* serial.h, ser-unix.c, ser-go32.c: Provide gdb_setpgid.
	* utils.c (quit): Use current_target->to_terminal_ours to figure
	out whether we care about lack of job control, rather than __GO32__.
	* utils.c: Include serial.h not terminal.h
	(quit): Use job_control not TIOCGPGRP.
	* terminal.h: Don't undefine TIOCGPGRP.
	* serial.h, ser-unix.c, ser-go32.c, ser-tcp.c: Add SERIAL_FLUSH_OUTPUT.
	* utils.c (quit): Use it.
	* serial.h: Add SERIAL_UN_FDOPEN.
	* utils.c (quit): Use it.
	* ser-unix.c: Add process group to ttystate.
	[HAVE_SGTTY]: Add tchars, ltchars, and lmode to ttystate.
	* inflow.c: Include serial.h not terminal.h.
	Use serial.h stuff to replace most of the maze of #ifdef's.
	* inflow.c, main.c, inferior.h: make gdb_has_a_terminal a function.
	* serial.h: Document SERIAL_SET_TTY_STATE as being immediate.
	* ser-unix.c: Use TIOCSETN not TIOCSETP so it is true.
	* serial.h, ser-unix.c, ser-go32.c, ser-tcp.c:
	Add SERIAL_PRINT_TTY_STATE, SERIAL_NOFLUSH_SET_TTY_STATE, and
	SERIAL_SET_PROCESS_GROUP.
	* inflow.c: Use them.
	* config/xm-svr4.h, config/rs6000/xm-rs6000.h, config/sparc/sun4os4.h:
	Define HAVE_TERMIOS.
	* Various: Remove all use of TIOC*_BROKEN.
1993-06-30 22:20:53 +00:00
Jim Kingdon 3768398df8 * fork-child.c (fork_inferior): Quote exec_file so it can contain
funky characters.
1993-06-22 04:27:00 +00:00
John Gilmore 3fbdd5366e Make the /proc support a target-struct in its own right.
* inferior.h (proc_wait, inferior_proc_init, proc_set_exec_trap):
No longer global functions.
(fork_inferior):  New global function from fork-child.c.
* inftarg.c (child_wait):  Remove USE_PROC_FS conditional.
(ptrace_me, ptrace_him):  New stub functions for fork_inferior().
(child_create_inferior):  Moved to fork-child.c as fork_inferior.
(child_create_inferior):  New tiny function that calls fork_inferior.
* fork-child.c:  New file, containing fork_inferior, which is
built from slight mods to inftarg.c's child_create_inferior.

* procfs.c (procfs_ops):  Add target vector.
(attach):  Rename as static do_attach.
(procfs_create_inferior):  New tiny function that calls fork_inferior.
(child_xfer_memory):  Rename to static procfs_xfer_memory.
(store_inferior_registers):  Rename to static procfs_store_registers.
(inferior_proc_init):  Rename to static procfs_init_inferior.
(procfs_attach, procfs_detach, procfs_prepare_to_store,
procfs_files_info, procfs_open, procfs_mourn_inferior,
procfs_can_run):  Slightly mangled copies of the corresponding
child_XXX routines from inftarg.c.
(proc_wait):  Renamed to static procfs_wait.
(child_resume):  Rename to static procfs_resume.
(fetch_inferior_registers):  Rename to static procfs_fetch_registers.
(initialize_proc_fs):  Rename to initialize_procfs.  Set up
procfs_ops, too.
* xm-irix4.h, xm-sysv4.h (CREATE_INFERIOR_HOOK):  No longer needed.
1992-09-26 09:06:30 +00:00