Skip to content

Commit 8c42dd3

Browse files
committed
Readd linkmap explicitly because we need it for the dynamic loader to figure out the TLS sections
1 parent f4c25e1 commit 8c42dd3

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ void DynamicLoaderPOSIXDYLD::DidAttach() {
108108
// if we dont have a load address we cant re-base
109109
bool rebase_exec = load_offset != LLDB_INVALID_ADDRESS;
110110

111+
// if the target executable should be re-based
111112
if (rebase_exec) {
112113
ModuleList module_list;
113114

lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ ArchSpec ProcessMinidump::GetArchitecture() {
336336
}
337337

338338
DynamicLoader *ProcessMinidump::GetDynamicLoader() {
339-
if (m_dyld_up.get() == nullptr)
339+
if (m_dyld_up.get() == nullptr
340+
&& GetArchitecture().GetTriple().isOSLinux())
340341
m_dyld_up.reset(DynamicLoader::FindPlugin(
341342
this, DynamicLoaderPOSIXDYLD::GetPluginNameStatic()));
342343
return m_dyld_up.get();

lldb/source/Target/Process.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6528,7 +6528,7 @@ static void AddRegion(const MemoryRegionInfo &region, bool try_dirty_pages,
65286528
CreateCoreFileMemoryRange(region));
65296529
}
65306530

6531-
static void AddRegisterSections(Process &process, ThreadSP &thread_sp,
6531+
static void AddSegmentRegisterSections(Process &process, ThreadSP &thread_sp,
65326532
CoreFileMemoryRanges &ranges,
65336533
lldb::addr_t range_end) {
65346534
lldb::RegisterContextSP reg_ctx = thread_sp->GetRegisterContext();
@@ -6566,8 +6566,7 @@ static void AddRegisterSections(Process &process, ThreadSP &thread_sp,
65666566
AddRegion(register_region, true, ranges);
65676567
}
65686568

6569-
static void AddModuleSections(Process &process, CoreFileMemoryRanges &ranges,
6570-
std::set<addr_t> &stack_ends) {
6569+
static void AddLinkMapSections(Process &process, CoreFileMemoryRanges &ranges) {
65716570
ModuleList &module_list = process.GetTarget().GetImages();
65726571
Target *target = &process.GetTarget();
65736572
for (size_t idx = 0; idx < module_list.GetSize(); idx++) {
@@ -6588,10 +6587,6 @@ static void AddModuleSections(Process &process, CoreFileMemoryRanges &ranges,
65886587
if (err.Fail())
65896588
continue;
65906589

6591-
// We already saved off this truncated stack range.
6592-
if (stack_ends.count(tls_storage_region.GetRange().GetRangeEnd()) > 0)
6593-
continue;
6594-
65956590
AddRegion(tls_storage_region, true, ranges);
65966591
}
65976592
}
@@ -6633,7 +6628,7 @@ static void SaveOffRegionsWithStackPointers(Process &process,
66336628
// or contains the thread id from thread_sp.
66346629
if (core_options.ShouldThreadBeSaved(thread_sp->GetID())) {
66356630
AddRegion(sp_region, try_dirty_pages, ranges);
6636-
AddRegisterSections(process, thread_sp, ranges, range_end);
6631+
AddSegmentRegisterSections(process, thread_sp, ranges, range_end);
66376632
}
66386633
}
66396634
}
@@ -6747,8 +6742,8 @@ Status Process::CalculateCoreFileSaveRanges(const SaveCoreOptions &options,
67476742
options.HasSpecifiedThreads()) {
67486743
SaveOffRegionsWithStackPointers(*this, options, regions, ranges,
67496744
stack_ends);
6750-
// Save off the load sections for the TLS data.
6751-
AddModuleSections(*this, ranges, stack_ends);
6745+
// We need the link map for TLS data.
6746+
AddLinkMapSections(*this, ranges);
67526747
}
67536748

67546749
switch (core_style) {

0 commit comments

Comments
 (0)