From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32258 invoked by alias); 29 Jul 2013 11:42:50 -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 32218 invoked by uid 89); 29 Jul 2013 11:42:48 -0000 X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,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 11:42:47 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1V3lqZ-0007Gv-N5 from Muhammad_Waqas@mentor.com ; Mon, 29 Jul 2013 04:42:39 -0700 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 29 Jul 2013 04:42:40 -0700 Received: from [137.202.157.111] (147.34.91.1) by mail-na.mentorg.com (147.34.97.43) with Microsoft SMTP Server (TLS) id 14.2.247.3; Mon, 29 Jul 2013 04:42:38 -0700 Message-ID: <51F65519.2080806@codesourcery.com> Date: Mon, 29 Jul 2013 11:42: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: Yao Qi CC: , , Subject: Re: [PATCH with testcase] Bug 11568 - delete thread-specific breakpoint on the thread exit References: <51F619CE.5040407@codesourcery.com> <51F633E5.7000302@codesourcery.com> In-Reply-To: <51F633E5.7000302@codesourcery.com> Content-Type: multipart/mixed; boundary="------------030502080200030508030904" X-Virus-Found: No X-SW-Source: 2013-07/txt/msg00700.txt.bz2 --------------030502080200030508030904 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 6445 On 07/29/2013 02:20 PM, Yao Qi wrote: > On 07/29/2013 03:29 PM, Muhammad Waqas wrote: >> 2013-07-24 Muhammad Waqas > > Wrong e-mail address? > Should mention PR number in ChangeLog. > >> >> * breakpoint.c (breakpoint_auto_delete): Remove breakpoint >> Remove thread related breakpoints if threads are exited. >> > > "Remove breakpoint" can be removed, IMO. > > >> 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*/ > > This line is too long, and your mailer wrap the patch. > >> + { >> + struct thread_info * tp = find_thread_id (b->thread) ; >> + if (tp != NULL && (tp->state == THREAD_EXITED || >> !target_thread_alive (tp->ptid))) > > Likewise. > >> + delete_breakpoint (b); >> + } >> } >> } >> > > I am wondering why don't we register to thread_exit observer, and > remove breakpoints when thread exits. arm-linux-nat.c and > ppc-linux-nat.c did something similar to delete thread hw breakpoint. > However, I am not sure it is safe to do so considering async/non-stop > mode. > >> gdb/testcase/Changlog >> >> 2013-07-29 Muhammad Waqas >> >> * gdb.threads/thread-specific-bp.c: New file > > It is copied from Jan's example in bugzilla, better to list his name > here too. > >> * gdb.threads/thread-specific-bp.exp: New file. >> > > > >> >> gdb.threads/thread-specific-bp.c > > Please include these new added files into the patch. So that > reviewers can apply your patch to get these new files. > > We need a copyright header for test files too. > > >> 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\])*" >> } >> > > This test passes even without your patch to breakpoint_auto_delete > above. Please make sure the test fails without your patch, and fails > go away when your patch is applied. > > >> >> 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 > ^^^^^^^^^^^ > > Duplicated test results. Please make them unique. Like, > > PASS: gdb.threads/thread-specific-bp.exp: info break 1 > ... > PASS: gdb.threads/thread-specific-bp.exp: info break 2 > Thanks for reviewing the patch. gdb/ChangLog 2013-07-24 Muhammad Waqas PR gdb/11568 * breakpoint.c (breakpoint_auto_delete): add new condition Remove thread related breakpoints if threads are exited. 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 29 Jul 2013 11:22:05 -0000 @@ -11910,6 +11910,15 @@ 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); + } } } testsuite/Changlog 2013-07-29 Muhammad Waqas Jan Kratochvil * gdb.threads/thread-specific-bp.c: New file. * gdb.threads/thread-specific-bp.exp: New file. find the attached file for testcase and now testcase fails without my patch and passes with my patch Test Run By waqas on Mon Jul 29 15:47:40 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: threaded breakpoint deleted === gdb Summary === # of expected passes 6 /home/waqas/gdb/mygdb/newgdb/src/gdb/testsuite/../../gdb/gdb version 7.6.50.20130724-cvs -nw -nx -data-directory /home/waqas/gdb/mygdb/newgdb/src/gdb/testsuite/../data-directory --------------030502080200030508030904 Content-Type: application/x-gzip; name="patch.tar.gz" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="patch.tar.gz" Content-length: 4035 H4sIAJ9O9lEAA+1abXPTSBLma1Tl/9DnUFdONpblt3gJC3eBBTZXIVBJKIoi XEqWxvYssqTTSxwfxX+/p2dkWQ4Jjg9nd9lVV16s0cx0T3fP0z09Du3EGTWG bt+M0/G9uyELtLvb4f/NXtcq/mdqdjvNe80Wmjqd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jZSSqamsj6H/OS8sSHjTuQU22uQgUN jmJTHNr6m1pZWZDNPfsCK7ADHhYB3DELi2PIAX16jwPIefbNkPP8i0tnxgZV 73/CAQUnkc8NfEr7s0+Rw4M/V2ed+tLPGoSq2vD1G31SKdhn+kB/e0TVKn2m T+obcxn815sAfAdHUv8cp0YVruYTGSzYez72BKrk9YFt5WcTsLiFKlVVDa7m r2ZFvPMkuKYb98q7shrOx6mXSByrqFq86alSlS94MiU2SeKg+cnYqMPNqrWz 91b9wdmHH7bw6d9n/ll09mFb1zvnz4qdub1Vu8+c4DnjECvcUrMwf650za5j ZncfVWPjsxJO/90kLQL2lKv9lTurV3EmG93XpbNzbMFac4e3tY9gf42alJUx 3zmH3HM/HfeBEtU8/lY/bFyr3OJVyX3+X13QXqY0NQIqM7fnY83tWnHc1nIL zYVRXTduMtF8TGYlbl1invmYeRuvzdxeFHJmngGQZGaexaoof+8g21HKXv8X 0zNfs9oousG11deCT9wmQfqTk87/7paHug/tdW/K/5jy/K/dbSL/azaRElL3 bsXS9BfP/0oqqaSSSiqppJJKKqmkkkoqqaSSSiqppJJKKqmkkkr6c9H/AOsT m7cAUAAA --------------030502080200030508030904--