================ @@ -6528,6 +6528,74 @@ static void AddRegion(const MemoryRegionInfo ®ion, bool try_dirty_pages, CreateCoreFileMemoryRange(region)); } +static void AddRegisterSections(Process &process, ThreadSP &thread_sp, + CoreFileMemoryRanges &ranges, + lldb::addr_t range_end) { + lldb::RegisterContextSP reg_ctx = thread_sp->GetRegisterContext(); + if (!reg_ctx) + return; + + const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo( + lldb::RegisterKind::eRegisterKindGeneric, LLDB_REGNUM_GENERIC_TP); + if (!reg_info) + return; + + lldb_private::RegisterValue reg_value; + bool success = reg_ctx->ReadRegister(reg_info, reg_value); + if (!success) + return; + + const uint64_t fail_value = UINT64_MAX; + bool readSuccess = false; + const lldb::addr_t reg_value_addr = + reg_value.GetAsUInt64(fail_value, &readSuccess); + if (!readSuccess || reg_value_addr == fail_value) + return; + + MemoryRegionInfo register_region; + Status err = process.GetMemoryRegionInfo(reg_value_addr, register_region); + if (err.Fail()) + return; + + // We already saved off this truncated stack range. + if (register_region.GetRange().GetRangeEnd() == range_end) + return; + + // We don't need to worry about duplication because the CoreFileMemoryRanges + // will unique them + AddRegion(register_region, true, ranges); +} + +static void AddModuleSections(Process &process, CoreFileMemoryRanges &ranges, + std::set<addr_t> &stack_ends) { + ModuleList &module_list = process.GetTarget().GetImages(); + Target *target = &process.GetTarget(); + for (size_t idx = 0; idx < module_list.GetSize(); idx++) { + ModuleSP module_sp = module_list.GetModuleAtIndex(idx); + if (!module_sp) + continue; + + ObjectFile *obj = module_sp->GetObjectFile(); + if (!obj) + continue; + Address addr = obj->GetImageInfoAddress(target); + addr_t load_addr = addr.GetLoadAddress(target); + if (load_addr == LLDB_INVALID_ADDRESS) + continue; + + MemoryRegionInfo tls_storage_region; + Status err = process.GetMemoryRegionInfo(load_addr, tls_storage_region); ---------------- labath wrote:
I can believe that. My point is that the `tls_storage_region` is not a good name for this variable since it does not actually contain the thread-local data. https://github.com/llvm/llvm-project/pull/109477 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits