[Lldb-commits] [lldb] [lldb] Improve error message for script commands when there's no interpreter (PR #73321)
@@ -26,17 +26,19 @@ ScriptInterpreterNone::ScriptInterpreterNone(Debugger &debugger) ScriptInterpreterNone::~ScriptInterpreterNone() = default; +static const char *no_interpreter_err_msg = +"There is no embedded script interpreter. Check that LLDB was built with a " +"scripting language enabled.\n"; DavidSpickett wrote: Right, this also doesn't imply that not having scripting support is necessarily bad. It's just a choice made at some point. https://github.com/llvm/llvm-project/pull/73321 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] colorize symbols in image lookup (PR #69422)
=?utf-8?q?José?= L. Junior ,taalhaataahir0102 <23100...@lums.edu.pk>, =?utf-8?q?José?= L. Junior , =?utf-8?q?José?= L. Junior ,taalhaataahir0102 <23100...@lums.edu.pk> Message-ID: In-Reply-To: medismailben wrote: Guys, this sounds very cool, but I don't think I've seen any screenshot of what this supposed to look like. Would you mind sharing an example ? @taalhaataahir0102 @junior-jl https://github.com/llvm/llvm-project/pull/69422 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] colorize symbols in image lookup (PR #69422)
=?utf-8?q?José?= L. Junior ,taalhaataahir0102 <23100...@lums.edu.pk>, =?utf-8?q?José?= L. Junior , =?utf-8?q?José?= L. Junior ,taalhaataahir0102 <23100...@lums.edu.pk> Message-ID: In-Reply-To: taalhaataahir0102 wrote: Hi! This is how the implemented version looks like:  Current version of lldb is just plain white text. https://github.com/llvm/llvm-project/pull/69422 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add --copyExecutable and --ignoreNegativeCache to dsymForUUID invoke (PR #72579)
medismailben wrote: Seems to have been resolved in #72669 https://github.com/llvm/llvm-project/pull/72579 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add --copyExecutable and --ignoreNegativeCache to dsymForUUID invoke (PR #72579)
https://github.com/medismailben closed https://github.com/llvm/llvm-project/pull/72579 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Improve error message for script commands when there's no interpreter (PR #73321)
https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/73321 >From bc00c8f219134554d2dcbcb39e7565797c1ed14c Mon Sep 17 00:00:00 2001 From: David Spickett Date: Fri, 24 Nov 2023 12:05:41 + Subject: [PATCH] [lldb] Improve error message for script commands when there's no interpreter It was: ``` error: there is no embedded script interpreter in this mode. ``` 1. What does "mode" mean? 2. It implies there might be an embedded script interpreter for some other "mode", whatever that would be. So I'm simplifying it and noting the most common reason for this which is that lldb wasn't built with a scripting lanugage enabled in the first place. There are other tips for dealing with this, but I'm not sure this message is the best place for them. --- .../ScriptInterpreter/None/ScriptInterpreterNone.cpp | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp index 7df8b55fc7f55b1..7aeee6e40395432 100644 --- a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp @@ -26,17 +26,19 @@ ScriptInterpreterNone::ScriptInterpreterNone(Debugger &debugger) ScriptInterpreterNone::~ScriptInterpreterNone() = default; +static const char *no_interpreter_err_msg = +"error: Embedded script interpreter unavailable. LLDB was built without " +"scripting language support.\n"; + bool ScriptInterpreterNone::ExecuteOneLine(llvm::StringRef command, CommandReturnObject *, const ExecuteScriptOptions &) { - m_debugger.GetErrorStream().PutCString( - "error: there is no embedded script interpreter in this mode.\n"); + m_debugger.GetErrorStream().PutCString(no_interpreter_err_msg); return false; } void ScriptInterpreterNone::ExecuteInterpreterLoop() { - m_debugger.GetErrorStream().PutCString( - "error: there is no embedded script interpreter in this mode.\n"); + m_debugger.GetErrorStream().PutCString(no_interpreter_err_msg); } void ScriptInterpreterNone::Initialize() { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 8167934 - [lldb] Improve error message for script commands when there's no interpreter (#73321)
Author: David Spickett Date: 2023-11-27T09:10:39Z New Revision: 8167934480a7b6a8e122aa6233aa8ed2e2683d6a URL: https://github.com/llvm/llvm-project/commit/8167934480a7b6a8e122aa6233aa8ed2e2683d6a DIFF: https://github.com/llvm/llvm-project/commit/8167934480a7b6a8e122aa6233aa8ed2e2683d6a.diff LOG: [lldb] Improve error message for script commands when there's no interpreter (#73321) It was: ``` error: there is no embedded script interpreter in this mode. ``` 1. What does "mode" mean? 2. It implies there might be an embedded script interpreter for some other "mode", whatever that would be. So I'm simplifying it and noting the most common reason for this which is that lldb wasn't built with a scripting language enabled in the first place. There are other tips for dealing with this, but I'm not sure this message is the best place for them. Added: Modified: lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp Removed: diff --git a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp index 7df8b55fc7f55b1..7aeee6e40395432 100644 --- a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp @@ -26,17 +26,19 @@ ScriptInterpreterNone::ScriptInterpreterNone(Debugger &debugger) ScriptInterpreterNone::~ScriptInterpreterNone() = default; +static const char *no_interpreter_err_msg = +"error: Embedded script interpreter unavailable. LLDB was built without " +"scripting language support.\n"; + bool ScriptInterpreterNone::ExecuteOneLine(llvm::StringRef command, CommandReturnObject *, const ExecuteScriptOptions &) { - m_debugger.GetErrorStream().PutCString( - "error: there is no embedded script interpreter in this mode.\n"); + m_debugger.GetErrorStream().PutCString(no_interpreter_err_msg); return false; } void ScriptInterpreterNone::ExecuteInterpreterLoop() { - m_debugger.GetErrorStream().PutCString( - "error: there is no embedded script interpreter in this mode.\n"); + m_debugger.GetErrorStream().PutCString(no_interpreter_err_msg); } void ScriptInterpreterNone::Initialize() { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Improve error message for script commands when there's no interpreter (PR #73321)
https://github.com/DavidSpickett closed https://github.com/llvm/llvm-project/pull/73321 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 772f296 - [lldb][AArch64][Linux] Correct name of FPCR field
Author: David Spickett Date: 2023-11-27T09:10:56Z New Revision: 772f296214e10323ca16921c02b1852307b7d51b URL: https://github.com/llvm/llvm-project/commit/772f296214e10323ca16921c02b1852307b7d51b DIFF: https://github.com/llvm/llvm-project/commit/772f296214e10323ca16921c02b1852307b7d51b.diff LOG: [lldb][AArch64][Linux] Correct name of FPCR field It should be "RMode" as in "rounding mode" not "RMMode". Added: Modified: lldb/source/Plugins/Process/Utility/RegisterFlagsLinux_arm64.cpp lldb/test/API/commands/register/register/register_command/TestRegisters.py lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py Removed: diff --git a/lldb/source/Plugins/Process/Utility/RegisterFlagsLinux_arm64.cpp b/lldb/source/Plugins/Process/Utility/RegisterFlagsLinux_arm64.cpp index 77c7116d3c624ae..51553817921f350 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterFlagsLinux_arm64.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterFlagsLinux_arm64.cpp @@ -53,7 +53,7 @@ LinuxArm64RegisterFlags::DetectMTECtrlFields(uint64_t hwcap, uint64_t hwcap2) { LinuxArm64RegisterFlags::Fields LinuxArm64RegisterFlags::DetectFPCRFields(uint64_t hwcap, uint64_t hwcap2) { std::vector fpcr_fields{ - {"AHP", 26}, {"DN", 25}, {"FZ", 24}, {"RMMode", 22, 23}, + {"AHP", 26}, {"DN", 25}, {"FZ", 24}, {"RMode", 22, 23}, // Bits 21-20 are "Stride" which is unused in AArch64 state. }; diff --git a/lldb/test/API/commands/register/register/register_command/TestRegisters.py b/lldb/test/API/commands/register/register/register_command/TestRegisters.py index 386991c18db7c8c..5c4f3a4bb374c26 100644 --- a/lldb/test/API/commands/register/register/register_command/TestRegisters.py +++ b/lldb/test/API/commands/register/register/register_command/TestRegisters.py @@ -630,9 +630,9 @@ def test_register_read_fields(self): # N/Z/C/V bits will always be present, so check only for those. self.expect("register read cpsr", substrs=["= (N = 0, Z = 1, C = 1, V = 0"]) self.expect("register read fpsr", substrs=["= (QC = 0, IDC = 0, IXC = 0"]) -# AHP/DN/FZ/RMMode always present, others may vary. +# AHP/DN/FZ/RMode always present, others may vary. self.expect( -"register read fpcr", substrs=["= (AHP = 0, DN = 0, FZ = 0, RMMode = 0"] +"register read fpcr", substrs=["= (AHP = 0, DN = 0, FZ = 0, RMode = 0"] ) @skipUnlessPlatform(["linux"]) diff --git a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py index 58f104eb49de245..d6907075820ece7 100644 --- a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py +++ b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py @@ -578,9 +578,9 @@ def test_aarch64_sve_regs_full(self): # The N/Z/C/V bits are always present so just check for those. self.expect("register read cpsr", substrs=["= (N = 0, Z = 0, C = 0, V = 0"]) self.expect("register read fpsr", substrs=["= (QC = 0, IDC = 0, IXC = 0"]) -# AHP/DN/FZ/RMMode always present, others may vary. +# AHP/DN/FZ/RMode always present, others may vary. self.expect( -"register read fpcr", substrs=["= (AHP = 0, DN = 0, FZ = 0, RMMode = 0"] +"register read fpcr", substrs=["= (AHP = 0, DN = 0, FZ = 0, RMode = 0"] ) @skipIfLLVMTargetMissing("AArch64") ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lld] [clang-tools-extra] [libcxxabi] [libcxx] [libunwind] [mlir] [llvm] [flang] [lldb] [libc] [compiler-rt] PR#72453 : Exceeding maximum file name length (PR #72654)
shahidiqbal13 wrote: Hi @DrTodd13 , Any further needs to be done here ?? Can you please add more devs for reviewing this Thanks, Shahid https://github.com/llvm/llvm-project/pull/72654 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxxabi] [llvm] [lldb] [clang] [flang] [clang-tools-extra] [libc] [lld] [libcxx] [flang] Pass Argv0 to getIntriniscDir and getOpenMPHeadersDir (PR #73254)
https://github.com/madanial0 updated https://github.com/llvm/llvm-project/pull/73254 >From 81d1e05dd084dd5bb88dab88d2f23008b8dc6cfb Mon Sep 17 00:00:00 2001 From: Mark Danial Date: Tue, 21 Nov 2023 12:18:40 -0500 Subject: [PATCH] Pass the correct path to getIntriniscDir and getOpenMPHeadersDir --- .../include/flang/Frontend/CompilerInvocation.h | 6 ++ flang/lib/Frontend/CompilerInvocation.cpp| 16 ++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/flang/include/flang/Frontend/CompilerInvocation.h b/flang/include/flang/Frontend/CompilerInvocation.h index 229aa75748f725d..b345806586e04ef 100644 --- a/flang/include/flang/Frontend/CompilerInvocation.h +++ b/flang/include/flang/Frontend/CompilerInvocation.h @@ -101,6 +101,8 @@ class CompilerInvocation : public CompilerInvocationBase { bool warnAsErr = false; + const char *argv0; + /// This flag controls the unparsing and is used to decide whether to print /// out the semantically analyzed version of an object or expression or the /// plain version that does not include any information from semantic @@ -190,6 +192,8 @@ class CompilerInvocation : public CompilerInvocationBase { return enableConformanceChecks; } + const char *getArgv0() { return argv0; } + bool &getEnableUsageChecks() { return enableUsageChecks; } const bool &getEnableUsageChecks() const { return enableUsageChecks; } @@ -223,6 +227,8 @@ class CompilerInvocation : public CompilerInvocationBase { void setEnableUsageChecks() { enableUsageChecks = true; } /// Useful setters + void setArgv0(const char *dir) { argv0 = dir; } + void setModuleDir(std::string &dir) { moduleDir = dir; } void setModuleFileSuffix(const char *suffix) { diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index cb4f2d6a6225205..2afea5ad6b9d97c 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -687,19 +687,19 @@ static bool parseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args, } // Generate the path to look for intrinsic modules -static std::string getIntrinsicDir() { +static std::string getIntrinsicDir(const char *argv) { // TODO: Find a system independent API llvm::SmallString<128> driverPath; - driverPath.assign(llvm::sys::fs::getMainExecutable(nullptr, nullptr)); + driverPath.assign(llvm::sys::fs::getMainExecutable(argv, nullptr)); llvm::sys::path::remove_filename(driverPath); driverPath.append("/../include/flang/"); return std::string(driverPath); } // Generate the path to look for OpenMP headers -static std::string getOpenMPHeadersDir() { +static std::string getOpenMPHeadersDir(const char *argv) { llvm::SmallString<128> includePath; - includePath.assign(llvm::sys::fs::getMainExecutable(nullptr, nullptr)); + includePath.assign(llvm::sys::fs::getMainExecutable(argv, nullptr)); llvm::sys::path::remove_filename(includePath); includePath.append("/../include/flang/OpenMP/"); return std::string(includePath); @@ -1203,6 +1203,8 @@ bool CompilerInvocation::createFromArgs( } } + res.setArgv0(argv0); + return success; } @@ -1245,7 +1247,8 @@ void CompilerInvocation::setDefaultFortranOpts() { // Add the location of omp_lib.h to the search directories. Currently this is // identical to the modules' directory. - fortranOptions.searchDirectories.emplace_back(getOpenMPHeadersDir()); + fortranOptions.searchDirectories.emplace_back( + getOpenMPHeadersDir(getArgv0())); fortranOptions.isFixedForm = false; } @@ -1310,7 +1313,8 @@ void CompilerInvocation::setFortranOpts() { preprocessorOptions.searchDirectoriesFromIntrModPath.end()); // Add the default intrinsic module directory - fortranOptions.intrinsicModuleDirectories.emplace_back(getIntrinsicDir()); + fortranOptions.intrinsicModuleDirectories.emplace_back( + getIntrinsicDir(getArgv0())); // Add the directory supplied through -J/-module-dir to the list of search // directories ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // JDevlieghere wrote: Same here https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // JDevlieghere wrote: Remove? https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // + llvm::StringRef name = GetTypeName(); + return k_libcxx_std_unique_ptr_regex.match(name) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; + return IsIntegerType(is_signed); +} + +bool CompilerType::IsFloat() const { + uint32_t count = 0; + bool is_complex = false; + return IsFloatingPointType(count, is_complex); +} + +bool CompilerType::IsEnumerationType() const { + // This is used when you don't care about the signedness of the enum. + bool is_signed; + return IsEnumerationType(is_signed); +} + +bool CompilerType::IsUnscopedEnumerationType() const { + return IsEnumerationType() && !IsScopedEnumerationType(); +} + +bool CompilerType::IsIntegerOrUnscopedEnumerationType() const { + return IsInteger() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsSigned() const { + if (IsEnumerationType()) { +return IsEnumerationIntegerTypeSigned(); + } + return GetTypeInfo() & lldb::eTypeIsSigned; +} + +bool CompilerType::IsNullPtrType() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeNullPtr; +} + +bool CompilerType::IsBoolean() const { + return GetCanonicalType().GetBasicTypeEnumeration() == lldb::eBasicTypeBool; +} + +bool CompilerType::IsEnumerationIntegerTypeSigned() const { + if (IsValid()) { +return GetEnumerationIntegerType().GetTypeInfo() & lldb::eTypeIsSigned; + } + return false; +} + +bool CompilerType::IsScalarOrUnscopedEnumerationType() const { + return IsScalarType() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsPromotableIntegerType() const { + // Unscoped enums are always considered as promotable, even if their + // underlying type does not need to be promoted (e.g. "int"). + if (IsUnscopedEnumerationType()) { +return true; + } + + switch (GetCanonicalType().GetBasicTypeEnumeration()) { + case lldb::eBasicTypeBool: + case lldb::eBasicTypeChar: + case lldb::eBasicTypeSignedChar: + case lldb::eBasicTypeUnsignedChar: + case lldb::eBasicTypeShort: + case lldb::eBasicTypeUnsignedShort: + case lldb::eBasicTypeWChar: + case lldb::eBasicTypeSignedWChar: + case lldb::eBasicTypeUnsignedWChar: + case lldb::eBasicTypeChar16: + case lldb::eBasicTypeChar32: +return true; + + default: +return false; + } +} + +bool CompilerType::IsPointerToVoid() const { + if (!IsValid()) +return false; + + return IsPointerType() && + GetPointeeType().GetBasicTypeEnumeration() == lldb::eBasicTypeVoid; +} + +bool CompilerType::IsRecordType() const { + if (!IsValid()) +return false; + + return GetCanonicalType().GetTypeClass() & + (lldb::eTypeClassClass | lldb::eTypeClassStruct | + lldb::eTypeClassUnion); +} + +// Checks whether `target_base` is a virtual base of `type` (direct or +// indirect). If it is, stores the first virtual base type on the path from +// `type` to `target_type`. +bool CompilerType::IsVirtualBase(CompilerType target_base, + CompilerType *virtual_base, + bool carry_virtual) const { + if (CompareTypes(target_base)) { +return carry_virtual; + } + + if (!carry_virtual) { +uint32_t num_virtual_bases = GetNumVirtualBaseClasses(); +for (uint32_t i = 0; i < num_virtual_bases; ++i) { + uint32_t bit_offset; + auto base = GetVirtualBaseClassAtIndex(i, &bit_offset); + if (base.IsVirtualBase(target_base, virtual_base, + /*carry_virtual*/ true)) { +if (virtual_base) { + *virtual_base = base; +} +return true; + } +} + } + + uint32_t num_direct_bases = GetNumDirectBaseClasses(); + for (uint32_t i = 0; i < num_direct_bases; ++i) { +uint32_t bit_offset; +auto base = GetDirect
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // + llvm::StringRef name = GetTypeName(); + return k_libcxx_std_unique_ptr_regex.match(name) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; + return IsIntegerType(is_signed); +} + +bool CompilerType::IsFloat() const { + uint32_t count = 0; + bool is_complex = false; + return IsFloatingPointType(count, is_complex); +} + +bool CompilerType::IsEnumerationType() const { + // This is used when you don't care about the signedness of the enum. + bool is_signed; + return IsEnumerationType(is_signed); +} + +bool CompilerType::IsUnscopedEnumerationType() const { + return IsEnumerationType() && !IsScopedEnumerationType(); +} + +bool CompilerType::IsIntegerOrUnscopedEnumerationType() const { + return IsInteger() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsSigned() const { + if (IsEnumerationType()) { +return IsEnumerationIntegerTypeSigned(); + } + return GetTypeInfo() & lldb::eTypeIsSigned; +} + +bool CompilerType::IsNullPtrType() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeNullPtr; +} + +bool CompilerType::IsBoolean() const { + return GetCanonicalType().GetBasicTypeEnumeration() == lldb::eBasicTypeBool; +} + +bool CompilerType::IsEnumerationIntegerTypeSigned() const { + if (IsValid()) { +return GetEnumerationIntegerType().GetTypeInfo() & lldb::eTypeIsSigned; + } JDevlieghere wrote: No braces around single line if. https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // + llvm::StringRef name = GetTypeName(); + return k_libcxx_std_unique_ptr_regex.match(name) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; + return IsIntegerType(is_signed); +} + +bool CompilerType::IsFloat() const { + uint32_t count = 0; + bool is_complex = false; + return IsFloatingPointType(count, is_complex); +} + +bool CompilerType::IsEnumerationType() const { + // This is used when you don't care about the signedness of the enum. + bool is_signed; + return IsEnumerationType(is_signed); +} + +bool CompilerType::IsUnscopedEnumerationType() const { + return IsEnumerationType() && !IsScopedEnumerationType(); +} + +bool CompilerType::IsIntegerOrUnscopedEnumerationType() const { + return IsInteger() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsSigned() const { + if (IsEnumerationType()) { +return IsEnumerationIntegerTypeSigned(); + } + return GetTypeInfo() & lldb::eTypeIsSigned; +} + +bool CompilerType::IsNullPtrType() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeNullPtr; +} + +bool CompilerType::IsBoolean() const { + return GetCanonicalType().GetBasicTypeEnumeration() == lldb::eBasicTypeBool; +} + +bool CompilerType::IsEnumerationIntegerTypeSigned() const { + if (IsValid()) { +return GetEnumerationIntegerType().GetTypeInfo() & lldb::eTypeIsSigned; + } + return false; +} + +bool CompilerType::IsScalarOrUnscopedEnumerationType() const { + return IsScalarType() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsPromotableIntegerType() const { + // Unscoped enums are always considered as promotable, even if their + // underlying type does not need to be promoted (e.g. "int"). + if (IsUnscopedEnumerationType()) { +return true; + } + + switch (GetCanonicalType().GetBasicTypeEnumeration()) { + case lldb::eBasicTypeBool: + case lldb::eBasicTypeChar: + case lldb::eBasicTypeSignedChar: + case lldb::eBasicTypeUnsignedChar: + case lldb::eBasicTypeShort: + case lldb::eBasicTypeUnsignedShort: + case lldb::eBasicTypeWChar: + case lldb::eBasicTypeSignedWChar: + case lldb::eBasicTypeUnsignedWChar: + case lldb::eBasicTypeChar16: + case lldb::eBasicTypeChar32: +return true; + + default: +return false; + } +} + +bool CompilerType::IsPointerToVoid() const { + if (!IsValid()) +return false; + + return IsPointerType() && + GetPointeeType().GetBasicTypeEnumeration() == lldb::eBasicTypeVoid; +} + +bool CompilerType::IsRecordType() const { + if (!IsValid()) +return false; + + return GetCanonicalType().GetTypeClass() & + (lldb::eTypeClassClass | lldb::eTypeClassStruct | + lldb::eTypeClassUnion); +} + +// Checks whether `target_base` is a virtual base of `type` (direct or +// indirect). If it is, stores the first virtual base type on the path from +// `type` to `target_type`. +bool CompilerType::IsVirtualBase(CompilerType target_base, + CompilerType *virtual_base, + bool carry_virtual) const { + if (CompareTypes(target_base)) { +return carry_virtual; + } + + if (!carry_virtual) { +uint32_t num_virtual_bases = GetNumVirtualBaseClasses(); +for (uint32_t i = 0; i < num_virtual_bases; ++i) { + uint32_t bit_offset; + auto base = GetVirtualBaseClassAtIndex(i, &bit_offset); + if (base.IsVirtualBase(target_base, virtual_base, + /*carry_virtual*/ true)) { +if (virtual_base) { + *virtual_base = base; +} +return true; + } +} + } + + uint32_t num_direct_bases = GetNumDirectBaseClasses(); + for (uint32_t i = 0; i < num_direct_bases; ++i) { +uint32_t bit_offset; +auto base = GetDirect
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // + llvm::StringRef name = GetTypeName(); + return k_libcxx_std_unique_ptr_regex.match(name) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; + return IsIntegerType(is_signed); +} + +bool CompilerType::IsFloat() const { + uint32_t count = 0; + bool is_complex = false; + return IsFloatingPointType(count, is_complex); +} + +bool CompilerType::IsEnumerationType() const { + // This is used when you don't care about the signedness of the enum. + bool is_signed; + return IsEnumerationType(is_signed); +} + +bool CompilerType::IsUnscopedEnumerationType() const { + return IsEnumerationType() && !IsScopedEnumerationType(); +} + +bool CompilerType::IsIntegerOrUnscopedEnumerationType() const { + return IsInteger() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsSigned() const { + if (IsEnumerationType()) { +return IsEnumerationIntegerTypeSigned(); + } + return GetTypeInfo() & lldb::eTypeIsSigned; +} + +bool CompilerType::IsNullPtrType() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeNullPtr; +} + +bool CompilerType::IsBoolean() const { + return GetCanonicalType().GetBasicTypeEnumeration() == lldb::eBasicTypeBool; +} + +bool CompilerType::IsEnumerationIntegerTypeSigned() const { + if (IsValid()) { +return GetEnumerationIntegerType().GetTypeInfo() & lldb::eTypeIsSigned; + } + return false; +} + +bool CompilerType::IsScalarOrUnscopedEnumerationType() const { + return IsScalarType() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsPromotableIntegerType() const { + // Unscoped enums are always considered as promotable, even if their + // underlying type does not need to be promoted (e.g. "int"). + if (IsUnscopedEnumerationType()) { +return true; + } + + switch (GetCanonicalType().GetBasicTypeEnumeration()) { + case lldb::eBasicTypeBool: + case lldb::eBasicTypeChar: + case lldb::eBasicTypeSignedChar: + case lldb::eBasicTypeUnsignedChar: + case lldb::eBasicTypeShort: + case lldb::eBasicTypeUnsignedShort: + case lldb::eBasicTypeWChar: + case lldb::eBasicTypeSignedWChar: + case lldb::eBasicTypeUnsignedWChar: + case lldb::eBasicTypeChar16: + case lldb::eBasicTypeChar32: +return true; + + default: +return false; + } JDevlieghere wrote: This likely needs a `llvm_unreachable("All cases handled above.");` to appease gcc. https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // + llvm::StringRef name = GetTypeName(); + return k_libcxx_std_unique_ptr_regex.match(name) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; + return IsIntegerType(is_signed); +} + +bool CompilerType::IsFloat() const { + uint32_t count = 0; + bool is_complex = false; + return IsFloatingPointType(count, is_complex); +} + +bool CompilerType::IsEnumerationType() const { + // This is used when you don't care about the signedness of the enum. + bool is_signed; + return IsEnumerationType(is_signed); +} + +bool CompilerType::IsUnscopedEnumerationType() const { + return IsEnumerationType() && !IsScopedEnumerationType(); +} + +bool CompilerType::IsIntegerOrUnscopedEnumerationType() const { + return IsInteger() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsSigned() const { + if (IsEnumerationType()) { +return IsEnumerationIntegerTypeSigned(); + } + return GetTypeInfo() & lldb::eTypeIsSigned; +} + +bool CompilerType::IsNullPtrType() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeNullPtr; +} + +bool CompilerType::IsBoolean() const { + return GetCanonicalType().GetBasicTypeEnumeration() == lldb::eBasicTypeBool; +} + +bool CompilerType::IsEnumerationIntegerTypeSigned() const { + if (IsValid()) { +return GetEnumerationIntegerType().GetTypeInfo() & lldb::eTypeIsSigned; + } + return false; +} + +bool CompilerType::IsScalarOrUnscopedEnumerationType() const { + return IsScalarType() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsPromotableIntegerType() const { + // Unscoped enums are always considered as promotable, even if their + // underlying type does not need to be promoted (e.g. "int"). + if (IsUnscopedEnumerationType()) { +return true; + } + + switch (GetCanonicalType().GetBasicTypeEnumeration()) { + case lldb::eBasicTypeBool: + case lldb::eBasicTypeChar: + case lldb::eBasicTypeSignedChar: + case lldb::eBasicTypeUnsignedChar: + case lldb::eBasicTypeShort: + case lldb::eBasicTypeUnsignedShort: + case lldb::eBasicTypeWChar: + case lldb::eBasicTypeSignedWChar: + case lldb::eBasicTypeUnsignedWChar: + case lldb::eBasicTypeChar16: + case lldb::eBasicTypeChar32: +return true; + + default: +return false; + } +} + +bool CompilerType::IsPointerToVoid() const { + if (!IsValid()) +return false; + + return IsPointerType() && + GetPointeeType().GetBasicTypeEnumeration() == lldb::eBasicTypeVoid; +} + +bool CompilerType::IsRecordType() const { + if (!IsValid()) +return false; + + return GetCanonicalType().GetTypeClass() & + (lldb::eTypeClassClass | lldb::eTypeClassStruct | + lldb::eTypeClassUnion); +} + +// Checks whether `target_base` is a virtual base of `type` (direct or +// indirect). If it is, stores the first virtual base type on the path from +// `type` to `target_type`. +bool CompilerType::IsVirtualBase(CompilerType target_base, + CompilerType *virtual_base, + bool carry_virtual) const { + if (CompareTypes(target_base)) { +return carry_virtual; + } JDevlieghere wrote: No braces https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // + llvm::StringRef name = GetTypeName(); + return k_libcxx_std_unique_ptr_regex.match(name) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. JDevlieghere wrote: This should this be a Doxygen comment (`///`) in the header. Also applies to comments in the functions. https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [clang] [clang-tools-extra] [libc] [flang] [libcxx] [compiler-rt] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)
Endilll wrote: There has been multiple discussion in different places about behavior of `-E`, `-M`, and friends (the most notable starts [here](https://discord.com/channels/636084430946959380/636732781086638081/1175241241710055424)), so I thought it would be a good idea to raise awareness among commonly used tools. `ccache`, `sccache`, and `distcc` are the ones I know that might be directly impacted by this. https://github.com/ccache/ccache/discussions/1366 https://github.com/mozilla/sccache/discussions/1990 https://github.com/distcc/distcc/issues/494 https://github.com/llvm/llvm-project/pull/68620 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [compiler-rt] [llvm] [lldb] [libcxx] [flang] [libc] [clang-tools-extra] [clang] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)
Endilll wrote: @AaronBallman Can you describe your current plan how driver options are going to behave in the light of `#embed`? https://github.com/llvm/llvm-project/pull/68620 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][dap] always add column field in StackFrame body (PR #73393)
https://github.com/bulbazord approved this pull request. Lgtm thanks! https://github.com/llvm/llvm-project/pull/73393 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] colorize symbols in image lookup (PR #69422)
https://github.com/junior-jl updated https://github.com/llvm/llvm-project/pull/69422 From c416443a93f7113a7f57d337682ec4862438522d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= Date: Tue, 7 Nov 2023 16:57:18 -0300 Subject: [PATCH 1/2] [lldb] colorize symbols in image lookup This creates the method PutCStringColorHighlighted for Stream class, which highlights searched symbols in red color for the image lookup command. A new shell test was added to verify functionality. Relevant methods were updated to accept the searched pattern/symbol as a parameter. Co-authored-by: Talha --- lldb/include/lldb/Core/Address.h | 4 +- lldb/include/lldb/Symbol/Symbol.h | 4 +- lldb/include/lldb/Symbol/SymbolContext.h | 8 ++-- lldb/include/lldb/Utility/Stream.h| 16 lldb/source/Commands/CommandObjectTarget.cpp | 16 +--- lldb/source/Core/Address.cpp | 21 ++ lldb/source/Symbol/Symbol.cpp | 18 ++--- lldb/source/Symbol/SymbolContext.cpp | 16 +--- lldb/source/Utility/Stream.cpp| 28 + .../Commands/command-image-lookup-color.test | 39 +++ 10 files changed, 138 insertions(+), 32 deletions(-) create mode 100644 lldb/test/Shell/Commands/command-image-lookup-color.test diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h index b19e694427546f8b..c3f2832be424efd8 100644 --- a/lldb/include/lldb/Core/Address.h +++ b/lldb/include/lldb/Core/Address.h @@ -246,8 +246,8 @@ class Address { /// \see Address::DumpStyle bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, DumpStyle fallback_style = DumpStyleInvalid, -uint32_t addr_byte_size = UINT32_MAX, -bool all_ranges = false) const; +uint32_t addr_byte_size = UINT32_MAX, bool all_ranges = false, +const char *pattern = nullptr) const; AddressClass GetAddressClass() const; diff --git a/lldb/include/lldb/Symbol/Symbol.h b/lldb/include/lldb/Symbol/Symbol.h index 44a2d560010fe403..0e41cd95e0ef17d2 100644 --- a/lldb/include/lldb/Symbol/Symbol.h +++ b/lldb/include/lldb/Symbol/Symbol.h @@ -174,8 +174,8 @@ class Symbol : public SymbolContextScope { void SetFlags(uint32_t flags) { m_flags = flags; } - void GetDescription(Stream *s, lldb::DescriptionLevel level, - Target *target) const; + void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target, + const char *pattern = nullptr) const; bool IsSynthetic() const { return m_is_synthetic; } diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h index b0f5ffead2a16569..9567c3f4384c1752 100644 --- a/lldb/include/lldb/Symbol/SymbolContext.h +++ b/lldb/include/lldb/Symbol/SymbolContext.h @@ -150,8 +150,8 @@ class SymbolContext { bool DumpStopContext(Stream *s, ExecutionContextScope *exe_scope, const Address &so_addr, bool show_fullpaths, bool show_module, bool show_inlined_frames, - bool show_function_arguments, - bool show_function_name) const; + bool show_function_arguments, bool show_function_name, + const char *pattern = nullptr) const; /// Get the address range contained within a symbol context. /// @@ -217,8 +217,8 @@ class SymbolContext { /// The symbol that was found, or \b nullptr if none was found. const Symbol *FindBestGlobalDataSymbol(ConstString name, Status &error); - void GetDescription(Stream *s, lldb::DescriptionLevel level, - Target *target) const; + void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target, + const char *pattern = nullptr) const; uint32_t GetResolvedMask() const; diff --git a/lldb/include/lldb/Utility/Stream.h b/lldb/include/lldb/Utility/Stream.h index 1a5fd343e4df0dc9..8e3fd48dfe705799 100644 --- a/lldb/include/lldb/Utility/Stream.h +++ b/lldb/include/lldb/Utility/Stream.h @@ -231,6 +231,22 @@ class Stream { /// The string to be output to the stream. size_t PutCString(llvm::StringRef cstr); + /// Output a C string to the stream with color highlighting. + /// + /// Print a C string \a text to the stream, applying red color highlighting to + /// the portions of the string that match the regex pattern \a pattern. The + /// pattern is matched as many times as possible throughout the string. If \a + /// pattern is nullptr, then no highlighting is applied. + /// + /// \param[in] text + /// The string to be output to the stream. + /// + /// \param[in] pattern + /// The regex pattern to match against the \a text string. Portions of \a + /// text matching this pattern will be colorized. If this parameter is + /// nullptr, highlighting
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
https://github.com/bulbazord edited https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // + llvm::StringRef name = GetTypeName(); + return k_libcxx_std_unique_ptr_regex.match(name) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; bulbazord wrote: Initialize this to something even if it's unused. Reasoning: somebody may refactor this in the future in such a way that this becomes a problem. https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( bulbazord wrote: What does the prefix k mean here? https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // + llvm::StringRef name = GetTypeName(); + return k_libcxx_std_unique_ptr_regex.match(name) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; + return IsIntegerType(is_signed); +} + +bool CompilerType::IsFloat() const { + uint32_t count = 0; + bool is_complex = false; + return IsFloatingPointType(count, is_complex); +} + +bool CompilerType::IsEnumerationType() const { + // This is used when you don't care about the signedness of the enum. + bool is_signed; + return IsEnumerationType(is_signed); +} + +bool CompilerType::IsUnscopedEnumerationType() const { + return IsEnumerationType() && !IsScopedEnumerationType(); +} + +bool CompilerType::IsIntegerOrUnscopedEnumerationType() const { + return IsInteger() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsSigned() const { + if (IsEnumerationType()) { +return IsEnumerationIntegerTypeSigned(); + } + return GetTypeInfo() & lldb::eTypeIsSigned; +} + +bool CompilerType::IsNullPtrType() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeNullPtr; +} + +bool CompilerType::IsBoolean() const { + return GetCanonicalType().GetBasicTypeEnumeration() == lldb::eBasicTypeBool; +} + +bool CompilerType::IsEnumerationIntegerTypeSigned() const { + if (IsValid()) { +return GetEnumerationIntegerType().GetTypeInfo() & lldb::eTypeIsSigned; + } + return false; +} + +bool CompilerType::IsScalarOrUnscopedEnumerationType() const { + return IsScalarType() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsPromotableIntegerType() const { + // Unscoped enums are always considered as promotable, even if their + // underlying type does not need to be promoted (e.g. "int"). + if (IsUnscopedEnumerationType()) { +return true; + } + + switch (GetCanonicalType().GetBasicTypeEnumeration()) { + case lldb::eBasicTypeBool: + case lldb::eBasicTypeChar: + case lldb::eBasicTypeSignedChar: + case lldb::eBasicTypeUnsignedChar: + case lldb::eBasicTypeShort: + case lldb::eBasicTypeUnsignedShort: + case lldb::eBasicTypeWChar: + case lldb::eBasicTypeSignedWChar: + case lldb::eBasicTypeUnsignedWChar: + case lldb::eBasicTypeChar16: + case lldb::eBasicTypeChar32: +return true; + + default: +return false; + } +} + +bool CompilerType::IsPointerToVoid() const { + if (!IsValid()) +return false; + + return IsPointerType() && + GetPointeeType().GetBasicTypeEnumeration() == lldb::eBasicTypeVoid; +} + +bool CompilerType::IsRecordType() const { + if (!IsValid()) +return false; + + return GetCanonicalType().GetTypeClass() & + (lldb::eTypeClassClass | lldb::eTypeClassStruct | + lldb::eTypeClassUnion); +} + +// Checks whether `target_base` is a virtual base of `type` (direct or +// indirect). If it is, stores the first virtual base type on the path from +// `type` to `target_type`. +bool CompilerType::IsVirtualBase(CompilerType target_base, + CompilerType *virtual_base, + bool carry_virtual) const { + if (CompareTypes(target_base)) { +return carry_virtual; + } + + if (!carry_virtual) { +uint32_t num_virtual_bases = GetNumVirtualBaseClasses(); +for (uint32_t i = 0; i < num_virtual_bases; ++i) { + uint32_t bit_offset; + auto base = GetVirtualBaseClassAtIndex(i, &bit_offset); + if (base.IsVirtualBase(target_base, virtual_base, + /*carry_virtual*/ true)) { +if (virtual_base) { + *virtual_base = base; +} +return true; + } +} + } + + uint32_t num_direct_bases = GetNumDirectBaseClasses(); + for (uint32_t i = 0; i < num_direct_bases; ++i) { +uint32_t bit_offset; +auto base = GetDirect
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
https://github.com/bulbazord commented: Seems okay to me in general. Left some inline comments and I also agree with all of Jonas's inline comments I saw too. https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // + llvm::StringRef name = GetTypeName(); + return k_libcxx_std_unique_ptr_regex.match(name) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; + return IsIntegerType(is_signed); +} + +bool CompilerType::IsFloat() const { + uint32_t count = 0; + bool is_complex = false; + return IsFloatingPointType(count, is_complex); +} + +bool CompilerType::IsEnumerationType() const { + // This is used when you don't care about the signedness of the enum. + bool is_signed; + return IsEnumerationType(is_signed); +} + +bool CompilerType::IsUnscopedEnumerationType() const { + return IsEnumerationType() && !IsScopedEnumerationType(); +} + +bool CompilerType::IsIntegerOrUnscopedEnumerationType() const { + return IsInteger() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsSigned() const { + if (IsEnumerationType()) { +return IsEnumerationIntegerTypeSigned(); + } + return GetTypeInfo() & lldb::eTypeIsSigned; +} + +bool CompilerType::IsNullPtrType() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeNullPtr; +} + +bool CompilerType::IsBoolean() const { + return GetCanonicalType().GetBasicTypeEnumeration() == lldb::eBasicTypeBool; +} + +bool CompilerType::IsEnumerationIntegerTypeSigned() const { + if (IsValid()) { +return GetEnumerationIntegerType().GetTypeInfo() & lldb::eTypeIsSigned; + } + return false; +} + +bool CompilerType::IsScalarOrUnscopedEnumerationType() const { + return IsScalarType() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsPromotableIntegerType() const { + // Unscoped enums are always considered as promotable, even if their + // underlying type does not need to be promoted (e.g. "int"). + if (IsUnscopedEnumerationType()) { +return true; + } + + switch (GetCanonicalType().GetBasicTypeEnumeration()) { + case lldb::eBasicTypeBool: + case lldb::eBasicTypeChar: + case lldb::eBasicTypeSignedChar: + case lldb::eBasicTypeUnsignedChar: + case lldb::eBasicTypeShort: + case lldb::eBasicTypeUnsignedShort: + case lldb::eBasicTypeWChar: + case lldb::eBasicTypeSignedWChar: + case lldb::eBasicTypeUnsignedWChar: + case lldb::eBasicTypeChar16: + case lldb::eBasicTypeChar32: +return true; + + default: +return false; + } +} + +bool CompilerType::IsPointerToVoid() const { + if (!IsValid()) +return false; + + return IsPointerType() && + GetPointeeType().GetBasicTypeEnumeration() == lldb::eBasicTypeVoid; +} + +bool CompilerType::IsRecordType() const { + if (!IsValid()) +return false; + + return GetCanonicalType().GetTypeClass() & + (lldb::eTypeClassClass | lldb::eTypeClassStruct | + lldb::eTypeClassUnion); +} + +// Checks whether `target_base` is a virtual base of `type` (direct or +// indirect). If it is, stores the first virtual base type on the path from +// `type` to `target_type`. +bool CompilerType::IsVirtualBase(CompilerType target_base, + CompilerType *virtual_base, + bool carry_virtual) const { + if (CompareTypes(target_base)) { +return carry_virtual; + } + + if (!carry_virtual) { +uint32_t num_virtual_bases = GetNumVirtualBaseClasses(); +for (uint32_t i = 0; i < num_virtual_bases; ++i) { + uint32_t bit_offset; + auto base = GetVirtualBaseClassAtIndex(i, &bit_offset); + if (base.IsVirtualBase(target_base, virtual_base, + /*carry_virtual*/ true)) { +if (virtual_base) { + *virtual_base = base; +} +return true; + } +} + } + + uint32_t num_direct_bases = GetNumDirectBaseClasses(); + for (uint32_t i = 0; i < num_direct_bases; ++i) { +uint32_t bit_offset; +auto base = GetDirect
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // + llvm::StringRef name = GetTypeName(); + return k_libcxx_std_unique_ptr_regex.match(name) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; + return IsIntegerType(is_signed); +} + +bool CompilerType::IsFloat() const { + uint32_t count = 0; + bool is_complex = false; + return IsFloatingPointType(count, is_complex); +} + +bool CompilerType::IsEnumerationType() const { + // This is used when you don't care about the signedness of the enum. + bool is_signed; + return IsEnumerationType(is_signed); +} + +bool CompilerType::IsUnscopedEnumerationType() const { + return IsEnumerationType() && !IsScopedEnumerationType(); +} + +bool CompilerType::IsIntegerOrUnscopedEnumerationType() const { + return IsInteger() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsSigned() const { + if (IsEnumerationType()) { +return IsEnumerationIntegerTypeSigned(); + } + return GetTypeInfo() & lldb::eTypeIsSigned; +} + +bool CompilerType::IsNullPtrType() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeNullPtr; +} + +bool CompilerType::IsBoolean() const { + return GetCanonicalType().GetBasicTypeEnumeration() == lldb::eBasicTypeBool; +} + +bool CompilerType::IsEnumerationIntegerTypeSigned() const { + if (IsValid()) { +return GetEnumerationIntegerType().GetTypeInfo() & lldb::eTypeIsSigned; + } + return false; +} + +bool CompilerType::IsScalarOrUnscopedEnumerationType() const { + return IsScalarType() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsPromotableIntegerType() const { + // Unscoped enums are always considered as promotable, even if their + // underlying type does not need to be promoted (e.g. "int"). + if (IsUnscopedEnumerationType()) { +return true; + } + + switch (GetCanonicalType().GetBasicTypeEnumeration()) { + case lldb::eBasicTypeBool: + case lldb::eBasicTypeChar: + case lldb::eBasicTypeSignedChar: + case lldb::eBasicTypeUnsignedChar: + case lldb::eBasicTypeShort: + case lldb::eBasicTypeUnsignedShort: + case lldb::eBasicTypeWChar: + case lldb::eBasicTypeSignedWChar: + case lldb::eBasicTypeUnsignedWChar: + case lldb::eBasicTypeChar16: + case lldb::eBasicTypeChar32: +return true; + + default: +return false; + } +} + +bool CompilerType::IsPointerToVoid() const { + if (!IsValid()) +return false; + + return IsPointerType() && + GetPointeeType().GetBasicTypeEnumeration() == lldb::eBasicTypeVoid; +} + +bool CompilerType::IsRecordType() const { + if (!IsValid()) +return false; + + return GetCanonicalType().GetTypeClass() & + (lldb::eTypeClassClass | lldb::eTypeClassStruct | + lldb::eTypeClassUnion); +} + +// Checks whether `target_base` is a virtual base of `type` (direct or +// indirect). If it is, stores the first virtual base type on the path from bulbazord wrote: This seems like it would be more useful as a doxygen comment in the header. https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. bulbazord wrote: If it covers both, I would suggest changing the names of the variables to not have the word "libcxx" in them. Comments can get out of date or otherwise be misleading, this one feels confusing to read through. https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] colorize symbols in image lookup (PR #69422)
https://github.com/junior-jl updated https://github.com/llvm/llvm-project/pull/69422 From c416443a93f7113a7f57d337682ec4862438522d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= Date: Tue, 7 Nov 2023 16:57:18 -0300 Subject: [PATCH 1/2] [lldb] colorize symbols in image lookup This creates the method PutCStringColorHighlighted for Stream class, which highlights searched symbols in red color for the image lookup command. A new shell test was added to verify functionality. Relevant methods were updated to accept the searched pattern/symbol as a parameter. Co-authored-by: Talha --- lldb/include/lldb/Core/Address.h | 4 +- lldb/include/lldb/Symbol/Symbol.h | 4 +- lldb/include/lldb/Symbol/SymbolContext.h | 8 ++-- lldb/include/lldb/Utility/Stream.h| 16 lldb/source/Commands/CommandObjectTarget.cpp | 16 +--- lldb/source/Core/Address.cpp | 21 ++ lldb/source/Symbol/Symbol.cpp | 18 ++--- lldb/source/Symbol/SymbolContext.cpp | 16 +--- lldb/source/Utility/Stream.cpp| 28 + .../Commands/command-image-lookup-color.test | 39 +++ 10 files changed, 138 insertions(+), 32 deletions(-) create mode 100644 lldb/test/Shell/Commands/command-image-lookup-color.test diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h index b19e694427546f8b..c3f2832be424efd8 100644 --- a/lldb/include/lldb/Core/Address.h +++ b/lldb/include/lldb/Core/Address.h @@ -246,8 +246,8 @@ class Address { /// \see Address::DumpStyle bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, DumpStyle fallback_style = DumpStyleInvalid, -uint32_t addr_byte_size = UINT32_MAX, -bool all_ranges = false) const; +uint32_t addr_byte_size = UINT32_MAX, bool all_ranges = false, +const char *pattern = nullptr) const; AddressClass GetAddressClass() const; diff --git a/lldb/include/lldb/Symbol/Symbol.h b/lldb/include/lldb/Symbol/Symbol.h index 44a2d560010fe403..0e41cd95e0ef17d2 100644 --- a/lldb/include/lldb/Symbol/Symbol.h +++ b/lldb/include/lldb/Symbol/Symbol.h @@ -174,8 +174,8 @@ class Symbol : public SymbolContextScope { void SetFlags(uint32_t flags) { m_flags = flags; } - void GetDescription(Stream *s, lldb::DescriptionLevel level, - Target *target) const; + void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target, + const char *pattern = nullptr) const; bool IsSynthetic() const { return m_is_synthetic; } diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h index b0f5ffead2a16569..9567c3f4384c1752 100644 --- a/lldb/include/lldb/Symbol/SymbolContext.h +++ b/lldb/include/lldb/Symbol/SymbolContext.h @@ -150,8 +150,8 @@ class SymbolContext { bool DumpStopContext(Stream *s, ExecutionContextScope *exe_scope, const Address &so_addr, bool show_fullpaths, bool show_module, bool show_inlined_frames, - bool show_function_arguments, - bool show_function_name) const; + bool show_function_arguments, bool show_function_name, + const char *pattern = nullptr) const; /// Get the address range contained within a symbol context. /// @@ -217,8 +217,8 @@ class SymbolContext { /// The symbol that was found, or \b nullptr if none was found. const Symbol *FindBestGlobalDataSymbol(ConstString name, Status &error); - void GetDescription(Stream *s, lldb::DescriptionLevel level, - Target *target) const; + void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target, + const char *pattern = nullptr) const; uint32_t GetResolvedMask() const; diff --git a/lldb/include/lldb/Utility/Stream.h b/lldb/include/lldb/Utility/Stream.h index 1a5fd343e4df0dc9..8e3fd48dfe705799 100644 --- a/lldb/include/lldb/Utility/Stream.h +++ b/lldb/include/lldb/Utility/Stream.h @@ -231,6 +231,22 @@ class Stream { /// The string to be output to the stream. size_t PutCString(llvm::StringRef cstr); + /// Output a C string to the stream with color highlighting. + /// + /// Print a C string \a text to the stream, applying red color highlighting to + /// the portions of the string that match the regex pattern \a pattern. The + /// pattern is matched as many times as possible throughout the string. If \a + /// pattern is nullptr, then no highlighting is applied. + /// + /// \param[in] text + /// The string to be output to the stream. + /// + /// \param[in] pattern + /// The regex pattern to match against the \a text string. Portions of \a + /// text matching this pattern will be colorized. If this parameter is + /// nullptr, highlighting
[Lldb-commits] [lldb] [libc] [compiler-rt] [libcxx] [llvm] [flang] [clang-tools-extra] [clang] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)
AaronBallman wrote: > @AaronBallman Can you describe your current plan how driver options are going > to behave in the light of `#embed`? I'm flexible with how we proceed, so if others have different ideas, feel free to suggest them! But my initial inclination is: * `--embed-dir=` as a way to specify a search path for `<>` and `""` embedded resources; the quoted form will search the current directory similar to how it behaves for `#include`. I do not envision needing a "system" embedded resources directory, but should such a need arise, we can consider something like `--embed-system=` to support it. * `-E -dE` as a way to preprocess to a file without exploding the contents of the embedded resource into the preprocessed output (that output could become very large). Then the options for determining makefile dependencies can be updated to consider embedded resources are a dependency and tools like distcc can hopefully cope from there. * As a follow-up, I might consider adding a directive `#embed_base64` that holds base64 encoded file contents of the resource to be embedded. Then we can add `-E -dE64` (or some other option name) to preprocess from `#embed ` to `#embed_base64 ` for times when it's not plausible to keep the source and the resource separately. I don't envision that being a directive users would use directly, but instead only for rewriting purposes. Ideally, GCC and Clang can agree on what and how we surface the command line features. https://github.com/llvm/llvm-project/pull/68620 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang-tools-extra] [libc] [libcxx] [compiler-rt] [flang] [llvm] [clang] [lldb] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)
Endilll wrote: I'd also like to highlight the use case of diagnostic for compiler crashes. IIRC preprocessed source to attach to an issue is produced with `-frewrite-includes`, so we might want to change its behavior for `#embed`. This might be a good use case for `#embed_base64`. https://github.com/llvm/llvm-project/pull/68620 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][dap] always add column field in StackFrame body (PR #73393)
https://github.com/walter-erquinigo approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/73393 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libc] [clang-tools-extra] [flang] [llvm] [libcxx] [compiler-rt] [lldb] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)
AaronBallman wrote: > I'd also like to highlight the use case of diagnostic for compiler crashes. > IIRC preprocessed source to attach to an issue is produced with > `-frewrite-includes`, so we might want to change its behavior for `#embed`. > This might be a good use case for `#embed_base64`. I'm wary of this for privacy reasons. Including header files makes a lot of sense because there's almost no chance a reproducer will be useful without those header files. I don't think the same is true with `#embed` though it certainly is plausible. And header files can contain sensitive information, so the problem of leaking sensitive details already exists. However, with include files, you can tell at a glance if you're pulling in sensitive information because everything is textual code. I think `#embed` is a bit different in that it seems likely to contain sensitive information that would be hard to spot if it was base64 encoded; you'd need more contextual information from the code to determine what is being embedded. I think the safer approach for users would be `-E -dE` mode where the resource isn't embedded. The downside to this is: you can't immediately pass the script to Clang because the `#embed` directives likely won't find the correct file, so triage may need to reduce the test case to remove the directive. But given that we want reduced test cases anyway, maybe that's reasonable? https://github.com/llvm/llvm-project/pull/68620 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [mostly NFC] Large WP foundation: WatchpointResources (PR #68845)
@@ -0,0 +1,37 @@ +//===-- StopPointSiteList.cpp -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "lldb/Breakpoint/StopPointSiteList.h" +#include "lldb/Breakpoint/BreakpointSite.h" +#include "lldb/Breakpoint/WatchpointResource.h" + +#include "lldb/Utility/Stream.h" +#include + +using namespace lldb; +using namespace lldb_private; + +// This method is only defined when we're specializing for +// BreakpointSite / BreakpointLocation / Breakpoint. +// Watchpoints don't have a similar structure, they are +// WatchpointResource / Watchpoint + +template <> +bool StopPointSiteList::StopPointSiteContainsBreakpoint( +typename BreakpointSite::SiteID site_id, lldb::break_id_t bp_id) { + std::lock_guard guard(m_mutex); + typename collection::const_iterator pos = GetIDConstIterator(site_id); JDevlieghere wrote: This would be a good candidate for `auto`. https://github.com/llvm/llvm-project/pull/68845 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] DEBUGINFOD based DWP acquisition for LLDB (PR #70996)
@@ -0,0 +1,142 @@ +//===-- SymbolLocatorDebuginfod.cpp ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "SymbolLocatorDebuginfod.h" + +#include "lldb/Core/PluginManager.h" +#include "lldb/Utility/Args.h" + +#include "llvm/Debuginfod/Debuginfod.h" +#include "llvm/Debuginfod/HTTPClient.h" + +using namespace lldb; +using namespace lldb_private; + +LLDB_PLUGIN_DEFINE(SymbolLocatorDebuginfod) + +namespace { + +#define LLDB_PROPERTIES_symbollocatordebuginfod +#include "SymbolLocatorDebuginfodProperties.inc" + +enum { +#define LLDB_PROPERTIES_symbollocatordebuginfod +#include "SymbolLocatorDebuginfodPropertiesEnum.inc" +}; + +class PluginProperties : public Properties { +public: + static llvm::StringRef GetSettingName() { +return SymbolLocatorDebuginfod::GetPluginNameStatic(); + } + + PluginProperties() { +m_collection_sp = std::make_shared(GetSettingName()); +m_collection_sp->Initialize(g_symbollocatordebuginfod_properties); + +// We need to read the default value first to read the environment variable. +llvm::SmallVector urls = llvm::getDefaultDebuginfodUrls(); +Args arg_urls{urls}; +m_collection_sp->SetPropertyAtIndexFromArgs(ePropertyServerURLs, arg_urls); + +m_collection_sp->SetValueChangedCallback( +ePropertyServerURLs, [this] { ServerURLsChangedCallback(); }); + } + + Args GetDebugInfoDURLs() const { +Args urls; +m_collection_sp->GetPropertyAtIndexAsArgs(ePropertyServerURLs, urls); +return urls; + } + +private: + void ServerURLsChangedCallback() { +Args urls = GetDebugInfoDURLs(); +llvm::SmallVector dbginfod_urls; +llvm::transform(urls, dbginfod_urls.end(), +[](const auto &obj) { return obj.ref(); }); +llvm::setDefaultDebuginfodUrls(dbginfod_urls); + } +}; + +} // namespace + +static PluginProperties &GetGlobalPluginProperties() { + static PluginProperties g_settings; + return g_settings; +} + +SymbolLocatorDebuginfod::SymbolLocatorDebuginfod() : SymbolLocator() {} + +void SymbolLocatorDebuginfod::Initialize() { + static llvm::once_flag g_once_flag; + + llvm::call_once(g_once_flag, []() { +PluginManager::RegisterPlugin( +GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance, +LocateExecutableObjectFile, LocateExecutableSymbolFile, nullptr, +nullptr, SymbolLocatorDebuginfod::DebuggerInitialize); +llvm::HTTPClient::initialize(); + }); +} + +void SymbolLocatorDebuginfod::DebuggerInitialize(Debugger &debugger) { + if (!PluginManager::GetSettingForSymbolLocatorPlugin( + debugger, PluginProperties::GetSettingName())) { +const bool is_global_setting = true; +PluginManager::CreateSettingForSymbolLocatorPlugin( +debugger, GetGlobalPluginProperties().GetValueProperties(), +"Properties for the Debuginfod Symbol Locator plug-in.", +is_global_setting); + } +} + +void SymbolLocatorDebuginfod::Terminate() { + PluginManager::UnregisterPlugin(CreateInstance); + llvm::HTTPClient::cleanup(); +} + +llvm::StringRef SymbolLocatorDebuginfod::GetPluginDescriptionStatic() { + return "Debuginfod symbol locator."; +} + +SymbolLocator *SymbolLocatorDebuginfod::CreateInstance() { + return new SymbolLocatorDebuginfod(); +} + +std::optional SymbolLocatorDebuginfod::LocateExecutableObjectFile( +const ModuleSpec &module_spec) { + const UUID &module_uuid = module_spec.GetUUID(); + if (module_uuid.IsValid() && llvm::canUseDebuginfod()) { +llvm::object::BuildID build_id(module_uuid.GetBytes()); +llvm::Expected result = +llvm::getCachedOrDownloadExecutable(build_id); +if (result) + return FileSpec(*result); +// An error here should be logged as a failure in the Debuginfod library, +// so just consume it here +consumeError(result.takeError()); + } + return {}; +} + +std::optional SymbolLocatorDebuginfod::LocateExecutableSymbolFile( +const ModuleSpec &module_spec, const FileSpecList &default_search_paths) { + const UUID &module_uuid = module_spec.GetUUID(); + if (module_uuid.IsValid() && llvm::canUseDebuginfod()) { +llvm::object::BuildID build_id(module_uuid.GetBytes()); +llvm::Expected result = +llvm::getCachedOrDownloadDebuginfo(build_id); +if (result) + return FileSpec(*result); +// An error here should be logged as a failure in the Debuginfod library, +// so just consume it here +consumeError(result.takeError()); + } kevinfrei wrote: Not quite: They're calling different functions (llvm::getCachedOrDownloadDebugInfo vs. llvm::getCachedOrDownloadExecutable) but I could factor that out and pass the function pointers instead. ht
[Lldb-commits] [lldb] [lldb] [mostly NFC] Large WP foundation: WatchpointResources (PR #68845)
https://github.com/JDevlieghere approved this pull request. https://github.com/llvm/llvm-project/pull/68845 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libc] [compiler-rt] [lldb] [llvm] [flang] [libcxx] [clang] [clang-tools-extra] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)
Endilll wrote: Your reasoning works until we have a crash that relies on `#embed` and/or its contents. >From what I saw triaging old crashes, crash submitters are conscious if they >work with proprietary code they can't share even a fragment of, and not so >rarely reduce crash by themselves. I'm not fond of the idea on giving up on >every embed-related crash, because there is a risk (which I'm not estimating >high), that submitter forgot to check their otherwise open code for sensitive >information. This doesn't help us ironing out bugs in `#embed` implementation >in the long run. One might say that additional back-and-forth with crash submitter is not too big of a deal, and it would be, if we haven't had ever-growing backlog of issues, some dating back more than a decade. Our existing workflow that allows people to drop attachments on us and forget about it has proven itself useful in the very long run. So I'd like us to keep this. https://github.com/llvm/llvm-project/pull/68620 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxxabi] [llvm] [clang] [libcxx] [mlir] [openmp] [lldb] [lld] [libc] [flang] [BOLT] Use deterministic xxh3 for computing BF/BB hashes (PR #72542)
https://github.com/spupyrev updated https://github.com/llvm/llvm-project/pull/72542 error: too big or took too long to generate ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [llvm] [compiler-rt] [clang] [libcxx] [clang-tools-extra] [lldb] [libc] [flang] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)
AaronBallman wrote: > Your reasoning works until we have a crash that relies on `#embed` and/or its > contents. Agreed, that's the "downsides" I mentioned. > From what I saw triaging old crashes, crash submitters are conscious if they > work with proprietary code they can't share even a fragment of, and not so > rarely reduce crash by themselves. I'm not fond of the idea on giving up on > every embed-related crash, because there is a risk (which I'm not estimating > high), that submitter forgot to check their otherwise open code for sensitive > information. This doesn't help us ironing out bugs in `#embed` implementation > in the long run. I think folks are conscious of that because 1) it's been a known issue with header files for ages and 2) header files are textual prose that you can often read to see it's sensitive (e.g., a notice in a comment at the top of the file). I don't think either of those hold true for `#embed` though. Further, I think leaking source code is a different kind of issue than leaking credentials stored in a binary blob in some ways -- they're both leaks, but leaked header code isn't usually immediately exploitable by itself. > One might say that additional back-and-forth with crash submitter is not too > big of a deal, and it would be, if we haven't had ever-growing backlog of > issues, some dating back more than a decade. Our existing workflow that > allows people to drop attachments on us and forget about it has proven itself > useful in the very long run. So I'd like us to keep this. I agree that it would be nice to have, but I think we need to think very carefully about the behavior here. I think `#embed` usage will be quite a bit different from `#include` usage in the wild; I'd rather we err on the side of caution until we have a more clear understanding of usage patterns in the wild. (Again, I'm flexible here -- if we think my concerns aren't realistic ones, then that changes my opinions.) https://github.com/llvm/llvm-project/pull/68620 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [llvm] [lldb] DEBUGINFOD based DWP acquisition for LLDB (PR #70996)
https://github.com/JDevlieghere approved this pull request. I was out last week. Thanks, this LGTM! https://github.com/llvm/llvm-project/pull/70996 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [mostly NFC] Large WP foundation: WatchpointResources (PR #68845)
https://github.com/jasonmolenda closed https://github.com/llvm/llvm-project/pull/68845 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libc] [clang] [llvm] [lld] [flang] [clang-tools-extra] [openmp] [lldb] [compiler-rt] [libcxx] [mlir] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)
https://github.com/silee2 updated https://github.com/llvm/llvm-project/pull/71430 >From c76403cf8629b8f7d8a5b7a3ee5da2881713a7f8 Mon Sep 17 00:00:00 2001 From: "Lee, Sang Ik" Date: Mon, 6 Nov 2023 18:47:23 + Subject: [PATCH 1/5] [MLIR] Enable GPU Dialect to SYCL runtime integration GPU Dialect lowering to SYCL runtime is driven by spirv.target_env attached to gpu.module. As a result of this, spirv.target_env remains as an input to LLVMIR Translation. A SPIRVToLLVMIRTranslation without any actual translation is added to avoid an unregistered error in mlir-cpu-runner. SelectObjectAttr.cpp is updated to 1) Pass binary size argument to getModuleLoadFn 2) Pass parameter count to getKernelLaunchFn This change does not impact CUDA and ROCM usage since both mlir_cuda_runtime and mlir_rocm_runtime are already updated to accept and ignore the extra arguments. --- mlir/include/mlir/Target/LLVMIR/Dialect/All.h | 3 ++ .../Dialect/SPIRV/SPIRVToLLVMIRTranslation.h | 31 +++ mlir/lib/Target/LLVMIR/CMakeLists.txt | 1 + mlir/lib/Target/LLVMIR/Dialect/CMakeLists.txt | 1 + .../LLVMIR/Dialect/GPU/SelectObjectAttr.cpp | 50 + .../LLVMIR/Dialect/SPIRV/CMakeLists.txt | 13 + .../SPIRV/SPIRVToLLVMIRTranslation.cpp| 31 +++ mlir/test/CMakeLists.txt | 4 ++ .../Integration/GPU/SYCL/gpu-to-spirv.mlir| 54 +++ mlir/test/Integration/GPU/SYCL/lit.local.cfg | 2 + mlir/test/Target/LLVMIR/gpu.mlir | 9 ++-- mlir/test/lit.cfg.py | 3 ++ mlir/test/lit.site.cfg.py.in | 1 + 13 files changed, 188 insertions(+), 15 deletions(-) create mode 100644 mlir/include/mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h create mode 100644 mlir/lib/Target/LLVMIR/Dialect/SPIRV/CMakeLists.txt create mode 100644 mlir/lib/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.cpp create mode 100644 mlir/test/Integration/GPU/SYCL/gpu-to-spirv.mlir create mode 100644 mlir/test/Integration/GPU/SYCL/lit.local.cfg diff --git a/mlir/include/mlir/Target/LLVMIR/Dialect/All.h b/mlir/include/mlir/Target/LLVMIR/Dialect/All.h index 0563b9bf3d475a4..5dfc15afb75931a 100644 --- a/mlir/include/mlir/Target/LLVMIR/Dialect/All.h +++ b/mlir/include/mlir/Target/LLVMIR/Dialect/All.h @@ -26,6 +26,7 @@ #include "mlir/Target/LLVMIR/Dialect/OpenACC/OpenACCToLLVMIRTranslation.h" #include "mlir/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.h" #include "mlir/Target/LLVMIR/Dialect/ROCDL/ROCDLToLLVMIRTranslation.h" +#include "mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h" #include "mlir/Target/LLVMIR/Dialect/X86Vector/X86VectorToLLVMIRTranslation.h" namespace mlir { @@ -45,6 +46,7 @@ static inline void registerAllToLLVMIRTranslations(DialectRegistry ®istry) { registerOpenACCDialectTranslation(registry); registerOpenMPDialectTranslation(registry); registerROCDLDialectTranslation(registry); + registerSPIRVDialectTranslation(registry); registerX86VectorDialectTranslation(registry); // Extension required for translating GPU offloading Ops. @@ -61,6 +63,7 @@ registerAllGPUToLLVMIRTranslations(DialectRegistry ®istry) { registerLLVMDialectTranslation(registry); registerNVVMDialectTranslation(registry); registerROCDLDialectTranslation(registry); + registerSPIRVDialectTranslation(registry); // Extension required for translating GPU offloading Ops. gpu::registerOffloadingLLVMTranslationInterfaceExternalModels(registry); diff --git a/mlir/include/mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h b/mlir/include/mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h new file mode 100644 index 000..e9580a10b4ca780 --- /dev/null +++ b/mlir/include/mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h @@ -0,0 +1,31 @@ +//===- SPIRVToLLVMIRTranslation.h - SPIRV to LLVM IR *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This provides registration calls for SPIRV dialect to LLVM IR translation. +// +//===--===// + +#ifndef MLIR_TARGET_LLVMIR_DIALECT_SPIRV_SPIRVTOLLVMIRTRANSLATION_H +#define MLIR_TARGET_LLVMIR_DIALECT_SPIRV_SPIRVTOLLVMIRTRANSLATION_H + +namespace mlir { + +class DialectRegistry; +class MLIRContext; + +/// Register the SPIRV dialect and the translation from it to the LLVM IR in the +/// given registry; +void registerSPIRVDialectTranslation(DialectRegistry ®istry); + +/// Register the SPIRV dialect and the translation from it in the registry +/// associated with the given context. +void registerSPIRVDialectTranslation(MLIRContext &context); + +} // namespa
[Lldb-commits] [lldb] a0a1ff3 - Include in WatchpointResource.h
Author: Jason Molenda Date: 2023-11-27T13:39:24-08:00 New Revision: a0a1ff3ab40e347589b4e27d8fd350c600526735 URL: https://github.com/llvm/llvm-project/commit/a0a1ff3ab40e347589b4e27d8fd350c600526735 DIFF: https://github.com/llvm/llvm-project/commit/a0a1ff3ab40e347589b4e27d8fd350c600526735.diff LOG: Include in WatchpointResource.h On macOS was already included via another header file, but this failed on the CI bots. I'd tested on linux earlier in this patch's life when the headers were differently arranged. Added: Modified: lldb/include/lldb/Breakpoint/WatchpointResource.h Removed: diff --git a/lldb/include/lldb/Breakpoint/WatchpointResource.h b/lldb/include/lldb/Breakpoint/WatchpointResource.h index e83ba0bbe8c65913..4b1d733850f1bbf5 100644 --- a/lldb/include/lldb/Breakpoint/WatchpointResource.h +++ b/lldb/include/lldb/Breakpoint/WatchpointResource.h @@ -13,7 +13,7 @@ #include "lldb/lldb-public.h" #include -#include +#include namespace lldb_private { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] DRAFT - Remove 2nd "error: " and print caret (^) below last input line from the developer. (PR #72150)
https://github.com/PortalPete updated https://github.com/llvm/llvm-project/pull/72150 >From 047413349901684411fb260a49c996633b7b4dc0 Mon Sep 17 00:00:00 2001 From: Pete Lawrence Date: Mon, 6 Nov 2023 17:16:28 -1000 Subject: [PATCH] Remove secondary "error: " and print diagnostic line with caret (^) just below the developer's last command. --- .../lldb/Expression/DiagnosticManager.h | 67 +- .../lldb/Interpreter/CommandReturnObject.h| 4 ++ lldb/include/lldb/Utility/Status.h| 70 +++ lldb/source/Expression/UserExpression.cpp | 14 .../source/Interpreter/CommandInterpreter.cpp | 59 +++- .../Interpreter/CommandReturnObject.cpp | 6 ++ lldb/source/Utility/Status.cpp| 8 +++ 7 files changed, 160 insertions(+), 68 deletions(-) diff --git a/lldb/include/lldb/Expression/DiagnosticManager.h b/lldb/include/lldb/Expression/DiagnosticManager.h index df9ba3b245f51e8..5eec90241aa51d8 100644 --- a/lldb/include/lldb/Expression/DiagnosticManager.h +++ b/lldb/include/lldb/Expression/DiagnosticManager.h @@ -14,80 +14,15 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" +#include "lldb/Utility/Status.h" #include #include namespace lldb_private { -enum DiagnosticOrigin { - eDiagnosticOriginUnknown = 0, - eDiagnosticOriginLLDB, - eDiagnosticOriginClang, - eDiagnosticOriginSwift, - eDiagnosticOriginLLVM -}; - -enum DiagnosticSeverity { - eDiagnosticSeverityError, - eDiagnosticSeverityWarning, - eDiagnosticSeverityRemark -}; - const uint32_t LLDB_INVALID_COMPILER_ID = UINT32_MAX; -class Diagnostic { - friend class DiagnosticManager; - -public: - DiagnosticOrigin getKind() const { return m_origin; } - - static bool classof(const Diagnostic *diag) { -DiagnosticOrigin kind = diag->getKind(); -switch (kind) { -case eDiagnosticOriginUnknown: -case eDiagnosticOriginLLDB: -case eDiagnosticOriginLLVM: - return true; -case eDiagnosticOriginClang: -case eDiagnosticOriginSwift: - return false; -} - } - - Diagnostic(llvm::StringRef message, DiagnosticSeverity severity, - DiagnosticOrigin origin, uint32_t compiler_id) - : m_message(message), m_severity(severity), m_origin(origin), -m_compiler_id(compiler_id) {} - - Diagnostic(const Diagnostic &rhs) - : m_message(rhs.m_message), m_severity(rhs.m_severity), -m_origin(rhs.m_origin), m_compiler_id(rhs.m_compiler_id) {} - - virtual ~Diagnostic() = default; - - virtual bool HasFixIts() const { return false; } - - DiagnosticSeverity GetSeverity() const { return m_severity; } - - uint32_t GetCompilerID() const { return m_compiler_id; } - - llvm::StringRef GetMessage() const { return m_message; } - - void AppendMessage(llvm::StringRef message, - bool precede_with_newline = true) { -if (precede_with_newline) - m_message.push_back('\n'); -m_message += message; - } - -protected: - std::string m_message; - DiagnosticSeverity m_severity; - DiagnosticOrigin m_origin; - uint32_t m_compiler_id; // Compiler-specific diagnostic ID -}; - typedef std::vector> DiagnosticList; class DiagnosticManager { diff --git a/lldb/include/lldb/Interpreter/CommandReturnObject.h b/lldb/include/lldb/Interpreter/CommandReturnObject.h index 8c4dcb54d708f08..ec8b09f151fac93 100644 --- a/lldb/include/lldb/Interpreter/CommandReturnObject.h +++ b/lldb/include/lldb/Interpreter/CommandReturnObject.h @@ -9,6 +9,7 @@ #ifndef LLDB_INTERPRETER_COMMANDRETURNOBJECT_H #define LLDB_INTERPRETER_COMMANDRETURNOBJECT_H +#include "lldb/Expression/DiagnosticManager.h" #include "lldb/Host/StreamFile.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/StreamTee.h" @@ -139,6 +140,8 @@ class CommandReturnObject { void SetStatus(lldb::ReturnStatus status); + std::vector GetDiagnostics() const; + bool Succeeded() const; bool HasResult() const; @@ -162,6 +165,7 @@ class CommandReturnObject { StreamTee m_err_stream; lldb::ReturnStatus m_status = lldb::eReturnStatusStarted; + std::vector m_diagnostics; bool m_did_change_process_state = false; bool m_suppress_immediate_output = false; diff --git a/lldb/include/lldb/Utility/Status.h b/lldb/include/lldb/Utility/Status.h index fa5768141fa45df..840177385b9e1a2 100644 --- a/lldb/include/lldb/Utility/Status.h +++ b/lldb/include/lldb/Utility/Status.h @@ -25,6 +25,71 @@ class raw_ostream; } namespace lldb_private { + enum DiagnosticOrigin { +eDiagnosticOriginUnknown = 0, +eDiagnosticOriginLLDB, +eDiagnosticOriginClang, +eDiagnosticOriginSwift, +eDiagnosticOriginLLVM + }; + + enum DiagnosticSeverity { +eDiagnosticSeverityError, +eDiagnosticSeverityWarning, +eDiagnosticSeverityRemark + }; + + class Diagnostic { +friend class DiagnosticManager; + + public: +DiagnosticOrigin getKind() const { return m_origin; } + +static bool classof
[Lldb-commits] [lldb] [lldb] DRAFT - Remove 2nd "error: " and print caret (^) below last input line from the developer. (PR #72150)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff a0a1ff3ab40e347589b4e27d8fd350c600526735 047413349901684411fb260a49c996633b7b4dc0 -- lldb/include/lldb/Expression/DiagnosticManager.h lldb/include/lldb/Interpreter/CommandReturnObject.h lldb/include/lldb/Utility/Status.h lldb/source/Expression/UserExpression.cpp lldb/source/Interpreter/CommandInterpreter.cpp lldb/source/Interpreter/CommandReturnObject.cpp lldb/source/Utility/Status.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/include/lldb/Expression/DiagnosticManager.h b/lldb/include/lldb/Expression/DiagnosticManager.h index 5eec90241a..79fa6bf24d 100644 --- a/lldb/include/lldb/Expression/DiagnosticManager.h +++ b/lldb/include/lldb/Expression/DiagnosticManager.h @@ -12,9 +12,9 @@ #include "lldb/lldb-defines.h" #include "lldb/lldb-types.h" +#include "lldb/Utility/Status.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" -#include "lldb/Utility/Status.h" #include #include diff --git a/lldb/include/lldb/Utility/Status.h b/lldb/include/lldb/Utility/Status.h index 840177385b..c044146c85 100644 --- a/lldb/include/lldb/Utility/Status.h +++ b/lldb/include/lldb/Utility/Status.h @@ -25,71 +25,71 @@ class raw_ostream; } namespace lldb_private { - enum DiagnosticOrigin { -eDiagnosticOriginUnknown = 0, -eDiagnosticOriginLLDB, -eDiagnosticOriginClang, -eDiagnosticOriginSwift, -eDiagnosticOriginLLVM - }; - - enum DiagnosticSeverity { -eDiagnosticSeverityError, -eDiagnosticSeverityWarning, -eDiagnosticSeverityRemark - }; - - class Diagnostic { -friend class DiagnosticManager; - - public: -DiagnosticOrigin getKind() const { return m_origin; } - -static bool classof(const Diagnostic *diag) { - DiagnosticOrigin kind = diag->getKind(); - switch (kind) { -case eDiagnosticOriginUnknown: -case eDiagnosticOriginLLDB: -case eDiagnosticOriginLLVM: - return true; -case eDiagnosticOriginClang: -case eDiagnosticOriginSwift: - return false; - } +enum DiagnosticOrigin { + eDiagnosticOriginUnknown = 0, + eDiagnosticOriginLLDB, + eDiagnosticOriginClang, + eDiagnosticOriginSwift, + eDiagnosticOriginLLVM +}; + +enum DiagnosticSeverity { + eDiagnosticSeverityError, + eDiagnosticSeverityWarning, + eDiagnosticSeverityRemark +}; + +class Diagnostic { + friend class DiagnosticManager; + +public: + DiagnosticOrigin getKind() const { return m_origin; } + + static bool classof(const Diagnostic *diag) { +DiagnosticOrigin kind = diag->getKind(); +switch (kind) { +case eDiagnosticOriginUnknown: +case eDiagnosticOriginLLDB: +case eDiagnosticOriginLLVM: + return true; +case eDiagnosticOriginClang: +case eDiagnosticOriginSwift: + return false; } + } -Diagnostic(llvm::StringRef message, DiagnosticSeverity severity, - DiagnosticOrigin origin, uint32_t compiler_id) -: m_message(message), m_severity(severity), m_origin(origin), -m_compiler_id(compiler_id) {} + Diagnostic(llvm::StringRef message, DiagnosticSeverity severity, + DiagnosticOrigin origin, uint32_t compiler_id) + : m_message(message), m_severity(severity), m_origin(origin), +m_compiler_id(compiler_id) {} -Diagnostic(const Diagnostic &rhs) -: m_message(rhs.m_message), m_severity(rhs.m_severity), -m_origin(rhs.m_origin), m_compiler_id(rhs.m_compiler_id) {} + Diagnostic(const Diagnostic &rhs) + : m_message(rhs.m_message), m_severity(rhs.m_severity), +m_origin(rhs.m_origin), m_compiler_id(rhs.m_compiler_id) {} -virtual ~Diagnostic() = default; + virtual ~Diagnostic() = default; -virtual bool HasFixIts() const { return false; } + virtual bool HasFixIts() const { return false; } -DiagnosticSeverity GetSeverity() const { return m_severity; } + DiagnosticSeverity GetSeverity() const { return m_severity; } -uint32_t GetCompilerID() const { return m_compiler_id; } + uint32_t GetCompilerID() const { return m_compiler_id; } -llvm::StringRef GetMessage() const { return m_message; } + llvm::StringRef GetMessage() const { return m_message; } -void AppendMessage(llvm::StringRef message, - bool precede_with_newline = true) { - if (precede_with_newline) -m_message.push_back('\n'); - m_message += message; -} + void AppendMessage(llvm::StringRef message, + bool precede_with_newline = true) { +if (precede_with_newline) + m_message.push_back('\n'); +m_message += message; + } - protected: -std::string m_message; -DiagnosticSeverity m_severity; -DiagnosticOrigin m_origin; -uint32_t m_compiler_id; // Compiler-specific diagnostic ID -
[Lldb-commits] [clang] [compiler-rt] [libc] [clang-tools-extra] [libcxx] [llvm] [lldb] [flang] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)
jyknight wrote: I'm somewhat concerned about the default for `-E` being to explode `#embed` into the comma-separated raw integers. Even with moderately-sized embeds, I think it'll generate unusably-bloated output. The human-readability of a big list of integers is not better than embedded base64 -- and actually, seems more of a pain to decode. I think the most user-friendly behavior would be: - `-E`: convert `#embed "file"` into `#embed_base64 "base64-file-contents"`. This preserves the property of the output not depending on other files, but doesn't make it hugely-bloated. - `-E -dE`: preserve any `#embed` directive as-is, referring to the external file. - Potentially another `-d?` mode to explode `#embed` into the raw integers (like you had proposed for the default behavior) -- though I'm not sure that's really going to be useful. https://github.com/llvm/llvm-project/pull/68620 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libc] [clang-tools-extra] [libcxx] [lld] [llvm] [libcxxabi] [lldb] [flang] [flang] Pass Argv0 to getIntriniscDir and getOpenMPHeadersDir (PR #73254)
brad0 wrote: I see you re-based 2 times. Does this look Ok as is? It would be good to add the AIX Driver bits once this goes in. https://github.com/llvm/llvm-project/pull/73254 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] DRAFT - Remove 2nd "error: " and print caret (^) below last input line from the developer. (PR #72150)
https://github.com/PortalPete updated https://github.com/llvm/llvm-project/pull/72150 >From af3e1a6dce00477afd1418cc41fde6a2f8c17258 Mon Sep 17 00:00:00 2001 From: Pete Lawrence Date: Mon, 6 Nov 2023 17:16:28 -1000 Subject: [PATCH] Remove secondary "error: " and print diagnostic line with caret (^) just below the developer's last command. --- .../lldb/Expression/DiagnosticManager.h | 67 + .../lldb/Interpreter/CommandReturnObject.h| 4 ++ lldb/include/lldb/Utility/Status.h| 71 +++ lldb/source/Expression/UserExpression.cpp | 14 .../source/Interpreter/CommandInterpreter.cpp | 59 ++- .../Interpreter/CommandReturnObject.cpp | 6 ++ lldb/source/Utility/Status.cpp| 6 ++ 7 files changed, 159 insertions(+), 68 deletions(-) diff --git a/lldb/include/lldb/Expression/DiagnosticManager.h b/lldb/include/lldb/Expression/DiagnosticManager.h index df9ba3b245f51e8..79fa6bf24da1a1e 100644 --- a/lldb/include/lldb/Expression/DiagnosticManager.h +++ b/lldb/include/lldb/Expression/DiagnosticManager.h @@ -12,6 +12,7 @@ #include "lldb/lldb-defines.h" #include "lldb/lldb-types.h" +#include "lldb/Utility/Status.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" @@ -20,74 +21,8 @@ namespace lldb_private { -enum DiagnosticOrigin { - eDiagnosticOriginUnknown = 0, - eDiagnosticOriginLLDB, - eDiagnosticOriginClang, - eDiagnosticOriginSwift, - eDiagnosticOriginLLVM -}; - -enum DiagnosticSeverity { - eDiagnosticSeverityError, - eDiagnosticSeverityWarning, - eDiagnosticSeverityRemark -}; - const uint32_t LLDB_INVALID_COMPILER_ID = UINT32_MAX; -class Diagnostic { - friend class DiagnosticManager; - -public: - DiagnosticOrigin getKind() const { return m_origin; } - - static bool classof(const Diagnostic *diag) { -DiagnosticOrigin kind = diag->getKind(); -switch (kind) { -case eDiagnosticOriginUnknown: -case eDiagnosticOriginLLDB: -case eDiagnosticOriginLLVM: - return true; -case eDiagnosticOriginClang: -case eDiagnosticOriginSwift: - return false; -} - } - - Diagnostic(llvm::StringRef message, DiagnosticSeverity severity, - DiagnosticOrigin origin, uint32_t compiler_id) - : m_message(message), m_severity(severity), m_origin(origin), -m_compiler_id(compiler_id) {} - - Diagnostic(const Diagnostic &rhs) - : m_message(rhs.m_message), m_severity(rhs.m_severity), -m_origin(rhs.m_origin), m_compiler_id(rhs.m_compiler_id) {} - - virtual ~Diagnostic() = default; - - virtual bool HasFixIts() const { return false; } - - DiagnosticSeverity GetSeverity() const { return m_severity; } - - uint32_t GetCompilerID() const { return m_compiler_id; } - - llvm::StringRef GetMessage() const { return m_message; } - - void AppendMessage(llvm::StringRef message, - bool precede_with_newline = true) { -if (precede_with_newline) - m_message.push_back('\n'); -m_message += message; - } - -protected: - std::string m_message; - DiagnosticSeverity m_severity; - DiagnosticOrigin m_origin; - uint32_t m_compiler_id; // Compiler-specific diagnostic ID -}; - typedef std::vector> DiagnosticList; class DiagnosticManager { diff --git a/lldb/include/lldb/Interpreter/CommandReturnObject.h b/lldb/include/lldb/Interpreter/CommandReturnObject.h index 8c4dcb54d708f08..ec8b09f151fac93 100644 --- a/lldb/include/lldb/Interpreter/CommandReturnObject.h +++ b/lldb/include/lldb/Interpreter/CommandReturnObject.h @@ -9,6 +9,7 @@ #ifndef LLDB_INTERPRETER_COMMANDRETURNOBJECT_H #define LLDB_INTERPRETER_COMMANDRETURNOBJECT_H +#include "lldb/Expression/DiagnosticManager.h" #include "lldb/Host/StreamFile.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/StreamTee.h" @@ -139,6 +140,8 @@ class CommandReturnObject { void SetStatus(lldb::ReturnStatus status); + std::vector GetDiagnostics() const; + bool Succeeded() const; bool HasResult() const; @@ -162,6 +165,7 @@ class CommandReturnObject { StreamTee m_err_stream; lldb::ReturnStatus m_status = lldb::eReturnStatusStarted; + std::vector m_diagnostics; bool m_did_change_process_state = false; bool m_suppress_immediate_output = false; diff --git a/lldb/include/lldb/Utility/Status.h b/lldb/include/lldb/Utility/Status.h index fa5768141fa45df..c044146c85af7b1 100644 --- a/lldb/include/lldb/Utility/Status.h +++ b/lldb/include/lldb/Utility/Status.h @@ -25,6 +25,71 @@ class raw_ostream; } namespace lldb_private { +enum DiagnosticOrigin { + eDiagnosticOriginUnknown = 0, + eDiagnosticOriginLLDB, + eDiagnosticOriginClang, + eDiagnosticOriginSwift, + eDiagnosticOriginLLVM +}; + +enum DiagnosticSeverity { + eDiagnosticSeverityError, + eDiagnosticSeverityWarning, + eDiagnosticSeverityRemark +}; + +class Diagnostic { + friend class DiagnosticManager; + +public: + DiagnosticOrigin getKind() const { return m_origin; } + +
[Lldb-commits] [libcxxabi] [clang-tools-extra] [lldb] [llvm] [libc] [clang] [flang] [lld] [libcxx] [flang] Pass Argv0 to getIntriniscDir and getOpenMPHeadersDir (PR #73254)
madanial0 wrote: > I see you re-based 2 times. Does this look Ok as is? It would be good to add > the AIX Driver bits once this goes in. This should be good as is pending any review comments/approvals https://github.com/llvm/llvm-project/pull/73254 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [flang] [llvm] [lldb] [clang-tools-extra] [libc] [clang] [compiler-rt] [libcxx] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)
AaronBallman wrote: > I'm somewhat concerned about the default for `-E` being to explode `#embed` > into the comma-separated raw integers. Even with moderately-sized embeds, I > think it'll generate unusably-bloated output. The human-readability of a big > list of integers is not better than embedded base64 -- and actually, seems > more of a pain to decode. > > I think the most user-friendly behavior would be: > > * `-E`: convert `#embed "file"` into `#embed_base64 > "base64-file-contents"`. This preserves the property of the output not > depending on other files, but doesn't make it hugely-bloated. > > * `-E -dE`: preserve any `#embed` directive as-is, referring to the > external file. > > * Potentially another `-d?` mode to explode `#embed` into the raw > integers (like you had proposed for the default behavior) -- though I'm not > sure that's really going to be useful. I agree with you that the exploded list of integers will potentially add a lot of content to the preprocessed output. However, the behavior of `-E` has always been to produce a fully preprocessed representation of the original source; your design breaks that. A significant use case for `-E` is as a way to debug surprising preprocessor behavior. So it depends on *why* you're using `-E` as to whether the contents are salient or not. Perhaps your approach is still reasonable, but I would personally find it to be a surprising change from the usual expectations. In some situations, I suspect the preprocessed data may not be crucial to explode out. e.g., as a braced initializer for an array. But there are other situations where the base64 data is not useful. e.g., as an initializer for a structure, as a list of arguments to a function, etc. I anticipate use to predominately be in an initializer lists for an array but we have no actual usage experience with the feature either. That's why I lean towards "do the most expected thing by default" which would be to emit the actual list of integers even if it's large. https://github.com/llvm/llvm-project/pull/68620 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [mostly NFC] Large WP foundation: WatchpointResources (PR #68845)
sylvestre wrote: Seems that it caused https://github.com/llvm/llvm-project/issues/73580 no? https://github.com/llvm/llvm-project/pull/68845 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -436,8 +482,8 @@ class CompilerType { ExecutionContextScope *exe_scope); /// Dump to stdout. - void DumpTypeDescription(lldb::DescriptionLevel level = - lldb::eDescriptionLevelFull) const; felipepiovezan wrote: I understand the desire to fix formatting issues, but let's avoid doing them in a big patch like this. If things needs to be reverted, as this patch was, such a formatting change should not need to be reverted. This can also cause unnecessary work for downstream forks in case of merge conflicts (the first patch, the revert, the second patch, etc). https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -249,7 +250,7 @@ bool CompilerType::IsPossibleDynamicType(CompilerType *dynamic_pointee_type, if (IsValid()) if (auto type_system_sp = GetTypeSystem()) return type_system_sp->IsPossibleDynamicType(m_type, dynamic_pointee_type, -check_cplusplus, check_objc); + check_cplusplus, check_objc); felipepiovezan wrote: same issue with formatting as mentioned before https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // + llvm::StringRef name = GetTypeName(); + return k_libcxx_std_unique_ptr_regex.match(name) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; + return IsIntegerType(is_signed); +} + +bool CompilerType::IsFloat() const { + uint32_t count = 0; + bool is_complex = false; + return IsFloatingPointType(count, is_complex); +} + +bool CompilerType::IsEnumerationType() const { + // This is used when you don't care about the signedness of the enum. + bool is_signed; + return IsEnumerationType(is_signed); +} + +bool CompilerType::IsUnscopedEnumerationType() const { + return IsEnumerationType() && !IsScopedEnumerationType(); +} + +bool CompilerType::IsIntegerOrUnscopedEnumerationType() const { + return IsInteger() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsSigned() const { + if (IsEnumerationType()) { +return IsEnumerationIntegerTypeSigned(); + } + return GetTypeInfo() & lldb::eTypeIsSigned; +} + +bool CompilerType::IsNullPtrType() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeNullPtr; +} + +bool CompilerType::IsBoolean() const { + return GetCanonicalType().GetBasicTypeEnumeration() == lldb::eBasicTypeBool; +} + +bool CompilerType::IsEnumerationIntegerTypeSigned() const { + if (IsValid()) { +return GetEnumerationIntegerType().GetTypeInfo() & lldb::eTypeIsSigned; + } + return false; +} + +bool CompilerType::IsScalarOrUnscopedEnumerationType() const { + return IsScalarType() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsPromotableIntegerType() const { + // Unscoped enums are always considered as promotable, even if their + // underlying type does not need to be promoted (e.g. "int"). + if (IsUnscopedEnumerationType()) { +return true; + } + + switch (GetCanonicalType().GetBasicTypeEnumeration()) { + case lldb::eBasicTypeBool: + case lldb::eBasicTypeChar: + case lldb::eBasicTypeSignedChar: + case lldb::eBasicTypeUnsignedChar: + case lldb::eBasicTypeShort: + case lldb::eBasicTypeUnsignedShort: + case lldb::eBasicTypeWChar: + case lldb::eBasicTypeSignedWChar: + case lldb::eBasicTypeUnsignedWChar: + case lldb::eBasicTypeChar16: + case lldb::eBasicTypeChar32: +return true; + + default: +return false; + } +} + +bool CompilerType::IsPointerToVoid() const { + if (!IsValid()) +return false; + + return IsPointerType() && + GetPointeeType().GetBasicTypeEnumeration() == lldb::eBasicTypeVoid; +} + +bool CompilerType::IsRecordType() const { + if (!IsValid()) +return false; + + return GetCanonicalType().GetTypeClass() & + (lldb::eTypeClassClass | lldb::eTypeClassStruct | + lldb::eTypeClassUnion); +} + +// Checks whether `target_base` is a virtual base of `type` (direct or +// indirect). If it is, stores the first virtual base type on the path from felipepiovezan wrote: +1 https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( felipepiovezan wrote: Let's make these `const`s https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // + llvm::StringRef name = GetTypeName(); + return k_libcxx_std_unique_ptr_regex.match(name) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; felipepiovezan wrote: +1 https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -54,7 +54,7 @@ bool CompilerType::IsArrayType(CompilerType *element_type_ptr, uint64_t *size, if (IsValid()) if (auto type_system_sp = GetTypeSystem()) return type_system_sp->IsArrayType(m_type, element_type_ptr, size, - is_incomplete); + is_incomplete); felipepiovezan wrote: same issue with formatting as mentioned before https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // + llvm::StringRef name = GetTypeName(); + return k_libcxx_std_unique_ptr_regex.match(name) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; + return IsIntegerType(is_signed); +} + +bool CompilerType::IsFloat() const { + uint32_t count = 0; + bool is_complex = false; + return IsFloatingPointType(count, is_complex); +} + +bool CompilerType::IsEnumerationType() const { + // This is used when you don't care about the signedness of the enum. + bool is_signed; + return IsEnumerationType(is_signed); +} + +bool CompilerType::IsUnscopedEnumerationType() const { + return IsEnumerationType() && !IsScopedEnumerationType(); +} + +bool CompilerType::IsIntegerOrUnscopedEnumerationType() const { + return IsInteger() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsSigned() const { + if (IsEnumerationType()) { +return IsEnumerationIntegerTypeSigned(); + } + return GetTypeInfo() & lldb::eTypeIsSigned; +} + +bool CompilerType::IsNullPtrType() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeNullPtr; +} + +bool CompilerType::IsBoolean() const { + return GetCanonicalType().GetBasicTypeEnumeration() == lldb::eBasicTypeBool; +} + +bool CompilerType::IsEnumerationIntegerTypeSigned() const { + if (IsValid()) { +return GetEnumerationIntegerType().GetTypeInfo() & lldb::eTypeIsSigned; + } + return false; +} + +bool CompilerType::IsScalarOrUnscopedEnumerationType() const { + return IsScalarType() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsPromotableIntegerType() const { + // Unscoped enums are always considered as promotable, even if their + // underlying type does not need to be promoted (e.g. "int"). + if (IsUnscopedEnumerationType()) { +return true; + } + + switch (GetCanonicalType().GetBasicTypeEnumeration()) { + case lldb::eBasicTypeBool: + case lldb::eBasicTypeChar: + case lldb::eBasicTypeSignedChar: + case lldb::eBasicTypeUnsignedChar: + case lldb::eBasicTypeShort: + case lldb::eBasicTypeUnsignedShort: + case lldb::eBasicTypeWChar: + case lldb::eBasicTypeSignedWChar: + case lldb::eBasicTypeUnsignedWChar: + case lldb::eBasicTypeChar16: + case lldb::eBasicTypeChar32: +return true; + + default: +return false; + } felipepiovezan wrote: Rationale: https://llvm.org/docs/CodingStandards.html#don-t-use-default-labels-in-fully-covered-switches-over-enumerations https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // + llvm::StringRef name = GetTypeName(); + return k_libcxx_std_unique_ptr_regex.match(name) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; + return IsIntegerType(is_signed); +} + +bool CompilerType::IsFloat() const { + uint32_t count = 0; + bool is_complex = false; + return IsFloatingPointType(count, is_complex); +} + +bool CompilerType::IsEnumerationType() const { + // This is used when you don't care about the signedness of the enum. + bool is_signed; + return IsEnumerationType(is_signed); +} + +bool CompilerType::IsUnscopedEnumerationType() const { + return IsEnumerationType() && !IsScopedEnumerationType(); +} + +bool CompilerType::IsIntegerOrUnscopedEnumerationType() const { + return IsInteger() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsSigned() const { + if (IsEnumerationType()) { +return IsEnumerationIntegerTypeSigned(); + } + return GetTypeInfo() & lldb::eTypeIsSigned; +} + +bool CompilerType::IsNullPtrType() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeNullPtr; +} + +bool CompilerType::IsBoolean() const { + return GetCanonicalType().GetBasicTypeEnumeration() == lldb::eBasicTypeBool; +} + +bool CompilerType::IsEnumerationIntegerTypeSigned() const { + if (IsValid()) { +return GetEnumerationIntegerType().GetTypeInfo() & lldb::eTypeIsSigned; + } + return false; +} + +bool CompilerType::IsScalarOrUnscopedEnumerationType() const { + return IsScalarType() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsPromotableIntegerType() const { + // Unscoped enums are always considered as promotable, even if their + // underlying type does not need to be promoted (e.g. "int"). + if (IsUnscopedEnumerationType()) { +return true; + } + + switch (GetCanonicalType().GetBasicTypeEnumeration()) { + case lldb::eBasicTypeBool: + case lldb::eBasicTypeChar: + case lldb::eBasicTypeSignedChar: + case lldb::eBasicTypeUnsignedChar: + case lldb::eBasicTypeShort: + case lldb::eBasicTypeUnsignedShort: + case lldb::eBasicTypeWChar: + case lldb::eBasicTypeSignedWChar: + case lldb::eBasicTypeUnsignedWChar: + case lldb::eBasicTypeChar16: + case lldb::eBasicTypeChar32: +return true; + + default: +return false; + } +} + +bool CompilerType::IsPointerToVoid() const { + if (!IsValid()) +return false; + + return IsPointerType() && + GetPointeeType().GetBasicTypeEnumeration() == lldb::eBasicTypeVoid; +} + +bool CompilerType::IsRecordType() const { + if (!IsValid()) +return false; + + return GetCanonicalType().GetTypeClass() & + (lldb::eTypeClassClass | lldb::eTypeClassStruct | + lldb::eTypeClassUnion); +} + +// Checks whether `target_base` is a virtual base of `type` (direct or +// indirect). If it is, stores the first virtual base type on the path from +// `type` to `target_type`. +bool CompilerType::IsVirtualBase(CompilerType target_base, + CompilerType *virtual_base, + bool carry_virtual) const { + if (CompareTypes(target_base)) { +return carry_virtual; + } felipepiovezan wrote: There are many other instances of this in the code below https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const { return false; } +bool CompilerType::IsSmartPtrType() const { + // These regular expressions cover shared, unique and weak pointers both from + // stdlibc++ and libc+++. + + static llvm::Regex k_libcxx_std_unique_ptr_regex( + "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex( + "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex( + "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$"); + // + static llvm::Regex k_libcxx_std_unique_ptr_regex_2( + "^std::unique_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_shared_ptr_regex_2( + "^std::shared_ptr<.+>(( )?&)?$"); + static llvm::Regex k_libcxx_std_weak_ptr_regex_2( + "^std::weak_ptr<.+>(( )?&)?$"); + // + llvm::StringRef name = GetTypeName(); + return k_libcxx_std_unique_ptr_regex.match(name) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; + return IsIntegerType(is_signed); +} + +bool CompilerType::IsFloat() const { + uint32_t count = 0; + bool is_complex = false; + return IsFloatingPointType(count, is_complex); +} + +bool CompilerType::IsEnumerationType() const { + // This is used when you don't care about the signedness of the enum. + bool is_signed; + return IsEnumerationType(is_signed); +} + +bool CompilerType::IsUnscopedEnumerationType() const { + return IsEnumerationType() && !IsScopedEnumerationType(); +} + +bool CompilerType::IsIntegerOrUnscopedEnumerationType() const { + return IsInteger() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsSigned() const { + if (IsEnumerationType()) { +return IsEnumerationIntegerTypeSigned(); + } + return GetTypeInfo() & lldb::eTypeIsSigned; +} + +bool CompilerType::IsNullPtrType() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeNullPtr; +} + +bool CompilerType::IsBoolean() const { + return GetCanonicalType().GetBasicTypeEnumeration() == lldb::eBasicTypeBool; +} + +bool CompilerType::IsEnumerationIntegerTypeSigned() const { + if (IsValid()) { +return GetEnumerationIntegerType().GetTypeInfo() & lldb::eTypeIsSigned; + } + return false; +} + +bool CompilerType::IsScalarOrUnscopedEnumerationType() const { + return IsScalarType() || IsUnscopedEnumerationType(); +} + +bool CompilerType::IsPromotableIntegerType() const { + // Unscoped enums are always considered as promotable, even if their + // underlying type does not need to be promoted (e.g. "int"). + if (IsUnscopedEnumerationType()) { +return true; + } + + switch (GetCanonicalType().GetBasicTypeEnumeration()) { + case lldb::eBasicTypeBool: + case lldb::eBasicTypeChar: + case lldb::eBasicTypeSignedChar: + case lldb::eBasicTypeUnsignedChar: + case lldb::eBasicTypeShort: + case lldb::eBasicTypeUnsignedShort: + case lldb::eBasicTypeWChar: + case lldb::eBasicTypeSignedWChar: + case lldb::eBasicTypeUnsignedWChar: + case lldb::eBasicTypeChar16: + case lldb::eBasicTypeChar32: +return true; + + default: +return false; + } +} + +bool CompilerType::IsPointerToVoid() const { + if (!IsValid()) +return false; + + return IsPointerType() && + GetPointeeType().GetBasicTypeEnumeration() == lldb::eBasicTypeVoid; +} + +bool CompilerType::IsRecordType() const { + if (!IsValid()) +return false; + + return GetCanonicalType().GetTypeClass() & + (lldb::eTypeClassClass | lldb::eTypeClassStruct | + lldb::eTypeClassUnion); +} + +// Checks whether `target_base` is a virtual base of `type` (direct or +// indirect). If it is, stores the first virtual base type on the path from felipepiovezan wrote: This comment should also explain what `virtual_base` and `carry_virtual` are https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -157,7 +157,8 @@ bool CompilerType::IsBlockPointerType( CompilerType *function_pointer_type_ptr) const { if (IsValid()) if (auto type_system_sp = GetTypeSystem()) - return type_system_sp->IsBlockPointerType(m_type, function_pointer_type_ptr); + return type_system_sp->IsBlockPointerType(m_type, felipepiovezan wrote: same issue with formatting as mentioned before https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Apply @expectedFailureAll/@skipIf early for debug_info tests (PR #73067)
rupprecht wrote: > * This is still early enough that the standard `unittest` framework will > recognize the test as xfail/skip by the time the test actually runs. I did a little bit more research, turns out this is not a difference between unittest and unittest2, but rather just something we have in our ancient, vendored copy of unittest2. Our copy of `unittest2` originates from 2010 in 73258830f391047d9ee9ae4a07fd8ced4d7cf0a9, and has never undergone a version upgrade AFAICT. Two commits, both applied Mar 20, 2013, implement some features for `subTest` in both `unittest` and `unittest2` for https://bugs.python.org/issue16997: - https://github.com/python/cpython/commit/c9b3ef2df06818f055e555c1d23e3ff2d5bf2d74 - https://hg.python.org/unittest2/rev/0daffa9ee7c1 The important part of that diff is it stops raising `_ExpectedFailure` and starts just setting `__unittest_expecting_failure__` on the test method. The full discussion on that is https://bugs.python.org/issue16997, especially starting around [msg183450](https://bugs.python.org/issue16997#msg183450) https://github.com/llvm/llvm-project/pull/73067 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Remove `reason` from `unittest2.expectedFailure` usage (PR #73028)
rupprecht wrote: > I suppose we don't really lose anything by moving away from `expectedFailure` > from decorators? > Someone filed a FR ages ago for the standard unittest to take a reason for xfail: https://bugs.python.org/issue12681 tl;dr good idea but that ship has sailed. So, this PR isn't really "better", it's just more compatible. > Is it worth deleting the custom decorator that we have as well? 😄 Yeah, it's not holding its own weight. Tests can just write `import unittest; @unittest.expectedFailure`. I'll update the PR later today. https://github.com/llvm/llvm-project/pull/73028 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libc] [clang] [libcxx] [flang] [compiler-rt] [lldb] [llvm] [clang-tools-extra] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)
jyknight wrote: I guess I'd consider the "mental model" here to be that (notionally) `#embed` is preprocessed by expanding to `#embed_base64`, which is handled by the compiler proper, not the preprocessor. Yes, that's not entirely true in the implementation, but it seems like a reasonable way to think about it. (similar in feel to `#pragma` which is also not purely preprocessor, despite starting with `#`.) https://github.com/llvm/llvm-project/pull/68620 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [mostly NFC] Large WP foundation: WatchpointResources (PR #68845)
dyung wrote: > Seems that it caused #73580 no? I believe so. @jasonmolenda I see you attempted to make a fix in a0a1ff3ab40e347589b4e27d8fd350c600526735, however I still have two buildbots that are failing to build. Can you either fix it or revert if you need time to investigate? https://lab.llvm.org/buildbot/#/builders/217/builds/31915 https://lab.llvm.org/buildbot/#/builders/243/builds/16118 https://github.com/llvm/llvm-project/pull/68845 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -194,6 +192,54 @@ class CompilerType { bool IsTypedefType() const; bool IsVoidType() const; + + bool IsSmartPtrType() const; + + bool IsInteger() const; + + bool IsFloat() const; + + bool IsEnumerationType() const; + + bool IsUnscopedEnumerationType() const; + + bool IsIntegerOrUnscopedEnumerationType() const; + + bool IsSigned() const; + + bool IsNullPtrType() const; + + bool IsBoolean() const; + + bool IsEnumerationIntegerTypeSigned() const; + + bool IsScalarOrUnscopedEnumerationType() const; + + bool IsPromotableIntegerType() const; + + bool IsPointerToVoid() const; + + bool IsRecordType() const; + + bool IsVirtualBase(CompilerType target_base, CompilerType *virtual_base, + bool carry_virtual = false) const; + + bool IsContextuallyConvertibleToBool() const; adrian-prantl wrote: This seems extremely specific to the C language family. I don't think that's a problem, but it would be nice to at least document that this may be only defined in TypeSystemClang? https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -194,6 +192,54 @@ class CompilerType { bool IsTypedefType() const; bool IsVoidType() const; + + bool IsSmartPtrType() const; + + bool IsInteger() const; + + bool IsFloat() const; + + bool IsEnumerationType() const; + + bool IsUnscopedEnumerationType() const; + + bool IsIntegerOrUnscopedEnumerationType() const; + + bool IsSigned() const; + + bool IsNullPtrType() const; + + bool IsBoolean() const; + + bool IsEnumerationIntegerTypeSigned() const; + + bool IsScalarOrUnscopedEnumerationType() const; + + bool IsPromotableIntegerType() const; + + bool IsPointerToVoid() const; + + bool IsRecordType() const; + + bool IsVirtualBase(CompilerType target_base, CompilerType *virtual_base, + bool carry_virtual = false) const; + + bool IsContextuallyConvertibleToBool() const; + + bool IsBasicType() const; + + std::string TypeDescription(); + + bool CompareTypes(CompilerType rhs) const; + + const char *GetTypeTag(); + + uint32_t GetNumberOfNonEmptyBaseClasses(); + + CompilerType GetTemplateArgumentType(uint32_t idx); + + CompilerType GetSmartPtrPointeeType(); adrian-prantl wrote: There seems to be some overlap between this and the C++ shared_ptr synthetic child provider. I think it would be good if either the formatter uses this functionality or if the intended user of this function uses the synthetic children instead. https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
@@ -194,6 +192,54 @@ class CompilerType { bool IsTypedefType() const; bool IsVoidType() const; + + bool IsSmartPtrType() const; adrian-prantl wrote: Some methods like this one could benefit from a Doxygen comment that explains what the semantics are. https://github.com/llvm/llvm-project/pull/73472 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)
petrhosek wrote: Can we add back the constant to the declaration? It's been a week and the progress on #72730 seems to have stalled while our builders are still broken. https://github.com/llvm/llvm-project/pull/71780 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] a6c62bf - [lldb] try to fix build on linux after fc6b72523f3d7
Author: Nico Weber Date: 2023-11-28T08:53:05+09:00 New Revision: a6c62bf1a4717accc852463b664cd1012237d334 URL: https://github.com/llvm/llvm-project/commit/a6c62bf1a4717accc852463b664cd1012237d334 DIFF: https://github.com/llvm/llvm-project/commit/a6c62bf1a4717accc852463b664cd1012237d334.diff LOG: [lldb] try to fix build on linux after fc6b72523f3d7 Tries to fix: ../../lldb/source/Breakpoint/WatchpointResource.cpp:59:12: error: no member named 'find' in namespace 'std'; did you mean 'fill'? std::find(m_constituents.begin(), m_constituents.end(), wp_sp); ~^~~~ fill Added: Modified: lldb/source/Breakpoint/WatchpointResource.cpp Removed: diff --git a/lldb/source/Breakpoint/WatchpointResource.cpp b/lldb/source/Breakpoint/WatchpointResource.cpp index 4b8fbe42c865e25..d0f8dc346f3c024 100644 --- a/lldb/source/Breakpoint/WatchpointResource.cpp +++ b/lldb/source/Breakpoint/WatchpointResource.cpp @@ -10,6 +10,8 @@ #include "lldb/Breakpoint/WatchpointResource.h" +#include + using namespace lldb; using namespace lldb_private; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Respect the DW_AT_alignment attribute. (PR #73307)
@@ -1926,12 +1930,13 @@ DWARFASTParserClang::ParseStructureLikeDIE(const SymbolContext &sc, // TypeSystemClang is always in C++ mode, but some compilers such as // GCC and Clang give empty structs a size of 0 in C mode (in contrast to // the size of 1 for empty structs that would be computed in C++ mode). - if (attrs.byte_size) { + if (attrs.byte_size || attrs.alignment) { clang::RecordDecl *record_decl = TypeSystemClang::GetAsRecordDecl(clang_type); if (record_decl) { ClangASTImporter::LayoutInfo layout; - layout.bit_size = *attrs.byte_size * 8; + layout.bit_size = attrs.byte_size.value_or(0) * 8; + layout.alignment = attrs.alignment.value_or(0) * 8; clayborg wrote: This looks fine to me. If we have a byte size computed by clang, it was always using it and it helped with C structs being computed in a C++ type system when the size was zero or 1. Now we will also respect the alignment. Also the ClangASTImporter::LayoutInfo::bit_size is initialized to zero in the header file, so even though we will make it into this case now if we have only alignment,it shouldn't change anything AFAIK. https://github.com/llvm/llvm-project/pull/73307 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Respect the DW_AT_alignment attribute. (PR #73307)
https://github.com/clayborg edited https://github.com/llvm/llvm-project/pull/73307 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Respect the DW_AT_alignment attribute. (PR #73307)
https://github.com/clayborg approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/73307 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)
https://github.com/mdko created https://github.com/llvm/llvm-project/pull/73596 We'd like a way to select the current thread by its thread ID (rather than its internal LLDB thread index). This PR adds a `-t` option (`--thread_id` long option) that tells the `thread select` command to interpret the `` argument as a thread ID. Here's an example of it working: ``` michristensen@devbig356 llvm/llvm-project (thread-select-tid) » ../Debug/bin/lldb ~/scratch/cpp/threading/a.out (lldb) target create "/home/michristensen/scratch/cpp/threading/a.out" Current executable set to '/home/michristensen/scratch/cpp/threading/a.out' (x86_64). (lldb) b 18 Breakpoint 1: where = a.out`main + 80 at main.cpp:18:12, address = 0x0850 (lldb) run Process 215715 launched: '/home/michristensen/scratch/cpp/threading/a.out' (x86_64) This is a thread, i=1 This is a thread, i=2 This is a thread, i=3 This is a thread, i=4 This is a thread, i=5 Process 215715 stopped * thread #1, name = 'a.out', stop reason = breakpoint 1.1 frame #0: 0x55400850 a.out`main at main.cpp:18:12 15 for (int i = 0; i < 5; i++) { 16 pthread_create(&thread_ids[i], NULL, foo, NULL); 17 } -> 18 for (int i = 0; i < 5; i++) { 19 pthread_join(thread_ids[i], NULL); 20 } 21 return 0; (lldb) thread select 2 * thread #2, name = 'a.out' frame #0: 0x768f9918 libc.so.6`__nanosleep + 72 libc.so.6`__nanosleep: -> 0x768f9918 <+72>: cmpq $-0x1000, %rax ; imm = 0xF000 0x768f991e <+78>: ja 0x768f9952 ; <+130> 0x768f9920 <+80>: movl %edx, %edi 0x768f9922 <+82>: movl %eax, 0xc(%rsp) (lldb) thread info thread #2: tid = 216047, 0x768f9918 libc.so.6`__nanosleep + 72, name = 'a.out' (lldb) thread list Process 215715 stopped thread #1: tid = 215715, 0x55400850 a.out`main at main.cpp:18:12, name = 'a.out', stop reason = breakpoint 1.1 * thread #2: tid = 216047, 0x768f9918 libc.so.6`__nanosleep + 72, name = 'a.out' thread #3: tid = 216048, 0x768f9918 libc.so.6`__nanosleep + 72, name = 'a.out' thread #4: tid = 216049, 0x768f9918 libc.so.6`__nanosleep + 72, name = 'a.out' thread #5: tid = 216050, 0x768f9918 libc.so.6`__nanosleep + 72, name = 'a.out' thread #6: tid = 216051, 0x768f9918 libc.so.6`__nanosleep + 72, name = 'a.out' (lldb) thread select 215715 error: invalid thread #215715. (lldb) thread select -t 215715 * thread #1, name = 'a.out', stop reason = breakpoint 1.1 frame #0: 0x55400850 a.out`main at main.cpp:18:12 15 for (int i = 0; i < 5; i++) { 16 pthread_create(&thread_ids[i], NULL, foo, NULL); 17 } -> 18 for (int i = 0; i < 5; i++) { 19 pthread_join(thread_ids[i], NULL); 20 } 21 return 0; (lldb) thread select -t 216051 * thread #6, name = 'a.out' frame #0: 0x768f9918 libc.so.6`__nanosleep + 72 libc.so.6`__nanosleep: -> 0x768f9918 <+72>: cmpq $-0x1000, %rax ; imm = 0xF000 0x768f991e <+78>: ja 0x768f9952 ; <+130> 0x768f9920 <+80>: movl %edx, %edi 0x768f9922 <+82>: movl %eax, 0xc(%rsp) (lldb) thread select 3 * thread #3, name = 'a.out' frame #0: 0x768f9918 libc.so.6`__nanosleep + 72 libc.so.6`__nanosleep: -> 0x768f9918 <+72>: cmpq $-0x1000, %rax ; imm = 0xF000 0x768f991e <+78>: ja 0x768f9952 ; <+130> 0x768f9920 <+80>: movl %edx, %edi 0x768f9922 <+82>: movl %eax, 0xc(%rsp) (lldb) thread select -t 216048 * thread #3, name = 'a.out' frame #0: 0x768f9918 libc.so.6`__nanosleep + 72 libc.so.6`__nanosleep: -> 0x768f9918 <+72>: cmpq $-0x1000, %rax ; imm = 0xF000 0x768f991e <+78>: ja 0x768f9952 ; <+130> 0x768f9920 <+80>: movl %edx, %edi 0x768f9922 <+82>: movl %eax, 0xc(%rsp) (lldb) thread select --thread_id 216048 * thread #3, name = 'a.out' frame #0: 0x768f9918 libc.so.6`__nanosleep + 72 libc.so.6`__nanosleep: -> 0x768f9918 <+72>: cmpq $-0x1000, %rax ; imm = 0xF000 0x768f991e <+78>: ja 0x768f9952 ; <+130> 0x768f9920 <+80>: movl %edx, %edi 0x768f9922 <+82>: movl %eax, 0xc(%rsp) (lldb) help thread select Change the currently selected thread. Syntax: thread select Command Options Usage: thread select [-t] -t ( --thread_id ) Provide a thread ID instead of a thread index. This command takes options and free-form arguments. If your arguments resemble option specifiers (i.e., they start with a - or --), you must use ' -- ' between the end of the command options and the beginning of the arguments. (lldb) c Process 215715 resuming Process 215715 exited with status = 0 (0x) ``` >From 97a6e23c85457a14c91c5800fa03bb872e6f1fa6 Mon Sep 17 00:00:00 2001 From: Michael Christensen Date: Mon, 27 Nov 2023 12:49:24 -0800 Subject: [PATCH] Add option to pass thread ID to t
[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)
mdko wrote: CC @jeffreytan81 @clayborg https://github.com/llvm/llvm-project/pull/73596 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Michael Christensen (mdko) Changes We'd like a way to select the current thread by its thread ID (rather than its internal LLDB thread index). This PR adds a `-t` option (`--thread_id` long option) that tells the `thread select` command to interpret the `` argument as a thread ID. Here's an example of it working: ``` michristensen@devbig356 llvm/llvm-project (thread-select-tid) » ../Debug/bin/lldb ~/scratch/cpp/threading/a.out (lldb) target create "/home/michristensen/scratch/cpp/threading/a.out" Current executable set to '/home/michristensen/scratch/cpp/threading/a.out' (x86_64). (lldb) b 18 Breakpoint 1: where = a.out`main + 80 at main.cpp:18:12, address = 0x0850 (lldb) run Process 215715 launched: '/home/michristensen/scratch/cpp/threading/a.out' (x86_64) This is a thread, i=1 This is a thread, i=2 This is a thread, i=3 This is a thread, i=4 This is a thread, i=5 Process 215715 stopped * thread #1, name = 'a.out', stop reason = breakpoint 1.1 frame #0: 0x55400850 a.out`main at main.cpp:18:12 15 for (int i = 0; i < 5; i++) { 16 pthread_create(&thread_ids[i], NULL, foo, NULL); 17 } -> 18 for (int i = 0; i < 5; i++) { 19 pthread_join(thread_ids[i], NULL); 20 } 21 return 0; (lldb) thread select 2 * thread #2, name = 'a.out' frame #0: 0x768f9918 libc.so.6`__nanosleep + 72 libc.so.6`__nanosleep: -> 0x768f9918 <+72>: cmpq $-0x1000, %rax ; imm = 0xF000 0x768f991e <+78>: ja 0x768f9952 ; <+130> 0x768f9920 <+80>: movl %edx, %edi 0x768f9922 <+82>: movl %eax, 0xc(%rsp) (lldb) thread info thread #2: tid = 216047, 0x768f9918 libc.so.6`__nanosleep + 72, name = 'a.out' (lldb) thread list Process 215715 stopped thread #1: tid = 215715, 0x55400850 a.out`main at main.cpp:18:12, name = 'a.out', stop reason = breakpoint 1.1 * thread #2: tid = 216047, 0x768f9918 libc.so.6`__nanosleep + 72, name = 'a.out' thread #3: tid = 216048, 0x768f9918 libc.so.6`__nanosleep + 72, name = 'a.out' thread #4: tid = 216049, 0x768f9918 libc.so.6`__nanosleep + 72, name = 'a.out' thread #5: tid = 216050, 0x768f9918 libc.so.6`__nanosleep + 72, name = 'a.out' thread #6: tid = 216051, 0x768f9918 libc.so.6`__nanosleep + 72, name = 'a.out' (lldb) thread select 215715 error: invalid thread #215715. (lldb) thread select -t 215715 * thread #1, name = 'a.out', stop reason = breakpoint 1.1 frame #0: 0x55400850 a.out`main at main.cpp:18:12 15 for (int i = 0; i < 5; i++) { 16 pthread_create(&thread_ids[i], NULL, foo, NULL); 17 } -> 18 for (int i = 0; i < 5; i++) { 19 pthread_join(thread_ids[i], NULL); 20 } 21 return 0; (lldb) thread select -t 216051 * thread #6, name = 'a.out' frame #0: 0x768f9918 libc.so.6`__nanosleep + 72 libc.so.6`__nanosleep: -> 0x768f9918 <+72>: cmpq $-0x1000, %rax ; imm = 0xF000 0x768f991e <+78>: ja 0x768f9952 ; <+130> 0x768f9920 <+80>: movl %edx, %edi 0x768f9922 <+82>: movl %eax, 0xc(%rsp) (lldb) thread select 3 * thread #3, name = 'a.out' frame #0: 0x768f9918 libc.so.6`__nanosleep + 72 libc.so.6`__nanosleep: -> 0x768f9918 <+72>: cmpq $-0x1000, %rax ; imm = 0xF000 0x768f991e <+78>: ja 0x768f9952 ; <+130> 0x768f9920 <+80>: movl %edx, %edi 0x768f9922 <+82>: movl %eax, 0xc(%rsp) (lldb) thread select -t 216048 * thread #3, name = 'a.out' frame #0: 0x768f9918 libc.so.6`__nanosleep + 72 libc.so.6`__nanosleep: -> 0x768f9918 <+72>: cmpq $-0x1000, %rax ; imm = 0xF000 0x768f991e <+78>: ja 0x768f9952 ; <+130> 0x768f9920 <+80>: movl %edx, %edi 0x768f9922 <+82>: movl %eax, 0xc(%rsp) (lldb) thread select --thread_id 216048 * thread #3, name = 'a.out' frame #0: 0x768f9918 libc.so.6`__nanosleep + 72 libc.so.6`__nanosleep: -> 0x768f9918 <+72>: cmpq $-0x1000, %rax ; imm = 0xF000 0x768f991e <+78>: ja 0x768f9952 ; <+130> 0x768f9920 <+80>: movl %edx, %edi 0x768f9922 <+82>: movl %eax, 0xc(%rsp) (lldb) help thread select Change the currently selected thread. Syntax: thread select Command Options Usage: thread select [-t] -t ( --thread_id ) Provide a thread ID instead of a thread index. This command takes options and free-form arguments. If your arguments resemble option specifiers (i.e., they start with a - or --), you must use ' -- ' between the end of the command options and the beginning of the arguments. (lldb) c Process 215715 resuming Process 215715 exited with status = 0 (0x) ``` --- Full diff: https://github.com/llvm/llvm-project/pull/73596.diff 3 Files Affected: - (modified) lldb/source/Command
[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 67268da61aa2f8b24172907ee6f8d9250ee18b65 97a6e23c85457a14c91c5800fa03bb872e6f1fa6 -- lldb/source/Commands/CommandObjectThread.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index 9384df319c..cbd87d2607 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -1227,9 +1227,9 @@ protected: Thread *new_thread = nullptr; if (m_options.m_thread_id) { -new_thread = process->GetThreadList().FindThreadByID(index_id).get(); + new_thread = process->GetThreadList().FindThreadByID(index_id).get(); } else { -new_thread = process->GetThreadList().FindThreadByIndexID(index_id).get(); + new_thread = process->GetThreadList().FindThreadByIndexID(index_id).get(); } if (new_thread == nullptr) { result.AppendErrorWithFormat("invalid thread %s%s.\n", `` https://github.com/llvm/llvm-project/pull/73596 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)
jimingham wrote: I would prefer you make the `-t` an option with a value, rather than a flag saying what the argument means. It makes the completer much easier to hook up since the option value can complete against the native thread ID's, and the argument complete against thread indexes. You CAN write completers that look at the whole line, check what options are provided and complete based on that. `break set` does this for `break set -n Foo -s libmylib.dylib` if you want to have a look at that. But otherwise, making the option have a value will be more straightforward. https://github.com/llvm/llvm-project/pull/73596 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][progress] Always report progress upon Progress object destruction (PR #73605)
https://github.com/chelcassanova created https://github.com/llvm/llvm-project/pull/73605 This commit allows a final progress report upon the destruction of the `Progress` object to happen at all times as opposed to when the progress was not completed. >From 8c29a2034a57174ec68f8c1f1a2c5c66a7988762 Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova Date: Mon, 27 Nov 2023 15:42:13 -0800 Subject: [PATCH] [lldb][progress] Always report progress upon Progress object destruction This commit allows a final progress report upon the destruction of the `Progress` object to happen at all times as opposed to when the progress was not completed --- lldb/source/Core/Progress.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp index 08be73f1470f349..eee4d3955154ba9 100644 --- a/lldb/source/Core/Progress.cpp +++ b/lldb/source/Core/Progress.cpp @@ -32,8 +32,8 @@ Progress::~Progress() { std::lock_guard guard(m_mutex); if (!m_completed) { m_completed = m_total; -ReportProgress(); } + ReportProgress(); } void Progress::Increment(uint64_t amount, std::string update) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][progress] Always report progress upon Progress object destruction (PR #73605)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Chelsea Cassanova (chelcassanova) Changes This commit allows a final progress report upon the destruction of the `Progress` object to happen at all times as opposed to when the progress was not completed. --- Full diff: https://github.com/llvm/llvm-project/pull/73605.diff 1 Files Affected: - (modified) lldb/source/Core/Progress.cpp (+1-1) ``diff diff --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp index 08be73f1470f349..eee4d3955154ba9 100644 --- a/lldb/source/Core/Progress.cpp +++ b/lldb/source/Core/Progress.cpp @@ -32,8 +32,8 @@ Progress::~Progress() { std::lock_guard guard(m_mutex); if (!m_completed) { m_completed = m_total; -ReportProgress(); } + ReportProgress(); } void Progress::Increment(uint64_t amount, std::string update) { `` https://github.com/llvm/llvm-project/pull/73605 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][progress] Always report progress upon Progress object destruction (PR #73605)
https://github.com/medismailben edited https://github.com/llvm/llvm-project/pull/73605 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][progress] Always report progress upon Progress object destruction (PR #73605)
https://github.com/medismailben approved this pull request. LGTM with comment. https://github.com/llvm/llvm-project/pull/73605 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][progress] Always report progress upon Progress object destruction (PR #73605)
@@ -32,8 +32,8 @@ Progress::~Progress() { std::lock_guard guard(m_mutex); if (!m_completed) { m_completed = m_total; -ReportProgress(); } medismailben wrote: Remove the braces: https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements https://github.com/llvm/llvm-project/pull/73605 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Remove `reason` from `unittest2.expectedFailure` usage (PR #73028)
https://github.com/rupprecht updated https://github.com/llvm/llvm-project/pull/73028 >From a0805cfc2b2b1c84d58c0551ccf1acfaf2326a4a Mon Sep 17 00:00:00 2001 From: Jordan Rupprecht Date: Tue, 21 Nov 2023 11:38:43 -0800 Subject: [PATCH 1/3] [lldb][test] Remove `reason` from `unittest2.expectedFailure` usage When switching to the standard `unittest` library, various unittests fail because we provide a "bugnumber" (a github issue/rdar link), but there is no longer a way to provide an xfail reason. See: https://docs.python.org/3/library/unittest.html?highlight=unittest#unittest.expectedFailure --- .../API/functionalities/jitloader_gdb/TestJITLoaderGDB.py | 2 +- .../API/functionalities/thread/state/TestThreadStates.py | 4 ++-- lldb/test/API/lang/c/shared_lib/TestSharedLib.py | 2 +- .../TestSharedLibStrippedSymbols.py | 2 +- lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py | 8 .../TestCppReferenceToOuterClass.py | 2 +- lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py b/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py index e93f566ea7ea63c..409dcf8e19d383b 100644 --- a/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py +++ b/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py @@ -13,7 +13,7 @@ class JITLoaderGDBTestCase(TestBase): lambda: "Skipped because the test crashes the test runner", bugnumber="llvm.org/pr24702", ) -@expectedFailure("llvm.org/pr24702") +@expectedFailure # llvm.org/pr24702 def test_bogus_values(self): """Test that we handle inferior misusing the GDB JIT interface""" self.build() diff --git a/lldb/test/API/functionalities/thread/state/TestThreadStates.py b/lldb/test/API/functionalities/thread/state/TestThreadStates.py index ad1edff6ae3f354..8e937d6c22a6758 100644 --- a/lldb/test/API/functionalities/thread/state/TestThreadStates.py +++ b/lldb/test/API/functionalities/thread/state/TestThreadStates.py @@ -40,14 +40,14 @@ def test_state_after_continue(self): @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24660") @expectedFailureNetBSD # thread states not properly maintained -@expectedFailure("llvm.org/pr16712") +@expectedFailure # llvm.org/pr16712 def test_state_after_expression(self): """Test thread state after expression.""" self.build() self.thread_state_after_expression_test() # thread states not properly maintained -@expectedFailure("llvm.org/pr15824 and ") +@expectedFailure # llvm.org/pr15824 and @expectedFailureAll( oslist=["windows"], bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly", diff --git a/lldb/test/API/lang/c/shared_lib/TestSharedLib.py b/lldb/test/API/lang/c/shared_lib/TestSharedLib.py index b375aa6a86e14fb..39f5a144703763e 100644 --- a/lldb/test/API/lang/c/shared_lib/TestSharedLib.py +++ b/lldb/test/API/lang/c/shared_lib/TestSharedLib.py @@ -34,7 +34,7 @@ def test_expr_no_preload(self): """Test that types work when defined in a shared library and forward-declared in the main executable, but with preloading disabled""" self.common_test_expr(False) -@expectedFailure("llvm.org/PR36712") +@expectedFailure # llvm.org/PR36712 def test_frame_variable(self): """Test that types work when defined in a shared library and forward-declared in the main executable""" self.build() diff --git a/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py b/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py index f7035edddaf09b8..5fd6cc1a3172f48 100644 --- a/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py +++ b/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py @@ -27,7 +27,7 @@ def test_expr(self): ) @expectedFailureAll(oslist=["windows"]) -@expectedFailure("llvm.org/PR36712") +@expectedFailure # llvm.org/PR36712 def test_frame_variable(self): """Test that types work when defined in a shared library and forward-declared in the main executable""" self.build() diff --git a/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py b/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py index f88667b9dfa2ae9..1803fdcd4d87956 100644 --- a/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py +++ b/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py @@ -40,7 +40,7 @@ def runToBkpt(self, command): ) @skipIfWindows # This is flakey on Windows: llvm.org/pr38373 -@expectedFailure("CU-local objects incorrectly scoped") +@expectedFailure # CU-local objects incorrectly scoped def test_scope_lookup_with_ru
[Lldb-commits] [lldb] [LLDB] Respect the DW_AT_alignment attribute. (PR #73307)
@@ -1926,12 +1930,13 @@ DWARFASTParserClang::ParseStructureLikeDIE(const SymbolContext &sc, // TypeSystemClang is always in C++ mode, but some compilers such as // GCC and Clang give empty structs a size of 0 in C mode (in contrast to // the size of 1 for empty structs that would be computed in C++ mode). - if (attrs.byte_size) { + if (attrs.byte_size || attrs.alignment) { Michael137 wrote: This comment is now out-of-date. Can you briefly update it to reflect the newest changes? I.e., that this is also used for setting alignment on empty classes? https://github.com/llvm/llvm-project/pull/73307 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)
Michael137 wrote: > Can we add back the constant to the declaration? It's been a week and the > progress on #72730 seems to have stalled while our builders are still broken. Yup will do, apologies for the noise https://github.com/llvm/llvm-project/pull/71780 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits