public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* Watchpoint prorogation to child threads
@ 2008-02-26 15:14 Phil Muldoon
  2008-02-26 16:00 ` Mark Wielaard
  0 siblings, 1 reply; 5+ messages in thread
From: Phil Muldoon @ 2008-02-26 15:14 UTC (permalink / raw)
  To: Frysk Hackers

A question about watchpoint prorogation to child threads:

Thread A clones/forks Thread B

In the state machine that deals with the watchpoint code, the new code 
will update cloned offspring with the same set of watchpoints.

This is how I see it now. Are there useful use-cases that dictate that 
this behavior should not happen?

Regards

Phil

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

* Re: Watchpoint prorogation to child threads
  2008-02-26 15:14 Watchpoint prorogation to child threads Phil Muldoon
@ 2008-02-26 16:00 ` Mark Wielaard
  2008-02-26 16:11   ` Phil Muldoon
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Wielaard @ 2008-02-26 16:00 UTC (permalink / raw)
  To: Phil Muldoon; +Cc: Frysk Hackers

Hi Phil,

On Tue, 2008-02-26 at 15:13 +0000, Phil Muldoon wrote:
> A question about watchpoint prorogation to child threads:
> 
> Thread A clones/forks Thread B
> 
> In the state machine that deals with the watchpoint code, the new code 
> will update cloned offspring with the same set of watchpoints.
> 
> This is how I see it now. Are there useful use-cases that dictate that 
> this behavior should not happen?

It would be nice if this is similar to the breakpoints. Low-level
breakpoints are the same on a clone (because they are really just
markers in the code segment which is the same), but they are cleared on
exec (because then the memory of the process is reset).

Cheers,

Mark

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

* Re: Watchpoint prorogation to child threads
  2008-02-26 16:00 ` Mark Wielaard
@ 2008-02-26 16:11   ` Phil Muldoon
  2008-02-26 16:25     ` Mark Wielaard
  0 siblings, 1 reply; 5+ messages in thread
From: Phil Muldoon @ 2008-02-26 16:11 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: Frysk Hackers

Mark Wielaard wrote:
>
> It would be nice if this is similar to the breakpoints. Low-level
> breakpoints are the same on a clone (because they are really just
> markers in the code segment which is the same), but they are cleared on
> exec (because then the memory of the process is reset).
>
>   

I'm not sure I understand, are breakpoints propagated on clone or not? I 
think they should, and I think I agree on the similarity.

To be honest, not thought about the exec issue, but yeah  I guess the 
memory is reset.

Regards

Phil

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

* Re: Watchpoint prorogation to child threads
  2008-02-26 16:11   ` Phil Muldoon
@ 2008-02-26 16:25     ` Mark Wielaard
  2008-02-26 16:43       ` Phil Muldoon
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Wielaard @ 2008-02-26 16:25 UTC (permalink / raw)
  To: Phil Muldoon; +Cc: Frysk Hackers

Hi Phil,

On Tue, 2008-02-26 at 16:11 +0000, Phil Muldoon wrote:
> Mark Wielaard wrote:
> > It would be nice if this is similar to the breakpoints. Low-level
> > breakpoints are the same on a clone (because they are really just
> > markers in the code segment which is the same), but they are cleared on
> > exec (because then the memory of the process is reset). 
> 
> I'm not sure I understand, are breakpoints propagated on clone or not? I 
> think they should, and I think I agree on the similarity.

Yes, the low-level breakpoints are propagated (by virtue of them being
actually inside the code segment that are shared between clones). But
higher-level Code observers still work per Task, so on that level you
need to register a new Code observer for a new Task to get notified when
they trigger (they still trigger of course, but if nobody is
listening...). I assume a Watch is similar to a Code, both being
TaskObservers (and the comments look funnily similar).

> To be honest, not thought about the exec issue, but yeah  I guess the 
> memory is reset.

The memory is, and for low-level breakpoints we reset the internal data
structures for that reason on an exec event. Since you are implementing
low-level watchpoints with hardware support in the cpu register you
might have to also clear those (if the kernel doesn't do that for you on
an exec).

Cheers,

Mark

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

* Re: Watchpoint prorogation to child threads
  2008-02-26 16:25     ` Mark Wielaard
@ 2008-02-26 16:43       ` Phil Muldoon
  0 siblings, 0 replies; 5+ messages in thread
From: Phil Muldoon @ 2008-02-26 16:43 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: Frysk Hackers

Mark Wielaard wrote:
> Hi Phil,
>
> On Tue, 2008-02-26 at 16:11 +0000, Phil Muldoon wrote:
>   
>> Mark Wielaard wrote:
>>     
>>> It would be nice if this is similar to the breakpoints. Low-level
>>> breakpoints are the same on a clone (because they are really just
>>> markers in the code segment which is the same), but they are cleared on
>>> exec (because then the memory of the process is reset). 
>>>       
>> I'm not sure I understand, are breakpoints propagated on clone or not? I 
>> think they should, and I think I agree on the similarity.
>>     
>
> Yes, the low-level breakpoints are propagated (by virtue of them being
> actually inside the code segment that are shared between clones). But
> higher-level Code observers still work per Task, so on that level you
> need to register a new Code observer for a new Task to get notified when
> they trigger (they still trigger of course, but if nobody is
> listening...). I assume a Watch is similar to a Code, both being
> TaskObservers (and the comments look funnily similar).
>
>   

Yep, sure will. The comments/code is based entirely of the breakpoint 
code. So far the only operational difference is the length attribute, 
and that watchpoints are inserted/removed/trapped via register bit 
shifting instead of the memory insertions that the code breakpoints do 
at set-up. If the similarity continues throughout implementation I might 
very well refactor them to one common interface. We'll see.

>> To be honest, not thought about the exec issue, but yeah  I guess the 
>> memory is reset.
>>     
>
> The memory is, and for low-level breakpoints we reset the internal data
> structures for that reason on an exec event. Since you are implementing
> low-level watchpoints with hardware support in the cpu register you
> might have to also clear those (if the kernel doesn't do that for you on
> an exec).
>   

Uknown at the moment, but fixing to find out.

Regards

Phil

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

end of thread, other threads:[~2008-02-26 16:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-26 15:14 Watchpoint prorogation to child threads Phil Muldoon
2008-02-26 16:00 ` Mark Wielaard
2008-02-26 16:11   ` Phil Muldoon
2008-02-26 16:25     ` Mark Wielaard
2008-02-26 16:43       ` Phil Muldoon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).