This is the mail archive of the
frysk@sourceware.org
mailing list for the frysk project.
Re: proc based observers
On Mon, 2007-06-18 at 16:47 -0400, Sami Wagiaalla wrote:
> > Do you have some examples of code that does that in frysk at the moment?
> >
> There are a couple of instances in the gui. Here is an example from
> Ftrace.java:
>
> ProcObserver.ProcTasks tasksObserver = new ProcObserver.ProcTasks()
> {
> public void existingTask (Task task)
> {
> handleTask(task);
> }
>
> public void taskAdded (Task task)
> {
> handleTask(task);
> }
> [...]
> };
>
>
> Then handle task does this:
>
> synchronized void handleTask (Task task)
> {
> task.requestAddSyscallObserver(syscallObserver);
> task.requestAddForkedObserver(forkedObserver);
Yeah, that is a nice way to easily add observers to all Tasks of a Proc
now and in the future (this should really also be added to fstep, which
currently only traces the main task, I have updated the bug report).
> The history behind this is interesting:
>
> We used to have some proc observers, but we wanted fine grain control so
> everything was moved down to tasks. then we wanted a safe way of getting
> a procs tasks, so we created ProcTasksObserver.
Is there any functional difference between the old and the new way?
Cheers,
Mark