aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1991-09-04 07:43:50 +0000
committerJohn Gilmore <gnu@cygnus>1991-09-04 07:43:50 +0000
commitbdbd5f508635fa9581f85bd6ba7ec3620970674d (patch)
tree15b699530b87aa2ae144216c734ecd2bcb9c474a /gdb/infrun.c
parent7c589d2562b1b91366f01b95daa7b47a81ccb19d (diff)
downloadgdb-bdbd5f508635fa9581f85bd6ba7ec3620970674d.zip
gdb-bdbd5f508635fa9581f85bd6ba7ec3620970674d.tar.gz
gdb-bdbd5f508635fa9581f85bd6ba7ec3620970674d.tar.bz2
Make writing to files work properly. (Fixes to BFD are also needed.)
* core.c (core_open): Open file ourselves, read or r/w, depending on write_files. Use bfd_fdopenr. * gdbcore.h (write_files): New variable. * exec.c (write_files): Define variable, add set&show for it. (exec_file_command): Use write_files to open for read or r/write. Make shared library reading happen automatically. These changes are mostly from Peter Schauer <pes@regent.e-technik.tu-muenchen.de>. * inferior.h (stop_soon_quietly): Add to exported variables. * infrun.c (child_create_inferior): call solib hook, if defined. (child_attach): call solib hook, if defined. * solib.c: Include inferior.h. Add from_tty to so_list as kludge. (find_solib): Use lookup_misc_func rather than hand-rolled. (symbol_add_stub): New stub for catch_errors. (solib_add): Avoid output if !from_tty. Catch errors rather than just calling symbol_file_add and bombing. (solib_create_inferior_hook): Interface with the target process to let it read and alloc shared libs, then figure out what it did. * core.c (validate_files): Fix typo, soften warning. (Fix from Hiroto Kagotani <kagotani@cs.titech.ac.jp>.) * utils.c (fputs_demangled): Avoid duplicate printing if demangling is off. (Fix from J.T. Conklin <jtc@cayenne.com>.) * infrun.c (proceed): Cast -1 to (CORE_ADDR) before comparing. (Fix from pierre@la.tce.com (Pierre Willard).) * main.c (catch_errors): Change argument to a char * from an int, since a char * can point to a struct full of glop, but an int is not guaranteed to be able to hold a pointer. * breakpoint.c (breakpoint_cond_eval, bpstat_stop_status, breakpoint_re_set_one, breakpoint_re_set): Adapt. * core.c (core_open, solib_add_stub): Adapt. * remote-vx.c (symbol_stub, add_symbol_stub, callers): Adapt.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index e48f761..b6f6a8f 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -152,10 +152,6 @@ extern char **environ;
extern struct target_ops child_ops; /* In inftarg.c */
-/* Copy of inferior_io_terminal when inferior was last started. */
-
-extern char *inferior_thisrun_terminal;
-
/* Sigtramp is a routine that the kernel calls (which then calls the
signal handler). On most machines it is a library routine that
@@ -298,6 +294,11 @@ resume (step, sig)
}
#endif
+ /* Handle any optimized stores to the inferior NOW... */
+#ifdef DO_DEFERRED_STORES
+ DO_DEFERRED_STORES;
+#endif
+
target_resume (step, sig);
discard_cleanups (old_cleanups);
}
@@ -349,7 +350,7 @@ proceed (addr, siggnal, step)
if (step < 0)
stop_after_trap = 1;
- if (addr == -1)
+ if (addr == (CORE_ADDR)-1)
{
/* If there is a breakpoint at the address we will resume at,
step one instruction before inserting breakpoints
@@ -405,11 +406,6 @@ The same program may be running in another process.");
else if (stop_signal < NSIG && !signal_program[stop_signal])
stop_signal= 0;
- /* Handle any optimized stores to the inferior NOW... */
-#ifdef DO_DEFERRED_STORES
- DO_DEFERRED_STORES;
-#endif
-
/* Resume inferior. */
resume (oneproc || step || bpstat_should_step (), stop_signal);
@@ -507,6 +503,11 @@ child_create_inferior (exec_file, allargs, env)
restore it. */
save_our_env = environ;
+ /* Tell the terminal handling subsystem what tty we plan to run on;
+ it will just record the information for later. */
+
+ new_tty_prefork (inferior_io_terminal);
+
#if defined(USG) && !defined(HAVE_VFORK)
pid = fork ();
#else
@@ -542,10 +543,10 @@ child_create_inferior (exec_file, allargs, env)
}
#endif /* SET_STACK_LIMIT_HUGE */
- /* Tell the terminal handling subsystem what tty we plan to run on;
- it will now switch to that one if non-null. */
+ /* Ask the tty subsystem to switch to the one we specified earlier
+ (or to share the current terminal, if none was specified). */
- new_tty (inferior_io_terminal);
+ new_tty ();
/* Changing the signal handlers for the inferior after
a vfork can also change them for the superior, so we don't mess
@@ -630,6 +631,13 @@ child_create_inferior (exec_file, allargs, env)
}
stop_soon_quietly = 0;
+ /* We are now in the child process of interest, having exec'd the
+ correct program, and are poised at the first instruction of the
+ new program. */
+#ifdef SOLIB_CREATE_INFERIOR_HOOK
+ SOLIB_CREATE_INFERIOR_HOOK ();
+#endif
+
/* Should this perhaps just be a "proceed" call? FIXME */
insert_step_breakpoint ();
breakpoints_failed = insert_breakpoints ();
@@ -725,6 +733,9 @@ child_attach (args, from_tty)
/*proceed (-1, 0, -2);*/
target_terminal_inferior ();
wait_for_inferior ();
+#ifdef SOLIB_ADD
+ solib_add (NULL, 0);
+#endif
normal_stop ();
#endif /* ATTACH_DETACH */
}