From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30090 invoked by alias); 9 May 2013 18:53:04 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 30061 invoked by uid 89); 9 May 2013 18:53:03 -0000 X-Spam-SWARE-Status: No, score=-7.6 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 09 May 2013 18:53:03 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r49Ir2BP006076 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 9 May 2013 14:53:02 -0400 Received: from barimba (ovpn-113-133.phx2.redhat.com [10.3.113.133]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r49IqxRS024888 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 9 May 2013 14:53:01 -0400 From: Tom Tromey From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH 38/40] some fixes to infrun.c In-Reply-To: References: Message-Id: <72b491c4ccd7996cf471b85b346616f207e69760.1368124285.git.tromey@redhat.com> Date: Thu, 09 May 2013 18:53:00 -0000 MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-05/txt/msg00352.txt.bz2 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