summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2006-01-26 18:05:55 +0000
committerDaniel Jacobowitz <dan@debian.org>2006-01-26 18:05:55 +0000
commit58c144f62d3161aceea048fe9d65879f01ac5034 (patch)
tree544c237c0fcc58e708b0c73f7d9e3195f3804900
parent5e39bdd3cb94c8ef05bf89a168b744a2c132100d (diff)
downloadgdb-58c144f62d3161aceea048fe9d65879f01ac5034.tar.gz
Backport:
2006-01-24 Daniel Jacobowitz <dan@codesourcery.com> * infcmd.c: Include "observer.h". (post_create_inferior): New function. (run_command_1): Call it. Also call proceed. * inferior.h (post_create_inferior): New prototype. * Makefile.in (infcmd.o): Update. ...
-rw-r--r--ChangeLog.csl37
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/gnu-nat.c3
-rw-r--r--gdb/go32-nat.c1
-rw-r--r--gdb/inf-ptrace.c6
-rw-r--r--gdb/inf-ttrace.c6
-rw-r--r--gdb/infcmd.c16
-rw-r--r--gdb/inferior.h2
-rw-r--r--gdb/inftarg.c5
-rw-r--r--gdb/monitor.c5
-rw-r--r--gdb/nto-procfs.c1
-rw-r--r--gdb/ocd.c5
-rw-r--r--gdb/procfs.c5
-rw-r--r--gdb/remote-e7000.c2
-rw-r--r--gdb/remote-m32r-sdi.c2
-rw-r--r--gdb/remote-mips.c2
-rw-r--r--gdb/remote-rdi.c2
-rw-r--r--gdb/remote-rdp.c3
-rw-r--r--gdb/remote-sds.c3
-rw-r--r--gdb/remote-sim.c3
-rw-r--r--gdb/remote-st.c3
-rw-r--r--gdb/remote.c6
-rw-r--r--gdb/win32-nat.c1
-rw-r--r--gdb/wince.c2
24 files changed, 67 insertions, 56 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl
index 60b6afd2979..dd16faf7334 100644
--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -1,3 +1,40 @@
+2006-01-26 Daniel Jacobowitz <dan@codesourcery.com>
+
+ Backport:
+ 2006-01-24 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * infcmd.c: Include "observer.h".
+ (post_create_inferior): New function.
+ (run_command_1): Call it. Also call proceed.
+ * inferior.h (post_create_inferior): New prototype.
+ * Makefile.in (infcmd.o): Update.
+
+ * gnu-nat.c (gnu_create_inferior): Don't call proceed.
+ * go32-nat.c (go32_create_inferior): Likewise.
+ * nto-procfs.c (procfs_create_inferior): Likewise.
+ * procfs.c (procfs_create_inferior): Likewise.
+ * remote-sim.c (gdbsim_create_inferior): Likewise.
+ * remote.c (extended_remote_create_inferior)
+ (extended_remote_async_create_inferior): Likewise.
+ * win32-nat.c (win32_create_inferior): Likewise.
+ * wince.c (child_create_inferior): Likewise.
+
+ * monitor.c (monitor_create_inferior): Don't call proceed.
+ Set the PC manually.
+ * ocd.c (ocd_create_inferior): Likewise.
+ * remote-e7000.c (e7000_create_inferior): Likewise.
+ * remote-m32r-sdi.c (m32r_create_inferior): Likewise.
+ * remote-mips.c (mips_create_inferior): Likewise.
+ * remote-rdi.c (arm_rdi_create_inferior): Likewise.
+ * remote-rdp.c (remote_rdp_create_inferior): Likewise.
+ * remote-sds.c (sds_create_inferior): Likewise.
+ * remote-st.c (st2000_create_inferior): Likewise.
+
+ * inf-ptrace.c (inf_ptrace_create_inferior): Don't call
+ proceed or observer_notify_inferior_created.
+ * inf-ttrace.c (inf_ttrace_create_inferior): Likewise.
+ * inftarg.c (child_create_inferior): Likewise.
+
2006-01-24 Daniel Jacobowitz <dan@codesourcery.com>
* gdb/gdbserver/linux-arm-low.c: Move #include below ELF_GREGSET_T
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 9130b564edc..2b93e19890f 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2115,7 +2115,7 @@ infcmd.o: infcmd.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
$(symfile_h) $(gdbcore_h) $(target_h) $(language_h) $(symfile_h) \
$(objfiles_h) $(completer_h) $(ui_out_h) $(event_top_h) \
$(parser_defs_h) $(regcache_h) $(reggroups_h) $(block_h) \
- $(solib_h) $(gdb_assert_h)
+ $(solib_h) $(gdb_assert_h) $(observer_h)
inf-loop.o: inf-loop.c $(defs_h) $(inferior_h) $(target_h) $(event_loop_h) \
$(event_top_h) $(inf_loop_h) $(remote_h) $(exceptions_h)
inflow.o: inflow.c $(defs_h) $(frame_h) $(inferior_h) $(command_h) \
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 43045536073..94bb9d9ccaf 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2089,9 +2089,6 @@ gnu_create_inferior (char *exec_file, char *allargs, char **env,
inf_steal_exc_ports (inf);
else
inf_restore_exc_ports (inf);
-
- /* Here we go! */
- proceed ((CORE_ADDR) -1, 0, 0);
}
/* Mark our target-struct as eligible for stray "run" and "attach"
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 0556f578b62..4b184f3aa00 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -657,7 +657,6 @@ go32_create_inferior (char *exec_file, char *args, char **env, int from_tty)
push_target (&go32_ops);
clear_proceed_status ();
insert_breakpoints ();
- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
prog_has_started = 1;
}
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index d12d1ad3214..a2fef2213e6 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -138,12 +138,6 @@ inf_ptrace_create_inferior (char *exec_file, char *allargs, char **env,
{
fork_inferior (exec_file, allargs, env, inf_ptrace_me, inf_ptrace_him,
NULL, NULL);
-
- /* We are at the first instruction we care about. */
- observer_notify_inferior_created (&current_target, from_tty);
-
- /* Pedal to the metal... */
- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
}
#ifdef PT_GET_PROCESS_STATE
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index a9087afa578..e5bf842bca3 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -636,12 +636,6 @@ inf_ttrace_create_inferior (char *exec_file, char *allargs, char **env,
fork_inferior (exec_file, allargs, env, inf_ttrace_me, inf_ttrace_him,
inf_ttrace_prepare, NULL);
-
- /* We are at the first instruction we care about. */
- observer_notify_inferior_created (&current_target, from_tty);
-
- /* Pedal to the metal... */
- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
}
static void
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 43207dce31d..8183448b791 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -47,6 +47,7 @@
#include "solib.h"
#include <ctype.h>
#include "gdb_assert.h"
+#include "observer.h"
/* Functions exported for general use, in inferior.h: */
@@ -397,6 +398,16 @@ tty_command (char *file, int from_tty)
set_inferior_io_terminal (file);
}
+/* Common actions to take after creating any sort of inferior, by any
+ means (running, attaching, connecting, et cetera). The target
+ should be stopped. */
+
+void
+post_create_inferior (struct target_ops *target, int from_tty)
+{
+ observer_notify_inferior_created (target, from_tty);
+}
+
/* Kill the inferior if already running. This function is designed
to be called when we are about to start the execution of the program
from the beginning. Ask the user to confirm that he wants to restart
@@ -510,6 +521,11 @@ run_command_1 (char *args, int from_tty, int tbreak_at_main)
the value now. */
target_create_inferior (exec_file, get_inferior_args (),
environ_vector (inferior_environ), from_tty);
+
+ post_create_inferior (&current_target, from_tty);
+
+ /* Start the target running. */
+ proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
}
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 435bf7ee87e..c4df7ad0f81 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -296,6 +296,8 @@ extern void follow_inferior_reset_breakpoints (void);
extern void tty_command (char *, int);
+extern void post_create_inferior (struct target_ops *, int);
+
extern void attach_command (char *, int);
extern char *get_inferior_args (void);
diff --git a/gdb/inftarg.c b/gdb/inftarg.c
index 836c77d2792..5153b52e98d 100644
--- a/gdb/inftarg.c
+++ b/gdb/inftarg.c
@@ -335,11 +335,6 @@ child_create_inferior (char *exec_file, char *allargs, char **env,
int from_tty)
{
fork_inferior (exec_file, allargs, env, ptrace_me, ptrace_him, NULL, NULL);
-
- /* We are at the first instruction we care about. */
- observer_notify_inferior_created (&current_target, from_tty);
- /* Pedal to the metal... */
- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
}
#if !defined(CHILD_POST_STARTUP_INFERIOR)
diff --git a/gdb/monitor.c b/gdb/monitor.c
index c805eb47834..8328d312f7d 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -2008,8 +2008,7 @@ monitor_kill (void)
return; /* ignore attempts to kill target system */
}
-/* All we actually do is set the PC to the start address of exec_bfd, and start
- the program at that point. */
+/* All we actually do is set the PC to the start address of exec_bfd. */
static void
monitor_create_inferior (char *exec_file, char *args, char **env,
@@ -2020,7 +2019,7 @@ monitor_create_inferior (char *exec_file, char *args, char **env,
first_time = 1;
clear_proceed_status ();
- proceed (bfd_get_start_address (exec_bfd), TARGET_SIGNAL_0, 0);
+ write_pc (bfd_get_start_address (exec_bfd));
}
/* Clean up when a program exits.
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 624ef063a58..af95cafd182 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -1093,7 +1093,6 @@ procfs_create_inferior (char *exec_file, char *allargs, char **env,
|| (symfile_objfile != NULL && symfile_objfile->obfd != NULL))
solib_create_inferior_hook ();
stop_soon = 0;
- proceed (-1, TARGET_SIGNAL_DEFAULT, 0);
}
static void
diff --git a/gdb/ocd.c b/gdb/ocd.c
index 43fe35fc0bb..b9fe2930192 100644
--- a/gdb/ocd.c
+++ b/gdb/ocd.c
@@ -1011,8 +1011,7 @@ ocd_mourn (void)
generic_mourn_inferior ();
}
-/* All we actually do is set the PC to the start address of exec_bfd, and start
- the program at that point. */
+/* All we actually do is set the PC to the start address of exec_bfd. */
void
ocd_create_inferior (char *exec_file, char *args, char **env, int from_tty)
@@ -1021,7 +1020,7 @@ ocd_create_inferior (char *exec_file, char *args, char **env, int from_tty)
error (_("Args are not supported by BDM."));
clear_proceed_status ();
- proceed (bfd_get_start_address (exec_bfd), TARGET_SIGNAL_0, 0);
+ write_pc (bfd_get_start_address (exec_bfd));
}
void
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 14bcf7d978c..8adeb9bacf0 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -5102,11 +5102,6 @@ procfs_create_inferior (char *exec_file, char *allargs, char **env,
proc_trace_syscalls_1 (find_procinfo_or_die (PIDGET (inferior_ptid), 0),
SYS_syssgi, PR_SYSEXIT, FLAG_RESET, 0);
#endif
-
- /* We are at the first instruction we care about. */
- /* Pedal to the metal... */
-
- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
}
/*
diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c
index 76a245c9973..8e1051e52c1 100644
--- a/gdb/remote-e7000.c
+++ b/gdb/remote-e7000.c
@@ -405,7 +405,7 @@ e7000_create_inferior (char *execfile, char *args, char **env,
target_terminal_inferior ();
/* insert_step_breakpoint (); FIXME, do we need this? */
- proceed ((CORE_ADDR) entry_pt, -1, 0); /* Let 'er rip... */
+ write_pc ((CORE_ADDR) entry_pt);
}
/* Open a connection to a remote debugger. NAME is the filename used
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index 9471c115381..238d9c5542c 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -338,7 +338,7 @@ m32r_create_inferior (char *execfile, char *args, char **env, int from_tty)
/* Install inferior's terminal modes. */
target_terminal_inferior ();
- proceed (entry_pt, TARGET_SIGNAL_DEFAULT, 0);
+ write_pc (entry_pt);
}
/* Open a connection to a remote debugger.
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 790b23ea838..d59072c6e28 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -2197,7 +2197,7 @@ Can't pass arguments to remote MIPS board; arguments ignored.");
/* FIXME: Should we set inferior_ptid here? */
- proceed (entry_pt, TARGET_SIGNAL_DEFAULT, 0);
+ write_pc (entry_pt);
}
/* Clean up after a process. Actually nothing to do. */
diff --git a/gdb/remote-rdi.c b/gdb/remote-rdi.c
index 55401755c74..5522b7a678d 100644
--- a/gdb/remote-rdi.c
+++ b/gdb/remote-rdi.c
@@ -386,7 +386,7 @@ arm_rdi_create_inferior (char *exec_file, char *args, char **env, int from_tty)
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
}
- proceed (entry_point, TARGET_SIGNAL_DEFAULT, 0);
+ write_pc (entry_point);
}
/* This takes a program previously attached to and detaches it. After
diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c
index a1f54f79d3c..9125995e43c 100644
--- a/gdb/remote-rdp.c
+++ b/gdb/remote-rdp.c
@@ -1376,8 +1376,7 @@ remote_rdp_create_inferior (char *exec_file, char *allargs, char **env,
** so we don't bother to look for MEMSIZE in the environment.
*/
- /* Let's go! */
- proceed (entry_point, TARGET_SIGNAL_DEFAULT, 0);
+ write_pc (entry_point);
}
/* Attach doesn't need to do anything */
diff --git a/gdb/remote-sds.c b/gdb/remote-sds.c
index b967c430b9c..2e532821c89 100644
--- a/gdb/remote-sds.c
+++ b/gdb/remote-sds.c
@@ -988,8 +988,7 @@ sds_create_inferior (char *exec_file, char *args, char **env, int from_tty)
/* Clean up from the last time we were running. */
clear_proceed_status ();
- /* Let the remote process run. */
- proceed (bfd_get_start_address (exec_bfd), TARGET_SIGNAL_0, 0);
+ write_pc (bfd_get_start_address (exec_bfd));
}
static void
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 2d8ef7e513a..428962c1f1e 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -468,9 +468,6 @@ gdbsim_create_inferior (char *exec_file, char *args, char **env, int from_tty)
insert_breakpoints (); /* Needed to get correct instruction in cache */
clear_proceed_status ();
-
- /* NB: Entry point already set by sim_create_inferior. */
- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
}
/* The open routine takes the rest of the parameters from the command,
diff --git a/gdb/remote-st.c b/gdb/remote-st.c
index e90cbc37a0c..e7dbdad98cf 100644
--- a/gdb/remote-st.c
+++ b/gdb/remote-st.c
@@ -258,8 +258,7 @@ st2000_create_inferior (char *execfile, char *args, char **env,
target_terminal_inferior ();
/* insert_step_breakpoint (); FIXME, do we need this? */
- /* Let 'er rip... */
- proceed ((CORE_ADDR) entry_pt, TARGET_SIGNAL_DEFAULT, 0);
+ write_pc ((CORE_ADDR) entry_pt);
}
/* Open a connection to a remote debugger.
diff --git a/gdb/remote.c b/gdb/remote.c
index 846e329fd63..203afee1512 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4445,9 +4445,6 @@ extended_remote_create_inferior (char *exec_file, char *args,
/* Clean up from the last time we were running. */
clear_proceed_status ();
-
- /* Let the remote process run. */
- proceed (-1, TARGET_SIGNAL_0, 0);
}
/* Async version of extended_remote_create_inferior. */
@@ -4473,9 +4470,6 @@ extended_remote_async_create_inferior (char *exec_file, char *args,
/* Clean up from the last time we were running. */
clear_proceed_status ();
-
- /* Let the remote process run. */
- proceed (-1, TARGET_SIGNAL_0, 0);
}
/* Store register REGNUM, or all registers if REGNUM == -1, from the contents
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index d9525727479..edae6c68016 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -1908,7 +1908,6 @@ child_create_inferior (char *exec_file, char *allargs, char **env,
do_initial_child_stuff (pi.dwProcessId);
/* child_continue (DBG_CONTINUE, -1); */
- proceed ((CORE_ADDR) - 1, TARGET_SIGNAL_0, 0);
}
static void
diff --git a/gdb/wince.c b/gdb/wince.c
index 9be5e6fa8a1..ffaf47ffbcd 100644
--- a/gdb/wince.c
+++ b/gdb/wince.c
@@ -1821,8 +1821,6 @@ child_create_inferior (char *exec_file, char *args, char **env,
while (!get_child_debug_event (PIDGET (inferior_ptid), &dummy,
CREATE_PROCESS_DEBUG_EVENT, &ret))
continue;
-
- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
}
/* Chile has gone bye-bye. */