[Lldb-commits] [PATCH] D92314: [lldb] [Process/FreeBSDRemote] Implement GetLoadedModuleFileSpec() and GetFileLoadAddress()
Michał Górny via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 7 00:57:29 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG276638ecaf22: [lldb] [Process/FreeBSDRemote] Implement GetLoadedModuleFileSpec() and… (authored by mgorny).
Herald added a project: LLDB.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92314/new/
https://reviews.llvm.org/D92314
Files:
lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.h
Index: lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.h
===================================================================
--- lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.h
+++ lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.h
@@ -67,9 +67,13 @@
Status SetBreakpoint(lldb::addr_t addr, uint32_t size,
bool hardware) override;
+ // The two following methods are probably not necessary and probably
+ // will never be called. Nevertheless, we implement them right now
+ // to reduce the differences between different platforms and reduce
+ // the risk of the lack of implementation actually breaking something,
+ // at least for the time being.
Status GetLoadedModuleFileSpec(const char *module_path,
FileSpec &file_spec) override;
-
Status GetFileLoadAddress(const llvm::StringRef &file_name,
lldb::addr_t &load_addr) override;
Index: lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
===================================================================
--- lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
+++ lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
@@ -630,14 +630,40 @@
Status NativeProcessFreeBSD::GetLoadedModuleFileSpec(const char *module_path,
FileSpec &file_spec) {
- return Status("Unimplemented");
+ Status error = PopulateMemoryRegionCache();
+ if (error.Fail())
+ return error;
+
+ FileSpec module_file_spec(module_path);
+ FileSystem::Instance().Resolve(module_file_spec);
+
+ file_spec.Clear();
+ for (const auto &it : m_mem_region_cache) {
+ if (it.second.GetFilename() == module_file_spec.GetFilename()) {
+ file_spec = it.second;
+ return Status();
+ }
+ }
+ return Status("Module file (%s) not found in process' memory map!",
+ module_file_spec.GetFilename().AsCString());
}
Status
NativeProcessFreeBSD::GetFileLoadAddress(const llvm::StringRef &file_name,
lldb::addr_t &load_addr) {
load_addr = LLDB_INVALID_ADDRESS;
- return Status();
+ Status error = PopulateMemoryRegionCache();
+ if (error.Fail())
+ return error;
+
+ FileSpec file(file_name);
+ for (const auto &it : m_mem_region_cache) {
+ if (it.second == file) {
+ load_addr = it.first.GetRange().GetRangeBase();
+ return Status();
+ }
+ }
+ return Status("No load address found for file %s.", file_name.str().c_str());
}
void NativeProcessFreeBSD::SigchldHandler() {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92314.309827.patch
Type: text/x-patch
Size: 2642 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201207/746bf792/attachment-0001.bin>
More information about the lldb-commits
mailing list