DWARFExpression lldb_private::npdb::MakeGlobalLocationExpression( uint16_t section, uint32_t offset, ModuleSP module) { assert(section > 0); assert(module); return MakeLocationExpressionInternal( module, [&](Stream &stream, RegisterKind ®ister_kind) -> bool { stream.PutHex8(llvm::dwarf::DW_OP_addr); SectionList *section_list = module->GetSectionList(); assert(section_list); // Section indices in PDB are 1-based, but in DWARF they are 0-based, so // we need to subtract 1. uint32_t section_idx = section - 1; if (section_idx >= section_list->GetSize()) return false; auto section_ptr = section_list->GetSectionAtIndex(section_idx); if (!section_ptr) return false; stream.PutMaxHex64(section_ptr->GetFileAddress() + offset, stream.GetAddressByteSize(), stream.GetByteOrder()); return true; }); }