From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28845 invoked by alias); 11 May 2014 03:27:50 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 28807 invoked by uid 89); 11 May 2014 03:27:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 11 May 2014 03:27:44 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WjKQN-0000Hb-Gv from Luis_Gustavo@mentor.com ; Sat, 10 May 2014 20:27:39 -0700 Received: from NA1-MAIL.mgc.mentorg.com ([147.34.98.181]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Sat, 10 May 2014 20:27:38 -0700 Received: from [172.30.4.62] ([172.30.4.62]) by NA1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.3959); Sat, 10 May 2014 20:27:39 -0700 Message-ID: <536EEE1F.6050003@codesourcery.com> Date: Sun, 11 May 2014 03:27:00 -0000 From: Luis Machado Reply-To: lgustavo@codesourcery.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Sofia , gdb@sourceware.org Subject: Re: GDB breakpoint implementation for multithreaded programms References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg00013.txt.bz2 On 05/10/2014 06:56 PM, Sofia wrote: > I'm writing my GDB stub and trying to set breakpoints on different threads. > When I don't ask GDB about the number of threads, It works fine as a single- > threaded application and breakpoints are set correctly. But when I enter - > 'info threads', something strange happens. > > Firstly, GDB reads the contents of all threads' registers(it's OK). Then I > enter 'continue' and see that breakpoints are not set at all threads my > program has. I don't understand why, but the packet Z0(breakpoint packet) is > only sent to inactive thread. The documentation says that if the thread id is > not specified, breakpoints will be set at all threads. What's wrong with this > or where can I read about such GDB behavior? > > > Is this a software breakpoint (Z0/z0) or a hardware breakpoint we are talking about? A software breakpoint should be valid for all threads if the threads are executing a shared piece of code. If these breakpoints are not triggering, we may have a bug somewhere. For hardware breakpoints, the target code (in this case, the remote stub) is responsible for replicating the hardware breakpoint settings (register contents) to all threads upon their creation. What version of GDB are you using?