This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 38/40] some fixes to infrun.c


This fixes some of the problems in infrun.c that the checker reported.
I filed the remaining problems as bugs.

This patch is purely stylistic.

	* infrun.c (handle_vfork_child_exec_or_exit)
	(fetch_inferior_event, adjust_pc_after_break): Introduce
	an outer null cleanup.
---
 gdb/infrun.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 54e92f2..4e7091e 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -665,7 +665,7 @@ handle_vfork_child_exec_or_exit (int exec)
       if (inf->vfork_parent->pending_detach)
 	{
 	  struct thread_info *tp;
-	  struct cleanup *old_chain;
+	  struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
 	  struct program_space *pspace;
 	  struct address_space *aspace;
 
@@ -677,12 +677,12 @@ handle_vfork_child_exec_or_exit (int exec)
 	    {
 	      /* If we're handling a child exit, then inferior_ptid
 		 points at the inferior's pid, not to a thread.  */
-	      old_chain = save_inferior_ptid ();
+	      save_inferior_ptid ();
 	      save_current_program_space ();
 	      save_current_inferior ();
 	    }
 	  else
-	    old_chain = save_current_space_and_thread ();
+	    save_current_space_and_thread ();
 
 	  /* We're letting loose of the parent.  */
 	  tp = any_live_thread_of_process (inf->vfork_parent->pid);
@@ -2803,10 +2803,11 @@ fetch_inferior_event (void *client_data)
   /* If an error happens while handling the event, propagate GDB's
      knowledge of the executing state to the frontend/user running
      state.  */
+  ts_old_chain = make_cleanup (null_cleanup, NULL);
   if (!non_stop)
-    ts_old_chain = make_cleanup (finish_thread_state_cleanup, &minus_one_ptid);
+    make_cleanup (finish_thread_state_cleanup, &minus_one_ptid);
   else
-    ts_old_chain = make_cleanup (finish_thread_state_cleanup, &ecs->ptid);
+    make_cleanup (finish_thread_state_cleanup, &ecs->ptid);
 
   /* Get executed before make_cleanup_restore_current_thread above to apply
      still for the thread which has thrown the exception.  */
@@ -3004,10 +3005,10 @@ adjust_pc_after_break (struct execution_control_state *ecs)
   if (software_breakpoint_inserted_here_p (aspace, breakpoint_pc)
       || (non_stop && moribund_breakpoint_here_p (aspace, breakpoint_pc)))
     {
-      struct cleanup *old_cleanups = NULL;
+      struct cleanup *old_cleanups = make_cleanup (null_cleanup, NULL);
 
       if (RECORD_IS_USED)
-	old_cleanups = record_full_gdb_operation_disable_set ();
+	record_full_gdb_operation_disable_set ();
 
       /* When using hardware single-step, a SIGTRAP is reported for both
 	 a completed single-step and a software breakpoint.  Need to
@@ -3033,8 +3034,7 @@ adjust_pc_after_break (struct execution_control_state *ecs)
 	  || ecs->event_thread->prev_pc == breakpoint_pc)
 	regcache_write_pc (regcache, breakpoint_pc);
 
-      if (RECORD_IS_USED)
-	do_cleanups (old_cleanups);
+      do_cleanups (old_cleanups);
     }
 }
 
-- 
1.8.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]