diff options
author | Nitesh Jain <nitesh.jain@imgtec.com> | 2017-08-14 16:39:16 +0000 |
---|---|---|
committer | Nitesh Jain <nitesh.jain@imgtec.com> | 2017-08-14 16:39:16 +0000 |
commit | f7a5851d42bd61561d4df2bb20dc6ae44fd566b8 (patch) | |
tree | 62a02091b35a1702fa5fd4f222bfc07b0aa8157c /lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp | |
parent | 8ac63e8f9f58a44c2512d019b4ead10b37895d15 (diff) | |
download | bcm5719-llvm-f7a5851d42bd61561d4df2bb20dc6ae44fd566b8.tar.gz bcm5719-llvm-f7a5851d42bd61561d4df2bb20dc6ae44fd566b8.zip |
[LLDB][MIPS] Fix process load/unload on android.
To detect the correct function name based on the list of available symbols instead of the SDK version
Reviewers: tberghammer, clayborg
Subscribers: jaydeep, bhushan, lldb-commits
Differential Revision: https://reviews.llvm.org/D36445
llvm-svn: 310856
Diffstat (limited to 'lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp')
-rw-r--r-- | lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp index 0f37da60d5d..5b85bcdf7fd 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -21,6 +21,7 @@ #include "AdbClient.h" #include "PlatformAndroid.h" #include "PlatformAndroidRemoteGDBServer.h" +#include "lldb/Target/Target.h" using namespace lldb; using namespace lldb_private; @@ -366,9 +367,22 @@ bool PlatformAndroid::GetRemoteOSVersion() { return m_major_os_version != 0; } -llvm::StringRef PlatformAndroid::GetLibdlFunctionDeclarations() { +llvm::StringRef +PlatformAndroid::GetLibdlFunctionDeclarations(lldb_private::Process *process) { + SymbolContextList matching_symbols; + std::vector<const char *> dl_open_names = { "__dl_dlopen", "dlopen" }; + const char *dl_open_name = nullptr; + Target &target = process->GetTarget(); + for (auto name: dl_open_names) { + if (target.GetImages().FindFunctionSymbols(ConstString(name), + eFunctionNameTypeFull, + matching_symbols)) { + dl_open_name = name; + break; + } + } // Older platform versions have the dl function symbols mangled - if (GetSdkVersion() < 26) + if (dl_open_name == dl_open_names[0]) return R"( extern "C" void* dlopen(const char*, int) asm("__dl_dlopen"); extern "C" void* dlsym(void*, const char*) asm("__dl_dlsym"); @@ -376,7 +390,7 @@ llvm::StringRef PlatformAndroid::GetLibdlFunctionDeclarations() { extern "C" char* dlerror(void) asm("__dl_dlerror"); )"; - return PlatformPOSIX::GetLibdlFunctionDeclarations(); + return PlatformPOSIX::GetLibdlFunctionDeclarations(process); } AdbClient::SyncService *PlatformAndroid::GetSyncService(Status &error) { |