From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8317 invoked by alias); 13 Aug 2007 21:03:39 -0000 Received: (qmail 8184 invoked by uid 22791); 13 Aug 2007 21:03:35 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 13 Aug 2007 21:03:29 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 0435898308 for ; Mon, 13 Aug 2007 21:03:29 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id DCFBA98104 for ; Mon, 13 Aug 2007 21:03:28 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.67) (envelope-from ) id 1IKh4Q-0006Ii-JI for gdb-patches@sourceware.org; Mon, 13 Aug 2007 17:03:26 -0400 Date: Mon, 13 Aug 2007 21:03:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org Subject: [rfc] Delay deletion of step-resume breakpoints Message-ID: <20070813210326.GA24049@caradoc.them.org> Mail-Followup-To: gdb-patches@sourceware.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.15 (2007-04-09) X-IsSubscribed: yes 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 X-SW-Source: 2007-08/txt/msg00257.txt.bz2 This patch addresses a problem I encountered a long time ago. Unfortunately I can't find the testcase, and all my attempts to write a new one have failed. But, logically, I'm pretty sure the problem still exists - it's just hard to trigger. delete_thread calls free_thread, which calls delete_breakpoint. But delete_thread is called from a number of places during target_wait on various targets - when the program might not be stopped, so deleting the breakpoint will fail. This patch changes the delete_breakpoint call to set disp_del_at_next_stop instead. The breakpoint will stick around a little longer, but still be collected. The problem with writing a test case is that you need a step resume breakpoint in a non-current thread when that thread exits. This is timing sensitive and I haven't had any luck reproducing it today. Does anyone else think this patch is right (or wrong)? -- Daniel Jacobowitz CodeSourcery 2007-08-13 Daniel Jacobowitz * thread.c (free_thread): Do not delete the step resume breakpoint right away. Index: thread.c =================================================================== RCS file: /cvs/src/src/gdb/thread.c,v retrieving revision 1.53 diff -u -p -r1.53 thread.c --- thread.c 10 Apr 2007 14:53:46 -0000 1.53 +++ thread.c 13 Aug 2007 20:42:58 -0000 @@ -87,9 +87,11 @@ static void free_thread (struct thread_info *tp) { /* NOTE: this will take care of any left-over step_resume breakpoints, - but not any user-specified thread-specific breakpoints. */ + but not any user-specified thread-specific breakpoints. We can not + delete the breakpoint straight-off, because the inferior might not + be stopped at the moment. */ if (tp->step_resume_breakpoint) - delete_breakpoint (tp->step_resume_breakpoint); + tp->step_resume_breakpoint->disposition = disp_del_at_next_stop; /* FIXME: do I ever need to call the back-end to give it a chance at this private data before deleting the thread? */