Re: [PATCH 5/9] New probe type: DTrace USDT probes.

Jose E. Marchesi
2014-10-10T18:32:25Z

> You should free the enablers VEC in the end of the function. You could
> probably make a cleanup and call it later.
>
> Hmm, I don't see the need of doing a deep copy of the vector, nor I
> remember why I felt it was necessary to do it when I wrote the original
> code.
>
> I changed that to:
>
> /* Add the vector of enablers to this probe, if any. */
> ret->enablers = enablers;
>
> But maybe(probably) I am missing something? :?

Hm, right. But if you do that, you will have to adjust
dtrace_probe_destroy, because it will be freeing the same 'enablers'
over and over...

Aaah, that was indeed the reason! A "DOF probe" translates into 0 or
more gdb probes, and they all share the same vector of enablers.

Maintaining a copy of the enablers per gdb probe makes it trivial to
manage its memory. Otherwise we would need to keep track of which
enabler vectors are shared by which gdb probes... argh!

I will roll back to the deep copy approach :)

> This shouldn't be needed, because USDT probes don't have the concept of
> a semaphore, right? I will submit a patch soon to fix the fact that the
> set/clear_semaphore functions are being called inconditionally.
>
> Correct, that should not be needed and can go away as soon as you do
> that change.

I should be able to post something today. Will put you on the loop.

Ah nice, I will update the patches accordingly.