diff options
| author | Antonio Afonso <antonio.afonso@gmail.com> | 2019-06-11 20:16:13 +0000 |
|---|---|---|
| committer | Antonio Afonso <antonio.afonso@gmail.com> | 2019-06-11 20:16:13 +0000 |
| commit | 943faef1fafe2793cfaf9bf7741fe4215d3b0fe7 (patch) | |
| tree | 3964c21d1573a12769317960aaeb236d544ad4bd /lldb/source/Plugins/Process/Linux | |
| parent | 1dc3c9aa8f7a68343a0ec1447c96e66b348a2608 (diff) | |
| download | bcm5719-llvm-943faef1fafe2793cfaf9bf7741fe4215d3b0fe7.tar.gz bcm5719-llvm-943faef1fafe2793cfaf9bf7741fe4215d3b0fe7.zip | |
Add support to read aux vector values
Summary:
This is the second patch to improve module loading in a series that started here (where I explain the motivation and solution): https://reviews.llvm.org/D62499
I need to read the aux vector to know where the r_debug map with the loaded libraries are.
The AuxVector class was made generic so it could be reused between the POSIX-DYLD plugin and NativeProcess*. The class itself ended up in the ProcessUtility plugin.
Reviewers: clayborg, xiaobai, labath, JDevlieghere
Reviewed By: clayborg, labath, JDevlieghere
Subscribers: emaste, JDevlieghere, mgorny, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D62500
llvm-svn: 363098
Diffstat (limited to 'lldb/source/Plugins/Process/Linux')
| -rw-r--r-- | lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp | 15 | ||||
| -rw-r--r-- | lldb/source/Plugins/Process/Linux/NativeProcessLinux.h | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index a55dc41bed0..81d257e95e1 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -2082,3 +2082,18 @@ Status NativeProcessLinux::StopProcessorTracingOnThread(lldb::user_id_t traceid, return error; } + +llvm::Optional<uint64_t> +NativeProcessLinux::GetAuxValue(enum AuxVector::EntryType type) { + if (m_aux_vector == nullptr) { + auto buffer_or_error = GetAuxvData(); + if (!buffer_or_error) + return llvm::None; + DataExtractor auxv_data(buffer_or_error.get()->getBufferStart(), + buffer_or_error.get()->getBufferSize(), + GetByteOrder(), GetAddressByteSize()); + m_aux_vector = llvm::make_unique<AuxVector>(auxv_data); + } + + return m_aux_vector->GetAuxValue(type); +} diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h index 006ae000168..0a67af0a0a4 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h @@ -12,6 +12,7 @@ #include <csignal> #include <unordered_set> +#include "Plugins/Process/Utility/AuxVector.h" #include "lldb/Host/Debug.h" #include "lldb/Host/HostThread.h" #include "lldb/Host/linux/Support.h" @@ -102,6 +103,8 @@ public: return getProcFile(GetID(), "auxv"); } + llvm::Optional<uint64_t> GetAuxValue(enum AuxVector::EntryType type); + lldb::user_id_t StartTrace(const TraceOptions &config, Status &error) override; @@ -132,6 +135,7 @@ protected: private: MainLoop::SignalHandleUP m_sigchld_handle; ArchSpec m_arch; + std::unique_ptr<AuxVector> m_aux_vector; LazyBool m_supports_mem_region = eLazyBoolCalculate; std::vector<std::pair<MemoryRegionInfo, FileSpec>> m_mem_region_cache; |

