diff options
Diffstat (limited to 'lldb/source')
| -rw-r--r-- | lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp | 4 | ||||
| -rw-r--r-- | lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp | 6 | ||||
| -rw-r--r-- | lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp | 22 | ||||
| -rw-r--r-- | lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp | 6 | ||||
| -rw-r--r-- | lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp | 4 | ||||
| -rw-r--r-- | lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp | 4 | ||||
| -rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 12 | ||||
| -rw-r--r-- | lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp | 2 | ||||
| -rw-r--r-- | lldb/source/Symbol/ObjectFile.cpp | 8 | ||||
| -rw-r--r-- | lldb/source/Target/InstrumentationRuntime.cpp | 3 | ||||
| -rw-r--r-- | lldb/source/Target/Target.cpp | 19 | ||||
| -rw-r--r-- | lldb/source/Utility/Args.cpp | 2 | ||||
| -rw-r--r-- | lldb/source/Utility/Stream.cpp | 8 | 
13 files changed, 50 insertions, 50 deletions
diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp index e8bf04e..b5831f0 100644 --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -149,11 +149,11 @@ ConnectionFileDescriptor::Connect(llvm::StringRef path,          llvm::StringSwitch<ConnectionStatus (ConnectionFileDescriptor::*)(              llvm::StringRef, socket_id_callback_type, Status *)>(scheme)              .Case("listen", &ConnectionFileDescriptor::AcceptTCP) -            .Cases("accept", "unix-accept", +            .Cases({"accept", "unix-accept"},                     &ConnectionFileDescriptor::AcceptNamedSocket)              .Case("unix-abstract-accept",                    &ConnectionFileDescriptor::AcceptAbstractSocket) -            .Cases("connect", "tcp-connect", +            .Cases({"connect", "tcp-connect"},                     &ConnectionFileDescriptor::ConnectTCP)              .Case("udp", &ConnectionFileDescriptor::ConnectUDP)              .Case("unix-connect", &ConnectionFileDescriptor::ConnectNamedSocket) diff --git a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp index e40d2c5..8bfb432 100644 --- a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp +++ b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp @@ -86,9 +86,9 @@ std::string ABIAArch64::GetMCName(std::string reg) {  uint32_t ABIAArch64::GetGenericNum(llvm::StringRef name) {    return llvm::StringSwitch<uint32_t>(name)        .Case("pc", LLDB_REGNUM_GENERIC_PC) -      .Cases("lr", "x30", LLDB_REGNUM_GENERIC_RA) -      .Cases("sp", "x31", LLDB_REGNUM_GENERIC_SP) -      .Cases("fp", "x29", LLDB_REGNUM_GENERIC_FP) +      .Cases({"lr", "x30"}, LLDB_REGNUM_GENERIC_RA) +      .Cases({"sp", "x31"}, LLDB_REGNUM_GENERIC_SP) +      .Cases({"fp", "x29"}, LLDB_REGNUM_GENERIC_FP)        .Case("cpsr", LLDB_REGNUM_GENERIC_FLAGS)        .Case("x0", LLDB_REGNUM_GENERIC_ARG1)        .Case("x1", LLDB_REGNUM_GENERIC_ARG2) diff --git a/lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp b/lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp index 4f5e29c..91b965d 100644 --- a/lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp +++ b/lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp @@ -622,17 +622,17 @@ void ABISysV_loongarch::Terminate() {  static uint32_t GetGenericNum(llvm::StringRef name) {    return llvm::StringSwitch<uint32_t>(name)        .Case("pc", LLDB_REGNUM_GENERIC_PC) -      .Cases("ra", "r1", LLDB_REGNUM_GENERIC_RA) -      .Cases("sp", "r3", LLDB_REGNUM_GENERIC_SP) -      .Cases("fp", "r22", LLDB_REGNUM_GENERIC_FP) -      .Cases("a0", "r4", LLDB_REGNUM_GENERIC_ARG1) -      .Cases("a1", "r5", LLDB_REGNUM_GENERIC_ARG2) -      .Cases("a2", "r6", LLDB_REGNUM_GENERIC_ARG3) -      .Cases("a3", "r7", LLDB_REGNUM_GENERIC_ARG4) -      .Cases("a4", "r8", LLDB_REGNUM_GENERIC_ARG5) -      .Cases("a5", "r9", LLDB_REGNUM_GENERIC_ARG6) -      .Cases("a6", "r10", LLDB_REGNUM_GENERIC_ARG7) -      .Cases("a7", "r11", LLDB_REGNUM_GENERIC_ARG8) +      .Cases({"ra", "r1"}, LLDB_REGNUM_GENERIC_RA) +      .Cases({"sp", "r3"}, LLDB_REGNUM_GENERIC_SP) +      .Cases({"fp", "r22"}, LLDB_REGNUM_GENERIC_FP) +      .Cases({"a0", "r4"}, LLDB_REGNUM_GENERIC_ARG1) +      .Cases({"a1", "r5"}, LLDB_REGNUM_GENERIC_ARG2) +      .Cases({"a2", "r6"}, LLDB_REGNUM_GENERIC_ARG3) +      .Cases({"a3", "r7"}, LLDB_REGNUM_GENERIC_ARG4) +      .Cases({"a4", "r8"}, LLDB_REGNUM_GENERIC_ARG5) +      .Cases({"a5", "r9"}, LLDB_REGNUM_GENERIC_ARG6) +      .Cases({"a6", "r10"}, LLDB_REGNUM_GENERIC_ARG7) +      .Cases({"a7", "r11"}, LLDB_REGNUM_GENERIC_ARG8)        .Default(LLDB_INVALID_REGNUM);  } diff --git a/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp index 53f11b5..ff37b48 100644 --- a/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp +++ b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp @@ -815,9 +815,9 @@ void ABISysV_riscv::Terminate() {  static uint32_t GetGenericNum(llvm::StringRef name) {    return llvm::StringSwitch<uint32_t>(name)        .Case("pc", LLDB_REGNUM_GENERIC_PC) -      .Cases("ra", "x1", LLDB_REGNUM_GENERIC_RA) -      .Cases("sp", "x2", LLDB_REGNUM_GENERIC_SP) -      .Cases("fp", "s0", LLDB_REGNUM_GENERIC_FP) +      .Cases({"ra", "x1"}, LLDB_REGNUM_GENERIC_RA) +      .Cases({"sp", "x2"}, LLDB_REGNUM_GENERIC_SP) +      .Cases({"fp", "s0"}, LLDB_REGNUM_GENERIC_FP)        .Case("a0", LLDB_REGNUM_GENERIC_ARG1)        .Case("a1", LLDB_REGNUM_GENERIC_ARG2)        .Case("a2", LLDB_REGNUM_GENERIC_ARG3) diff --git a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp index 0489f4d..faa0dd0 100644 --- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp @@ -47,7 +47,7 @@ Language *ObjCPlusPlusLanguage::CreateInstance(lldb::LanguageType language) {  std::optional<bool>  ObjCPlusPlusLanguage::GetBooleanFromString(llvm::StringRef str) const {    return llvm::StringSwitch<std::optional<bool>>(str) -      .Cases("true", "YES", {true}) -      .Cases("false", "NO", {false}) +      .Cases({"true", "YES"}, {true}) +      .Cases({"false", "NO"}, {false})        .Default({});  } diff --git a/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp b/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp index d40f87b..945b70f 100644 --- a/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp +++ b/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp @@ -70,7 +70,7 @@ llvm::Triple::ArchType stringTo<llvm::Triple::ArchType>(llvm::StringRef Str) {    using llvm::Triple;    return llvm::StringSwitch<Triple::ArchType>(Str)        .Case("arm", Triple::arm) -      .Cases("arm64", "arm64e", Triple::aarch64) +      .Cases({"arm64", "arm64e"}, Triple::aarch64)        .Case("mips", Triple::mips)        .Case("msp430", Triple::msp430)        .Case("ppc", Triple::ppc) @@ -79,7 +79,7 @@ llvm::Triple::ArchType stringTo<llvm::Triple::ArchType>(llvm::StringRef Str) {        .Case("sparc", Triple::sparc)        .Case("sparcv9", Triple::sparcv9)        .Case("x86", Triple::x86) -      .Cases("x86_64", "x86_64h", Triple::x86_64) +      .Cases({"x86_64", "x86_64h"}, Triple::x86_64)        .Default(Triple::UnknownArch);  } diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 097c91b..e06e69f 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1678,7 +1678,7 @@ static SectionType GetSectionTypeFromName(llvm::StringRef Name) {        .Case(".ARM.exidx", eSectionTypeARMexidx)        .Case(".ARM.extab", eSectionTypeARMextab)        .Case(".ctf", eSectionTypeDebug) -      .Cases(".data", ".tdata", eSectionTypeData) +      .Cases({".data", ".tdata"}, eSectionTypeData)        .Case(".eh_frame", eSectionTypeEHFrame)        .Case(".gnu_debugaltlink", eSectionTypeDWARFGNUDebugAltLink)        .Case(".gosymtab", eSectionTypeGoSymtab) @@ -2735,9 +2735,8 @@ static void ApplyELF64ABS64Relocation(Symtab *symtab, ELFRelocation &rel,      // ObjectFileELF creates a WritableDataBuffer in CreateInstance.      WritableDataBuffer *data_buffer =          llvm::cast<WritableDataBuffer>(data_buffer_sp.get()); -    uint64_t *dst = reinterpret_cast<uint64_t *>( -        data_buffer->GetBytes() + rel_section->GetFileOffset() + -        ELFRelocation::RelocOffset64(rel)); +    void *const dst = data_buffer->GetBytes() + rel_section->GetFileOffset() + +                      ELFRelocation::RelocOffset64(rel);      uint64_t val_offset = value + ELFRelocation::RelocAddend64(rel);      memcpy(dst, &val_offset, sizeof(uint64_t));    } @@ -2762,9 +2761,8 @@ static void ApplyELF64ABS32Relocation(Symtab *symtab, ELFRelocation &rel,      // ObjectFileELF creates a WritableDataBuffer in CreateInstance.      WritableDataBuffer *data_buffer =          llvm::cast<WritableDataBuffer>(data_buffer_sp.get()); -    uint32_t *dst = reinterpret_cast<uint32_t *>( -        data_buffer->GetBytes() + rel_section->GetFileOffset() + -        ELFRelocation::RelocOffset32(rel)); +    void *const dst = data_buffer->GetBytes() + rel_section->GetFileOffset() + +                      ELFRelocation::RelocOffset32(rel);      memcpy(dst, &truncated_addr, sizeof(uint32_t));    }  } diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 4984445..244489a 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -985,7 +985,7 @@ SectionType ObjectFilePECOFF::GetSectionType(llvm::StringRef sect_name,            .Case(".stabstr", eSectionTypeDataCString)            .Case(".reloc", eSectionTypeOther)            // .eh_frame can be truncated to 8 chars. -          .Cases(".eh_frame", ".eh_fram", eSectionTypeEHFrame) +          .Cases({".eh_frame", ".eh_fram"}, eSectionTypeEHFrame)            .Case(".gosymtab", eSectionTypeGoSymtab)            .Case(".lldbsummaries", lldb::eSectionTypeLLDBTypeSummaries)            .Case(".lldbformatters", lldb::eSectionTypeLLDBFormatters) diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index 9a79b3c..6f5348c 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -647,14 +647,14 @@ ObjectFile::GetDWARFSectionTypeFromName(llvm::StringRef name) {        .Case("frame", eSectionTypeDWARFDebugFrame)        .Case("info", eSectionTypeDWARFDebugInfo)        .Case("info.dwo", eSectionTypeDWARFDebugInfoDwo) -      .Cases("line", "line.dwo", eSectionTypeDWARFDebugLine) -      .Cases("line_str", "line_str.dwo", eSectionTypeDWARFDebugLineStr) +      .Cases({"line", "line.dwo"}, eSectionTypeDWARFDebugLine) +      .Cases({"line_str", "line_str.dwo"}, eSectionTypeDWARFDebugLineStr)        .Case("loc", eSectionTypeDWARFDebugLoc)        .Case("loc.dwo", eSectionTypeDWARFDebugLocDwo)        .Case("loclists", eSectionTypeDWARFDebugLocLists)        .Case("loclists.dwo", eSectionTypeDWARFDebugLocListsDwo)        .Case("macinfo", eSectionTypeDWARFDebugMacInfo) -      .Cases("macro", "macro.dwo", eSectionTypeDWARFDebugMacro) +      .Cases({"macro", "macro.dwo"}, eSectionTypeDWARFDebugMacro)        .Case("names", eSectionTypeDWARFDebugNames)        .Case("pubnames", eSectionTypeDWARFDebugPubNames)        .Case("pubtypes", eSectionTypeDWARFDebugPubTypes) @@ -663,7 +663,7 @@ ObjectFile::GetDWARFSectionTypeFromName(llvm::StringRef name) {        .Case("rnglists.dwo", eSectionTypeDWARFDebugRngListsDwo)        .Case("str", eSectionTypeDWARFDebugStr)        .Case("str.dwo", eSectionTypeDWARFDebugStrDwo) -      .Cases("str_offsets", "str_offs", eSectionTypeDWARFDebugStrOffsets) +      .Cases({"str_offsets", "str_offs"}, eSectionTypeDWARFDebugStrOffsets)        .Case("str_offsets.dwo", eSectionTypeDWARFDebugStrOffsetsDwo)        .Case("tu_index", eSectionTypeDWARFDebugTuIndex)        .Case("types", eSectionTypeDWARFDebugTypes) diff --git a/lldb/source/Target/InstrumentationRuntime.cpp b/lldb/source/Target/InstrumentationRuntime.cpp index 7e58e8b..d9800a8 100644 --- a/lldb/source/Target/InstrumentationRuntime.cpp +++ b/lldb/source/Target/InstrumentationRuntime.cpp @@ -55,7 +55,8 @@ void InstrumentationRuntime::ModulesDidLoad(        return IterationAction::Continue;      const RegularExpression &runtime_regex = GetPatternForRuntimeLibrary(); -    if (runtime_regex.Execute(file_spec.GetFilename().GetCString()) || +    if (MatchAllModules() || +        runtime_regex.Execute(file_spec.GetFilename().GetCString()) ||          module_sp->IsExecutable()) {        if (CheckIfRuntimeIsValid(module_sp)) {          SetRuntimeModuleSP(module_sp); diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 1e43094..a23091a 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -3962,9 +3962,7 @@ void Target::StopHook::GetDescription(Stream &s,      return;    } -  unsigned indent_level = s.GetIndentLevel(); - -  s.SetIndentLevel(indent_level + 2); +  auto indent_scope = s.MakeIndentScope();    s.Printf("Hook: %" PRIu64 "\n", GetID());    if (m_active) @@ -3978,19 +3976,17 @@ void Target::StopHook::GetDescription(Stream &s,    if (m_specifier_sp) {      s.Indent();      s.PutCString("Specifier:\n"); -    s.SetIndentLevel(indent_level + 4); +    auto indent_scope = s.MakeIndentScope();      m_specifier_sp->GetDescription(&s, level); -    s.SetIndentLevel(indent_level + 2);    }    if (m_thread_spec_up) {      StreamString tmp;      s.Indent("Thread:\n");      m_thread_spec_up->GetDescription(&tmp, level); -    s.SetIndentLevel(indent_level + 4); +    auto indent_scope = s.MakeIndentScope();      s.Indent(tmp.GetString());      s.PutCString("\n"); -    s.SetIndentLevel(indent_level + 2);    }    GetSubclassDescription(s, level);  } @@ -4003,14 +3999,13 @@ void Target::StopHookCommandLine::GetSubclassDescription(        s.PutCString(m_commands.GetStringAtIndex(0));      return;    } -  s.Indent("Commands: \n"); -  s.SetIndentLevel(s.GetIndentLevel() + 4); +  s.Indent("Commands:\n"); +  auto indent_scope = s.MakeIndentScope(4);    uint32_t num_commands = m_commands.GetSize();    for (uint32_t i = 0; i < num_commands; i++) {      s.Indent(m_commands.GetStringAtIndex(i));      s.PutCString("\n");    } -  s.SetIndentLevel(s.GetIndentLevel() - 4);  }  // Target::StopHookCommandLine @@ -4145,7 +4140,7 @@ void Target::StopHookScripted::GetSubclassDescription(      return;    s.Indent("Args:\n"); -  s.SetIndentLevel(s.GetIndentLevel() + 4); +  auto indent_scope = s.MakeIndentScope(4);    auto print_one_element = [&s](llvm::StringRef key,                                  StructuredData::Object *object) { @@ -4155,8 +4150,6 @@ void Target::StopHookScripted::GetSubclassDescription(    };    as_dict->ForEach(print_one_element); - -  s.SetIndentLevel(s.GetIndentLevel() - 4);  }  static constexpr OptionEnumValueElement g_dynamic_value_types[] = { diff --git a/lldb/source/Utility/Args.cpp b/lldb/source/Utility/Args.cpp index 8ba40ba..7eff9cf 100644 --- a/lldb/source/Utility/Args.cpp +++ b/lldb/source/Utility/Args.cpp @@ -445,7 +445,7 @@ uint32_t Args::StringToGenericRegister(llvm::StringRef s) {                          .Case("pc", LLDB_REGNUM_GENERIC_PC)                          .Case("sp", LLDB_REGNUM_GENERIC_SP)                          .Case("fp", LLDB_REGNUM_GENERIC_FP) -                        .Cases("ra", "lr", LLDB_REGNUM_GENERIC_RA) +                        .Cases({"ra", "lr"}, LLDB_REGNUM_GENERIC_RA)                          .Case("flags", LLDB_REGNUM_GENERIC_FLAGS)                          .Case("arg1", LLDB_REGNUM_GENERIC_ARG1)                          .Case("arg2", LLDB_REGNUM_GENERIC_ARG2) diff --git a/lldb/source/Utility/Stream.cpp b/lldb/source/Utility/Stream.cpp index 89dce9f..e9632c3 100644 --- a/lldb/source/Utility/Stream.cpp +++ b/lldb/source/Utility/Stream.cpp @@ -202,6 +202,14 @@ void Stream::IndentLess(unsigned amount) {      m_indent_level = 0;  } +// Create an indentation scope that restores the original indent level when the +// object goes out of scope (RAII). +Stream::IndentScope Stream::MakeIndentScope(unsigned indent_amount) { +  IndentScope indent_scope(*this); +  IndentMore(indent_amount); +  return indent_scope; +} +  // Get the address size in bytes  uint32_t Stream::GetAddressByteSize() const { return m_addr_size; }  | 
