diff options
Diffstat (limited to 'lldb/source/Expression')
| -rw-r--r-- | lldb/source/Expression/DWARFExpression.cpp | 10 | ||||
| -rw-r--r-- | lldb/source/Expression/DWARFExpressionList.cpp | 2 | ||||
| -rw-r--r-- | lldb/source/Expression/Expression.cpp | 29 | ||||
| -rw-r--r-- | lldb/source/Expression/IRExecutionUnit.cpp | 59 | ||||
| -rw-r--r-- | lldb/source/Expression/IRMemoryMap.cpp | 13 |
5 files changed, 36 insertions, 77 deletions
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index ed4e4e4e341a..332cf2c86024 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -67,7 +67,8 @@ void DWARFExpression::UpdateValue(uint64_t const_value, } void DWARFExpression::DumpLocation(Stream *s, lldb::DescriptionLevel level, - ABI *abi) const { + ABI *abi, + llvm::DIDumpOptions options) const { auto *MCRegInfo = abi ? &abi->GetMCRegisterInfo() : nullptr; auto GetRegName = [&MCRegInfo](uint64_t DwarfRegNum, bool IsEH) -> llvm::StringRef { @@ -79,10 +80,9 @@ void DWARFExpression::DumpLocation(Stream *s, lldb::DescriptionLevel level, return llvm::StringRef(RegName); return {}; }; - llvm::DIDumpOptions DumpOpts; - DumpOpts.GetNameForDWARFReg = GetRegName; + options.GetNameForDWARFReg = GetRegName; llvm::DWARFExpression E(m_data.GetAsLLVM(), m_data.GetAddressByteSize()); - llvm::printDwarfExpression(&E, s->AsRawOstream(), DumpOpts, nullptr); + llvm::printDwarfExpression(&E, s->AsRawOstream(), options, nullptr); } RegisterKind DWARFExpression::GetRegisterKind() const { return m_reg_kind; } @@ -2078,7 +2078,7 @@ llvm::Expected<Value> DWARFExpression::Evaluate( case DW_OP_implicit_pointer: { dwarf4_location_description_kind = Implicit; - return llvm::createStringError("Could not evaluate %s.", + return llvm::createStringError("could not evaluate %s", DW_OP_value_to_name(op)); } diff --git a/lldb/source/Expression/DWARFExpressionList.cpp b/lldb/source/Expression/DWARFExpressionList.cpp index ef7333518f00..91c174013603 100644 --- a/lldb/source/Expression/DWARFExpressionList.cpp +++ b/lldb/source/Expression/DWARFExpressionList.cpp @@ -254,7 +254,7 @@ llvm::Expected<Value> DWARFExpressionList::Evaluate( } if (!pc.IsValid()) { - return llvm::createStringError("Invalid PC in frame."); + return llvm::createStringError("invalid PC in frame"); } addr_t pc_load_addr = pc.GetLoadAddress(exe_ctx->GetTargetPtr()); const DWARFExpression *entry = diff --git a/lldb/source/Expression/Expression.cpp b/lldb/source/Expression/Expression.cpp index 796851ff15ca..16ecb1d7deef 100644 --- a/lldb/source/Expression/Expression.cpp +++ b/lldb/source/Expression/Expression.cpp @@ -34,10 +34,10 @@ Expression::Expression(ExecutionContextScope &exe_scope) llvm::Expected<FunctionCallLabel> lldb_private::FunctionCallLabel::fromString(llvm::StringRef label) { - llvm::SmallVector<llvm::StringRef, 4> components; - label.split(components, ":", /*MaxSplit=*/3); + llvm::SmallVector<llvm::StringRef, 5> components; + label.split(components, ":", /*MaxSplit=*/4); - if (components.size() != 4) + if (components.size() != 5) return llvm::createStringError("malformed function call label."); if (components[0] != FunctionCallLabelPrefix) @@ -45,8 +45,10 @@ lldb_private::FunctionCallLabel::fromString(llvm::StringRef label) { "expected function call label prefix '{0}' but found '{1}' instead.", FunctionCallLabelPrefix, components[0])); - llvm::StringRef module_label = components[1]; - llvm::StringRef die_label = components[2]; + llvm::StringRef discriminator = components[1]; + llvm::StringRef module_label = components[2]; + llvm::StringRef die_label = components[3]; + llvm::StringRef lookup_name = components[4]; lldb::user_id_t module_id = 0; if (!llvm::to_integer(module_label, module_id)) @@ -58,20 +60,23 @@ lldb_private::FunctionCallLabel::fromString(llvm::StringRef label) { return llvm::createStringError( llvm::formatv("failed to parse symbol ID from '{0}'.", die_label)); - return FunctionCallLabel{/*.module_id=*/module_id, + return FunctionCallLabel{/*.discriminator=*/discriminator, + /*.module_id=*/module_id, /*.symbol_id=*/die_id, - /*.lookup_name=*/components[3]}; + /*.lookup_name=*/lookup_name}; } std::string lldb_private::FunctionCallLabel::toString() const { - return llvm::formatv("{0}:{1:x}:{2:x}:{3}", FunctionCallLabelPrefix, - module_id, symbol_id, lookup_name) + return llvm::formatv("{0}:{1}:{2:x}:{3:x}:{4}", FunctionCallLabelPrefix, + discriminator, module_id, symbol_id, lookup_name) .str(); } void llvm::format_provider<FunctionCallLabel>::format( const FunctionCallLabel &label, raw_ostream &OS, StringRef Style) { - OS << llvm::formatv("FunctionCallLabel{ module_id: {0:x}, symbol_id: {1:x}, " - "lookup_name: {2} }", - label.module_id, label.symbol_id, label.lookup_name); + OS << llvm::formatv("FunctionCallLabel{ discriminator: {0}, module_id: " + "{1:x}, symbol_id: {2:x}, " + "lookup_name: {3} }", + label.discriminator, label.module_id, label.symbol_id, + label.lookup_name); } diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp index d557084acb74..25d4a87b89ef 100644 --- a/lldb/source/Expression/IRExecutionUnit.cpp +++ b/lldb/source/Expression/IRExecutionUnit.cpp @@ -543,62 +543,7 @@ lldb::SectionType IRExecutionUnit::GetSectionTypeFromSectionName( else if (name.starts_with("__debug_") || name.starts_with(".debug_")) { const uint32_t name_idx = name[0] == '_' ? 8 : 7; llvm::StringRef dwarf_name(name.substr(name_idx)); - switch (dwarf_name[0]) { - case 'a': - if (dwarf_name == "abbrev") - sect_type = lldb::eSectionTypeDWARFDebugAbbrev; - else if (dwarf_name == "aranges") - sect_type = lldb::eSectionTypeDWARFDebugAranges; - else if (dwarf_name == "addr") - sect_type = lldb::eSectionTypeDWARFDebugAddr; - break; - - case 'f': - if (dwarf_name == "frame") - sect_type = lldb::eSectionTypeDWARFDebugFrame; - break; - - case 'i': - if (dwarf_name == "info") - sect_type = lldb::eSectionTypeDWARFDebugInfo; - break; - - case 'l': - if (dwarf_name == "line") - sect_type = lldb::eSectionTypeDWARFDebugLine; - else if (dwarf_name == "loc") - sect_type = lldb::eSectionTypeDWARFDebugLoc; - else if (dwarf_name == "loclists") - sect_type = lldb::eSectionTypeDWARFDebugLocLists; - break; - - case 'm': - if (dwarf_name == "macinfo") - sect_type = lldb::eSectionTypeDWARFDebugMacInfo; - break; - - case 'p': - if (dwarf_name == "pubnames") - sect_type = lldb::eSectionTypeDWARFDebugPubNames; - else if (dwarf_name == "pubtypes") - sect_type = lldb::eSectionTypeDWARFDebugPubTypes; - break; - - case 's': - if (dwarf_name == "str") - sect_type = lldb::eSectionTypeDWARFDebugStr; - else if (dwarf_name == "str_offsets") - sect_type = lldb::eSectionTypeDWARFDebugStrOffsets; - break; - - case 'r': - if (dwarf_name == "ranges") - sect_type = lldb::eSectionTypeDWARFDebugRanges; - break; - - default: - break; - } + sect_type = ObjectFile::GetDWARFSectionTypeFromName(dwarf_name); } else if (name.starts_with("__apple_") || name.starts_with(".apple_")) sect_type = lldb::eSectionTypeInvalid; else if (name == "__objc_imageinfo") @@ -778,7 +723,7 @@ private: /// Returns address of the function referred to by the special function call /// label \c label. static llvm::Expected<lldb::addr_t> -ResolveFunctionCallLabel(const FunctionCallLabel &label, +ResolveFunctionCallLabel(FunctionCallLabel &label, const lldb_private::SymbolContext &sc, bool &symbol_was_missing_weak) { symbol_was_missing_weak = false; diff --git a/lldb/source/Expression/IRMemoryMap.cpp b/lldb/source/Expression/IRMemoryMap.cpp index 150699352a2e..f978217fa8f2 100644 --- a/lldb/source/Expression/IRMemoryMap.cpp +++ b/lldb/source/Expression/IRMemoryMap.cpp @@ -637,10 +637,19 @@ void IRMemoryMap::WriteScalarToMemory(lldb::addr_t process_address, } void IRMemoryMap::WritePointerToMemory(lldb::addr_t process_address, - lldb::addr_t address, Status &error) { + lldb::addr_t pointer, Status &error) { error.Clear(); - Scalar scalar(address); + /// Only ask the Process to fix `pointer` if the address belongs to the + /// process. An address belongs to the process if the Allocation policy is not + /// eAllocationPolicyHostOnly. + auto it = FindAllocation(pointer, 1); + if (it == m_allocations.end() || + it->second.m_policy != AllocationPolicy::eAllocationPolicyHostOnly) + if (auto process_sp = GetProcessWP().lock()) + pointer = process_sp->FixAnyAddress(pointer); + + Scalar scalar(pointer); WriteScalarToMemory(process_address, scalar, GetAddressByteSize(), error); } |
