* RFC: target_create_inferior that does not call proceed
@ 2006-01-16 20:02 Daniel Jacobowitz
2006-01-16 20:59 ` Mark Kettenis
2006-01-21 11:22 ` Eli Zaretskii
0 siblings, 2 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-01-16 20:02 UTC (permalink / raw)
To: gdb-patches
This patch adjusts the to_create_inferior target method so that the inferior
is implicitly stopped at the end of it, instead of running. I have a couple
of motives for this.
You'll notice that the call to observer_notify_inferior_created
is removed from several target methods, and moved to the end of
run_command_1. Consequently it's no longer possible to accidentally forget
about a target - as we've obviously done for most of the targets I changed
here. Less duplication is good!
I'll be needing to run some additional common code fragments between
creating an inferior and starting it, for an upcoming project. Like most of
GDB they need the target to be stopped; that's why I separated the create
and proceed phases here.
Another benefit of this is that I could finally implement a command I've
wanted for ages when debugging startup code: create the inferior but don't
run it, and give me my prompt back. That's not in this patch only because I
couldn't think of a name for it! I'd call it "start", but well... already
in use. Would anyone else find this useful? If so, would you care to
suggest a name?
Tested on x86_64-pc-linux-gnu. Any objections to this patch?
--
Daniel Jacobowitz
CodeSourcery
2005-01-16 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.
Index: src/gdb/gnu-nat.c
===================================================================
--- src.orig/gdb/gnu-nat.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/gnu-nat.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,5 +1,5 @@
/* Interface GDB to the GNU Hurd.
- Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2006
Free Software Foundation, Inc.
This file is part of GDB.
@@ -2089,9 +2089,6 @@ gnu_create_inferior (char *exec_file, ch
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"
Index: src/gdb/go32-nat.c
===================================================================
--- src.orig/gdb/go32-nat.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/go32-nat.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,5 +1,6 @@
/* Native debugging support for Intel x86 running DJGPP.
- Copyright (C) 1997, 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2000, 2001, 2005, 2006
+ Free Software Foundation, Inc.
Written by Robert Hoehne.
This file is part of GDB.
@@ -657,7 +658,6 @@ go32_create_inferior (char *exec_file, c
push_target (&go32_ops);
clear_proceed_status ();
insert_breakpoints ();
- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
prog_has_started = 1;
}
Index: src/gdb/inf-ptrace.c
===================================================================
--- src.orig/gdb/inf-ptrace.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/inf-ptrace.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,7 +1,7 @@
/* Low-level child interface to ptrace.
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
- 1998, 1999, 2000, 2001, 2002, 2004, 2005
+ 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of GDB.
@@ -138,12 +138,6 @@ inf_ptrace_create_inferior (char *exec_f
{
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 (¤t_target, from_tty);
-
- /* Pedal to the metal... */
- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
}
#ifdef PT_GET_PROCESS_STATE
Index: src/gdb/inf-ttrace.c
===================================================================
--- src.orig/gdb/inf-ttrace.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/inf-ttrace.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,6 +1,6 @@
/* Low-level child interface to ttrace.
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GDB.
@@ -636,12 +636,6 @@ inf_ttrace_create_inferior (char *exec_f
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 (¤t_target, from_tty);
-
- /* Pedal to the metal... */
- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
}
static void
Index: src/gdb/infcmd.c
===================================================================
--- src.orig/gdb/infcmd.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/infcmd.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,7 +1,7 @@
/* Memory-access and commands for "inferior" process, for GDB.
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
- 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of GDB.
@@ -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,
the value now. */
target_create_inferior (exec_file, get_inferior_args (),
environ_vector (inferior_environ), from_tty);
+
+ post_create_inferior (¤t_target, from_tty);
+
+ /* Start the target running. */
+ proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
}
Index: src/gdb/inferior.h
===================================================================
--- src.orig/gdb/inferior.h 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/inferior.h 2006-01-16 14:48:05.000000000 -0500
@@ -2,7 +2,7 @@
Where it is, why it stopped, and how to step it.
Copyright (C) 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
- 1996, 1998, 1999, 2000, 2001, 2003, 2004, 2005
+ 1996, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of GDB.
@@ -296,6 +296,8 @@ extern void follow_inferior_reset_breakp
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);
Index: src/gdb/inftarg.c
===================================================================
--- src.orig/gdb/inftarg.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/inftarg.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,7 +1,7 @@
/* Target-vector operations for controlling Unix child processes, for GDB.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2000, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Cygnus Support.
@@ -334,11 +334,6 @@ child_create_inferior (char *exec_file,
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 (¤t_target, from_tty);
- /* Pedal to the metal... */
- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
}
#if !defined(CHILD_POST_STARTUP_INFERIOR)
Index: src/gdb/monitor.c
===================================================================
--- src.orig/gdb/monitor.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/monitor.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,7 +1,7 @@
/* Remote debugging interface for boot monitors, for GDB.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2006 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by Rob Savoye for Cygnus.
Resurrected from the ashes by Stu Grossman.
@@ -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
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.
Index: src/gdb/nto-procfs.c
===================================================================
--- src.orig/gdb/nto-procfs.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/nto-procfs.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,7 +1,7 @@
/* Machine independent support for QNX Neutrino /proc (process file system)
for GDB. Written by Colin Burgess at QNX Software Systems Limited.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006 Free Software Foundation, Inc.
Contributed by QNX Software Systems Ltd.
@@ -1093,7 +1093,6 @@ procfs_create_inferior (char *exec_file,
|| (symfile_objfile != NULL && symfile_objfile->obfd != NULL))
solib_create_inferior_hook ();
stop_soon = 0;
- proceed (-1, TARGET_SIGNAL_DEFAULT, 0);
}
static void
Index: src/gdb/ocd.c
===================================================================
--- src.orig/gdb/ocd.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/ocd.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,7 +1,7 @@
/* Target communications support for Macraigor Systems' On-Chip Debugging
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004 Free
- Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -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, ch
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
Index: src/gdb/procfs.c
===================================================================
--- src.orig/gdb/procfs.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/procfs.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,6 +1,6 @@
/* Machine independent support for SVR4 /proc (process file system) for GDB.
- Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2006 Free Software Foundation,
Inc.
Written by Michael Snyder at Cygnus Solutions.
@@ -5103,11 +5103,6 @@ procfs_create_inferior (char *exec_file,
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);
}
/*
Index: src/gdb/remote-e7000.c
===================================================================
--- src.orig/gdb/remote-e7000.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/remote-e7000.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,7 +1,7 @@
/* Remote debugging interface for Renesas E7000 ICE, for GDB
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
Contributed by Cygnus Support.
@@ -405,7 +405,7 @@ e7000_create_inferior (char *execfile, c
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
Index: src/gdb/remote-m32r-sdi.c
===================================================================
--- src.orig/gdb/remote-m32r-sdi.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/remote-m32r-sdi.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,6 +1,6 @@
/* Remote debugging interface for M32R/SDI.
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Renesas Technology Co.
Written by Kei Sakamoto <sakamoto.kei@renesas.com>.
@@ -338,7 +338,7 @@ m32r_create_inferior (char *execfile, ch
/* 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.
Index: src/gdb/remote-mips.c
===================================================================
--- src.orig/gdb/remote-mips.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/remote-mips.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,7 +1,7 @@
/* Remote debugging interface for MIPS remote debugging protocol.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by Ian Lance Taylor
<ian@cygnus.com>.
@@ -2197,7 +2197,7 @@ Can't pass arguments to remote MIPS boar
/* 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. */
Index: src/gdb/remote-rdi.c
===================================================================
--- src.orig/gdb/remote-rdi.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/remote-rdi.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,7 +1,7 @@
/* GDB interface to ARM RDI library.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 Free Software
- Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -386,7 +386,7 @@ arm_rdi_create_inferior (char *exec_file
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
Index: src/gdb/remote-rdp.c
===================================================================
--- src.orig/gdb/remote-rdp.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/remote-rdp.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,7 +1,7 @@
/* Remote debugging for the ARM RDP interface.
- Copyright (C) 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003 Free
- Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2006
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -1376,8 +1376,7 @@ remote_rdp_create_inferior (char *exec_f
** 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 */
Index: src/gdb/remote-sds.c
===================================================================
--- src.orig/gdb/remote-sds.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/remote-sds.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,6 +1,6 @@
/* Remote target communications for serial-line targets using SDS' protocol.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006 Free Software
Foundation, Inc.
This file is part of GDB.
@@ -988,8 +988,7 @@ sds_create_inferior (char *exec_file, ch
/* 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
Index: src/gdb/remote-sim.c
===================================================================
--- src.orig/gdb/remote-sim.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/remote-sim.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,7 +1,7 @@
/* Generic remote debugging interface for simulators.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2004, 2005 Free Software Foundation, Inc.
+ 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Cygnus Support.
Steve Chamberlain (sac@cygnus.com).
@@ -458,9 +458,6 @@ gdbsim_create_inferior (char *exec_file,
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,
Index: src/gdb/remote-st.c
===================================================================
--- src.orig/gdb/remote-st.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/remote-st.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,7 +1,7 @@
/* Remote debugging interface for Tandem ST2000 phone switch, for GDB.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000,
- 2001, 2002 Free Software Foundation, Inc.
+ 2001, 2002, 2006 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by Jim Kingdon for Cygnus.
@@ -258,8 +258,7 @@ st2000_create_inferior (char *execfile,
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.
Index: src/gdb/remote.c
===================================================================
--- src.orig/gdb/remote.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/remote.c 2006-01-16 14:48:05.000000000 -0500
@@ -4423,9 +4423,6 @@ extended_remote_create_inferior (char *e
/* 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. */
@@ -4451,9 +4448,6 @@ extended_remote_async_create_inferior (c
/* Clean up from the last time we were running. */
clear_proceed_status ();
-
- /* Let the remote process run. */
- proceed (-1, TARGET_SIGNAL_0, 0);
}
\f
Index: src/gdb/win32-nat.c
===================================================================
--- src.orig/gdb/win32-nat.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/win32-nat.c 2006-01-16 14:48:14.000000000 -0500
@@ -1,6 +1,7 @@
/* Target-vector operations for controlling win32 child processes, for GDB.
- Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+ 2005, 2006
Free Software Foundation, Inc.
Contributed by Cygnus Solutions, A Red Hat Company.
@@ -1909,7 +1910,6 @@ win32_create_inferior (char *exec_file,
do_initial_win32_stuff (pi.dwProcessId);
/* win32_continue (DBG_CONTINUE, -1); */
- proceed ((CORE_ADDR) - 1, TARGET_SIGNAL_0, 0);
}
static void
Index: src/gdb/wince.c
===================================================================
--- src.orig/gdb/wince.c 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/wince.c 2006-01-16 14:48:05.000000000 -0500
@@ -1,6 +1,6 @@
/* Target-vector operations for controlling Windows CE child processes, for GDB.
- Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2004, 2006 Free Software Foundation, Inc.
Contributed by Cygnus Solutions, A Red Hat Company.
This file is part of GDB.
@@ -1821,8 +1821,6 @@ child_create_inferior (char *exec_file,
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. */
Index: src/gdb/Makefile.in
===================================================================
--- src.orig/gdb/Makefile.in 2006-01-16 14:48:03.000000000 -0500
+++ src/gdb/Makefile.in 2006-01-16 14:48:05.000000000 -0500
@@ -1,6 +1,6 @@
# Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-# 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
-# Inc.
+# 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
# This file is part of GDB.
@@ -2122,7 +2122,7 @@ infcmd.o: infcmd.c $(defs_h) $(gdb_strin
$(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) \
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: RFC: target_create_inferior that does not call proceed
2006-01-16 20:02 RFC: target_create_inferior that does not call proceed Daniel Jacobowitz
@ 2006-01-16 20:59 ` Mark Kettenis
2006-01-16 21:01 ` Daniel Jacobowitz
2006-01-21 11:22 ` Eli Zaretskii
1 sibling, 1 reply; 8+ messages in thread
From: Mark Kettenis @ 2006-01-16 20:59 UTC (permalink / raw)
To: drow; +Cc: gdb-patches
> Date: Mon, 16 Jan 2006 15:02:38 -0500
> From: Daniel Jacobowitz <drow@false.org>
>
> You'll notice that the call to observer_notify_inferior_created
> is removed from several target methods, and moved to the end of
> run_command_1. Consequently it's no longer possible to accidentally forget
> about a target - as we've obviously done for most of the targets I changed
> here. Less duplication is good!
Yay!
> I'll be needing to run some additional common code fragments between
> creating an inferior and starting it, for an upcoming project. Like most of
> GDB they need the target to be stopped; that's why I separated the create
> and proceed phases here.
That's the reason why you created post_create_inferior? If yes, then,
that answers the next question: Why did you introduce post_create_inferior?
> Another benefit of this is that I could finally implement a command I've
> wanted for ages when debugging startup code: create the inferior but don't
> run it, and give me my prompt back. That's not in this patch only because I
> couldn't think of a name for it! I'd call it "start", but well... already
> in use. Would anyone else find this useful? If so, would you care to
> suggest a name?
I vaguely remember there was a way to do that already, but when I last
wanted to use it, I couldn't find a way to do it. So yes, I'd welcome
such a command. Perhaps we could have something like:
(gdb) set stop-on-entry 1
after which "run" or "start" would stop at the entry point?
Mark
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RFC: target_create_inferior that does not call proceed
2006-01-16 20:59 ` Mark Kettenis
@ 2006-01-16 21:01 ` Daniel Jacobowitz
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-01-16 21:01 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
On Mon, Jan 16, 2006 at 09:58:39PM +0100, Mark Kettenis wrote:
> > I'll be needing to run some additional common code fragments between
> > creating an inferior and starting it, for an upcoming project. Like most of
> > GDB they need the target to be stopped; that's why I separated the create
> > and proceed phases here.
>
> That's the reason why you created post_create_inferior? If yes, then,
> that answers the next question: Why did you introduce post_create_inferior?
That's right. The followup patch I posted today calls solib functions
from there. The followups I'll be working on later in the week will
hook the "target properties" and "available register sets" bits I
discussed on gdb@ (a long time ago now) into the same place.
> I vaguely remember there was a way to do that already, but when I last
> wanted to use it, I couldn't find a way to do it. So yes, I'd welcome
> such a command. Perhaps we could have something like:
>
> (gdb) set stop-on-entry 1
>
> after which "run" or "start" would stop at the entry point?
Hrm, I'm not a big fan of state variables, but at least that's clearer
than anything else I've thought of. I suppose we could also call the
command create-inferior :-)
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RFC: target_create_inferior that does not call proceed
2006-01-16 20:02 RFC: target_create_inferior that does not call proceed Daniel Jacobowitz
2006-01-16 20:59 ` Mark Kettenis
@ 2006-01-21 11:22 ` Eli Zaretskii
2006-01-21 15:13 ` Daniel Jacobowitz
1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2006-01-21 11:22 UTC (permalink / raw)
To: gdb-patches
> Date: Mon, 16 Jan 2006 15:02:38 -0500
> From: Daniel Jacobowitz <drow@false.org>
>
> This patch adjusts the to_create_inferior target method so that the inferior
> is implicitly stopped at the end of it, instead of running.
Daniel, could you please describe in some detail what happens now on
Posix systems when to_create_inferior is called, and in particular as
result of the call to `proceed'? AFAIK, the inferior is not actually
running until you say "run", but your message seems to indicate
otherwise?
I need these details to decide whether your suggested change in
go32-nat.c is the right thing to do. There's the prog_has_started
flag there that go32_create_inferior is setting after the call to
proceed. You suggest to remove the call to proceed, but the flag is
still being set, and I need to make up my mind whether this could
spell some trouble. If it does, we might need a new target op to
handle that.
I tried to understand what exactly does proceed do when called from
to_create_inferior, but got lost in twisty little passages, all alike.
I need help.
> Another benefit of this is that I could finally implement a command I've
> wanted for ages when debugging startup code: create the inferior but don't
> run it, and give me my prompt back. That's not in this patch only because I
> couldn't think of a name for it! I'd call it "start", but well... already
> in use. Would anyone else find this useful? If so, would you care to
> suggest a name?
"create" or "create-inferior" sounds like a good name.
We would need a docs patch if we add a new command, of course.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RFC: target_create_inferior that does not call proceed
2006-01-21 11:22 ` Eli Zaretskii
@ 2006-01-21 15:13 ` Daniel Jacobowitz
2006-01-24 19:16 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-01-21 15:13 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On Sat, Jan 21, 2006 at 01:22:37PM +0200, Eli Zaretskii wrote:
> > Date: Mon, 16 Jan 2006 15:02:38 -0500
> > From: Daniel Jacobowitz <drow@false.org>
> >
> > This patch adjusts the to_create_inferior target method so that the inferior
> > is implicitly stopped at the end of it, instead of running.
>
> Daniel, could you please describe in some detail what happens now on
> Posix systems when to_create_inferior is called, and in particular as
> result of the call to `proceed'? AFAIK, the inferior is not actually
> running until you say "run", but your message seems to indicate
> otherwise?
>
> I need these details to decide whether your suggested change in
> go32-nat.c is the right thing to do. There's the prog_has_started
> flag there that go32_create_inferior is setting after the call to
> proceed. You suggest to remove the call to proceed, but the flag is
> still being set, and I need to make up my mind whether this could
> spell some trouble. If it does, we might need a new target op to
> handle that.
>
> I tried to understand what exactly does proceed do when called from
> to_create_inferior, but got lost in twisty little passages, all alike.
> I need help.
The only call site for target_create_inferior is at the bottom of
run_command_1. It first creates a new inferior, and then calls
proceed, which transitions the inferior from stopped to executing.
prog_has_started is only set when the program is created and cleared
when it is killed, so I think the patch is right - but I don't
understand all the DOS-specific bits of go32-nat.c.
> > Another benefit of this is that I could finally implement a command I've
> > wanted for ages when debugging startup code: create the inferior but don't
> > run it, and give me my prompt back. That's not in this patch only because I
> > couldn't think of a name for it! I'd call it "start", but well... already
> > in use. Would anyone else find this useful? If so, would you care to
> > suggest a name?
>
> "create" or "create-inferior" sounds like a good name.
>
> We would need a docs patch if we add a new command, of course.
Of course. Hmm, I like both of your suggestions.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RFC: target_create_inferior that does not call proceed
2006-01-21 15:13 ` Daniel Jacobowitz
@ 2006-01-24 19:16 ` Daniel Jacobowitz
2006-01-24 21:45 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-01-24 19:16 UTC (permalink / raw)
To: gdb-patches; +Cc: Eli Zaretskii
On Sat, Jan 21, 2006 at 10:13:46AM -0500, Daniel Jacobowitz wrote:
> > Daniel, could you please describe in some detail what happens now on
> > Posix systems when to_create_inferior is called, and in particular as
> > result of the call to `proceed'? AFAIK, the inferior is not actually
> > running until you say "run", but your message seems to indicate
> > otherwise?
> >
> > I need these details to decide whether your suggested change in
> > go32-nat.c is the right thing to do.
> The only call site for target_create_inferior is at the bottom of
> run_command_1. It first creates a new inferior, and then calls
> proceed, which transitions the inferior from stopped to executing.
> prog_has_started is only set when the program is created and cleared
> when it is killed, so I think the patch is right - but I don't
> understand all the DOS-specific bits of go32-nat.c.
Hi Eli,
Was this sufficient? Do you want to try the patch on DJGPP (since I
failed to build GDB on my local DJGPP installation)? I'd like to check
this patch in, and I believe it's correct, but I want to make sure I
don't break go32-nat.c.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RFC: target_create_inferior that does not call proceed
2006-01-24 19:16 ` Daniel Jacobowitz
@ 2006-01-24 21:45 ` Eli Zaretskii
2006-01-24 22:09 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2006-01-24 21:45 UTC (permalink / raw)
To: gdb-patches
> Date: Tue, 24 Jan 2006 14:16:24 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: Eli Zaretskii <eliz@gnu.org>
>
> > The only call site for target_create_inferior is at the bottom of
> > run_command_1. It first creates a new inferior, and then calls
> > proceed, which transitions the inferior from stopped to executing.
> > prog_has_started is only set when the program is created and cleared
> > when it is killed, so I think the patch is right - but I don't
> > understand all the DOS-specific bits of go32-nat.c.
>
> Hi Eli,
>
> Was this sufficient?
Yes, I think your patch is good to go.
Thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RFC: target_create_inferior that does not call proceed
2006-01-24 21:45 ` Eli Zaretskii
@ 2006-01-24 22:09 ` Daniel Jacobowitz
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-01-24 22:09 UTC (permalink / raw)
To: gdb-patches
On Tue, Jan 24, 2006 at 11:28:46PM +0200, Eli Zaretskii wrote:
> > Date: Tue, 24 Jan 2006 14:16:24 -0500
> > From: Daniel Jacobowitz <drow@false.org>
> > Cc: Eli Zaretskii <eliz@gnu.org>
> >
> > > The only call site for target_create_inferior is at the bottom of
> > > run_command_1. It first creates a new inferior, and then calls
> > > proceed, which transitions the inferior from stopped to executing.
> > > prog_has_started is only set when the program is created and cleared
> > > when it is killed, so I think the patch is right - but I don't
> > > understand all the DOS-specific bits of go32-nat.c.
> >
> > Hi Eli,
> >
> > Was this sufficient?
>
> Yes, I think your patch is good to go.
>
> Thanks.
Thanks! I've checked it in. I'm not going to work on the
create-inferior command right now, but I've left myself a note
to do that sometime if nobody else does.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-01-24 22:09 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-16 20:02 RFC: target_create_inferior that does not call proceed Daniel Jacobowitz
2006-01-16 20:59 ` Mark Kettenis
2006-01-16 21:01 ` Daniel Jacobowitz
2006-01-21 11:22 ` Eli Zaretskii
2006-01-21 15:13 ` Daniel Jacobowitz
2006-01-24 19:16 ` Daniel Jacobowitz
2006-01-24 21:45 ` Eli Zaretskii
2006-01-24 22:09 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox