From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11468 invoked by alias); 14 Jan 2013 13:38:40 -0000 Received: (qmail 11359 invoked by uid 22791); 14 Jan 2013 13:38:38 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_CP X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Jan 2013 13:38:26 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1TukF7-0003I9-98 from Muhammad_Bilal@mentor.com ; Mon, 14 Jan 2013 05:38:25 -0800 Received: from SVR-IES-FEM-03.mgc.mentorg.com ([137.202.0.108]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 14 Jan 2013 05:38:24 -0800 Received: from EU-MBX-02.mgc.mentorg.com ([169.254.3.230]) by SVR-IES-FEM-03.mgc.mentorg.com ([137.202.0.108]) with mapi id 14.01.0289.001; Mon, 14 Jan 2013 13:38:23 +0000 From: "Bilal, Muhammad" To: Tom Tromey , "eliz@gnu.org" , "brobecker@adacore.com" , "dje@google.com" , "jan.kratochvil@redhat.com" , "gdb-patches@sourceware.org" Subject: [PATCH]13217 thread apply all detach throws a SEGFAULT Date: Mon, 14 Jan 2013 13:38:00 -0000 Message-ID: <97B73E257CC18646B0B5D3DD77DCBDD158EBC9@EU-MBX-02.mgc.mentorg.com> References: <97B73E257CC18646B0B5D3DD77DCBDD158E8FD@EU-MBX-02.mgc.mentorg.com> In-Reply-To: <97B73E257CC18646B0B5D3DD77DCBDD158E8FD@EU-MBX-02.mgc.mentorg.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: 2013-01/txt/msg00273.txt.bz2 Hi, I worked on bug#13217 "thread apply all detach throws a SEGFAULT " of gdb and fixed this problem by making a Patch. I am upstreaming of it=20 Actually when command "thread apply all detach" is applied then the functio= n thread_apply_command (char *tidlist, int from_tty) in thread.c:1179 calle= d a function init_thread_list (void)in thread.c:140 which makes the 'thread_list' struck to null so when for (tp =3D thread_lis= t; tp; tp =3D tp->next) loop in thread_apply_command (char *tidlist, int fr= om_tty) in thread.c:1179 iterates 2nd time it throws a segmentation fault w= hen try to access the bogus value of thread_list so i have fixed this problem I have written the test case for it also I have worked on gdb-7.5.50.20121127 snapshot 1)=20 gdb/thread.c diff -u thread.c new_thread.c > change_thread.c ------------PATCH--------------------------------------- --- thread.c 2012-07-27 05:52:36.000000000 +0500 +++ new_thread.c 2013-01-02 12:06:51.876346782 +0500 @@ -1203,6 +1203,8 @@ execute_command (cmd, from_tty); strcpy (cmd, saved_cmd); /* Restore exact command used previously. */ + if(thread_list =3D=3D NULL) + break; } =20 do_cleanups (old_chain); 2) gdb/testsuit/gdb.thread -----------------------------------test------------------------------------ --- threadapply.exp 2013-01-14 16:30:25.000000000 +0500 +++ new_threadapply.exp 2013-01-14 16:39:07.000000000 +0500 @@ -63,3 +63,4 @@ gdb_test "up" ".*in main.*" "go up in the stack frame"=20 gdb_test "thread apply all print 1" "Thread ..*\\\$\[0-9]+ =3D 1.*Thread = ..*\\\$\[0-9]+ =3D 1.*Thread ..*\\\$\[0-9]+ =3D 1.*Thread ..*\\\$\[0-9]+ = =3D 1.*Thread ..*\\\$\[0-9]+ =3D 1.*Thread ..*\\\$\[0-9]+ =3D 1" "run a sim= ple print command on all threads" gdb_test "down" "#0.*thread_function.*" "go down and check selected frame" +gdb_test "thread apply all detach" "Thread.*\nDetaching from.*" "detaching= from all threads" ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= --------------------- please review it and add me sourceware.org thanks Bilal =20 =20