Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Remove ignoring leading exec events code.
@ 2008-03-14  9:12 Vladimir Prus
  2008-03-14 18:06 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Prus @ 2008-03-14  9:12 UTC (permalink / raw)
  To: gdb-patches


GDB has some code to handle a case where target reports more
that one exec event when execing. However, it turns out that
all target say that exactly one event is reported, and 
therefore that code is of no use. The comments for that code
is dated 2002-12-05 and mentions HP-UX, which I presume had this
bug fixed. Even if some new target appears with the same bug,
as the comment say, it's better to handle this in target_wait,
not in the generic infrun code.

OK?

- Volodya

	* fork-child.c (startup_inferior): Do not set
	inferior_ignoring_leading_exec_events.
	* inf-child.c (inf_child_reported_exec_events_per_exec_call): Remove.
	(inf_child_target): Do not set to_reported_exec_events_per_exec_call.
	* infrun.c (inferior_ignoring_leading_exec_events): Remove.
	(handle_inferior_event): Remove code for ignoring leading exec
	events.
	* target.c (update_current_target): Do not inherit, or default,
	to_reported_exec_events_per_exec_call.
	(debug_to_reported_exec_events_per_exec_call): Remove.
	(setup_target_debug): Do not set to_reported_exec_events_per_exec_call.
	* target.h (target_reported_exec_events_per_exec_call): Remove.
	(struct target): Remove the to_reported_exec_events_per_exec_call
	field.
---
 gdb/fork-child.c |    3 ---
 gdb/inf-child.c  |   10 ----------
 gdb/infrun.c     |   19 -------------------
 gdb/target.c     |   19 -------------------
 gdb/target.h     |    7 -------
 5 files changed, 0 insertions(+), 58 deletions(-)

diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index c8e7683..7aff110 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -426,9 +426,6 @@ startup_inferior (int ntraps)
 
   init_wait_for_inferior ();
 
-  inferior_ignoring_leading_exec_events =
-    target_reported_exec_events_per_exec_call () - 1;
-
   while (1)
     {
       /* Make wait_for_inferior be quiet. */
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index ae11871..8da25f4 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -145,14 +145,6 @@ inf_child_remove_exec_catchpoint (int pid)
 }
 
 static int
-inf_child_reported_exec_events_per_exec_call (void)
-{
-  /* This version of Unix doesn't support notification of exec
-     events.  */
-  return 1;
-}
-
-static int
 inf_child_can_run (void)
 {
   return 1;
@@ -195,8 +187,6 @@ inf_child_target (void)
   t->to_follow_fork = inf_child_follow_fork;
   t->to_insert_exec_catchpoint = inf_child_insert_exec_catchpoint;
   t->to_remove_exec_catchpoint = inf_child_remove_exec_catchpoint;
-  t->to_reported_exec_events_per_exec_call =
-    inf_child_reported_exec_events_per_exec_call;
   t->to_can_run = inf_child_can_run;
   t->to_pid_to_exec_file = inf_child_pid_to_exec_file;
   t->to_stratum = process_stratum;
diff --git a/gdb/infrun.c b/gdb/infrun.c
index f51a7ad..1ba3e07 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -82,8 +82,6 @@ static int prepare_to_proceed (int);
 
 void _initialize_infrun (void);
 
-int inferior_ignoring_leading_exec_events = 0;
-
 /* When set, stop the 'step' command if we enter a function which has
    no line number information.  The normal behavior is that we step
    over such function.  */
@@ -1493,23 +1491,6 @@ handle_inferior_event (struct execution_control_state *ecs)
         fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_EXECD\n");
       stop_signal = TARGET_SIGNAL_TRAP;
 
-      /* NOTE drow/2002-12-05: This code should be pushed down into the
-         target_wait function.  Until then following vfork on HP/UX 10.20
-         is probably broken by this.  Of course, it's broken anyway.  */
-      /* Is this a target which reports multiple exec events per actual
-         call to exec()?  (HP-UX using ptrace does, for example.)  If so,
-         ignore all but the last one.  Just resume the exec'r, and wait
-         for the next exec event. */
-      if (inferior_ignoring_leading_exec_events)
-	{
-	  inferior_ignoring_leading_exec_events--;
-	  target_resume (ecs->ptid, 0, TARGET_SIGNAL_0);
-	  prepare_to_wait (ecs);
-	  return;
-	}
-      inferior_ignoring_leading_exec_events =
-	target_reported_exec_events_per_exec_call () - 1;
-
       pending_follow.execd_pathname =
 	savestring (ecs->ws.value.execd_pathname,
 		    strlen (ecs->ws.value.execd_pathname));
diff --git a/gdb/target.c b/gdb/target.c
index 9d2f1fd..4168c05 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -439,7 +439,6 @@ update_current_target (void)
       /* Do not inherit to_follow_fork.  */
       INHERIT (to_insert_exec_catchpoint, t);
       INHERIT (to_remove_exec_catchpoint, t);
-      INHERIT (to_reported_exec_events_per_exec_call, t);
       INHERIT (to_has_exited, t);
       INHERIT (to_mourn_inferior, t);
       INHERIT (to_can_run, t);
@@ -599,9 +598,6 @@ update_current_target (void)
   de_fault (to_remove_exec_catchpoint,
 	    (int (*) (int))
 	    tcomplain);
-  de_fault (to_reported_exec_events_per_exec_call,
-	    (int (*) (void))
-	    return_one);
   de_fault (to_has_exited,
 	    (int (*) (int, int, int *))
 	    return_zero);
@@ -2636,20 +2632,6 @@ debug_to_remove_exec_catchpoint (int pid)
 }
 
 static int
-debug_to_reported_exec_events_per_exec_call (void)
-{
-  int reported_exec_events;
-
-  reported_exec_events = debug_target.to_reported_exec_events_per_exec_call ();
-
-  fprintf_unfiltered (gdb_stdlog,
-		      "target_reported_exec_events_per_exec_call () = %d\n",
-		      reported_exec_events);
-
-  return reported_exec_events;
-}
-
-static int
 debug_to_has_exited (int pid, int wait_status, int *exit_status)
 {
   int has_exited;
@@ -2786,7 +2768,6 @@ setup_target_debug (void)
   current_target.to_remove_vfork_catchpoint = debug_to_remove_vfork_catchpoint;
   current_target.to_insert_exec_catchpoint = debug_to_insert_exec_catchpoint;
   current_target.to_remove_exec_catchpoint = debug_to_remove_exec_catchpoint;
-  current_target.to_reported_exec_events_per_exec_call = debug_to_reported_exec_events_per_exec_call;
   current_target.to_has_exited = debug_to_has_exited;
   current_target.to_mourn_inferior = debug_to_mourn_inferior;
   current_target.to_can_run = debug_to_can_run;
diff --git a/gdb/target.h b/gdb/target.h
index 9a34244..5a5acbe 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -841,13 +841,6 @@ int target_follow_fork (int follow_child);
 #define target_remove_exec_catchpoint(pid) \
      (*current_target.to_remove_exec_catchpoint) (pid)
 
-/* Returns the number of exec events that are reported when a process
-   invokes a flavor of the exec() system call on this target, if exec
-   events are being reported.  */
-
-#define target_reported_exec_events_per_exec_call() \
-     (*current_target.to_reported_exec_events_per_exec_call) ()
-
 /* Returns TRUE if PID has exited.  And, also sets EXIT_STATUS to the
    exit code of PID, if any.  */
 
-- 
1.5.3.5


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] Remove ignoring leading exec events code.
  2008-03-14  9:12 [RFA] Remove ignoring leading exec events code Vladimir Prus
@ 2008-03-14 18:06 ` Daniel Jacobowitz
  2008-03-17 18:28   ` Michael Snyder
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2008-03-14 18:06 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb-patches

On Fri, Mar 14, 2008 at 12:12:31PM +0300, Vladimir Prus wrote:
> 
> GDB has some code to handle a case where target reports more
> that one exec event when execing. However, it turns out that
> all target say that exactly one event is reported, and 
> therefore that code is of no use. The comments for that code
> is dated 2002-12-05 and mentions HP-UX, which I presume had this
> bug fixed. Even if some new target appears with the same bug,
> as the comment say, it's better to handle this in target_wait,
> not in the generic infrun code.
> 
> OK?

OK.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] Remove ignoring leading exec events code.
  2008-03-14 18:06 ` Daniel Jacobowitz
@ 2008-03-17 18:28   ` Michael Snyder
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Snyder @ 2008-03-17 18:28 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Vladimir Prus, gdb-patches

On Fri, 2008-03-14 at 14:06 -0400, Daniel Jacobowitz wrote:
> On Fri, Mar 14, 2008 at 12:12:31PM +0300, Vladimir Prus wrote:
> > 
> > GDB has some code to handle a case where target reports more
> > that one exec event when execing. However, it turns out that
> > all target say that exactly one event is reported, and 
> > therefore that code is of no use. The comments for that code
> > is dated 2002-12-05 and mentions HP-UX, which I presume had this
> > bug fixed. Even if some new target appears with the same bug,
> > as the comment say, it's better to handle this in target_wait,
> > not in the generic infrun code.
> > 
> > OK?
> 
> OK.

Hmm, just a cautionary note.  The code / practice that you're
talking about stretches WAAAAY back in history.  I'm pretty
sure it was not only for HP-UX.  There may be other (possibly
historical) targets that depend on this.

I can remember that code being there (and being necessary)
in the mid-1990's.  I don't necessarily remember on what
targets it came into play, but I might guess that SunOS 
(perhaps solaris or perhaps before) was one of them.






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-17 18:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-14  9:12 [RFA] Remove ignoring leading exec events code Vladimir Prus
2008-03-14 18:06 ` Daniel Jacobowitz
2008-03-17 18:28   ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox