[Lldb-commits] [lldb] 8b62114 - [lldb] Delete unused lldbutil.print_registers (NFC)
Author: Dave Lee Date: 2025-01-25T09:39:10-08:00 New Revision: 8b6211472793680994f7bc15abb5910d0a916cc5 URL: https://github.com/llvm/llvm-project/commit/8b6211472793680994f7bc15abb5910d0a916cc5 DIFF: https://github.com/llvm/llvm-project/commit/8b6211472793680994f7bc15abb5910d0a916cc5.diff LOG: [lldb] Delete unused lldbutil.print_registers (NFC) Added: Modified: lldb/packages/Python/lldbsuite/test/lldbutil.py lldb/test/API/macosx/universal/TestUniversal.py Removed: diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index 07b5f8cc7d900b..ef068cf7f9ed10 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1353,33 +1353,6 @@ def get_args_as_string(frame, showFuncName=True): return "(%s)" % (", ".join(args)) -def print_registers(frame, string_buffer=False): -"""Prints all the register sets of the frame.""" - -output = io.StringIO() if string_buffer else sys.stdout - -print("Register sets for " + str(frame), file=output) - -registerSet = frame.GetRegisters() # Return type of SBValueList. -print( -"Frame registers (size of register set = %d):" % registerSet.GetSize(), -file=output, -) -for value in registerSet: -# print(value, file=output) -print( -"%s (number of children = %d):" % (value.GetName(), value.GetNumChildren()), -file=output, -) -for child in value: -print( -"Name: %s, Value: %s" % (child.GetName(), child.GetValue()), file=output -) - -if string_buffer: -return output.getvalue() - - def get_registers(frame, kind): """Returns the registers given the frame and the kind of registers desired. diff --git a/lldb/test/API/macosx/universal/TestUniversal.py b/lldb/test/API/macosx/universal/TestUniversal.py index aecc8814b377eb..3c043df641978c 100644 --- a/lldb/test/API/macosx/universal/TestUniversal.py +++ b/lldb/test/API/macosx/universal/TestUniversal.py @@ -57,8 +57,6 @@ def test_sbdebugger_create_target_with_file_and_target_triple(self): @skipIf(compiler="clang", compiler_version=["<", "7.0"]) def test_process_launch_for_universal(self): """Test process launch of a universal binary.""" -from lldbsuite.test.lldbutil import print_registers - if not haswellOrLater(): return ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] aba0476 - [lldb] Delete lldbutil.PrintableRegex (NFC)
Author: Dave Lee Date: 2025-01-25T09:58:52-08:00 New Revision: aba0476f23fc2a851792e9d85c25ee34a5ea7ed0 URL: https://github.com/llvm/llvm-project/commit/aba0476f23fc2a851792e9d85c25ee34a5ea7ed0 DIFF: https://github.com/llvm/llvm-project/commit/aba0476f23fc2a851792e9d85c25ee34a5ea7ed0.diff LOG: [lldb] Delete lldbutil.PrintableRegex (NFC) Use of this class wasn't making use of the original regex string. Note that `re.Pattern` has a `pattern` property to access the original regex. Added: Modified: lldb/packages/Python/lldbsuite/test/lldbutil.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py Removed: diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index ef068cf7f9ed10..27e00400343709 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1578,21 +1578,6 @@ def set_actions_for_signal( ) -class PrintableRegex(object): -def __init__(self, text): -self.regex = re.compile(text) -self.text = text - -def match(self, str): -return self.regex.match(str) - -def __str__(self): -return "%s" % (self.text) - -def __repr__(self): -return "re.compile(%s) -> %s" % (self.text, self.regex) - - def skip_if_callable(test, mycallable, reason): if callable(mycallable): if mycallable(test): diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py index 241226d50df80d..c6592ede03147c 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py @@ -2,6 +2,7 @@ Test lldb data formatter subsystem. """ +import re import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * @@ -30,9 +31,7 @@ def test(self): self.runCmd("run", RUN_SUCCEEDED) -lldbutil.skip_if_library_missing( -self, self.target(), lldbutil.PrintableRegex("libc\+\+") -) +lldbutil.skip_if_library_missing(self, self.target(), re.compile(r"libc\+\+")) # The stop reason of the thread should be breakpoint. self.expect( diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py index 93d5392830b508..b8a1dd3569d778 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py @@ -3,6 +3,7 @@ """ +import re import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * @@ -24,9 +25,7 @@ def test(self): self.runCmd("run", RUN_SUCCEEDED) -lldbutil.skip_if_library_missing( -self, self.target(), lldbutil.PrintableRegex("libc\+\+") -) +lldbutil.skip_if_library_missing(self, self.target(), re.compile(r"libc\+\+")) # The stop reason of the thread should be breakpoint. self.expect( ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Android 9 has added the spawn.h header (PR #124452)
https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/124452 None >From 2f773af320b8a32f0082a35392076d5a0d72e0b0 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 26 Jan 2025 02:28:39 -0500 Subject: [PATCH] [lldb] Android 9 has added the spawn.h header --- lldb/source/Host/common/Host.cpp | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index fdb623667bc251..eaba9995621f8a 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -26,10 +26,14 @@ #include #endif +#ifdef __ANDROID__ +include +#endif + #if defined(__linux__) || defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) || defined(__APPLE__) || \ defined(__NetBSD__) || defined(__OpenBSD__) || defined(__EMSCRIPTEN__) -#if !defined(__ANDROID__) +#if !defined(__ANDROID__) || __ANDROID_API__ >= 28 #include #endif #include ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Android 9 has added the spawn.h header (PR #124452)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Brad Smith (brad0) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/124452.diff 1 Files Affected: - (modified) lldb/source/Host/common/Host.cpp (+5-1) ``diff diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index fdb623667bc251..eaba9995621f8a 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -26,10 +26,14 @@ #include #endif +#ifdef __ANDROID__ +include +#endif + #if defined(__linux__) || defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) || defined(__APPLE__) || \ defined(__NetBSD__) || defined(__OpenBSD__) || defined(__EMSCRIPTEN__) -#if !defined(__ANDROID__) +#if !defined(__ANDROID__) || __ANDROID_API__ >= 28 #include #endif #include `` https://github.com/llvm/llvm-project/pull/124452 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Android 9 has added the spawn.h header (PR #124452)
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 753028bc81c1a556eaaaf45ac77ca0cf4c7a3b4a 2f773af320b8a32f0082a35392076d5a0d72e0b0 --extensions cpp -- lldb/source/Host/common/Host.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index eaba999562..035304f52c 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -27,7 +27,7 @@ #endif #ifdef __ANDROID__ -include +include #endif #if defined(__linux__) || defined(__FreeBSD__) || \ @@ -83,7 +83,7 @@ include #define _POSIX_SPAWN_DISABLE_ASLR 0x0100 #endif -extern "C" { +extern "C" { int __pthread_chdir(const char *path); int __pthread_fchdir(int fildes); } `` https://github.com/llvm/llvm-project/pull/124452 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Clean up Socket headers for Android (PR #124453)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Brad Smith (brad0) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/124453.diff 1 Files Affected: - (modified) lldb/source/Host/common/Socket.cpp (-10) ``diff diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp index 296c2273ba419c..f35e5ff43595be 100644 --- a/lldb/source/Host/common/Socket.cpp +++ b/lldb/source/Host/common/Socket.cpp @@ -40,16 +40,6 @@ #include "lldb/Host/linux/AbstractSocket.h" #endif -#ifdef __ANDROID__ -#include -#include -#include -#include -#include -#include -#include -#endif // __ANDROID__ - using namespace lldb; using namespace lldb_private; `` https://github.com/llvm/llvm-project/pull/124453 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Clean up Socket headers for Android (PR #124453)
https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/124453 None >From 105b1dc748e2f4209dbda01e6b8b8ebc66af4b12 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 26 Jan 2025 02:31:41 -0500 Subject: [PATCH] [lldb] Clean up Socket headers for Android --- lldb/source/Host/common/Socket.cpp | 10 -- 1 file changed, 10 deletions(-) diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp index 296c2273ba419c..f35e5ff43595be 100644 --- a/lldb/source/Host/common/Socket.cpp +++ b/lldb/source/Host/common/Socket.cpp @@ -40,16 +40,6 @@ #include "lldb/Host/linux/AbstractSocket.h" #endif -#ifdef __ANDROID__ -#include -#include -#include -#include -#include -#include -#include -#endif // __ANDROID__ - 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] Android 9 has added the spawn.h header (PR #124452)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/124452 >From ff82716a85fdbc2feb8c2940205cf47b6e5c992c Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 26 Jan 2025 02:28:39 -0500 Subject: [PATCH] [lldb] Android 9 has added the spawn.h header --- lldb/source/Host/common/Host.cpp | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index fdb623667bc251..8fffb8c1178360 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -26,10 +26,14 @@ #include #endif +#ifdef __ANDROID__ +#include +#endif + #if defined(__linux__) || defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) || defined(__APPLE__) || \ defined(__NetBSD__) || defined(__OpenBSD__) || defined(__EMSCRIPTEN__) -#if !defined(__ANDROID__) +#if !defined(__ANDROID__) || __ANDROID_API__ >= 28 #include #endif #include ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add Lexer (with tests) for DIL (Data Inspection Language). (PR #123521)
https://github.com/cmtice updated https://github.com/llvm/llvm-project/pull/123521 >From 468f73f8539dcb8addf8ed9618d9eb797dabbb01 Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Sun, 19 Jan 2025 09:15:34 -0800 Subject: [PATCH 1/3] [LLDB] Add Lexer (with tests) for DIL (Data Inspection Language). This adds the basic lexer, with unittests, for the Data Inspection Language (DIL) -- see https://discourse.llvm.org/t/rfc-data-inspection-language/69893 This version of the lexer only handles local variables and namespaces, and is designed to work with https://github.com/llvm/llvm-project/pull/120971. --- lldb/include/lldb/ValueObject/DILLexer.h | 156 ++ lldb/source/ValueObject/DILLexer.cpp | 205 +++ lldb/unittests/ValueObject/CMakeLists.txt| 1 + lldb/unittests/ValueObject/DILLexerTests.cpp | 193 + 4 files changed, 555 insertions(+) create mode 100644 lldb/include/lldb/ValueObject/DILLexer.h create mode 100644 lldb/source/ValueObject/DILLexer.cpp create mode 100644 lldb/unittests/ValueObject/DILLexerTests.cpp diff --git a/lldb/include/lldb/ValueObject/DILLexer.h b/lldb/include/lldb/ValueObject/DILLexer.h new file mode 100644 index 00..45c506b2f4106d --- /dev/null +++ b/lldb/include/lldb/ValueObject/DILLexer.h @@ -0,0 +1,156 @@ +//===-- DILLexer.h --*- 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 +// +//===--===// + +#ifndef LLDB_VALUEOBJECT_DILLEXER_H_ +#define LLDB_VALUEOBJECT_DILLEXER_H_ + +#include "llvm/ADT/StringRef.h" +#include +#include +#include +#include +#include + +namespace lldb_private { + +namespace dil { + +enum class TokenKind { + coloncolon, + eof, + identifier, + invalid, + kw_namespace, + l_paren, + none, + r_paren, + unknown, +}; + +/// Class defining the tokens generated by the DIL lexer and used by the +/// DIL parser. +class DILToken { +public: + DILToken(dil::TokenKind kind, std::string spelling, uint32_t start) + : m_kind(kind), m_spelling(spelling), m_start_pos(start) {} + + DILToken() : m_kind(dil::TokenKind::none), m_spelling(""), m_start_pos(0) {} + + void setKind(dil::TokenKind kind) { m_kind = kind; } + dil::TokenKind getKind() const { return m_kind; } + + std::string getSpelling() const { return m_spelling; } + + uint32_t getLength() const { return m_spelling.size(); } + + bool is(dil::TokenKind kind) const { return m_kind == kind; } + + bool isNot(dil::TokenKind kind) const { return m_kind != kind; } + + bool isOneOf(dil::TokenKind kind1, dil::TokenKind kind2) const { +return is(kind1) || is(kind2); + } + + template bool isOneOf(dil::TokenKind kind, Ts... Ks) const { +return is(kind) || isOneOf(Ks...); + } + + uint32_t getLocation() const { return m_start_pos; } + + void setValues(dil::TokenKind kind, std::string spelling, uint32_t start) { +m_kind = kind; +m_spelling = spelling; +m_start_pos = start; + } + + static const std::string getTokenName(dil::TokenKind kind); + +private: + dil::TokenKind m_kind; + std::string m_spelling; + uint32_t m_start_pos; // within entire expression string +}; + +/// Class for doing the simple lexing required by DIL. +class DILLexer { +public: + DILLexer(llvm::StringRef dil_expr) : m_expr(dil_expr.str()) { +m_cur_pos = m_expr.begin(); +// Use UINT_MAX to indicate invalid/uninitialized value. +m_tokens_idx = UINT_MAX; + } + + bool Lex(DILToken &result, bool look_ahead = false); + + bool Is_Word(std::string::iterator start, uint32_t &length); + + uint32_t GetLocation() { return m_cur_pos - m_expr.begin(); } + + /// Update 'result' with the other paremeter values, create a + /// duplicate token, and push the duplicate token onto the vector of + /// lexed tokens. + void UpdateLexedTokens(DILToken &result, dil::TokenKind tok_kind, + std::string tok_str, uint32_t tok_pos); + + /// Return the lexed token N+1 positions ahead of the 'current' token + /// being handled by the DIL parser. + const DILToken &LookAhead(uint32_t N); + + const DILToken &AcceptLookAhead(uint32_t N); + + /// Return the index for the 'current' token being handled by the DIL parser. + uint32_t GetCurrentTokenIdx() { return m_tokens_idx; } + + /// Return the current token to be handled by the DIL parser. + DILToken &GetCurrentToken() { return m_lexed_tokens[m_tokens_idx]; } + + /// Update the index for the 'current' token, to point to the next lexed + /// token. + bool IncrementTokenIdx() { +if (m_tokens_idx >= m_lexed_tokens.size() - 1) + return false; + +m_tokens_idx++; +return true; + } + + /// Set the index for the 'current' token (to be handled by the parser) + /// to a par
[Lldb-commits] [lldb] [LLDB] Add Lexer (with tests) for DIL (Data Inspection Language). (PR #123521)
cmtice wrote: I *think* I have addressed all the comments & requests. Please review this again. Thanks! https://github.com/llvm/llvm-project/pull/123521 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits