diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2022-07-09 16:52:20 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2022-07-09 16:52:20 +0200 |
| commit | d23185173490b72336f96cc4ffc20bdb49b4da4d (patch) | |
| tree | 1f3829ccc17495217819edf5f1fff17c263267f4 /src | |
| parent | c4a68bcd43252ac1b45bee6de476d8995beefcb1 (diff) | |
| download | box64-d23185173490b72336f96cc4ffc20bdb49b4da4d.tar.gz box64-d23185173490b72336f96cc4ffc20bdb49b4da4d.zip | |
Changed various log level for libdl file open error
Diffstat (limited to 'src')
| -rwxr-xr-x | src/include/debug.h | 8 | ||||
| -rwxr-xr-x | src/librarian/librarian.c | 2 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibdl.c | 159 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibgl.c | 12 | ||||
| -rwxr-xr-x | src/wrapped/wrappedsdl2.c | 10 | ||||
| -rwxr-xr-x | src/wrapped/wrappedvulkan.c | 16 |
6 files changed, 65 insertions, 142 deletions
diff --git a/src/include/debug.h b/src/include/debug.h index f1abbc9b..6d5ce616 100755 --- a/src/include/debug.h +++ b/src/include/debug.h @@ -57,11 +57,13 @@ extern int box64_tcmalloc_minimal; // when using tcmalloc_minimal extern FILE* ftrace; -#define printf_log(L, ...) do {if(L<=box64_log) {fprintf(ftrace, __VA_ARGS__); fflush(ftrace);}} while(0) +#define printf_log(L, ...) do {if((L)<=box64_log) {fprintf(ftrace, __VA_ARGS__); fflush(ftrace);}} while(0) -#define printf_dump(L, ...) do {if(box64_dump || (L<=box64_log)) {fprintf(ftrace, __VA_ARGS__); fflush(ftrace);}} while(0) +#define printf_dump(L, ...) do {if(box64_dump || ((L)<=box64_log)) {fprintf(ftrace, __VA_ARGS__); fflush(ftrace);}} while(0) -#define dynarec_log(L, ...) do {if(L<=box64_dynarec_log) {fprintf(ftrace, __VA_ARGS__); fflush(ftrace);}} while(0) +#define printf_dlsym(L, ...) do {if(dlsym_error || ((L)<=box64_log)) {fprintf(ftrace, __VA_ARGS__); fflush(ftrace);}} while(0) + +#define dynarec_log(L, ...) do {if((L)<=box64_dynarec_log) {fprintf(ftrace, __VA_ARGS__); fflush(ftrace);}} while(0) #define EXPORT __attribute__((visibility("default"))) #ifdef BUILD_DYNAMIC diff --git a/src/librarian/librarian.c b/src/librarian/librarian.c index d21c7b8c..9921c06a 100755 --- a/src/librarian/librarian.c +++ b/src/librarian/librarian.c @@ -351,7 +351,7 @@ int AddNeededLib(lib_t* maplib, needed_libs_t* neededlibs, library_t* deplib, in // Add libs and symbol for(int i=0; i<npath; ++i) { if(AddNeededLib_add(maplib, neededlibs, deplib, local, paths[i], box64, emu)) { - printf_log(LOG_INFO, "Error loading needed lib %s\n", paths[i]); + printf_log(strchr(paths[i],'/')?LOG_DEBUG:LOG_INFO, "Error loading needed lib %s\n", paths[i]); return 1; } } diff --git a/src/wrapped/wrappedlibdl.c b/src/wrapped/wrappedlibdl.c index 903c2b9e..fa134215 100755 --- a/src/wrapped/wrappedlibdl.c +++ b/src/wrapped/wrappedlibdl.c @@ -72,9 +72,7 @@ void* my_dlopen(x64emu_t* emu, void *filename, int flag) if(sys) return sys; } - if(dlsym_error || box64_log>=LOG_DEBUG) { - printf_log(LOG_NONE, "Call to dlopen(\"%s\"/%p, %X)\n", rfilename, filename, flag); - } + printf_dlsym(LOG_DEBUG, "Call to dlopen(\"%s\"/%p, %X)\n", rfilename, filename, flag); // Transform any ${...} that maight be present while(strstr(rfilename, "${ORIGIN}")) { char* origin = strdup(my_context->fullpath); @@ -107,31 +105,23 @@ void* my_dlopen(x64emu_t* emu, void *filename, int flag) if(IsSameLib(dl->libs[i], rfilename)) { if(dl->count[i]==0 && dl->dlopened[i]) { // need to lauch init again! if(flag&0x4) { - if(dlsym_error || box64_log>=LOG_DEBUG) { - printf_log(LOG_NONE, " => not present anymore\n"); - } + printf_dlsym(LOG_DEBUG, " => not present anymore\n"); return NULL; // don't re-open in RTLD_NOLOAD mode } int idx = GetElfIndex(dl->libs[i]); if(idx!=-1) { - if(dlsym_error || box64_log>=LOG_DEBUG) { - printf_log(LOG_NONE, "dlopen: Recycling, calling Init for %p (%s)\n", (void*)(i+1), rfilename); - } + printf_dlsym(LOG_DEBUG, "dlopen: Recycling, calling Init for %p (%s)\n", (void*)(i+1), rfilename); ReloadLibrary(dl->libs[i], emu); // reset memory image, redo reloc, run inits } } if(!(flag&0x4)) dl->count[i] = dl->count[i]+1; - if(dlsym_error || box64_log>=LOG_DEBUG) { - printf_log(LOG_NONE, "dlopen: Recycling %s/%p count=%ld (dlopened=%ld, elf_index=%d)\n", rfilename, (void*)(i+1), dl->count[i], dl->dlopened[i], GetElfIndex(dl->libs[i])); - } + printf_dlsym(LOG_DEBUG, "dlopen: Recycling %s/%p count=%ld (dlopened=%ld, elf_index=%d)\n", rfilename, (void*)(i+1), dl->count[i], dl->dlopened[i], GetElfIndex(dl->libs[i])); return (void*)(i+1); } } if(flag&0x4) { //RTLD_NOLOAD is just a "check" if lib is already loaded - if(dlsym_error || box64_log>=LOG_DEBUG) { - printf_log(LOG_NONE, " => not present\n"); - } + printf_dlsym(LOG_DEBUG, " => not present\n"); return NULL; } dlopened = (GetLibInternal(rfilename)==NULL); @@ -140,7 +130,7 @@ void* my_dlopen(x64emu_t* emu, void *filename, int flag) my_context->deferedInit = 1; int bindnow = (!box64_musl && (flag&0x2))?1:0; if(AddNeededLib(NULL, NULL, NULL, is_local, bindnow, libs, 1, emu->context, emu)) { - printf_log(LOG_INFO, "Warning: Cannot dlopen(\"%s\"/%p, %X)\n", rfilename, filename, flag); + printf_dlsym(strchr(rfilename,'/')?LOG_DEBUG:LOG_INFO, "Warning: Cannot dlopen(\"%s\"/%p, %X)\n", rfilename, filename, flag); if(!dl->last_error) dl->last_error = malloc(129); snprintf(dl->last_error, 129, "Cannot dlopen(\"%s\"/%p, %X)\n", rfilename, filename, flag); @@ -156,10 +146,7 @@ void* my_dlopen(x64emu_t* emu, void *filename, int flag) return (void*)(i+1); } } - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "Call to dlopen(NULL, %X)\n", flag); - } - printf_log(LOG_DEBUG, "Call to dlopen(NULL, %X)\n", flag); + printf_dlsym(LOG_DEBUG, "Call to dlopen(NULL, %X)\n", flag); } //get the lib and add it to the collection @@ -175,15 +162,13 @@ void* my_dlopen(x64emu_t* emu, void *filename, int flag) dl->libs[idx] = lib; dl->count[idx] = dl->count[idx]+1; dl->dlopened[idx] = dlopened; - if(dlsym_error || box64_log>=LOG_DEBUG) { - printf_log(LOG_NONE, "dlopen: New handle %p (%s), dlopened=%ld\n", (void*)(idx+1), (char*)filename, dlopened); - } + printf_dlsym(LOG_DEBUG, "dlopen: New handle %p (%s), dlopened=%ld\n", (void*)(idx+1), (char*)filename, dlopened); return (void*)(idx+1); } void* my_dlmopen(x64emu_t* emu, void* lmid, void *filename, int flag) { if(lmid) { - printf_log(LOG_INFO, "Warning, dlmopen(%p, %p(\"%s\"), 0x%x) called with lmid not LMID_ID_BASE (unsupported)\n", lmid, filename, filename?(char*)filename:"self", flag); + printf_dlsym(LOG_INFO, "Warning, dlmopen(%p, %p(\"%s\"), 0x%x) called with lmid not LMID_ID_BASE (unsupported)\n", lmid, filename, filename?(char*)filename:"self", flag); } // lmid is ignored for now... return my_dlopen(emu, filename, flag); @@ -234,41 +219,30 @@ void* my_dlsym(x64emu_t* emu, void *handle, void *symbol) uintptr_t start = 0, end = 0; char* rsymbol = (char*)symbol; CLEARERR - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "Call to dlsym(%p, %s) :", handle, rsymbol); - } - printf_log(LOG_DEBUG, "Call to dlsym(%p, \"%s\")\n", handle, rsymbol); + printf_dlsym(LOG_DEBUG, "Call to dlsym(%p, \"%s\")%s", handle, rsymbol, dlsym_error?"":"\n"); if(handle==NULL) { // special case, look globably if(GetGlobalSymbolStartEnd(emu->context->maplib, rsymbol, &start, &end, NULL, -1, NULL)) { - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", (void*)start); - } + printf_dlsym(LOG_NEVER, "%p\n", (void*)start); return (void*)start; } if(!dl->last_error) dl->last_error = malloc(129); snprintf(dl->last_error, 129, "Symbol \"%s\" not found in %p)\n", rsymbol, handle); - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", NULL); - } + printf_dlsym(LOG_NEVER, "%p\n", NULL); return NULL; } if(handle==(void*)~0LL) { // special case, look globably but no self (RTLD_NEXT) elfheader_t *elf = FindElfAddress(emu->context, *(uintptr_t*)R_RSP); // use return address to guess "self" if(GetNoSelfSymbolStartEnd(emu->context->maplib, rsymbol, &start, &end, elf, -1, NULL)) { - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", (void*)start); - } + printf_dlsym(LOG_NEVER, "%p\n", (void*)start); return (void*)start; } if(!dl->last_error) dl->last_error = malloc(129); snprintf(dl->last_error, 129, "Symbol \"%s\" not found in %p)\n", rsymbol, handle); - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", NULL); - } + printf_dlsym(LOG_NEVER, "%p\n", NULL); return NULL; } size_t nlib = (size_t)handle; @@ -278,26 +252,20 @@ void* my_dlsym(x64emu_t* emu, void *handle, void *symbol) if(!dl->last_error) dl->last_error = malloc(129); snprintf(dl->last_error, 129, "Bad handle %p)\n", handle); - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", NULL); - } + printf_dlsym(LOG_NEVER, "%p\n", NULL); return NULL; } if(dl->count[nlib]==0) { if(!dl->last_error) dl->last_error = malloc(129); snprintf(dl->last_error, 129, "Bad handle %p (already closed))\n", handle); - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", (void*)NULL); - } + printf_dlsym(LOG_NEVER, "%p\n", (void*)NULL); return NULL; } if(dl->libs[nlib]) { if(my_dlsym_lib(dl->libs[nlib], rsymbol, &start, &end, -1, NULL)==0) { // not found - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\nCall to dlsym(%s, \"%s\") Symbol not found\n", NULL, GetNameLib(dl->libs[nlib]), rsymbol); - } + printf_dlsym(LOG_NEVER, "%p\nCall to dlsym(%s, \"%s\") Symbol not found\n", NULL, GetNameLib(dl->libs[nlib]), rsymbol); printf_log(LOG_DEBUG, " Symbol not found\n"); if(!dl->last_error) dl->last_error = malloc(129); @@ -308,30 +276,22 @@ void* my_dlsym(x64emu_t* emu, void *handle, void *symbol) // still usefull? // => look globably if(GetGlobalSymbolStartEnd(emu->context->maplib, rsymbol, &start, &end, NULL, -1, NULL)) { - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", (void*)start); - } + printf_dlsym(LOG_NEVER, "%p\n", (void*)start); return (void*)start; } if(!dl->last_error) dl->last_error = malloc(129); snprintf(dl->last_error, 129, "Symbol \"%s\" not found in %p)\n", rsymbol, handle); - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", NULL); - } + printf_dlsym(LOG_NEVER, "%p\n", NULL); return NULL; } - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", (void*)start); - } + printf_dlsym(LOG_NEVER, "%p\n", (void*)start); return (void*)start; } int my_dlclose(x64emu_t* emu, void *handle) { (void)emu; - if(dlsym_error || box64_log>=LOG_DEBUG) { - printf_log(LOG_NONE, "Call to dlclose(%p)\n", handle); - } + printf_dlsym(LOG_DEBUG, "Call to dlclose(%p)\n", handle); dlprivate_t *dl = emu->context->dlprivate; CLEARERR size_t nlib = (size_t)handle; @@ -341,27 +301,21 @@ int my_dlclose(x64emu_t* emu, void *handle) if(!dl->last_error) dl->last_error = malloc(129); snprintf(dl->last_error, 129, "Bad handle %p)\n", handle); - if(dlsym_error || box64_log>=LOG_DEBUG) { - printf_log(LOG_NONE, "dlclose: %s\n", dl->last_error); - } + printf_dlsym(LOG_DEBUG, "dlclose: %s\n", dl->last_error); return -1; } if(dl->count[nlib]==0) { if(!dl->last_error) dl->last_error = malloc(129); snprintf(dl->last_error, 129, "Bad handle %p (already closed))\n", handle); - if(dlsym_error || box64_log>=LOG_DEBUG) { - printf_log(LOG_NONE, "dlclose: %s\n", dl->last_error); - } + printf_dlsym(LOG_DEBUG, "dlclose: %s\n", dl->last_error); return -1; } dl->count[nlib] = dl->count[nlib]-1; if(dl->count[nlib]==0 && dl->dlopened[nlib]) { // need to call Fini... int idx = GetElfIndex(dl->libs[nlib]); if(idx!=-1) { - if(dlsym_error || box64_log>=LOG_DEBUG) { - printf_log(LOG_NONE, "dlclose: Call to Fini for %p\n", handle); - } + printf_dlsym(LOG_DEBUG, "dlclose: Call to Fini for %p\n", handle); RunElfFini(emu->context->elfs[idx], emu); InactiveLibrary(dl->libs[nlib]); } @@ -401,41 +355,30 @@ void* my_dlvsym(x64emu_t* emu, void *handle, void *symbol, const char *vername) uintptr_t start, end; char* rsymbol = (char*)symbol; CLEARERR - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "Call to dlvsym(%p, %s, %s) :", handle, rsymbol, vername?vername:"(nil)"); - } - printf_log(LOG_DEBUG, "Call to dlvsym(%p, \"%s\", %s)\n", handle, rsymbol, vername?vername:"(nil)"); + printf_dlsym(LOG_DEBUG, "Call to dlvsym(%p, \"%s\", %s)\n", handle, rsymbol, vername?vername:"(nil)"); if(handle==NULL) { // special case, look globably if(GetGlobalSymbolStartEnd(emu->context->maplib, rsymbol, &start, &end, NULL, version, vername)) { - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", (void*)start); - } + printf_dlsym(LOG_NEVER, "%p\n", (void*)start); return (void*)start; } if(!dl->last_error) dl->last_error = malloc(129); snprintf(dl->last_error, 129, "Symbol \"%s\" version %s not found in %p)\n", rsymbol, vername?vername:"(nil)", handle); - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", NULL); - } + printf_dlsym(LOG_NEVER, "%p\n", NULL); return NULL; } if(handle==(void*)~0LL) { // special case, look globably but no self (RTLD_NEXT) elfheader_t *elf = FindElfAddress(emu->context, *(uintptr_t*)R_RSP); // use return address to guess "self" if(GetNoSelfSymbolStartEnd(emu->context->maplib, rsymbol, &start, &end, elf, version, vername)) { - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", (void*)start); - } + printf_dlsym(LOG_NEVER, "%p\n", (void*)start); return (void*)start; } if(!dl->last_error) dl->last_error = malloc(129); snprintf(dl->last_error, 129, "Symbol \"%s\" version %s not found in %p)\n", rsymbol, vername?vername:"(nil)", handle); - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", NULL); - } + printf_dlsym(LOG_NEVER, "%p\n", NULL); return NULL; } size_t nlib = (size_t)handle; @@ -445,26 +388,20 @@ void* my_dlvsym(x64emu_t* emu, void *handle, void *symbol, const char *vername) if(!dl->last_error) dl->last_error = malloc(129); snprintf(dl->last_error, 129, "Bad handle %p)\n", handle); - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", NULL); - } + printf_dlsym(LOG_NEVER, "%p\n", NULL); return NULL; } if(dl->count[nlib]==0) { if(!dl->last_error) dl->last_error = malloc(129); snprintf(dl->last_error, 129, "Bad handle %p (already closed))\n", handle); - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", (void*)NULL); - } + printf_dlsym(LOG_NEVER, "%p\n", (void*)NULL); return NULL; } if(dl->libs[nlib]) { if(my_dlsym_lib(dl->libs[nlib], rsymbol, &start, &end, version, vername)==0) { // not found - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\nCall to dlvsym(%s, \"%s\", %s) Symbol not found\n", NULL, GetNameLib(dl->libs[nlib]), rsymbol, vername?vername:"(nil)"); - } + printf_dlsym(LOG_NEVER, "%p\nCall to dlvsym(%s, \"%s\", %s) Symbol not found\n", NULL, GetNameLib(dl->libs[nlib]), rsymbol, vername?vername:"(nil)"); printf_log(LOG_DEBUG, " Symbol not found\n"); if(!dl->last_error) dl->last_error = malloc(129); @@ -474,45 +411,33 @@ void* my_dlvsym(x64emu_t* emu, void *handle, void *symbol, const char *vername) } else { // still usefull? if(GetSymbolStartEnd(GetLocalSymbol(emu->context->maplib), rsymbol, &start, &end, version, vername, 1)) { - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", (void*)start); - } + printf_dlsym(LOG_NEVER, "%p\n", (void*)start); return (void*)start; } if(GetSymbolStartEnd(GetWeakSymbol(emu->context->maplib), rsymbol, &start, &end, version, vername, 1)) { - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", (void*)start); - } + printf_dlsym(LOG_NEVER, "%p\n", (void*)start); return (void*)start; } if(GetSymbolStartEnd(GetMapSymbol(emu->context->maplib), rsymbol, &start, &end, version, vername, 1)) { - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", (void*)start); - } + printf_dlsym(LOG_NEVER, "%p\n", (void*)start); return (void*)start; } // not found - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\nCall to dlvsym(%s, \"%s\", %s) Symbol not found\n", NULL, "Self", rsymbol, vername?vername:"(nil)"); - } + printf_dlsym(LOG_NEVER, "%p\nCall to dlvsym(%s, \"%s\", %s) Symbol not found\n", NULL, "Self", rsymbol, vername?vername:"(nil)"); printf_log(LOG_DEBUG, " Symbol not found\n"); if(!dl->last_error) dl->last_error = malloc(129); snprintf(dl->last_error, 129, "Symbol \"%s\" version %s not found in %p)\n", rsymbol, vername?vername:"(nil)", handle); return NULL; } - if(dlsym_error && box64_log<LOG_DEBUG) { - printf_log(LOG_NONE, "%p\n", (void*)start); - } + printf_dlsym(LOG_NEVER, "%p\n", (void*)start); return (void*)start; } int my_dlinfo(x64emu_t* emu, void* handle, int request, void* info) { (void)emu; - if(dlsym_error || box64_log>=LOG_DEBUG) { - printf_log(LOG_NONE, "Call to dlinfo(%p, %d, %p)\n", handle, request, info); - } + printf_dlsym(LOG_DEBUG, "Call to dlinfo(%p, %d, %p)\n", handle, request, info); dlprivate_t *dl = emu->context->dlprivate; CLEARERR size_t nlib = (size_t)handle; @@ -522,18 +447,14 @@ int my_dlinfo(x64emu_t* emu, void* handle, int request, void* info) if(!dl->last_error) dl->last_error = malloc(129); snprintf(dl->last_error, 129, "Bad handle %p)\n", handle); - if(dlsym_error || box64_log>=LOG_DEBUG) { - printf_log(LOG_NONE, "dlinfo: %s\n", dl->last_error); - } + printf_dlsym(LOG_DEBUG, "dlinfo: %s\n", dl->last_error); return -1; } if(dl->count[nlib]==0) { if(!dl->last_error) dl->last_error = malloc(129); snprintf(dl->last_error, 129, "Bad handle %p (already closed))\n", handle); - if(dlsym_error || box64_log>=LOG_DEBUG) { - printf_log(LOG_NONE, "dlinfo: %s\n", dl->last_error); - } + printf_dlsym(LOG_DEBUG, "dlinfo: %s\n", dl->last_error); return -1; } library_t *lib = dl->libs[nlib]; diff --git a/src/wrapped/wrappedlibgl.c b/src/wrapped/wrappedlibgl.c index 95b14717..db4453c2 100755 --- a/src/wrapped/wrappedlibgl.c +++ b/src/wrapped/wrappedlibgl.c @@ -30,7 +30,7 @@ EXPORT void* my_glXGetProcAddress(x64emu_t* emu, void* name) { khint_t k; const char* rname = (const char*)name; - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "Calling glXGetProcAddress(\"%s\") => ", rname); + printf_dlsym(LOG_DEBUG, "Calling glXGetProcAddress(\"%s\") => ", rname); if(!emu->context->glwrappers) fillGLProcWrapper(emu->context); // check if glxprocaddress is filled, and search for lib and fill it if needed @@ -47,13 +47,13 @@ EXPORT void* my_glXGetProcAddress(x64emu_t* emu, void* name) } else symbol = emu->context->glxprocaddress(rname); if(!symbol) { - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "%p\n", NULL); + printf_dlsym(LOG_DEBUG, "%p\n", NULL); return NULL; // easy } // check if alread bridged uintptr_t ret = CheckBridged(emu->context->system, symbol); if(ret) { - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "%p\n", (void*)ret); + printf_dlsym(LOG_DEBUG, "%p\n", (void*)ret); return (void*)ret; // already bridged } // get wrapper @@ -73,14 +73,14 @@ EXPORT void* my_glXGetProcAddress(x64emu_t* emu, void* name) k = kh_get(symbolmap, emu->context->glwrappers, tmp); } if(k==kh_end(emu->context->glwrappers)) { - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "%p\n", NULL); - if(dlsym_error && box64_log<LOG_INFO) printf_log(LOG_NONE, "Warning, no wrapper for %s\n", rname); + printf_dlsym(LOG_DEBUG, "%p\n", NULL); + printf_dlsym(LOG_INFO, "Warning, no wrapper for %s\n", rname); return NULL; } const char* constname = kh_key(emu->context->glwrappers, k); AddOffsetSymbol(emu->context->maplib, symbol, rname); ret = AddBridge(emu->context->system, kh_value(emu->context->glwrappers, k), symbol, 0, constname); - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "%p\n", (void*)ret); + printf_dlsym(LOG_DEBUG, "%p\n", (void*)ret); return (void*)ret; } diff --git a/src/wrapped/wrappedsdl2.c b/src/wrapped/wrappedsdl2.c index baefaa74..37bab82b 100755 --- a/src/wrapped/wrappedsdl2.c +++ b/src/wrapped/wrappedsdl2.c @@ -588,7 +588,7 @@ EXPORT void* my2_SDL_GL_GetProcAddress(x64emu_t* emu, void* name) { khint_t k; const char* rname = (const char*)name; - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "Calling SDL_GL_GetProcAddress(%s) => ", rname); + printf_dlsym(LOG_DEBUG, "Calling SDL_GL_GetProcAddress(%s) => ", rname); // check if glxprocaddress is filled, and search for lib and fill it if needed if(!emu->context->glxprocaddress) emu->context->glxprocaddress = (procaddess_t)my->SDL_GL_GetProcAddress; @@ -613,13 +613,13 @@ EXPORT void* my2_SDL_GL_GetProcAddress(x64emu_t* emu, void* name) } else symbol = my->SDL_GL_GetProcAddress(name); if(!symbol) { - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "%p\n", NULL); + printf_dlsym(LOG_DEBUG, "%p\n", NULL); return NULL; // easy } // check if alread bridged uintptr_t ret = CheckBridged(emu->context->system, symbol); if(ret) { - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "%p\n", (void*)ret); + printf_dlsym(LOG_DEBUG, "%p\n", (void*)ret); return (void*)ret; // already bridged } // get wrapper @@ -639,14 +639,14 @@ EXPORT void* my2_SDL_GL_GetProcAddress(x64emu_t* emu, void* name) k = kh_get(symbolmap, emu->context->glwrappers, tmp); } if(k==kh_end(emu->context->glwrappers)) { - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "%p\n", NULL); + printf_dlsym(LOG_DEBUG, "%p\n", NULL); printf_log(LOG_INFO, "Warning, no wrapper for %s\n", rname); return NULL; } AddOffsetSymbol(emu->context->maplib, symbol, rname); const char* constname = kh_key(emu->context->glwrappers, k); ret = AddBridge(emu->context->system, kh_value(emu->context->glwrappers, k), symbol, 0, constname); - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "%p\n", (void*)ret); + printf_dlsym(LOG_DEBUG, "%p\n", (void*)ret); return (void*)ret; } diff --git a/src/wrapped/wrappedvulkan.c b/src/wrapped/wrappedvulkan.c index 9e4c53a5..b3f1b9d8 100755 --- a/src/wrapped/wrappedvulkan.c +++ b/src/wrapped/wrappedvulkan.c @@ -50,7 +50,7 @@ static void* resolveSymbol(x64emu_t* emu, void* symbol, const char* rname) // check if alread bridged uintptr_t ret = CheckBridged(emu->context->system, symbol); if(ret) { - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "%p\n", (void*)ret); + printf_dlsym(LOG_DEBUG, "%p\n", (void*)ret); return (void*)ret; // already bridged } // get wrapper @@ -63,14 +63,14 @@ static void* resolveSymbol(x64emu_t* emu, void* symbol, const char* rname) k = kh_get(symbolmap, emu->context->vkwrappers, tmp); } if(k==kh_end(emu->context->vkwrappers)) { - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "%p\n", NULL); - if(dlsym_error) printf_log(LOG_NONE, "Warning, no wrapper for %s\n", rname); + printf_dlsym(LOG_DEBUG, "%p\n", NULL); + printf_dlsym(LOG_INFO, "Warning, no wrapper for %s\n", rname); return NULL; } const char* constname = kh_key(emu->context->vkwrappers, k); AddOffsetSymbol(emu->context->maplib, symbol, constname); ret = AddBridge(emu->context->system, kh_value(emu->context->vkwrappers, k), symbol, 0, constname); - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "%p (%p)\n", (void*)ret, symbol); + printf_dlsym(LOG_DEBUG, "%p (%p)\n", (void*)ret, symbol); return (void*)ret; } @@ -79,7 +79,7 @@ EXPORT void* my_vkGetDeviceProcAddr(x64emu_t* emu, void* device, void* name) khint_t k; const char* rname = (const char*)name; - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "Calling my_vkGetDeviceProcAddr(%p, \"%s\") => ", device, rname); + printf_dlsym(LOG_DEBUG, "Calling my_vkGetDeviceProcAddr(%p, \"%s\") => ", device, rname); if(!emu->context->vkwrappers) fillVulkanProcWrapper(emu->context); k = kh_get(symbolmap, emu->context->vkmymap, rname); @@ -98,7 +98,7 @@ EXPORT void* my_vkGetDeviceProcAddr(x64emu_t* emu, void* device, void* name) } else symbol = my->vkGetDeviceProcAddr(device, name); if(!symbol) { - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "%p\n", NULL); + printf_dlsym(LOG_DEBUG, "%p\n", NULL); return NULL; // easy } return resolveSymbol(emu, symbol, rname); @@ -109,7 +109,7 @@ EXPORT void* my_vkGetInstanceProcAddr(x64emu_t* emu, void* instance, void* name) khint_t k; const char* rname = (const char*)name; - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "Calling my_vkGetInstanceProcAddr(%p, \"%s\") => ", instance, rname); + printf_dlsym(LOG_DEBUG, "Calling my_vkGetInstanceProcAddr(%p, \"%s\") => ", instance, rname); if(!emu->context->vkwrappers) fillVulkanProcWrapper(emu->context); if(instance!=my->currentInstance) { @@ -122,7 +122,7 @@ EXPORT void* my_vkGetInstanceProcAddr(x64emu_t* emu, void* instance, void* name) int is_my = (k==kh_end(emu->context->vkmymap))?0:1; void* symbol = my_context->vkprocaddress(instance, rname); if(!symbol) { - if(dlsym_error && box64_log<LOG_DEBUG) printf_log(LOG_NONE, "%p\n", NULL); + printf_dlsym(LOG_DEBUG, "%p\n", NULL); return NULL; // easy } if(is_my) { |