From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6459 invoked by alias); 8 Oct 2008 22:47:39 -0000 Received: (qmail 6450 invoked by uid 22791); 8 Oct 2008 22:47:38 -0000 X-Spam-Check-By: sourceware.org Received: from de01egw02.freescale.net (HELO de01egw02.freescale.net) (192.88.165.103) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 08 Oct 2008 22:46:57 +0000 Received: from de01smr01.freescale.net (de01smr01.freescale.net [10.208.0.31]) by de01egw02.freescale.net (8.12.11/de01egw02) with ESMTP id m98Mkq3e008768; Wed, 8 Oct 2008 15:46:52 -0700 (MST) Received: from ld0159-tx32 (ld0159-tx32.am.freescale.net [10.82.19.109]) by de01smr01.freescale.net (8.13.1/8.13.0) with ESMTP id m98Mkpts012209; Wed, 8 Oct 2008 17:46:51 -0500 (CDT) Date: Wed, 08 Oct 2008 22:47:00 -0000 From: "Anmol P. Paralkar" To: Pedro Alves cc: gdb@sourceware.org Subject: Re: Detaching from a remote progam: Why does GDB retain breakpoints? In-Reply-To: <200810082324.17293.pedro@codesourcery.com> Message-ID: References: <200810082324.17293.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed 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 X-SW-Source: 2008-10/txt/msg00031.txt.bz2 On Wed, 8 Oct 2008, Pedro Alves wrote: > On Wednesday 08 October 2008 23:01:57, Anmol P. Paralkar wrote: > >> I am trying to understand the 'detach' command and need your help. >> >> The documentation says: >> >> "After the detach command, gdb is free to connect to another target." >> >> So, why does GDB retain breakpoints after detaching from the remote target? > > GDB shouldn't be leaving breakpoints installed in the target on a detach. If it > is, it is a bug. > > If you refering to breakpoints as what is listed by "info breakpoints", we just > keep them, well, that's a user interface issue. We leave them because we can, it > can be useful. Just like we keep breakpoint if the program just exits normally > after a "run". > >> The documentation for 'disconnect' indicates that GDB could possibly re-connect >> to the same remote target so I can see why it makes sense to retain breakpoints >> on a 'disconnect'. But, with a 'detach', a D-packet is sent and I suppose stubs >> will then typically relinquish control and have the target proper take over. >> >> Should'nt GDB clear out all its target related debug-state on a 'detach'? >> > > You should be seeing GDB removing the breakpoints from the target before > you see the 'D' packet: either with `z' packets if the stub supports them, > or memory writes otherwise. Is this what you meant? > > -- > Pedro Alves > Hello Pedro, No, the remote program does not have any unremoved breakpoints: GDB properly sets and removes them - I see the pre Z's and post z's as and when expected in the interaction between GDB and the remote target stub. OK, it's just a UI issue then. Thanks. Best Regards, Anmol.