@@ -6577,7 +6577,8 @@ static void AddSegmentRegisterSections(Process &process, ThreadSP &thread_sp,
6577
6577
AddRegion (thread_local_region, true , ranges);
6578
6578
}
6579
6579
6580
- static void AddLinkMapSections (Process &process, CoreFileMemoryRanges &ranges) {
6580
+ static void AddLinkMapSections (Process &process, CoreFileMemoryRanges &ranges,
6581
+ std::set<addr_t > &stack_ends) {
6581
6582
ModuleList &module_list = process.GetTarget ().GetImages ();
6582
6583
Target *target = &process.GetTarget ();
6583
6584
for (size_t idx = 0 ; idx < module_list.GetSize (); idx++) {
@@ -6598,6 +6599,11 @@ static void AddLinkMapSections(Process &process, CoreFileMemoryRanges &ranges) {
6598
6599
if (err.Fail ())
6599
6600
continue ;
6600
6601
6602
+ // Sometimes, the link map section is included in one of the stack memory
6603
+ // ranges. In that case, we already saved a truncated version of that range
6604
+ if (stack_ends.count (link_map_section.GetRange ().GetRangeEnd ()) == 0 )
6605
+ continue ;
6606
+
6601
6607
AddRegion (link_map_section, true , ranges);
6602
6608
}
6603
6609
}
@@ -6754,7 +6760,7 @@ Status Process::CalculateCoreFileSaveRanges(const SaveCoreOptions &options,
6754
6760
SaveOffRegionsWithStackPointers (*this , options, regions, ranges,
6755
6761
stack_ends);
6756
6762
// We need the link map for TLS data.
6757
- AddLinkMapSections (*this , ranges);
6763
+ AddLinkMapSections (*this , ranges, stack_ends );
6758
6764
}
6759
6765
6760
6766
switch (core_style) {
0 commit comments