universal7885: Import dlopener debugging tool

[Linux4: This is helpful for things like OMX which hide dlopen errors]
This commit is contained in:
A2L5E0X1 2022-01-10 17:35:05 +01:00 committed by roynatech2544
commit 2e6fa25a3a
3 changed files with 41 additions and 1 deletions

View file

@ -0,0 +1,12 @@
cc_binary {
name: "dlopener",
srcs: ["dlopener.c"],
vendor_available: true,
}
cc_binary {
name: "dlopener32",
srcs: ["dlopener.c"],
compile_multilib: "32",
vendor_available: true,
}

View file

@ -0,0 +1,28 @@
#include <dlfcn.h>
#include <errno.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
const char *path;
int status = -EINVAL;
void *handle = NULL;
if(argc <= 1) {
printf("Please specify a module to load!\n");
return status;
}
path = argv[1];
handle = dlopen(path, RTLD_NOW);
if (handle == NULL) {
char const *err_str = dlerror();
printf("load: module=%s\n%s\n", path, err_str?err_str:"unknown");
status = -EINVAL;
} else {
printf("load: module=%s %s\n", path,"Success!");
}
return status;
}

View file

@ -105,7 +105,7 @@ PRODUCT_PACKAGES += \
libsuspend libsuspend
# Debug # Debug
PRODUCT_PACKAGES += eklogger PRODUCT_PACKAGES += eklogger dlopener
# DRM # DRM
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \