views:

139

answers:

1

Note that this is for Mac OS X, although I imagine my problem would exist on any dtrace-capable OS.

I have an app that utilizes a lot of plugins. I'm adding userland probes to it, in both the core application and in the plugins themselves. The issue is that if I use the same provider name in the plugins that the main app is using, those probes aren't showing up when I attempt to create a list of available probes. It appears that whoever's code that loads first wins.

my .d file in my main app:

provider MyApp {
    probe doSomething();
};

and in my plugin:

provider MyApp {
    probe plugin_doSomethingPluginish();
};

Changing the name of the provider to something else, like MyAppPlugin, works, but then the list of providers is going to get insane (MyAppPlugin1, MyAppPlugin2, etc). I'd like to think that there's a way to add in new plugin-defined probes under the same provider name as the main app, but I'm either not seeing it or it doesn't exist.

So is there a way to do this? And if not, is it normal to have a different provider for each plugin even though the module name is already unique? Seems like that's what the module name is for...

A: 

You should just be defining one provider.d file and then importing the .h file into each class using any of those probes, there is really no reason to do multiple .d files each listing the same provider. I just checked in the DTrace documentation about this and don't see anything about it right off the bat, but yeah I would presume that multiple .d files each defining the same provider creates some sort of conflict or that loading probe listing for the same provider is like redefining the probe listing and not extending it as you probably intended.

Colin Wheeler
The problem with this is each plugin is its own project. Creating the dependency from plugin projects to the main app's project is not possible.I suppose I could build the .h file for the main project then copy it to each plugin but that would be a pain to update when a change is made.
MyztikJenz
true, at the very least if you do define different providers you can keep the same prefix for different providers and that way you can do dtrace -l -n MyApp*:::entry,etc and that way all providers matching that prefix will be listed
Colin Wheeler