mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8228902: add os::dll_load to the unified logging os category
Reviewed-by: coleenp, mdoerr
This commit is contained in:
parent
2e6e33eba1
commit
f454862e65
5 changed files with 23 additions and 0 deletions
|
@ -1313,6 +1313,8 @@ bool os::dll_address_to_library_name(address addr, char* buf,
|
||||||
// for the same architecture as Hotspot is running on.
|
// for the same architecture as Hotspot is running on.
|
||||||
void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
|
void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
|
||||||
|
|
||||||
|
log_info(os)("attempting shared library load of %s", filename);
|
||||||
|
|
||||||
if (ebuf && ebuflen > 0) {
|
if (ebuf && ebuflen > 0) {
|
||||||
ebuf[0] = '\0';
|
ebuf[0] = '\0';
|
||||||
ebuf[ebuflen - 1] = '\0';
|
ebuf[ebuflen - 1] = '\0';
|
||||||
|
@ -1329,6 +1331,7 @@ void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
|
||||||
Events::log(NULL, "Loaded shared library %s", filename);
|
Events::log(NULL, "Loaded shared library %s", filename);
|
||||||
// Reload dll cache. Don't do this in signal handling.
|
// Reload dll cache. Don't do this in signal handling.
|
||||||
LoadedLibraries::reload();
|
LoadedLibraries::reload();
|
||||||
|
log_info(os)("shared library load of %s was successful", filename);
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
// error analysis when dlopen fails
|
// error analysis when dlopen fails
|
||||||
|
@ -1341,6 +1344,7 @@ void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
|
||||||
filename, ::getenv("LIBPATH"), ::getenv("LD_LIBRARY_PATH"), error_report);
|
filename, ::getenv("LIBPATH"), ::getenv("LD_LIBRARY_PATH"), error_report);
|
||||||
}
|
}
|
||||||
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
|
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
|
||||||
|
log_info(os)("shared library load of %s failed, %s", filename, error_report);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1263,10 +1263,13 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
|
||||||
#ifdef STATIC_BUILD
|
#ifdef STATIC_BUILD
|
||||||
return os::get_default_process_handle();
|
return os::get_default_process_handle();
|
||||||
#else
|
#else
|
||||||
|
log_info(os)("attempting shared library load of %s", filename);
|
||||||
|
|
||||||
void * result= ::dlopen(filename, RTLD_LAZY);
|
void * result= ::dlopen(filename, RTLD_LAZY);
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
Events::log(NULL, "Loaded shared library %s", filename);
|
Events::log(NULL, "Loaded shared library %s", filename);
|
||||||
// Successful loading
|
// Successful loading
|
||||||
|
log_info(os)("shared library load of %s was successful", filename);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1280,6 +1283,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
|
||||||
ebuf[ebuflen-1]='\0';
|
ebuf[ebuflen-1]='\0';
|
||||||
}
|
}
|
||||||
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
|
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
|
||||||
|
log_info(os)("shared library load of %s failed, %s", filename, error_report);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif // STATIC_BUILD
|
#endif // STATIC_BUILD
|
||||||
|
@ -1289,10 +1293,12 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
|
||||||
#ifdef STATIC_BUILD
|
#ifdef STATIC_BUILD
|
||||||
return os::get_default_process_handle();
|
return os::get_default_process_handle();
|
||||||
#else
|
#else
|
||||||
|
log_info(os)("attempting shared library load of %s", filename);
|
||||||
void * result= ::dlopen(filename, RTLD_LAZY);
|
void * result= ::dlopen(filename, RTLD_LAZY);
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
Events::log(NULL, "Loaded shared library %s", filename);
|
Events::log(NULL, "Loaded shared library %s", filename);
|
||||||
// Successful loading
|
// Successful loading
|
||||||
|
log_info(os)("shared library load of %s was successful", filename);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1308,6 +1314,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
|
||||||
ebuf[ebuflen-1]='\0';
|
ebuf[ebuflen-1]='\0';
|
||||||
}
|
}
|
||||||
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
|
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
|
||||||
|
log_info(os)("shared library load of %s failed, %s", filename, error_report);
|
||||||
|
|
||||||
int diag_msg_max_length=ebuflen-strlen(ebuf);
|
int diag_msg_max_length=ebuflen-strlen(ebuf);
|
||||||
char* diag_msg_buf=ebuf+strlen(ebuf);
|
char* diag_msg_buf=ebuf+strlen(ebuf);
|
||||||
|
|
|
@ -1739,6 +1739,8 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
|
||||||
void * result = NULL;
|
void * result = NULL;
|
||||||
bool load_attempted = false;
|
bool load_attempted = false;
|
||||||
|
|
||||||
|
log_info(os)("attempting shared library load of %s", filename);
|
||||||
|
|
||||||
// Check whether the library to load might change execution rights
|
// Check whether the library to load might change execution rights
|
||||||
// of the stack. If they are changed, the protection of the stack
|
// of the stack. If they are changed, the protection of the stack
|
||||||
// guard pages will be lost. We need a safepoint to fix this.
|
// guard pages will be lost. We need a safepoint to fix this.
|
||||||
|
@ -1990,8 +1992,10 @@ void * os::Linux::dlopen_helper(const char *filename, char *ebuf,
|
||||||
ebuf[ebuflen-1]='\0';
|
ebuf[ebuflen-1]='\0';
|
||||||
}
|
}
|
||||||
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
|
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
|
||||||
|
log_info(os)("shared library load of %s failed, %s", filename, error_report);
|
||||||
} else {
|
} else {
|
||||||
Events::log(NULL, "Loaded shared library %s", filename);
|
Events::log(NULL, "Loaded shared library %s", filename);
|
||||||
|
log_info(os)("shared library load of %s was successful", filename);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1532,10 +1532,13 @@ static void change_endianness(Elf32_Half& val) {
|
||||||
// same architecture as Hotspot is running on
|
// same architecture as Hotspot is running on
|
||||||
|
|
||||||
void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
|
void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
|
||||||
|
log_info(os)("attempting shared library load of %s", filename);
|
||||||
|
|
||||||
void * result= ::dlopen(filename, RTLD_LAZY);
|
void * result= ::dlopen(filename, RTLD_LAZY);
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
// Successful loading
|
// Successful loading
|
||||||
Events::log(NULL, "Loaded shared library %s", filename);
|
Events::log(NULL, "Loaded shared library %s", filename);
|
||||||
|
log_info(os)("shared library load of %s was successful", filename);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1550,6 +1553,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
|
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
|
||||||
|
log_info(os)("shared library load of %s failed, %s", filename, error_report);
|
||||||
|
|
||||||
int diag_msg_max_length=ebuflen-strlen(ebuf);
|
int diag_msg_max_length=ebuflen-strlen(ebuf);
|
||||||
char* diag_msg_buf=ebuf+strlen(ebuf);
|
char* diag_msg_buf=ebuf+strlen(ebuf);
|
||||||
|
|
|
@ -1365,11 +1365,14 @@ static int _print_module(const char* fname, address base_address,
|
||||||
// in case of error it checks if .dll/.so was built for the
|
// in case of error it checks if .dll/.so was built for the
|
||||||
// same architecture as Hotspot is running on
|
// same architecture as Hotspot is running on
|
||||||
void * os::dll_load(const char *name, char *ebuf, int ebuflen) {
|
void * os::dll_load(const char *name, char *ebuf, int ebuflen) {
|
||||||
|
log_info(os)("attempting shared library load of %s", name);
|
||||||
|
|
||||||
void * result = LoadLibrary(name);
|
void * result = LoadLibrary(name);
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
Events::log(NULL, "Loaded shared library %s", name);
|
Events::log(NULL, "Loaded shared library %s", name);
|
||||||
// Recalculate pdb search path if a DLL was loaded successfully.
|
// Recalculate pdb search path if a DLL was loaded successfully.
|
||||||
SymbolEngine::recalc_search_path();
|
SymbolEngine::recalc_search_path();
|
||||||
|
log_info(os)("shared library load of %s was successful", name);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
DWORD errcode = GetLastError();
|
DWORD errcode = GetLastError();
|
||||||
|
@ -1378,6 +1381,7 @@ void * os::dll_load(const char *name, char *ebuf, int ebuflen) {
|
||||||
lasterror(ebuf, (size_t) ebuflen);
|
lasterror(ebuf, (size_t) ebuflen);
|
||||||
ebuf[ebuflen - 1] = '\0';
|
ebuf[ebuflen - 1] = '\0';
|
||||||
Events::log(NULL, "Loading shared library %s failed, error code %lu", name, errcode);
|
Events::log(NULL, "Loading shared library %s failed, error code %lu", name, errcode);
|
||||||
|
log_info(os)("shared library load of %s failed, error code %lu", name, errcode);
|
||||||
|
|
||||||
if (errcode == ERROR_MOD_NOT_FOUND) {
|
if (errcode == ERROR_MOD_NOT_FOUND) {
|
||||||
strncpy(ebuf, "Can't find dependent libraries", ebuflen - 1);
|
strncpy(ebuf, "Can't find dependent libraries", ebuflen - 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue