nitesh.jain updated this revision to Diff 91833.
nitesh.jain retitled this revision from "[LLDB][MIPS] Fix typo in
MatchesModuleSpec()" to "[LLDB][MIPS] Regain Module Name if
memory_info.GetName() is empty".
nitesh.jain added a comment.
In case of debugging normal process, the memory_info.GetName() is not empty and
hence module is read from memory (m_process->ReadModuleFromMemory) and the
corresponding sections are updated. In case of core file , the
memory_info.GetName() is empty which causes FindFirstModule to matches with the
first module in ModuleSpecList and result in loading wrong module at incorrect
sections addresses. This patch regain "vdso" module name if
memory_info.GetName() is empty.
https://reviews.llvm.org/D30454
Files:
source/Core/DynamicLoader.cpp
Index: source/Core/DynamicLoader.cpp
===================================================================
--- source/Core/DynamicLoader.cpp
+++ source/Core/DynamicLoader.cpp
@@ -190,6 +190,10 @@
Error error = m_process->GetMemoryRegionInfo(base_addr, memory_info);
if (error.Success() && memory_info.GetMapped() &&
memory_info.GetRange().GetRangeBase() == base_addr) {
+ // Regain name if memory_info.GetName is empty
+ if (memory_info.GetName().IsEmpty())
+ memory_info.SetName(file.GetFilename().AsCString());
+
ModuleSpec new_module_spec(
FileSpec(memory_info.GetName().AsCString(), false),
target.GetArchitecture());
Index: source/Core/DynamicLoader.cpp
===================================================================
--- source/Core/DynamicLoader.cpp
+++ source/Core/DynamicLoader.cpp
@@ -190,6 +190,10 @@
Error error = m_process->GetMemoryRegionInfo(base_addr, memory_info);
if (error.Success() && memory_info.GetMapped() &&
memory_info.GetRange().GetRangeBase() == base_addr) {
+ // Regain name if memory_info.GetName is empty
+ if (memory_info.GetName().IsEmpty())
+ memory_info.SetName(file.GetFilename().AsCString());
+
ModuleSpec new_module_spec(
FileSpec(memory_info.GetName().AsCString(), false),
target.GetArchitecture());
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits