diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:12:36 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:12:36 +0000 |
commit | ef5d0b5e97ec8e6fa395d377b09aa7755e345b4f (patch) | |
tree | 27916256fdeeb57d10d2f3d6948be5d71a703215 /source/Plugins/Platform/Android | |
parent | 76e0736e7fcfeb179779e49c05604464b1ccd704 (diff) |
Notes
Diffstat (limited to 'source/Plugins/Platform/Android')
-rw-r--r-- | source/Plugins/Platform/Android/AdbClient.cpp | 2 | ||||
-rw-r--r-- | source/Plugins/Platform/Android/PlatformAndroid.cpp | 20 | ||||
-rw-r--r-- | source/Plugins/Platform/Android/PlatformAndroid.h | 3 |
3 files changed, 20 insertions, 5 deletions
diff --git a/source/Plugins/Platform/Android/AdbClient.cpp b/source/Plugins/Platform/Android/AdbClient.cpp index d3bcee6f487d7..6e15eb2b1dcb6 100644 --- a/source/Plugins/Platform/Android/AdbClient.cpp +++ b/source/Plugins/Platform/Android/AdbClient.cpp @@ -46,7 +46,7 @@ using namespace std::chrono; namespace { -const seconds kReadTimeout(12); +const seconds kReadTimeout(20); const char *kOKAY = "OKAY"; const char *kFAIL = "FAIL"; const char *kDATA = "DATA"; diff --git a/source/Plugins/Platform/Android/PlatformAndroid.cpp b/source/Plugins/Platform/Android/PlatformAndroid.cpp index 0f37da60d5d61..5b85bcdf7fdd1 100644 --- a/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/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) { diff --git a/source/Plugins/Platform/Android/PlatformAndroid.h b/source/Plugins/Platform/Android/PlatformAndroid.h index 638dba9733698..4c12eb8c016da 100644 --- a/source/Plugins/Platform/Android/PlatformAndroid.h +++ b/source/Plugins/Platform/Android/PlatformAndroid.h @@ -76,7 +76,8 @@ protected: Status DownloadSymbolFile(const lldb::ModuleSP &module_sp, const FileSpec &dst_file_spec) override; - llvm::StringRef GetLibdlFunctionDeclarations() override; + llvm::StringRef + GetLibdlFunctionDeclarations(lldb_private::Process *process) override; private: AdbClient::SyncService *GetSyncService(Status &error); |