From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9126 invoked by alias); 29 Jul 2013 07:29:49 -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 9098 invoked by uid 89); 29 Jul 2013 07:29:48 -0000 X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RDNS_NONE autolearn=no version=3.3.1 Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 29 Jul 2013 07:29:47 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1V3htj-0000wv-HK from Muhammad_Waqas@mentor.com ; Mon, 29 Jul 2013 00:29:39 -0700 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 29 Jul 2013 00:29:39 -0700 Received: from [137.202.157.111] (147.34.91.1) by SVR-ORW-FEM-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server (TLS) id 14.2.247.3; Mon, 29 Jul 2013 00:29:38 -0700 Message-ID: <51F619CE.5040407@codesourcery.com> Date: Mon, 29 Jul 2013 07:29:00 -0000 From: Muhammad Waqas User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 MIME-Version: 1.0 To: CC: , Subject: [PATCH with testcase] Bug 11568 - delete thread-specific breakpoint on the thread exit Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2013-07/txt/msg00680.txt.bz2 In my previous post ( http://sourceware.org/ml/gdb-patches/2013-07/msg00560.html ), Tom ask me for testcase here is complete patch with testcase . gdb ChangLog 2013-07-24 Muhammad Waqas * breakpoint.c (breakpoint_auto_delete): Remove breakpoint Remove thread related breakpoints if threads are exited. cvs diff -up gdb/breakpoint.c Index: gdb/breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.772 diff -u -p -r1.772 breakpoint.c --- gdb/breakpoint.c 6 Jul 2013 07:14:54 -0000 1.772 +++ gdb/breakpoint.c 24 Jul 2013 05:18:24 -0000 @@ -11910,6 +11910,12 @@ breakpoint_auto_delete (bpstat bs) { if (b->disposition == disp_del_at_next_stop) delete_breakpoint (b); + else if (b->thread > 0) /* If breakpoint relates to user created thread Check if it's not alive then delete it*/ + { + struct thread_info * tp = find_thread_id (b->thread) ; + if (tp != NULL && (tp->state == THREAD_EXITED || !target_thread_alive (tp->ptid))) + delete_breakpoint (b); + } } } gdb/testcase/Changlog 2013-07-29 Muhammad Waqas * gdb.threads/thread-specific-bp.c: New file * gdb.threads/thread-specific-bp.exp: New file. gdb.threads/thread-specific-bp.c #include #include static void * start (void *arg) { return NULL; } int main (void) { pthread_t thread; pthread_create (&thread, NULL, start, NULL); pthread_join (thread, NULL); return 0; /*line # 13*/ } gdb.threads/thread-specific-bp.exp #This test verfiy that Breakpoint on a spacific thread is deleted standard_testfile if {[gdb_compile_pthreads \ "${srcdir}/${subdir}/${srcfile}" \ "${binfile}" executable {debug} ] != "" } { return -1 } clean_restart ${binfile} if [runto main] then { gdb_breakpoint "start" gdb_continue_to_breakpoint "start" gdb_test_multiple "info threads" "get thread 1 id" { -re "(\[0-9\]+)(\[^\n\r\]*Thread\[^\n\r\]*start.*)($gdb_prompt $)" { pass "thread created" } } # get the id of thread set thre $expect_out(1,string) gdb_breakpoint [gdb_get_line_number "line # 13"] gdb_breakpoint "main thread $thre" gdb_test "info break" ".*breakpoint.*(thread $thre)" gdb_continue_to_breakpoint "line # 13" gdb_test "info break" ".*breakpoint.*(thread \[^$thre\])*" } runtest gdb.threads/thread-specific-bp.exp test Run By waqas on Mon Jul 29 10:57:26 2013 Native configuration is x86_64-unknown-linux-gnu === gdb tests === Schedule of variations: unix Running target unix Running ./gdb.threads/thread-specific-bp.exp ... PASS: gdb.threads/thread-specific-bp.exp: successfully compiled posix threads test case PASS: gdb.threads/thread-specific-bp.exp: continue to breakpoint: start PASS: gdb.threads/thread-specific-bp.exp: thread created PASS: gdb.threads/thread-specific-bp.exp: info break PASS: gdb.threads/thread-specific-bp.exp: continue to breakpoint: line # 13 PASS: gdb.threads/thread-specific-bp.exp: info break === gdb Summary === # of expected passes 6 /home/waqas/gdb/mygdb/gdb-7.6/gdb/testsuite/../../gdb/gdb version 7.6 -nw -nx -data-directory /home/waqas/gdb/mygdb/gdb-7.6/gdb/testsuite/../data-directory