|
Description
|
[ahl 7.16.2007]
dtrace_lookup_by_type() essentially has two operation modes: either it looks for symbol in a specific CTF container or it iterates over some subset of the CTF containers that libdtrace knows about. If there's a problem with the CTF container itself, we want to handle the case differently in those two cases. In the former, we want to report the error immediately; in the latter we press on and look for the type in other containers (reporting overall failure if no match is found later).
Here's the code that implements that bit of logic:
if (object != DTRACE_OBJ_EVERY &&
...
n = 1;
} else {
...
n = dtp->dt_nmods;
}
...
for (; n > 0; n--, dmp = dt_list_next(dmp)) {
...
/*
* If we can't load the CTF container, continue on to the next
* module. If our search was scoped to only one module (n = 1)
* then return immediately, leaving dt_errno set to the error
* from dt_module_getctf() on the module given by the caller.
*/
if (dt_module_getctf(dtp, dmp) == NULL) {
if (n == 1)
return (-1);
continue;
}
The problem is that if dt_module_getctf() fails during the last iteration of the for loop when n happens to equal 1, we treat it like the singleton case.
We need to maintain additional state to determine if we're in the singleton case or not.
|