@@ -6566,7 +6566,8 @@ static void AddSegmentRegisterSections(Process &process, ThreadSP &thread_sp,
6566
6566
AddRegion (thread_local_region, true , ranges);
6567
6567
}
6568
6568
6569
- static void AddLinkMapSections (Process &process, CoreFileMemoryRanges &ranges) {
6569
+ static void AddLinkMapSections (Process &process, CoreFileMemoryRanges &ranges,
6570
+ std::set<addr_t > &stack_ends) {
6570
6571
ModuleList &module_list = process.GetTarget ().GetImages ();
6571
6572
Target *target = &process.GetTarget ();
6572
6573
for (size_t idx = 0 ; idx < module_list.GetSize (); idx++) {
@@ -6587,6 +6588,11 @@ static void AddLinkMapSections(Process &process, CoreFileMemoryRanges &ranges) {
6587
6588
if (err.Fail ())
6588
6589
continue ;
6589
6590
6591
+ // Sometimes, the link map section is included in one of the stack memory
6592
+ // ranges. In that case, we already saved a truncated version of that range
6593
+ if (stack_ends.count (link_map_section.GetRange ().GetRangeEnd ()) == 0 )
6594
+ continue ;
6595
+
6590
6596
AddRegion (link_map_section, true , ranges);
6591
6597
}
6592
6598
}
@@ -6743,7 +6749,7 @@ Status Process::CalculateCoreFileSaveRanges(const SaveCoreOptions &options,
6743
6749
SaveOffRegionsWithStackPointers (*this , options, regions, ranges,
6744
6750
stack_ends);
6745
6751
// We need the link map for TLS data.
6746
- AddLinkMapSections (*this , ranges);
6752
+ AddLinkMapSections (*this , ranges, stack_ends );
6747
6753
}
6748
6754
6749
6755
switch (core_style) {
0 commit comments