Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Detaching from a remote progam: Why does GDB retain breakpoints?
@ 2008-10-08 22:02 Anmol P. Paralkar
  2008-10-08 22:24 ` Pedro Alves
  2008-10-08 22:56 ` Michael Snyder
  0 siblings, 2 replies; 4+ messages in thread
From: Anmol P. Paralkar @ 2008-10-08 22:02 UTC (permalink / raw)
  To: gdb

Hello,

  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?

  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'?

Thanks,
Anmol.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Detaching from a remote progam: Why does GDB retain breakpoints?
  2008-10-08 22:02 Detaching from a remote progam: Why does GDB retain breakpoints? Anmol P. Paralkar
@ 2008-10-08 22:24 ` Pedro Alves
  2008-10-08 22:47   ` Anmol P. Paralkar
  2008-10-08 22:56 ` Michael Snyder
  1 sibling, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2008-10-08 22:24 UTC (permalink / raw)
  To: gdb; +Cc: Anmol P. Paralkar

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Detaching from a remote progam: Why does GDB retain breakpoints?
  2008-10-08 22:24 ` Pedro Alves
@ 2008-10-08 22:47   ` Anmol P. Paralkar
  0 siblings, 0 replies; 4+ messages in thread
From: Anmol P. Paralkar @ 2008-10-08 22:47 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Detaching from a remote progam: Why does GDB retain breakpoints?
  2008-10-08 22:02 Detaching from a remote progam: Why does GDB retain breakpoints? Anmol P. Paralkar
  2008-10-08 22:24 ` Pedro Alves
@ 2008-10-08 22:56 ` Michael Snyder
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Snyder @ 2008-10-08 22:56 UTC (permalink / raw)
  To: Anmol P. Paralkar; +Cc: gdb

Anmol P. Paralkar wrote:
> Hello,
> 
>   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?
> 
>   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'?

It does clear out the target-related part.

The breakpoints in the "info breakpoint" list are debugger state,
not target state.  Just like the symbol table.  Detaching from the
target doesn't clear symbols either.

The premise is, you might want them again.
You might, for instance, reset your target and
begin a new debug session, with the same symbols
and breakpoints.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-10-08 22:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-08 22:02 Detaching from a remote progam: Why does GDB retain breakpoints? Anmol P. Paralkar
2008-10-08 22:24 ` Pedro Alves
2008-10-08 22:47   ` Anmol P. Paralkar
2008-10-08 22:56 ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox