mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_Module: report loaded hooks on startup
useful for debugging
This commit is contained in:
parent
114b885162
commit
24d3399fd5
@ -47,7 +47,7 @@ void AP_Module::module_scan(const char *path)
|
|||||||
printf("dlopen(%s) -> %s\n", path, dlerror());
|
printf("dlopen(%s) -> %s\n", path, dlerror());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool found_hook = false;
|
uint8_t found_hooks = 0;
|
||||||
for (uint16_t i=0; i<NUM_HOOKS; i++) {
|
for (uint16_t i=0; i<NUM_HOOKS; i++) {
|
||||||
void *s = dlsym(m, hook_names[i]);
|
void *s = dlsym(m, hook_names[i]);
|
||||||
if (s != nullptr) {
|
if (s != nullptr) {
|
||||||
@ -59,12 +59,14 @@ void AP_Module::module_scan(const char *path)
|
|||||||
h->next = hooks[i];
|
h->next = hooks[i];
|
||||||
h->symbol = s;
|
h->symbol = s;
|
||||||
hooks[i] = h;
|
hooks[i] = h;
|
||||||
found_hook = true;
|
found_hooks++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found_hook) {
|
if (found_hooks == 0) {
|
||||||
// we don't need this module
|
// we don't need this module
|
||||||
dlclose(m);
|
dlclose(m);
|
||||||
|
} else {
|
||||||
|
printf("AP_Module: Loaded %u hooks from %s\n", (unsigned)found_hooks, path);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user