[Lldb-commits] [lldb] [lldb] Additional pieces towards OpenBSD support (PR #74198)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/74198 >From 3ae1151d6bea76543b79f1d32dfbbe571ed97fdc Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sat, 2 Dec 2023 10:20:48 -0500 Subject: [PATCH] [lldb] Additional pieces towards OpenBSD support --- lldb/source/Core/FormatEntity.cpp | 7 --- lldb/source/Host/common/SocketAddress.cpp | 6 -- lldb/source/Host/posix/DomainSocket.cpp| 3 ++- lldb/source/Initialization/SystemInitializerCommon.cpp | 6 -- .../Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp| 1 + .../DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp| 3 ++- lldb/test/API/api/multithreaded/common.h | 3 ++- lldb/test/API/tools/lldb-server/thread-name/main.cpp | 5 + 8 files changed, 24 insertions(+), 10 deletions(-) diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index d8047b4242065..94986457552d9 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -1245,9 +1245,10 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, llvm::Triple::OSType ostype = arch.IsValid() ? arch.GetTriple().getOS() : llvm::Triple::UnknownOS; -if ((ostype == llvm::Triple::FreeBSD) || -(ostype == llvm::Triple::Linux) || -(ostype == llvm::Triple::NetBSD)) { +if (ostype == llvm::Triple::FreeBSD || +ostype == llvm::Triple::Linux || +ostype == llvm::Triple::NetBSD || +ostype == llvm::Triple::OpenBSD) { format = "%" PRIu64; } } else { diff --git a/lldb/source/Host/common/SocketAddress.cpp b/lldb/source/Host/common/SocketAddress.cpp index 3f47d32d4652d..6a23c633e54bf 100644 --- a/lldb/source/Host/common/SocketAddress.cpp +++ b/lldb/source/Host/common/SocketAddress.cpp @@ -113,7 +113,8 @@ static socklen_t GetFamilyLength(sa_family_t family) { } socklen_t SocketAddress::GetLength() const { -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ +defined(__OpenBSD__) return m_socket_addr.sa.sa_len; #else return GetFamilyLength(GetFamily()); @@ -128,7 +129,8 @@ sa_family_t SocketAddress::GetFamily() const { void SocketAddress::SetFamily(sa_family_t family) { m_socket_addr.sa.sa_family = family; -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ +defined(__OpenBSD__) m_socket_addr.sa.sa_len = GetFamilyLength(family); #endif } diff --git a/lldb/source/Host/posix/DomainSocket.cpp b/lldb/source/Host/posix/DomainSocket.cpp index ddbd983abb81d..9b44c2a8368ed 100644 --- a/lldb/source/Host/posix/DomainSocket.cpp +++ b/lldb/source/Host/posix/DomainSocket.cpp @@ -48,7 +48,8 @@ static bool SetSockAddr(llvm::StringRef name, const size_t name_offset, saddr_un_len = offsetof(struct sockaddr_un, sun_path) + name_offset + name.size(); -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ +defined(__OpenBSD__) saddr_un->sun_len = saddr_un_len; #endif diff --git a/lldb/source/Initialization/SystemInitializerCommon.cpp b/lldb/source/Initialization/SystemInitializerCommon.cpp index 40e54cd7f0e09..1a172a95aa147 100644 --- a/lldb/source/Initialization/SystemInitializerCommon.cpp +++ b/lldb/source/Initialization/SystemInitializerCommon.cpp @@ -18,7 +18,8 @@ #include "lldb/Utility/Timer.h" #include "lldb/Version/Version.h" -#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ +defined(__OpenBSD__) #include "Plugins/Process/POSIX/ProcessPOSIXLog.h" #endif @@ -77,7 +78,8 @@ llvm::Error SystemInitializerCommon::Initialize() { process_gdb_remote::ProcessGDBRemoteLog::Initialize(); -#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ +defined(__OpenBSD__) ProcessPOSIXLog::Initialize(); #endif #if defined(_WIN32) diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp index a0b6f44bed0e7..1a9c4593b1b4f 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp @@ -549,6 +549,7 @@ bool DYLDRendezvous::SOEntryIsMainExecutable(const SOEntry &entry) { switch (triple.getOS()) { case llvm::Triple::FreeBSD: case llvm::Triple::NetBSD: +
[Lldb-commits] [lldb] [lldb] colorize symbols in image lookup with a regex pattern (PR #69422)
=?utf-8?q?José?= L. Junior ,taalhaataahir0102 <23100...@lums.edu.pk>,taalhaataahir0102 <23100...@lums.edu.pk>,taalhaataahir0102 <23100...@lums.edu.pk>,taalhaataahir0102 <23100...@lums.edu.pk> Message-ID: In-Reply-To: https://github.com/taalhaataahir0102 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/6] [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 b19e694427546..c3f2832be424e 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 44a2d560010fe..0e41cd95e0ef1 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 b0f5ffead2a16..9567c3f4384c1 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 1a5fd343e4df0..8e3fd48dfe705 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. + /// + /// \par
[Lldb-commits] [lldb] [lldb] colorize symbols in image lookup with a regex pattern (PR #69422)
=?utf-8?q?Jos=C3=A9?= L. Junior ,taalhaataahir0102 <23100...@lums.edu.pk>,taalhaataahir0102 <23100...@lums.edu.pk>,taalhaataahir0102 <23100...@lums.edu.pk>,taalhaataahir0102 <23100...@lums.edu.pk> Message-ID: In-Reply-To: taalhaataahir0102 wrote: Hi @JDevlieghere! did you got a chance to look at the code 🙂 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