diff options
| author | 2018-09-12 01:12:56 +0200 | |
|---|---|---|
| committer | 2018-09-12 01:50:40 +0200 | |
| commit | 947573eafde8deac2cb5e67f5acc3c670ea8b5e9 (patch) | |
| tree | f744d8f359884d76737390f7b25d19f0c66b1c4e | |
| parent | 7c6c57d09dfac00c645188ec4f960dd70e559a05 (diff) | |
Log error message if CloseNativeLibrary fails
This change adds check for CloseNativeLibrary result and if the
call was unsuccessful logs error message.
Bug: https://issuetracker.google.com/79126103
Test: make
Change-Id: I9280fab7237296c1a06526387aba41f921ffde0f
| -rw-r--r-- | runtime/jni/java_vm_ext.cc | 5 | ||||
| -rw-r--r-- | runtime/ti/agent.cc | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/runtime/jni/java_vm_ext.cc b/runtime/jni/java_vm_ext.cc index fdf0feec14..42406cf73c 100644 --- a/runtime/jni/java_vm_ext.cc +++ b/runtime/jni/java_vm_ext.cc @@ -86,7 +86,10 @@ class SharedLibrary { self->GetJniEnv()->DeleteWeakGlobalRef(class_loader_); } - android::CloseNativeLibrary(handle_, needs_native_bridge_); + std::string error_msg; + if (!android::CloseNativeLibrary(handle_, needs_native_bridge_, &error_msg)) { + LOG(WARNING) << "Error while unloading native library \"" << path_ << "\": " << error_msg; + } } jweak GetClassLoader() const { diff --git a/runtime/ti/agent.cc b/runtime/ti/agent.cc index 608f0ee13c..fc51567241 100644 --- a/runtime/ti/agent.cc +++ b/runtime/ti/agent.cc @@ -134,7 +134,9 @@ std::unique_ptr<Agent> AgentSpec::DoDlOpen(JNIEnv* env, } if (needs_native_bridge) { // TODO: Consider support? - android::CloseNativeLibrary(dlopen_handle, needs_native_bridge); + // The result of this call and error_msg is ignored because the most + // relevant error is that native bridge is unsupported. + android::CloseNativeLibrary(dlopen_handle, needs_native_bridge, error_msg); *error_msg = StringPrintf("Native-bridge agents unsupported: %s", name_.c_str()); *error = kLoadingError; return nullptr; |