[Lldb-commits] [lldb] Centralize the handling of completion for simple argument lists. (PR #82085)
rastogishubham wrote: Reverted with 9ed8b272c30a01c450616f0ed8b2373d5d618ebb https://github.com/llvm/llvm-project/pull/82085 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 0c02329 - [lldb] Migrate distutils.version.LooseVersion to packaging (#82066)
Author: Jonas Devlieghere Date: 2024-02-19T19:54:53-08:00 New Revision: 0c02329ff375100ddcf2cb104aebe97bb3c9126f URL: https://github.com/llvm/llvm-project/commit/0c02329ff375100ddcf2cb104aebe97bb3c9126f DIFF: https://github.com/llvm/llvm-project/commit/0c02329ff375100ddcf2cb104aebe97bb3c9126f.diff LOG: [lldb] Migrate distutils.version.LooseVersion to packaging (#82066) The distutils package has been deprecated and was removed from Python 3.12. The migration page [1] advises to use the packaging module instead. Since Python 3.6 that's vendored into pkg_resources. [1] https://peps.python.org/pep-0632/#migration-advice Added: Modified: lldb/packages/Python/lldbsuite/test/decorators.py lldb/packages/Python/lldbsuite/test/lldbplatformutil.py lldb/test/API/sanity/TestSettingSkipping.py lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py lldb/test/Shell/helper/build.py Removed: diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index a5d7a7a25879df..b691f82b90652c 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -1,6 +1,6 @@ # System modules -from distutils.version import LooseVersion from functools import wraps +from pkg_resources import packaging import ctypes import locale import os @@ -65,10 +65,10 @@ def fn_neq(x, y): ">=": fn_geq, "<=": fn_leq, } -expected_str = ".".join([str(x) for x in expected]) -actual_str = ".".join([str(x) for x in actual]) -return op_lookup[comparison](LooseVersion(actual_str), LooseVersion(expected_str)) +return op_lookup[comparison]( +packaging.version.parse(actual), packaging.version.parse(expected) +) def _match_decorator_property(expected, actual): @@ -238,7 +238,9 @@ def fn(actual_debug_info=None): ) ) skip_for_py_version = (py_version is None) or _check_expected_version( -py_version[0], py_version[1], sys.version_info +py_version[0], +py_version[1], +"{}.{}".format(sys.version_info.major, sys.version_info.minor), ) skip_for_macos_version = (macos_version is None) or ( (platform.mac_ver()[0] != "") diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py index bd92d03e0e2212..c4d063d3cc77ef 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py @@ -7,8 +7,8 @@ import subprocess import sys import os -from distutils.version import LooseVersion from urllib.parse import urlparse +from pkg_resources import packaging # LLDB modules import lldb @@ -297,27 +297,30 @@ def expectedCompilerVersion(compiler_version): if compiler_version is None: return True operator = str(compiler_version[0]) -version = compiler_version[1] +version_str = str(compiler_version[1]) -if version is None: +if not version_str: return True -test_compiler_version = getCompilerVersion() -if test_compiler_version == "unknown": +test_compiler_version_str = getCompilerVersion() +if test_compiler_version_str == "unknown": # Assume the compiler version is at or near the top of trunk. return operator in [">", ">=", "!", "!=", "not"] +version = packaging.version.parse(version_str) +test_compiler_version = packaging.version.parse(test_compiler_version_str) + if operator == ">": -return LooseVersion(test_compiler_version) > LooseVersion(version) +return test_compiler_version > version if operator == ">=" or operator == "=>": -return LooseVersion(test_compiler_version) >= LooseVersion(version) +return test_compiler_version >= version if operator == "<": -return LooseVersion(test_compiler_version) < LooseVersion(version) +return test_compiler_version < version if operator == "<=" or operator == "=<": -return LooseVersion(test_compiler_version) <= LooseVersion(version) +return test_compiler_version <= version if operator == "!=" or operator == "!" or operator == "not": -return str(version) not in str(test_compiler_version) -return str(version) in str(test_compiler_version) +return version_str not in test_compiler_version_str +return version_str in test_compiler_version_str def expectedCompiler(compilers): diff --git a/lldb/test/API/sanity/TestSettingSkipping.py b/lldb/test/API/sanity/TestSettingSkipping.py index 5f58ec2638456d..f0d4d266073e03 100644 --- a/lldb/test/API/sanity/TestSettingSkipping.py +++ b/lldb/test/API/sanity/TestSettingSkipping.py @@ -1,8 +1,7 @@ """ -This is a sanity check that verifies that test can be skli
[Lldb-commits] [clang] [lldb] Enable aarch64-amazon-linux triple (PR #82231)
https://github.com/sebsto created https://github.com/llvm/llvm-project/pull/82231 Add aarch64-amazon-linux triplet to allow compilation for Amazon Linux 2023 on Graviton CPU This should address https://github.com/apple/llvm-project/issues/8227 Also submitted to downstream `apple/llvm-project` https://github.com/apple/llvm-project/pull/8228 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] [clang] [lldb] Enable aarch64-amazon-linux triple (PR #82231)
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using `@` followed by their GitHub username. If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the [LLVM GitHub User Guide](https://llvm.org/docs/GitHub.html). You can also ask questions in a comment on this PR, on the [LLVM Discord](https://discord.com/invite/xS7Z362) or on the [forums](https://discourse.llvm.org/). https://github.com/llvm/llvm-project/pull/82231 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] Enable aarch64-amazon-linux triple (PR #82231)
https://github.com/sebsto closed https://github.com/llvm/llvm-project/pull/82231 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Implement WebAssembly debugging (PR #77949)
https://github.com/paolosevMSFT updated https://github.com/llvm/llvm-project/pull/77949 >From 30d932bb0988e1c78c3e023be2270259df5e6664 Mon Sep 17 00:00:00 2001 From: Paolo Severini Date: Fri, 12 Jan 2024 09:10:59 -0800 Subject: [PATCH 1/4] Add support for source-level debugging of WebAssembly code --- lldb/include/lldb/Target/Process.h| 40 +++ lldb/source/Core/Value.cpp| 2 +- lldb/source/Expression/DWARFExpression.cpp| 41 +++ .../source/Interpreter/CommandInterpreter.cpp | 18 ++ lldb/source/Plugins/Process/CMakeLists.txt| 1 + .../Process/gdb-remote/ProcessGDBRemote.cpp | 7 +- .../Process/gdb-remote/ProcessGDBRemote.h | 2 + .../Plugins/Process/wasm/CMakeLists.txt | 12 + .../Plugins/Process/wasm/ProcessWasm.cpp | 291 ++ .../source/Plugins/Process/wasm/ProcessWasm.h | 129 .../Plugins/Process/wasm/ThreadWasm.cpp | 55 lldb/source/Plugins/Process/wasm/ThreadWasm.h | 44 +++ .../Plugins/Process/wasm/UnwindWasm.cpp | 76 + lldb/source/Plugins/Process/wasm/UnwindWasm.h | 55 .../Process/wasm/wasmRegisterContext.cpp | 108 +++ .../Process/wasm/wasmRegisterContext.h| 75 + 16 files changed, 954 insertions(+), 2 deletions(-) create mode 100644 lldb/source/Plugins/Process/wasm/CMakeLists.txt create mode 100644 lldb/source/Plugins/Process/wasm/ProcessWasm.cpp create mode 100644 lldb/source/Plugins/Process/wasm/ProcessWasm.h create mode 100644 lldb/source/Plugins/Process/wasm/ThreadWasm.cpp create mode 100644 lldb/source/Plugins/Process/wasm/ThreadWasm.h create mode 100644 lldb/source/Plugins/Process/wasm/UnwindWasm.cpp create mode 100644 lldb/source/Plugins/Process/wasm/UnwindWasm.h create mode 100644 lldb/source/Plugins/Process/wasm/wasmRegisterContext.cpp create mode 100644 lldb/source/Plugins/Process/wasm/wasmRegisterContext.h diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index 24c599e044c78f..587ae085b479b7 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -1548,6 +1548,46 @@ class Process : public std::enable_shared_from_this, virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error); + /// Read of memory from a process. + /// + /// This function will read memory from the current process's address space + /// and remove any traps that may have been inserted into the memory. + /// + /// This overloads accepts an ExecutionContext as additional argument. By + /// default, it calls the previous overload without the ExecutionContext + /// argument, but it can be overridden by Process subclasses. + /// + /// \param[in] vm_addr + /// A virtual load address that indicates where to start reading + /// memory from. + /// + /// \param[out] buf + /// A byte buffer that is at least \a size bytes long that + /// will receive the memory bytes. + /// + /// \param[in] size + /// The number of bytes to read. + /// + /// \param[in] exe_ctx + ///The current execution context, if available. + /// + /// \param[out] error + /// An error that indicates the success or failure of this + /// operation. If error indicates success (error.Success()), + /// then the value returned can be trusted, otherwise zero + /// will be returned. + /// + /// \return + /// The number of bytes that were actually read into \a buf. If + /// the returned number is greater than zero, yet less than \a + /// size, then this function will get called again with \a + /// vm_addr, \a buf, and \a size updated appropriately. Zero is + /// returned in the case of an error. + virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, +ExecutionContext *exe_ctx, Status &error) { +return ReadMemory(vm_addr, buf, size, error); + } + /// Read of memory from a process. /// /// This function has the same semantics of ReadMemory except that it diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp index 995cc934c82044..47a5fdee773886 100644 --- a/lldb/source/Core/Value.cpp +++ b/lldb/source/Core/Value.cpp @@ -552,7 +552,7 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, if (process) { const size_t bytes_read = - process->ReadMemory(address, dst, byte_size, error); + process->ReadMemory(address, dst, byte_size, exe_ctx, error); if (bytes_read != byte_size) error.SetErrorStringWithFormat( "read memory from 0x%" PRIx64 " failed (%u of %u bytes read)", diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index fe4928d4f43a43..ca24611724dc7c 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.c
[Lldb-commits] [lldb] [lldb] Implement WebAssembly debugging (PR #77949)
@@ -0,0 +1,293 @@ +//===-- ProcessWasm.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 "ProcessWasm.h" +#include "ThreadWasm.h" +#include "lldb/Core/Module.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Utility/DataBufferHeap.h" + +#include "lldb/Target/UnixSignals.h" +#include "llvm/ADT/ArrayRef.h" + +using namespace lldb; +using namespace lldb_private; +using namespace lldb_private::process_gdb_remote; +using namespace lldb_private::wasm; + +LLDB_PLUGIN_DEFINE(ProcessWasm) + +// ProcessGDBRemote constructor +ProcessWasm::ProcessWasm(lldb::TargetSP target_sp, ListenerSP listener_sp) +: ProcessGDBRemote(target_sp, listener_sp) { + /* always use linux signals for wasm process */ + m_unix_signals_sp = + UnixSignals::Create(ArchSpec{"wasm32-unknown-unknown-wasm"}); +} + +void ProcessWasm::Initialize() { + static llvm::once_flag g_once_flag; + + llvm::call_once(g_once_flag, []() { +PluginManager::RegisterPlugin(GetPluginNameStatic(), + GetPluginDescriptionStatic(), CreateInstance, + DebuggerInitialize); + }); +} + +void ProcessWasm::DebuggerInitialize(Debugger &debugger) { + ProcessGDBRemote::DebuggerInitialize(debugger); +} + +llvm::StringRef ProcessWasm::GetPluginName() { return GetPluginNameStatic(); } + +llvm::StringRef ProcessWasm::GetPluginNameStatic() { + static ConstString g_name("wasm"); + return g_name; +} + +llvm::StringRef ProcessWasm::GetPluginDescriptionStatic() { + return "GDB Remote protocol based WebAssembly debugging plug-in."; +} + +void ProcessWasm::Terminate() { + PluginManager::UnregisterPlugin(ProcessWasm::CreateInstance); +} + +lldb::ProcessSP ProcessWasm::CreateInstance(lldb::TargetSP target_sp, +ListenerSP listener_sp, +const FileSpec *crash_file_path, +bool can_connect) { + lldb::ProcessSP process_sp; + if (crash_file_path == nullptr) +process_sp = std::make_shared(target_sp, listener_sp); + return process_sp; +} + +bool ProcessWasm::CanDebug(lldb::TargetSP target_sp, + bool plugin_specified_by_name) { + if (plugin_specified_by_name) +return true; + + Module *exe_module = target_sp->GetExecutableModulePointer(); + if (exe_module) { +ObjectFile *exe_objfile = exe_module->GetObjectFile(); +return exe_objfile->GetArchitecture().GetMachine() == llvm::Triple::wasm32; + } + // However, if there is no wasm module, we return false, otherwise, + // we might use ProcessWasm to attach gdb remote. + return false; +} + +std::shared_ptr ProcessWasm::CreateThread(lldb::tid_t tid) { + return std::make_shared(*this, tid); +} + +size_t ProcessWasm::ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, + Status &error) { + wasm_addr_t wasm_addr(vm_addr); + + switch (wasm_addr.GetType()) { + case WasmAddressType::Memory: +if (wasm_addr.module_id != 0) { + if (WasmReadMemory(wasm_addr.module_id, wasm_addr.offset, buf, size)) { +return size; + } + error.SetErrorStringWithFormat("Wasm memory read failed for 0x%" PRIx64, + vm_addr); + return 0; +} else { + return ProcessGDBRemote::ReadMemory(vm_addr, buf, size, error); +} + case WasmAddressType::Code: +wasm_addr.type = 0; paolosevMSFT wrote: Done. https://github.com/llvm/llvm-project/pull/77949 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Implement WebAssembly debugging (PR #77949)
paolosevMSFT wrote: Removed the 'wasm' command and addressed all the other review comments. https://github.com/llvm/llvm-project/pull/77949 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Centralize the handling of completion for simple argument lists. (PR #82085)
jimingham wrote: This is responding to both Greg and Alex's "can't we also do X completion" comments: It was clear that this was going to be a whole lot of change, some of it purely manual, and some requiring a little thought. To make it easier to review, I'm doing the work in stages. This first stage was: Make the base class handle homogenous arguments of one type, either with single repeat or multiple repeat commands. I made that change, and changed all the arguments that were obviously of that sort. If any of the extant completions were outside this scope, a little tricky, or caused a test failure I didn't understand, I left them for the second pass. That way we can review the ones that aren't mechanical without all the noise of the obvious ones. https://github.com/llvm/llvm-project/pull/82085 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Centralize the handling of completion for simple argument lists. (PR #82085)
@@ -1139,6 +1097,15 @@ class CommandObjectPlatformProcessLaunch : public CommandObjectParsed { m_arguments.push_back({run_arg_arg}); } + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { jimingham wrote: That one caused a test failure when I tried the simple implementation, so it goes into the second round. https://github.com/llvm/llvm-project/pull/82085 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Centralize the handling of completion for simple argument lists. (PR #82085)
@@ -305,6 +305,42 @@ void CommandObject::HandleCompletion(CompletionRequest &request) { } } +void +CommandObject::HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) { + size_t num_arg_entries = GetNumArgumentEntries(); + if (num_arg_entries != 1) +return; + + CommandArgumentEntry *entry_ptr = GetArgumentEntryAtIndex(0); + if (!entry_ptr) +return; // Maybe this should be an assert, this shouldn't be possible. + + CommandArgumentEntry &entry = *entry_ptr; + // For now, we only handle the simple case of one homogenous argument type. + if (entry.size() != 1) +return; jimingham wrote: That's for the second round of fixes. https://github.com/llvm/llvm-project/pull/82085 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Centralize the handling of completion for simple argument lists. (PR #82085)
@@ -305,6 +305,42 @@ void CommandObject::HandleCompletion(CompletionRequest &request) { } } +void +CommandObject::HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) { + size_t num_arg_entries = GetNumArgumentEntries(); + if (num_arg_entries != 1) +return; + + CommandArgumentEntry *entry_ptr = GetArgumentEntryAtIndex(0); + if (!entry_ptr) +return; // Maybe this should be an assert, this shouldn't be possible. + + CommandArgumentEntry &entry = *entry_ptr; + // For now, we only handle the simple case of one homogenous argument type. + if (entry.size() != 1) +return; + + // Look up the completion type, and if it has one, invoke it: + const CommandObject::ArgumentTableEntry *arg_entry + = FindArgumentDataByType(entry[0].arg_type); + const ArgumentRepetitionType repeat = entry[0].arg_repetition; + + if (arg_entry == nullptr || arg_entry->completion_type == lldb::eNoCompletion) +return; + + // FIXME: This should be handled higher in the Command Parser. + // Check the case where this command only takes one argument, and don't do + // the completion if we aren't on the first entry: + if (repeat == eArgRepeatPlain && request.GetCursorIndex() != 0) +return; + + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( +GetCommandInterpreter(), arg_entry->completion_type, request, nullptr); + jimingham wrote: Anything not mechanical is for the second pass. https://github.com/llvm/llvm-project/pull/82085 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [ptrauth] Teach LLVM & LLDB about LLVM_ptrauth_authentication_mode (PR #82272)
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/82272 Teach LLVM & LLDB about `DW_AT_LLVM_ptrauth_authentication_mode` >From 36cdd0e2991e9ed28bdd023630a81595ec3c70bf Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 19 Feb 2024 11:11:05 -0800 Subject: [PATCH] [ptrauth] Teach LLVM & LLDB about LLVM_ptrauth_authentication_mode --- .../Plugins/SymbolFile/DWARF/DWARFDIE.cpp | 10 +-- llvm/include/llvm/BinaryFormat/Dwarf.def | 1 + llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp | 15 +++ .../tools/llvm-dwarfdump/AArch64/ptrauth.s| 26 --- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp index d4446befd83b05..4884374ef94729 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp @@ -316,8 +316,14 @@ void DWARFDIE::AppendTypeName(Stream &s) const { GetAttributeValueAsUnsigned(DW_AT_LLVM_ptrauth_extra_discriminator, 0); bool isaPointer = GetAttributeValueAsUnsigned(DW_AT_LLVM_ptrauth_isa_pointer, 0); -s.Printf("__ptrauth(%d, %d, 0x0%x, %d)", key, isAddressDiscriminated, - extraDiscriminator, isaPointer); +bool authenticatesNullValues = GetAttributeValueAsUnsigned( +DW_AT_LLVM_ptrauth_authenticates_null_values, 0); +unsigned authenticationMode = +GetAttributeValueAsUnsigned(DW_AT_LLVM_ptrauth_authentication_mode, 3); + +s.Printf("__ptrauth(%d, %d, 0x0%x, %d, %d, %d)", key, + isAddressDiscriminated, extraDiscriminator, isaPointer, + authenticatesNullValues, authenticationMode); break; } default: diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def index 3a08eeaa791aa6..e70b58d5ea50fc 100644 --- a/llvm/include/llvm/BinaryFormat/Dwarf.def +++ b/llvm/include/llvm/BinaryFormat/Dwarf.def @@ -611,6 +611,7 @@ HANDLE_DW_AT(0x3e06, LLVM_ptrauth_extra_discriminator, 0, LLVM) HANDLE_DW_AT(0x3e07, LLVM_apinotes, 0, APPLE) HANDLE_DW_AT(0x3e08, LLVM_ptrauth_isa_pointer, 0, LLVM) HANDLE_DW_AT(0x3e09, LLVM_ptrauth_authenticates_null_values, 0, LLVM) +HANDLE_DW_AT(0x3e0a, LLVM_ptrauth_authentication_mode, 0, LLVM) // Apple extensions. diff --git a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp index ef8ded8ebb66c1..05dee8a3d71298 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp @@ -251,6 +251,21 @@ void DWARFTypePrinter::appendUnqualifiedNameAfter( optionsVec.push_back("isa-pointer"); if (getValOrNull(DW_AT_LLVM_ptrauth_authenticates_null_values)) optionsVec.push_back("authenticates-null-values"); +if (auto AuthenticationMode = +D.find(DW_AT_LLVM_ptrauth_authentication_mode)) { + switch (*AuthenticationMode->getAsUnsignedConstant()) { + case 0: + case 1: +optionsVec.push_back("strip"); +break; + case 2: +optionsVec.push_back("sign-and-strip"); +break; + default: +// Default authentication policy +break; + } +} std::string options; for (const auto *option : optionsVec) { if (options.size()) diff --git a/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s b/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s index d24a60d99bdac3..befd0fa86ef99c 100644 --- a/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s +++ b/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s @@ -23,7 +23,7 @@ # CHECK: 0x004f: DW_TAG_variable # CHECK: DW_AT_name ("p3") -# CHECK: DW_AT_type (0x005a "void *__ptrauth(4, 1, 0x04d4, "authenticates-null-values")") +# CHECK: DW_AT_type (0x005a "void *__ptrauth(4, 1, 0x04d4, "authenticates-null-values,strip")") # CHECK: 0x005a: DW_TAG_LLVM_ptrauth_type # CHECK: DW_AT_LLVM_ptrauth_key (0x04) @@ -31,11 +31,11 @@ # CHECK: DW_AT_LLVM_ptrauth_extra_discriminator (0x04d4) # CHECK: DW_AT_LLVM_ptrauth_authenticates_null_values(true) -# CHECK: 0x0062: DW_TAG_variable +# CHECK: 0x0063: DW_TAG_variable # CHECK: DW_AT_name ("p4") -# CHECK: DW_AT_type (0x006d "void *__ptrauth(4, 1, 0x04d5, "isa-pointer,authenticates-null-values")") +# CHECK: DW_AT_type (0x006e "void *__ptrauth(4, 1, 0x04d5, "isa-pointer,authenticates-null-values,sign-and-strip")") -# CHECK: 0x006d: DW_TAG_LLVM_ptrauth_type +# CHECK: 0x006e: DW_TAG_LLVM_ptrauth_type # CHECK: DW_AT_LLVM_ptrauth_key (0x04) # CHECK: DW_AT_LLVM_ptrauth_address_discriminated(true) # CHECK: DW_AT_LLVM_ptrauth_extra_discriminator (0x04d5)
[Lldb-commits] [lldb] [llvm] [ptrauth] Teach LLVM & LLDB about LLVM_ptrauth_authentication_mode (PR #82272)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) Changes Teach LLVM & LLDB about `DW_AT_LLVM_ptrauth_authentication_mode` --- Full diff: https://github.com/llvm/llvm-project/pull/82272.diff 4 Files Affected: - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp (+8-2) - (modified) llvm/include/llvm/BinaryFormat/Dwarf.def (+1) - (modified) llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp (+15) - (modified) llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s (+16-10) ``diff diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp index d4446befd83b05..4884374ef94729 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp @@ -316,8 +316,14 @@ void DWARFDIE::AppendTypeName(Stream &s) const { GetAttributeValueAsUnsigned(DW_AT_LLVM_ptrauth_extra_discriminator, 0); bool isaPointer = GetAttributeValueAsUnsigned(DW_AT_LLVM_ptrauth_isa_pointer, 0); -s.Printf("__ptrauth(%d, %d, 0x0%x, %d)", key, isAddressDiscriminated, - extraDiscriminator, isaPointer); +bool authenticatesNullValues = GetAttributeValueAsUnsigned( +DW_AT_LLVM_ptrauth_authenticates_null_values, 0); +unsigned authenticationMode = +GetAttributeValueAsUnsigned(DW_AT_LLVM_ptrauth_authentication_mode, 3); + +s.Printf("__ptrauth(%d, %d, 0x0%x, %d, %d, %d)", key, + isAddressDiscriminated, extraDiscriminator, isaPointer, + authenticatesNullValues, authenticationMode); break; } default: diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def index 3a08eeaa791aa6..e70b58d5ea50fc 100644 --- a/llvm/include/llvm/BinaryFormat/Dwarf.def +++ b/llvm/include/llvm/BinaryFormat/Dwarf.def @@ -611,6 +611,7 @@ HANDLE_DW_AT(0x3e06, LLVM_ptrauth_extra_discriminator, 0, LLVM) HANDLE_DW_AT(0x3e07, LLVM_apinotes, 0, APPLE) HANDLE_DW_AT(0x3e08, LLVM_ptrauth_isa_pointer, 0, LLVM) HANDLE_DW_AT(0x3e09, LLVM_ptrauth_authenticates_null_values, 0, LLVM) +HANDLE_DW_AT(0x3e0a, LLVM_ptrauth_authentication_mode, 0, LLVM) // Apple extensions. diff --git a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp index ef8ded8ebb66c1..05dee8a3d71298 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp @@ -251,6 +251,21 @@ void DWARFTypePrinter::appendUnqualifiedNameAfter( optionsVec.push_back("isa-pointer"); if (getValOrNull(DW_AT_LLVM_ptrauth_authenticates_null_values)) optionsVec.push_back("authenticates-null-values"); +if (auto AuthenticationMode = +D.find(DW_AT_LLVM_ptrauth_authentication_mode)) { + switch (*AuthenticationMode->getAsUnsignedConstant()) { + case 0: + case 1: +optionsVec.push_back("strip"); +break; + case 2: +optionsVec.push_back("sign-and-strip"); +break; + default: +// Default authentication policy +break; + } +} std::string options; for (const auto *option : optionsVec) { if (options.size()) diff --git a/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s b/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s index d24a60d99bdac3..befd0fa86ef99c 100644 --- a/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s +++ b/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s @@ -23,7 +23,7 @@ # CHECK: 0x004f: DW_TAG_variable # CHECK: DW_AT_name ("p3") -# CHECK: DW_AT_type (0x005a "void *__ptrauth(4, 1, 0x04d4, "authenticates-null-values")") +# CHECK: DW_AT_type (0x005a "void *__ptrauth(4, 1, 0x04d4, "authenticates-null-values,strip")") # CHECK: 0x005a: DW_TAG_LLVM_ptrauth_type # CHECK: DW_AT_LLVM_ptrauth_key (0x04) @@ -31,11 +31,11 @@ # CHECK: DW_AT_LLVM_ptrauth_extra_discriminator (0x04d4) # CHECK: DW_AT_LLVM_ptrauth_authenticates_null_values(true) -# CHECK: 0x0062: DW_TAG_variable +# CHECK: 0x0063: DW_TAG_variable # CHECK: DW_AT_name ("p4") -# CHECK: DW_AT_type (0x006d "void *__ptrauth(4, 1, 0x04d5, "isa-pointer,authenticates-null-values")") +# CHECK: DW_AT_type (0x006e "void *__ptrauth(4, 1, 0x04d5, "isa-pointer,authenticates-null-values,sign-and-strip")") -# CHECK: 0x006d: DW_TAG_LLVM_ptrauth_type +# CHECK: 0x006e: DW_TAG_LLVM_ptrauth_type # CHECK: DW_AT_LLVM_ptrauth_key (0x04) # CHECK: DW_AT_LLVM_ptrauth_address_discriminated(true) # CHECK: DW_AT_LLVM_ptrauth_extra_discriminator (0x04d5) @@ -44,7 +44,7 @@ .section__TEXT,__text,regular,pure_instructions .file 1 "/" "/tmp/p.c" - .comm _p,8
[Lldb-commits] [lldb] [llvm] [ptrauth] Teach LLVM & LLDB about LLVM_ptrauth_authentication_mode (PR #82272)
llvmbot wrote: @llvm/pr-subscribers-debuginfo Author: Jonas Devlieghere (JDevlieghere) Changes Teach LLVM & LLDB about `DW_AT_LLVM_ptrauth_authentication_mode` --- Full diff: https://github.com/llvm/llvm-project/pull/82272.diff 4 Files Affected: - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp (+8-2) - (modified) llvm/include/llvm/BinaryFormat/Dwarf.def (+1) - (modified) llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp (+15) - (modified) llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s (+16-10) ``diff diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp index d4446befd83b05..4884374ef94729 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp @@ -316,8 +316,14 @@ void DWARFDIE::AppendTypeName(Stream &s) const { GetAttributeValueAsUnsigned(DW_AT_LLVM_ptrauth_extra_discriminator, 0); bool isaPointer = GetAttributeValueAsUnsigned(DW_AT_LLVM_ptrauth_isa_pointer, 0); -s.Printf("__ptrauth(%d, %d, 0x0%x, %d)", key, isAddressDiscriminated, - extraDiscriminator, isaPointer); +bool authenticatesNullValues = GetAttributeValueAsUnsigned( +DW_AT_LLVM_ptrauth_authenticates_null_values, 0); +unsigned authenticationMode = +GetAttributeValueAsUnsigned(DW_AT_LLVM_ptrauth_authentication_mode, 3); + +s.Printf("__ptrauth(%d, %d, 0x0%x, %d, %d, %d)", key, + isAddressDiscriminated, extraDiscriminator, isaPointer, + authenticatesNullValues, authenticationMode); break; } default: diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def index 3a08eeaa791aa6..e70b58d5ea50fc 100644 --- a/llvm/include/llvm/BinaryFormat/Dwarf.def +++ b/llvm/include/llvm/BinaryFormat/Dwarf.def @@ -611,6 +611,7 @@ HANDLE_DW_AT(0x3e06, LLVM_ptrauth_extra_discriminator, 0, LLVM) HANDLE_DW_AT(0x3e07, LLVM_apinotes, 0, APPLE) HANDLE_DW_AT(0x3e08, LLVM_ptrauth_isa_pointer, 0, LLVM) HANDLE_DW_AT(0x3e09, LLVM_ptrauth_authenticates_null_values, 0, LLVM) +HANDLE_DW_AT(0x3e0a, LLVM_ptrauth_authentication_mode, 0, LLVM) // Apple extensions. diff --git a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp index ef8ded8ebb66c1..05dee8a3d71298 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp @@ -251,6 +251,21 @@ void DWARFTypePrinter::appendUnqualifiedNameAfter( optionsVec.push_back("isa-pointer"); if (getValOrNull(DW_AT_LLVM_ptrauth_authenticates_null_values)) optionsVec.push_back("authenticates-null-values"); +if (auto AuthenticationMode = +D.find(DW_AT_LLVM_ptrauth_authentication_mode)) { + switch (*AuthenticationMode->getAsUnsignedConstant()) { + case 0: + case 1: +optionsVec.push_back("strip"); +break; + case 2: +optionsVec.push_back("sign-and-strip"); +break; + default: +// Default authentication policy +break; + } +} std::string options; for (const auto *option : optionsVec) { if (options.size()) diff --git a/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s b/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s index d24a60d99bdac3..befd0fa86ef99c 100644 --- a/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s +++ b/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s @@ -23,7 +23,7 @@ # CHECK: 0x004f: DW_TAG_variable # CHECK: DW_AT_name ("p3") -# CHECK: DW_AT_type (0x005a "void *__ptrauth(4, 1, 0x04d4, "authenticates-null-values")") +# CHECK: DW_AT_type (0x005a "void *__ptrauth(4, 1, 0x04d4, "authenticates-null-values,strip")") # CHECK: 0x005a: DW_TAG_LLVM_ptrauth_type # CHECK: DW_AT_LLVM_ptrauth_key (0x04) @@ -31,11 +31,11 @@ # CHECK: DW_AT_LLVM_ptrauth_extra_discriminator (0x04d4) # CHECK: DW_AT_LLVM_ptrauth_authenticates_null_values(true) -# CHECK: 0x0062: DW_TAG_variable +# CHECK: 0x0063: DW_TAG_variable # CHECK: DW_AT_name ("p4") -# CHECK: DW_AT_type (0x006d "void *__ptrauth(4, 1, 0x04d5, "isa-pointer,authenticates-null-values")") +# CHECK: DW_AT_type (0x006e "void *__ptrauth(4, 1, 0x04d5, "isa-pointer,authenticates-null-values,sign-and-strip")") -# CHECK: 0x006d: DW_TAG_LLVM_ptrauth_type +# CHECK: 0x006e: DW_TAG_LLVM_ptrauth_type # CHECK: DW_AT_LLVM_ptrauth_key (0x04) # CHECK: DW_AT_LLVM_ptrauth_address_discriminated(true) # CHECK: DW_AT_LLVM_ptrauth_extra_discriminator (0x04d5) @@ -44,7 +44,7 @@ .section__TEXT,__text,regular,pure_instructions .file 1 "/" "/tmp/p.c" - .comm _p,8
[Lldb-commits] [lldb] [llvm] [ptrauth] Teach LLVM & LLDB about LLVM_ptrauth_authentication_mode (PR #82272)
asl wrote: Tagging @kovdan01 https://github.com/llvm/llvm-project/pull/82272 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Standardize command option parsing error messages (PR #82273)
https://github.com/bulbazord created https://github.com/llvm/llvm-project/pull/82273 I have been looking to simplify parsing logic and improve the interfaces so that they are both easier to use and harder to abuse. To be specific, I am referring to functions such as `OptionArgParser::ToBoolean`: I would like to go from its current interface to something more like `llvm::Error ToBoolean(llvm::StringRef option_arg)`. Through working on that, I encountered 2 inconveniences: 1. Option parsing code is not uniform. Every function writes a slightly different error message, so incorporating an error message from the `ToBoolean` implementation is going to be laborious as I figure out what exactly needs to change or stay the same. 2. Changing the interface of `ToBoolean` would require a global atomic change across all of the Command code. This would be quite frustrating to do because of the non-uniformity of our existing code. To address these frustrations, I think it would be easiest to first standardize the error reporting mechanism when parsing options in commands. I do so by introducing `CreateOptionParsingError` which will create an error message of the shape: Invalid valud ('${option_arg}') for -${short_value} ('${long_value}'): ${additional_context} Concretely, it would look something like this: (lldb) breakpoint set -n main -G yay error: Invalid value ('yay') for -G (auto-continue): Failed to parse as boolean After this, updating the interfaces for parsing the values themselves should become simpler. Because this can be adopted incrementally, this should be able to done over the course of time instead of all at once as a giant difficult-to-review change. I've changed exactly one function where this function would be used as an illustration of what I am proposing. >From 062ec05006182838c8b0043051741ae6c26c2520 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Thu, 15 Feb 2024 17:39:42 -0800 Subject: [PATCH] [lldb] Standardize command option parsing error messages I have been looking to simplify parsing logic and improve the interfaces so that they are both easier to use and harder to abuse. To be specific, I am referring to functions such as `OptionArgParser::ToBoolean`: I would like to go from its current interface to something more like `llvm::Error ToBoolean(llvm::StringRef option_arg)`. Through working on that, I encountered 2 inconveniences: 1. Option parsing code is not uniform. Every function writes a slightly different error message, so incorporating an error message from the `ToBoolean` implementation is going to be laborious as I figure out what exactly needs to change or stay the same. 2. Changing the interface of `ToBoolean` would require a global atomic change across all of the Command code. This would be quite frustrating to do because of the non-uniformity of our existing code. To address these frustrations, I think it would be easiest to first standardize the error reporting mechanism when parsing options in commands. I do so by introducing `CreateOptionParsingError` which will create an error message of the shape: Invalid valud ('${option_arg}') for -${short_value} ('${long_value}'): ${additional_context} Concretely, it would look something like this: (lldb) breakpoint set -n main -G yay error: Invalid value ('yay') for -G (auto-continue): Failed to parse as boolean After this, updating the interfaces for parsing the values themselves should become simpler. Because this can be adopted incrementally, this should be able to done over the course of time instead of all at once as a giant difficult-to-review change. I've changed exactly one function where this function would be used as an illustration of what I am proposing. --- lldb/include/lldb/Interpreter/Options.h | 10 + .../Commands/CommandObjectBreakpoint.cpp | 37 ++- lldb/source/Interpreter/Options.cpp | 13 +++ lldb/unittests/Interpreter/CMakeLists.txt | 1 + lldb/unittests/Interpreter/TestOptions.cpp| 29 +++ 5 files changed, 73 insertions(+), 17 deletions(-) create mode 100644 lldb/unittests/Interpreter/TestOptions.cpp diff --git a/lldb/include/lldb/Interpreter/Options.h b/lldb/include/lldb/Interpreter/Options.h index bf74927cf99db8..3351fb517d4df3 100644 --- a/lldb/include/lldb/Interpreter/Options.h +++ b/lldb/include/lldb/Interpreter/Options.h @@ -336,6 +336,16 @@ class OptionGroupOptions : public Options { bool m_did_finalize = false; }; +llvm::Error CreateOptionParsingError(llvm::StringRef option_arg, + const char short_option, + llvm::StringRef long_option = {}, + llvm::StringRef additional_context = {}); + +static constexpr llvm::StringLiteral g_bool_parsing_error_message = +"Failed to parse as boolean"; +static constexpr llvm::StringLiteral g_int_parsing_error_message = +"Failed to parse as in
[Lldb-commits] [lldb] [lldb] Standardize command option parsing error messages (PR #82273)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Alex Langford (bulbazord) Changes I have been looking to simplify parsing logic and improve the interfaces so that they are both easier to use and harder to abuse. To be specific, I am referring to functions such as `OptionArgParser::ToBoolean`: I would like to go from its current interface to something more like `llvm::ErrorToBoolean(llvm::StringRef option_arg)`. Through working on that, I encountered 2 inconveniences: 1. Option parsing code is not uniform. Every function writes a slightly different error message, so incorporating an error message from the `ToBoolean` implementation is going to be laborious as I figure out what exactly needs to change or stay the same. 2. Changing the interface of `ToBoolean` would require a global atomic change across all of the Command code. This would be quite frustrating to do because of the non-uniformity of our existing code. To address these frustrations, I think it would be easiest to first standardize the error reporting mechanism when parsing options in commands. I do so by introducing `CreateOptionParsingError` which will create an error message of the shape: Invalid valud ('${option_arg}') for -${short_value} ('${long_value}'): ${additional_context} Concretely, it would look something like this: (lldb) breakpoint set -n main -G yay error: Invalid value ('yay') for -G (auto-continue): Failed to parse as boolean After this, updating the interfaces for parsing the values themselves should become simpler. Because this can be adopted incrementally, this should be able to done over the course of time instead of all at once as a giant difficult-to-review change. I've changed exactly one function where this function would be used as an illustration of what I am proposing. --- Full diff: https://github.com/llvm/llvm-project/pull/82273.diff 5 Files Affected: - (modified) lldb/include/lldb/Interpreter/Options.h (+10) - (modified) lldb/source/Commands/CommandObjectBreakpoint.cpp (+20-17) - (modified) lldb/source/Interpreter/Options.cpp (+13) - (modified) lldb/unittests/Interpreter/CMakeLists.txt (+1) - (added) lldb/unittests/Interpreter/TestOptions.cpp (+29) ``diff diff --git a/lldb/include/lldb/Interpreter/Options.h b/lldb/include/lldb/Interpreter/Options.h index bf74927cf99db8..3351fb517d4df3 100644 --- a/lldb/include/lldb/Interpreter/Options.h +++ b/lldb/include/lldb/Interpreter/Options.h @@ -336,6 +336,16 @@ class OptionGroupOptions : public Options { bool m_did_finalize = false; }; +llvm::Error CreateOptionParsingError(llvm::StringRef option_arg, + const char short_option, + llvm::StringRef long_option = {}, + llvm::StringRef additional_context = {}); + +static constexpr llvm::StringLiteral g_bool_parsing_error_message = +"Failed to parse as boolean"; +static constexpr llvm::StringLiteral g_int_parsing_error_message = +"Failed to parse as integer"; + } // namespace lldb_private #endif // LLDB_INTERPRETER_OPTIONS_H diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index 3fdf5cd3cd43d2..fc2217608a0bb9 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -64,6 +64,8 @@ class lldb_private::BreakpointOptionGroup : public OptionGroup { Status error; const int short_option = g_breakpoint_modify_options[option_idx].short_option; +const char *long_option = +g_breakpoint_modify_options[option_idx].long_option; switch (short_option) { case 'c': @@ -84,18 +86,17 @@ class lldb_private::BreakpointOptionGroup : public OptionGroup { case 'G': { bool value, success; value = OptionArgParser::ToBoolean(option_arg, false, &success); - if (success) { + if (success) m_bp_opts.SetAutoContinue(value); - } else -error.SetErrorStringWithFormat( -"invalid boolean value '%s' passed for -G option", -option_arg.str().c_str()); + else +error = CreateOptionParsingError(option_arg, short_option, long_option, + g_bool_parsing_error_message); } break; case 'i': { uint32_t ignore_count; if (option_arg.getAsInteger(0, ignore_count)) -error.SetErrorStringWithFormat("invalid ignore count '%s'", - option_arg.str().c_str()); +error = CreateOptionParsingError(option_arg, short_option, long_option, + g_int_parsing_error_message); else m_bp_opts.SetIgnoreCount(ignore_count); } break; @@ -105,27 +106,29 @@ class lldb_private::BreakpointOptionGroup : public OptionGroup { if (success) { m_bp_opts.SetOneShot(value); } else -
[Lldb-commits] [lldb] 1b26c25 - [llvm] Upstream the BridgeOS triple enum value (NFC)
Author: Jonas Devlieghere Date: 2024-02-19T12:20:23-08:00 New Revision: 1b26c25f7e56fe3d5e06c285566ef43812d7baee URL: https://github.com/llvm/llvm-project/commit/1b26c25f7e56fe3d5e06c285566ef43812d7baee DIFF: https://github.com/llvm/llvm-project/commit/1b26c25f7e56fe3d5e06c285566ef43812d7baee.diff LOG: [llvm] Upstream the BridgeOS triple enum value (NFC) This upstreams the BridgeOS target triple enum value. Added: Modified: lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp llvm/include/llvm/TargetParser/Triple.h llvm/lib/TargetParser/Triple.cpp Removed: diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index 4128ac1cdf1bba..3bdbce5a3b7c46 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -167,7 +167,7 @@ DynamicLoader *DynamicLoaderDarwinKernel::CreateInstance(Process *process, case llvm::Triple::TvOS: case llvm::Triple::WatchOS: case llvm::Triple::XROS: -// NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS: +case llvm::Triple::BridgeOS: if (triple_ref.getVendor() != llvm::Triple::Apple) { return nullptr; } diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index 33bb7f076848e1..0e17d57fa9c4fb 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -404,8 +404,8 @@ bool DynamicLoaderDarwin::JSONImageInformationIntoImageInfo( image_infos[i].os_type = llvm::Triple::TvOS; else if (os_name == "watchos") image_infos[i].os_type = llvm::Triple::WatchOS; - // NEED_BRIDGEOS_TRIPLE else if (os_name == "bridgeos") - // NEED_BRIDGEOS_TRIPLE image_infos[i].os_type = llvm::Triple::BridgeOS; + else if (os_name == "bridgeos") +image_infos[i].os_type = llvm::Triple::BridgeOS; else if (os_name == "maccatalyst") { image_infos[i].os_type = llvm::Triple::IOS; image_infos[i].os_env = llvm::Triple::MacABI; diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp index 261592558095b4..7878c506231120 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -56,7 +56,7 @@ DynamicLoader *DynamicLoaderMacOS::CreateInstance(Process *process, case llvm::Triple::TvOS: case llvm::Triple::WatchOS: case llvm::Triple::XROS: - // NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS: + case llvm::Triple::BridgeOS: create = triple_ref.getVendor() == llvm::Triple::Apple; break; default: diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index 7e589b0d7af2c7..9ceadb21d28413 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -76,7 +76,7 @@ DynamicLoader *DynamicLoaderMacOSXDYLD::CreateInstance(Process *process, case llvm::Triple::TvOS: case llvm::Triple::WatchOS: case llvm::Triple::XROS: - // NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS: + case llvm::Triple::BridgeOS: create = triple_ref.getVendor() == llvm::Triple::Apple; break; default: diff --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp index b652ede9b1f518..147c00e51b40dc 100644 --- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp +++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp @@ -831,7 +831,7 @@ uint32_t EmulateInstructionARM::GetFramePointerRegisterNumber() const { case llvm::Triple::TvOS: case llvm::Triple::WatchOS: case llvm::Triple::XROS: - //
[Lldb-commits] [lldb] [llvm] [ptrauth] Teach LLVM & LLDB about LLVM_ptrauth_authentication_mode (PR #82272)
https://github.com/adrian-prantl approved this pull request. https://github.com/llvm/llvm-project/pull/82272 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Centralize the handling of completion for simple argument lists. (PR #82085)
https://github.com/jimingham updated https://github.com/llvm/llvm-project/pull/82085 >From d08b2b0f10fd449a2b47252aa0da75d515a68664 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Fri, 16 Feb 2024 16:58:35 -0800 Subject: [PATCH 1/3] Centralize the handling of completion for simple argument lists. Most commands were adding argument completion handling by themselves, resulting in a lot of unnecessary boilerplate. In many cases, this could be done generically given the argument definition and the entries in the g_argument_table. I'm going to address this in a couple passes. In this first pass, I added handling of commands that have only one argument list, with one argument type, either single or repeated, and changed all the commands that are of this sort (and don't have other bits of business in their completers.) I also added some missing connections between arg types and completions to the table, and added a RemoteFilename and RemotePath to use in places where we were using the Remote completers. Those arguments used to say they were "files" but they were in fact remote files. I also added a module arg type to use where we were using the module completer. In that case, we should call the argument module. --- lldb/include/lldb/Interpreter/CommandObject.h | 9 ++- .../Interpreter/CommandOptionArgumentTable.h | 21 +++--- lldb/include/lldb/lldb-enumerations.h | 3 + .../source/Commands/CommandObjectCommands.cpp | 14 .../Commands/CommandObjectDWIMPrint.cpp | 6 -- lldb/source/Commands/CommandObjectDWIMPrint.h | 4 - lldb/source/Commands/CommandObjectFrame.cpp | 19 - .../source/Commands/CommandObjectPlatform.cpp | 74 +-- lldb/source/Commands/CommandObjectPlugin.cpp | 7 -- lldb/source/Commands/CommandObjectProcess.cpp | 19 + .../source/Commands/CommandObjectRegister.cpp | 7 +- lldb/source/Commands/CommandObjectSession.cpp | 7 -- .../source/Commands/CommandObjectSettings.cpp | 8 -- lldb/source/Commands/CommandObjectTarget.cpp | 29 +--- lldb/source/Commands/CommandObjectThread.cpp | 13 +--- lldb/source/Commands/CommandObjectType.cpp| 32 .../Commands/CommandObjectWatchpoint.cpp | 10 --- lldb/source/Interpreter/CommandObject.cpp | 36 + lldb/test/API/commands/help/TestHelp.py | 2 +- 19 files changed, 84 insertions(+), 236 deletions(-) diff --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h index 7b427de0264f75..537acb450296b5 100644 --- a/lldb/include/lldb/Interpreter/CommandObject.h +++ b/lldb/include/lldb/Interpreter/CommandObject.h @@ -239,6 +239,13 @@ class CommandObject : public std::enable_shared_from_this { ///The completion request that needs to be answered. virtual void HandleCompletion(CompletionRequest &request); + /// The default version handles argument definitions that have only one + /// argument type, and use one of the argument types that have an entry in + /// the CommonCompletions. Override this if you have a more complex + /// argument setup. + /// FIXME: we should be able to extend this to more complex argument + /// definitions provided we have completers for all the argument types. + /// /// The input array contains a parsed version of the line. /// /// We've constructed the map of options and their arguments as well if that @@ -248,7 +255,7 @@ class CommandObject : public std::enable_shared_from_this { ///The completion request that needs to be answered. virtual void HandleArgumentCompletion(CompletionRequest &request, - OptionElementVector &opt_element_vector) {} + OptionElementVector &opt_element_vector); bool HelpTextContainsWord(llvm::StringRef search_word, bool search_short_help = true, diff --git a/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h b/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h index d0cf54c31ca73f..ab5eff699b4cf0 100644 --- a/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h +++ b/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h @@ -243,7 +243,7 @@ static constexpr CommandObject::ArgumentTableEntry g_argument_table[] = { { lldb::eArgTypeLogCategory, "log-category", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of a category within a log channel, e.g. all (try \"log list\" to see a list of all channels and their categories." }, { lldb::eArgTypeLogChannel, "log-channel", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of a log channel, e.g. process.gdb-remote (try \"log list\" to see a list of all channels and their categories)." }, { lldb::eArgTypeMethod, "method", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "A C++ method name." }, -{ lldb::eArgTypeName, "name", lldb::eTypeCategoryNameCompletion, {}, { nullptr, false }, "Help tex
[Lldb-commits] [lldb] Centralize the handling of completion for simple argument lists. (PR #82085)
jimingham wrote: The next two pieces are "one heterogenous argument list" and then "multiple argument lists". The first one should be easy. The second one is harder because you have to figure out what group matches the current state of the command line. https://github.com/llvm/llvm-project/pull/82085 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 513d9f2 - [ptrauth] Teach LLVM & LLDB about LLVM_ptrauth_authentication_mode (#82272)
Author: Jonas Devlieghere Date: 2024-02-19T15:29:00-08:00 New Revision: 513d9f2395ea017e72602ca6e747a2e061ab8c3f URL: https://github.com/llvm/llvm-project/commit/513d9f2395ea017e72602ca6e747a2e061ab8c3f DIFF: https://github.com/llvm/llvm-project/commit/513d9f2395ea017e72602ca6e747a2e061ab8c3f.diff LOG: [ptrauth] Teach LLVM & LLDB about LLVM_ptrauth_authentication_mode (#82272) Teach LLVM & LLDB about `DW_AT_LLVM_ptrauth_authentication_mode` Added: Modified: lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp llvm/include/llvm/BinaryFormat/Dwarf.def llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s Removed: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp index d4446befd83b05..4884374ef94729 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp @@ -316,8 +316,14 @@ void DWARFDIE::AppendTypeName(Stream &s) const { GetAttributeValueAsUnsigned(DW_AT_LLVM_ptrauth_extra_discriminator, 0); bool isaPointer = GetAttributeValueAsUnsigned(DW_AT_LLVM_ptrauth_isa_pointer, 0); -s.Printf("__ptrauth(%d, %d, 0x0%x, %d)", key, isAddressDiscriminated, - extraDiscriminator, isaPointer); +bool authenticatesNullValues = GetAttributeValueAsUnsigned( +DW_AT_LLVM_ptrauth_authenticates_null_values, 0); +unsigned authenticationMode = +GetAttributeValueAsUnsigned(DW_AT_LLVM_ptrauth_authentication_mode, 3); + +s.Printf("__ptrauth(%d, %d, 0x0%x, %d, %d, %d)", key, + isAddressDiscriminated, extraDiscriminator, isaPointer, + authenticatesNullValues, authenticationMode); break; } default: diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def index 3a08eeaa791aa6..e70b58d5ea50fc 100644 --- a/llvm/include/llvm/BinaryFormat/Dwarf.def +++ b/llvm/include/llvm/BinaryFormat/Dwarf.def @@ -611,6 +611,7 @@ HANDLE_DW_AT(0x3e06, LLVM_ptrauth_extra_discriminator, 0, LLVM) HANDLE_DW_AT(0x3e07, LLVM_apinotes, 0, APPLE) HANDLE_DW_AT(0x3e08, LLVM_ptrauth_isa_pointer, 0, LLVM) HANDLE_DW_AT(0x3e09, LLVM_ptrauth_authenticates_null_values, 0, LLVM) +HANDLE_DW_AT(0x3e0a, LLVM_ptrauth_authentication_mode, 0, LLVM) // Apple extensions. diff --git a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp index ef8ded8ebb66c1..05dee8a3d71298 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp @@ -251,6 +251,21 @@ void DWARFTypePrinter::appendUnqualifiedNameAfter( optionsVec.push_back("isa-pointer"); if (getValOrNull(DW_AT_LLVM_ptrauth_authenticates_null_values)) optionsVec.push_back("authenticates-null-values"); +if (auto AuthenticationMode = +D.find(DW_AT_LLVM_ptrauth_authentication_mode)) { + switch (*AuthenticationMode->getAsUnsignedConstant()) { + case 0: + case 1: +optionsVec.push_back("strip"); +break; + case 2: +optionsVec.push_back("sign-and-strip"); +break; + default: +// Default authentication policy +break; + } +} std::string options; for (const auto *option : optionsVec) { if (options.size()) diff --git a/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s b/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s index d24a60d99bdac3..befd0fa86ef99c 100644 --- a/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s +++ b/llvm/test/tools/llvm-dwarfdump/AArch64/ptrauth.s @@ -23,7 +23,7 @@ # CHECK: 0x004f: DW_TAG_variable # CHECK: DW_AT_name ("p3") -# CHECK: DW_AT_type (0x005a "void *__ptrauth(4, 1, 0x04d4, "authenticates-null-values")") +# CHECK: DW_AT_type (0x005a "void *__ptrauth(4, 1, 0x04d4, "authenticates-null-values,strip")") # CHECK: 0x005a: DW_TAG_LLVM_ptrauth_type # CHECK: DW_AT_LLVM_ptrauth_key (0x04) @@ -31,11 +31,11 @@ # CHECK: DW_AT_LLVM_ptrauth_extra_discriminator (0x04d4) # CHECK: DW_AT_LLVM_ptrauth_authenticates_null_values(true) -# CHECK: 0x0062: DW_TAG_variable +# CHECK: 0x0063: DW_TAG_variable # CHECK: DW_AT_name ("p4") -# CHECK: DW_AT_type (0x006d "void *__ptrauth(4, 1, 0x04d5, "isa-pointer,authenticates-null-values")") +# CHECK: DW_AT_type (0x006e "void *__ptrauth(4, 1, 0x04d5, "isa-pointer,authenticates-null-values,sign-and-strip")") -# CHECK: 0x006d: DW_TAG_LLVM_ptrauth_type +# CHECK: 0x006e: DW_TAG_LLVM_ptrauth_type # CHECK: DW_AT_LLVM_ptrauth_key (0x04) # CHECK: DW_AT_LLVM_ptrauth_address_di
[Lldb-commits] [lldb] [llvm] [ptrauth] Teach LLVM & LLDB about LLVM_ptrauth_authentication_mode (PR #82272)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/82272 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Migrate distutils.version.LooseVersion to packaging (PR #82066)
https://github.com/felipepiovezan approved this pull request. Thanks for doing this https://github.com/llvm/llvm-project/pull/82066 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 13dce35 - [lldb] Migrate distutils.version.LooseVersion to packaging (#82066)
Author: Jonas Devlieghere Date: 2024-02-19T15:31:08-08:00 New Revision: 13dce35876acdd35269f7d64c187c1d831bbf980 URL: https://github.com/llvm/llvm-project/commit/13dce35876acdd35269f7d64c187c1d831bbf980 DIFF: https://github.com/llvm/llvm-project/commit/13dce35876acdd35269f7d64c187c1d831bbf980.diff LOG: [lldb] Migrate distutils.version.LooseVersion to packaging (#82066) The distutils package has been deprecated and was removed from Python 3.12. The migration page [1] advises to use the packaging module instead. Since Python 3.6 that's vendored into pkg_resources. [1] https://peps.python.org/pep-0632/#migration-advice Added: Modified: lldb/packages/Python/lldbsuite/test/decorators.py lldb/packages/Python/lldbsuite/test/lldbplatformutil.py lldb/test/API/sanity/TestSettingSkipping.py lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py lldb/test/Shell/helper/build.py Removed: diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index a5d7a7a25879df..b691f82b90652c 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -1,6 +1,6 @@ # System modules -from distutils.version import LooseVersion from functools import wraps +from pkg_resources import packaging import ctypes import locale import os @@ -65,10 +65,10 @@ def fn_neq(x, y): ">=": fn_geq, "<=": fn_leq, } -expected_str = ".".join([str(x) for x in expected]) -actual_str = ".".join([str(x) for x in actual]) -return op_lookup[comparison](LooseVersion(actual_str), LooseVersion(expected_str)) +return op_lookup[comparison]( +packaging.version.parse(actual), packaging.version.parse(expected) +) def _match_decorator_property(expected, actual): @@ -238,7 +238,9 @@ def fn(actual_debug_info=None): ) ) skip_for_py_version = (py_version is None) or _check_expected_version( -py_version[0], py_version[1], sys.version_info +py_version[0], +py_version[1], +"{}.{}".format(sys.version_info.major, sys.version_info.minor), ) skip_for_macos_version = (macos_version is None) or ( (platform.mac_ver()[0] != "") diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py index bd92d03e0e2212..a118aa61a6287d 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py @@ -7,8 +7,8 @@ import subprocess import sys import os -from distutils.version import LooseVersion from urllib.parse import urlparse +from pkg_resources import packaging # LLDB modules import lldb @@ -297,27 +297,30 @@ def expectedCompilerVersion(compiler_version): if compiler_version is None: return True operator = str(compiler_version[0]) -version = compiler_version[1] +version_str = str(compiler_version[1]) -if version is None: +if not version_str: return True -test_compiler_version = getCompilerVersion() -if test_compiler_version == "unknown": +test_compiler_version_str = getCompilerVersion() +if test_compiler_version_str == "unknown": # Assume the compiler version is at or near the top of trunk. return operator in [">", ">=", "!", "!=", "not"] +version = packaging.version.parse(version_str) +test_compiler_version = packaging.version.parse(test_compiler_version_str) + if operator == ">": -return LooseVersion(test_compiler_version) > LooseVersion(version) +return test_compiler_version < version if operator == ">=" or operator == "=>": -return LooseVersion(test_compiler_version) >= LooseVersion(version) +return test_compiler_version >= version if operator == "<": -return LooseVersion(test_compiler_version) < LooseVersion(version) +return test_compiler_version < version if operator == "<=" or operator == "=<": -return LooseVersion(test_compiler_version) <= LooseVersion(version) +return test_compiler_version <= version if operator == "!=" or operator == "!" or operator == "not": -return str(version) not in str(test_compiler_version) -return str(version) in str(test_compiler_version) +return version_str not in test_compiler_version_str +return version_str in test_compiler_version_str def expectedCompiler(compilers): diff --git a/lldb/test/API/sanity/TestSettingSkipping.py b/lldb/test/API/sanity/TestSettingSkipping.py index 5f58ec2638456d..f0d4d266073e03 100644 --- a/lldb/test/API/sanity/TestSettingSkipping.py +++ b/lldb/test/API/sanity/TestSettingSkipping.py @@ -1,8 +1,7 @@ """ -This is a sanity check that verifies that test can be skli
[Lldb-commits] [lldb] [lldb] Migrate distutils.version.LooseVersion to packaging (PR #82066)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/82066 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Centralize the handling of completion for simple argument lists. (PR #82085)
https://github.com/bulbazord approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/82085 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 2163149 - Centralize the handling of completion for simple argument lists. (#82085)
Author: jimingham Date: 2024-02-19T16:43:08-08:00 New Revision: 21631494b068d9364b8dc8f18e59adee9131a0a5 URL: https://github.com/llvm/llvm-project/commit/21631494b068d9364b8dc8f18e59adee9131a0a5 DIFF: https://github.com/llvm/llvm-project/commit/21631494b068d9364b8dc8f18e59adee9131a0a5.diff LOG: Centralize the handling of completion for simple argument lists. (#82085) Most commands were adding argument completion handling by themselves, resulting in a lot of unnecessary boilerplate. In many cases, this could be done generically given the argument definition and the entries in the g_argument_table. I'm going to address this in a couple passes. In this first pass, I added handling of commands that have only one argument list, with one argument type, either single or repeated, and changed all the commands that are of this sort (and don't have other bits of business in their completers.) I also added some missing connections between arg types and completions to the table, and added a RemoteFilename and RemotePath to use in places where we were using the Remote completers. Those arguments used to say they were "files" but they were in fact remote files. I also added a module arg type to use where we were using the module completer. In that case, we should call the argument module. Added: Modified: lldb/include/lldb/Interpreter/CommandObject.h lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h lldb/include/lldb/lldb-enumerations.h lldb/source/Commands/CommandObjectCommands.cpp lldb/source/Commands/CommandObjectDWIMPrint.cpp lldb/source/Commands/CommandObjectDWIMPrint.h lldb/source/Commands/CommandObjectFrame.cpp lldb/source/Commands/CommandObjectPlatform.cpp lldb/source/Commands/CommandObjectPlugin.cpp lldb/source/Commands/CommandObjectProcess.cpp lldb/source/Commands/CommandObjectRegister.cpp lldb/source/Commands/CommandObjectSession.cpp lldb/source/Commands/CommandObjectSettings.cpp lldb/source/Commands/CommandObjectTarget.cpp lldb/source/Commands/CommandObjectThread.cpp lldb/source/Commands/CommandObjectType.cpp lldb/source/Commands/CommandObjectWatchpoint.cpp lldb/source/Interpreter/CommandObject.cpp lldb/test/API/commands/help/TestHelp.py Removed: diff --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h index b99de56f534469..a326c6dc38a37a 100644 --- a/lldb/include/lldb/Interpreter/CommandObject.h +++ b/lldb/include/lldb/Interpreter/CommandObject.h @@ -242,6 +242,13 @@ class CommandObject : public std::enable_shared_from_this { ///The completion request that needs to be answered. virtual void HandleCompletion(CompletionRequest &request); + /// The default version handles argument definitions that have only one + /// argument type, and use one of the argument types that have an entry in + /// the CommonCompletions. Override this if you have a more complex + /// argument setup. + /// FIXME: we should be able to extend this to more complex argument + /// definitions provided we have completers for all the argument types. + /// /// The input array contains a parsed version of the line. /// /// We've constructed the map of options and their arguments as well if that @@ -251,7 +258,7 @@ class CommandObject : public std::enable_shared_from_this { ///The completion request that needs to be answered. virtual void HandleArgumentCompletion(CompletionRequest &request, - OptionElementVector &opt_element_vector) {} + OptionElementVector &opt_element_vector); bool HelpTextContainsWord(llvm::StringRef search_word, bool search_short_help = true, diff --git a/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h b/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h index d0cf54c31ca73f..ab5eff699b4cf0 100644 --- a/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h +++ b/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h @@ -243,7 +243,7 @@ static constexpr CommandObject::ArgumentTableEntry g_argument_table[] = { { lldb::eArgTypeLogCategory, "log-category", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of a category within a log channel, e.g. all (try \"log list\" to see a list of all channels and their categories." }, { lldb::eArgTypeLogChannel, "log-channel", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of a log channel, e.g. process.gdb-remote (try \"log list\" to see a list of all channels and their categories)." }, { lldb::eArgTypeMethod, "method", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "A C++ method name." }, -{ lldb::eArgTypeName, "name", lldb::eTypeCategoryNameCompletion, {}, { nullptr, false }, "Help text goes here." }, +
[Lldb-commits] [lldb] Centralize the handling of completion for simple argument lists. (PR #82085)
https://github.com/jimingham closed https://github.com/llvm/llvm-project/pull/82085 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] python-bindings: fix `SBTarget.get_target_watchpoints()` (PR #82295)
https://github.com/nikitalita created https://github.com/llvm/llvm-project/pull/82295 Fixes erroneous usage of `bkpts` instead of `watchpoints` (probably introduced from copying and pasting `get_target_bkpts()`). >From 17b15c7ca7c62dad1011e7920e3d06e8e09f6808 Mon Sep 17 00:00:00 2001 From: nikitalita <69168929+nikital...@users.noreply.github.com> Date: Mon, 19 Feb 2024 17:20:31 -0800 Subject: [PATCH] [lldb] bindings: fix SBTarget.get_target_watchpoints --- lldb/bindings/interface/SBTargetExtensions.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/bindings/interface/SBTargetExtensions.i b/lldb/bindings/interface/SBTargetExtensions.i index c80dadfc0c5ca5..d756a351a810ab 100644 --- a/lldb/bindings/interface/SBTargetExtensions.i +++ b/lldb/bindings/interface/SBTargetExtensions.i @@ -172,7 +172,7 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBTarget, lldb::eDescriptionLevelBrief) '''An accessor function that returns a list() that contains all watchpoints in a lldb.SBtarget object.''' watchpoints = [] for idx in range(self.GetNumWatchpoints()): -bkpts.append(self.GetWatchpointAtIndex(idx)) +watchpoints.append(self.GetWatchpointAtIndex(idx)) return watchpoints modules = property(get_modules_array, None, doc='''A read only property that returns a list() of lldb.SBModule objects contained in this target. This list is a list all modules that the target currently is tracking (the main executable and all dependent shared libraries).''') ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] python-bindings: fix `SBTarget.get_target_watchpoints()` (PR #82295)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: None (nikitalita) Changes Fixes erroneous usage of `bkpts` instead of `watchpoints` (probably introduced from copying and pasting `get_target_bkpts()`). --- Full diff: https://github.com/llvm/llvm-project/pull/82295.diff 1 Files Affected: - (modified) lldb/bindings/interface/SBTargetExtensions.i (+1-1) ``diff diff --git a/lldb/bindings/interface/SBTargetExtensions.i b/lldb/bindings/interface/SBTargetExtensions.i index c80dadfc0c5ca5..d756a351a810ab 100644 --- a/lldb/bindings/interface/SBTargetExtensions.i +++ b/lldb/bindings/interface/SBTargetExtensions.i @@ -172,7 +172,7 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBTarget, lldb::eDescriptionLevelBrief) '''An accessor function that returns a list() that contains all watchpoints in a lldb.SBtarget object.''' watchpoints = [] for idx in range(self.GetNumWatchpoints()): -bkpts.append(self.GetWatchpointAtIndex(idx)) +watchpoints.append(self.GetWatchpointAtIndex(idx)) return watchpoints modules = property(get_modules_array, None, doc='''A read only property that returns a list() of lldb.SBModule objects contained in this target. This list is a list all modules that the target currently is tracking (the main executable and all dependent shared libraries).''') `` https://github.com/llvm/llvm-project/pull/82295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] python-bindings: fix `SBTarget.get_target_watchpoints()` (PR #82295)
github-actions[bot] wrote: ⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo. Please turn off [Keep my email addresses private](https://github.com/settings/emails) setting in your account. See [LLVM Discourse](https://discourse.llvm.org/t/hidden-emails-on-github-should-we-do-something-about-it) for more information. https://github.com/llvm/llvm-project/pull/82295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Standardize command option parsing error messages (PR #82273)
jimingham wrote: This is a good direction. The API for creating the error message seems fine, a known part and a "site-specific error" is a workable division w/o being over designed. The one thing that bugs me about this whole setup is that we know the argument type for each option, so even more of the stuff we're doing by hand here should be automated. We should know the `--auto-continue` is a bool because we said so when we defined the option, so it's awkward we have to intervene at all. That's a bigger problem than you are addressing now. The reason it comes up at all with this patch is that you also shouldn't need to add the g_bool_parsing_error_message context by hand, we should know that from the option type. I thought about that when I saw the code: ` if (!additional_context.empty()) stream << ": " << additional_context; ` I was first thinking "we should put an assert there, it shouldn't be possible to have an option parse fail and just say: `Invalid value for -f (--foo) ` That's really unhelpful." But at the same time I was thinking "wait, we know the argument types, so in a lot of cases we could make a more helpful conversion error." But that's currently fairly far from being plumbed through to the point where you could use it. In the end I think this is fine. As you work more on this it might be nice to add some kind of trap to catch people who don't say why a value is wrong. And far down the road, the Option error reporting could provide a useful fallback for common option kinds like bool, int, etc. But that can all be added. This is a fine way to get started. https://github.com/llvm/llvm-project/pull/82273 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Standardize command option parsing error messages (PR #82273)
https://github.com/jimingham approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/82273 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Standardize command option parsing error messages (PR #82273)
jimingham wrote: Actually, I'm going to leave this as approved, but please add a header doc comment on your new API when you commit. Preferably with a stirring exhortation for people to use this in new code. https://github.com/llvm/llvm-project/pull/82273 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] python-bindings: fix `SBTarget.get_target_watchpoints()` (PR #82295)
https://github.com/jimingham approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/82295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Revert "[lldb] Migrate distutils.version.LooseVersion to packaging" (PR #82297)
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/82297 Reverts llvm/llvm-project#82066 because the following tests started failing after: [lldb-api.commands/expression/import-std-module/deque-basic.TestDequeFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_deque-basic/TestDequeFromStdModule_py/) [lldb-api.commands/expression/import-std-module/deque-dbg-info-content.TestDbgInfoContentDequeFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule_py/) [lldb-api.commands/expression/import-std-module/forward_list.TestForwardListFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_forward_list/TestForwardListFromStdModule_py/) [lldb-api.commands/expression/import-std-module/forward_list-dbg-info-content.TestDbgInfoContentForwardListFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule_py/) [lldb-api.commands/expression/import-std-module/list.TestListFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_list/TestListFromStdModule_py/) [lldb-api.commands/expression/import-std-module/non-module-type-separation.TestNonModuleTypeSeparation.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_non-module-type-separation/TestNonModuleTypeSeparation_py/) [lldb-api.commands/expression/import-std-module/queue.TestQueueFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_queue/TestQueueFromStdModule_py/) [lldb-api.commands/expression/import-std-module/retry-with-std-module.TestRetryWithStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_retry-with-std-module/TestRetryWithStdModule_py/) [lldb-api.commands/expression/import-std-module/unique_ptr.TestUniquePtrFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_unique_ptr/TestUniquePtrFromStdModule_py/) [lldb-api.commands/expression/import-std-module/unique_ptr-dbg-info-content.TestUniquePtrDbgInfoContent.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent_py/) [lldb-api.commands/expression/import-std-module/vector-of-vectors.TestVectorOfVectorsFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_vector-of-vectors/TestVectorOfVectorsFromStdModule_py/) [lldb-api.functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr.TestDataFormatterLibcxxSharedPtr.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/functionalities_data-formatter_data-formatter-stl_libcxx_shared_ptr/TestDataFormatterLibcxxSharedPtr_py/) [lldb-api.functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr.TestDataFormatterLibcxxUniquePtr.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/functionalities_data-formatter_data-formatter-stl_libcxx_unique_ptr/TestDataFormatterLibcxxUniquePtr_py/) >From f350b6a9b674f06a9f51048f0de10161813805a2 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 19 Feb 2024 17:45:45 -0800 Subject: [PATCH] Revert "[lldb] Migrate distutils.version.LooseVersion to packaging (#82066)" This reverts commit 13dce35876acdd35269f7d64c187c1d831bbf980. --- .../Python/lldbsuite/test/decorators.py | 12 +++ .../Python/lldbsuite/test/lldbplatformutil.py | 25 +++ lldb/test/API/sanity/TestSettingSkipping.py | 31 ++- .../lldb-server/TestAppleSimulatorOSType.py | 4 +-- lldb/test/Shell/helper/build.py | 4 +-- 5 files changed, 36 insertions(+), 40 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index b691f82b90652c..a5d7a7a25879df 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -1,6 +1,6 @@ # System modules +from distutils.version import LooseVersion from functools import wraps -from pkg_resources import packaging import ctypes import locale import os @@ -65,10 +65,10 @@ def
[Lldb-commits] [lldb] 71e0623 - Revert "[lldb] Migrate distutils.version.LooseVersion to packaging" (#82297)
Author: Jonas Devlieghere Date: 2024-02-19T17:46:51-08:00 New Revision: 71e0623110b674765fb9349f449279faa7361e3d URL: https://github.com/llvm/llvm-project/commit/71e0623110b674765fb9349f449279faa7361e3d DIFF: https://github.com/llvm/llvm-project/commit/71e0623110b674765fb9349f449279faa7361e3d.diff LOG: Revert "[lldb] Migrate distutils.version.LooseVersion to packaging" (#82297) Reverts llvm/llvm-project#82066 because the following tests started failing after: [lldb-api.commands/expression/import-std-module/deque-basic.TestDequeFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_deque-basic/TestDequeFromStdModule_py/) [lldb-api.commands/expression/import-std-module/deque-dbg-info-content.TestDbgInfoContentDequeFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule_py/) [lldb-api.commands/expression/import-std-module/forward_list.TestForwardListFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_forward_list/TestForwardListFromStdModule_py/) [lldb-api.commands/expression/import-std-module/forward_list-dbg-info-content.TestDbgInfoContentForwardListFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule_py/) [lldb-api.commands/expression/import-std-module/list.TestListFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_list/TestListFromStdModule_py/) [lldb-api.commands/expression/import-std-module/non-module-type-separation.TestNonModuleTypeSeparation.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_non-module-type-separation/TestNonModuleTypeSeparation_py/) [lldb-api.commands/expression/import-std-module/queue.TestQueueFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_queue/TestQueueFromStdModule_py/) [lldb-api.commands/expression/import-std-module/retry-with-std-module.TestRetryWithStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_retry-with-std-module/TestRetryWithStdModule_py/) [lldb-api.commands/expression/import-std-module/unique_ptr.TestUniquePtrFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_unique_ptr/TestUniquePtrFromStdModule_py/) [lldb-api.commands/expression/import-std-module/unique_ptr-dbg-info-content.TestUniquePtrDbgInfoContent.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent_py/) [lldb-api.commands/expression/import-std-module/vector-of-vectors.TestVectorOfVectorsFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_vector-of-vectors/TestVectorOfVectorsFromStdModule_py/) [lldb-api.functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr.TestDataFormatterLibcxxSharedPtr.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/functionalities_data-formatter_data-formatter-stl_libcxx_shared_ptr/TestDataFormatterLibcxxSharedPtr_py/) [lldb-api.functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr.TestDataFormatterLibcxxUniquePtr.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/functionalities_data-formatter_data-formatter-stl_libcxx_unique_ptr/TestDataFormatterLibcxxUniquePtr_py/) Added: Modified: lldb/packages/Python/lldbsuite/test/decorators.py lldb/packages/Python/lldbsuite/test/lldbplatformutil.py lldb/test/API/sanity/TestSettingSkipping.py lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py lldb/test/Shell/helper/build.py Removed: diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index b691f82b90652c..a5d7a7a25879df 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -1,6 +1,6 @@ # System modules +from distutils.version import LooseVersion from functools import wraps -from pkg_resources import packaging import ctypes import locale
[Lldb-commits] [lldb] Revert "[lldb] Migrate distutils.version.LooseVersion to packaging" (PR #82297)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/82297 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Revert "[lldb] Migrate distutils.version.LooseVersion to packaging" (PR #82297)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) Changes Reverts llvm/llvm-project#82066 because the following tests started failing after: [lldb-api.commands/expression/import-std-module/deque-basic.TestDequeFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_deque-basic/TestDequeFromStdModule_py/) [lldb-api.commands/expression/import-std-module/deque-dbg-info-content.TestDbgInfoContentDequeFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule_py/) [lldb-api.commands/expression/import-std-module/forward_list.TestForwardListFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_forward_list/TestForwardListFromStdModule_py/) [lldb-api.commands/expression/import-std-module/forward_list-dbg-info-content.TestDbgInfoContentForwardListFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule_py/) [lldb-api.commands/expression/import-std-module/list.TestListFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_list/TestListFromStdModule_py/) [lldb-api.commands/expression/import-std-module/non-module-type-separation.TestNonModuleTypeSeparation.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_non-module-type-separation/TestNonModuleTypeSeparation_py/) [lldb-api.commands/expression/import-std-module/queue.TestQueueFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_queue/TestQueueFromStdModule_py/) [lldb-api.commands/expression/import-std-module/retry-with-std-module.TestRetryWithStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_retry-with-std-module/TestRetryWithStdModule_py/) [lldb-api.commands/expression/import-std-module/unique_ptr.TestUniquePtrFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_unique_ptr/TestUniquePtrFromStdModule_py/) [lldb-api.commands/expression/import-std-module/unique_ptr-dbg-info-content.TestUniquePtrDbgInfoContent.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent_py/) [lldb-api.commands/expression/import-std-module/vector-of-vectors.TestVectorOfVectorsFromStdModule.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/commands_expression_import-std-module_vector-of-vectors/TestVectorOfVectorsFromStdModule_py/) [lldb-api.functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr.TestDataFormatterLibcxxSharedPtr.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/functionalities_data-formatter_data-formatter-stl_libcxx_shared_ptr/TestDataFormatterLibcxxSharedPtr_py/) [lldb-api.functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr.TestDataFormatterLibcxxUniquePtr.py](https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66513/testReport/junit/lldb-api/functionalities_data-formatter_data-formatter-stl_libcxx_unique_ptr/TestDataFormatterLibcxxUniquePtr_py/) --- Full diff: https://github.com/llvm/llvm-project/pull/82297.diff 5 Files Affected: - (modified) lldb/packages/Python/lldbsuite/test/decorators.py (+5-7) - (modified) lldb/packages/Python/lldbsuite/test/lldbplatformutil.py (+11-14) - (modified) lldb/test/API/sanity/TestSettingSkipping.py (+16-15) - (modified) lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py (+2-2) - (modified) lldb/test/Shell/helper/build.py (+2-2) ``diff diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index b691f82b90652c..a5d7a7a25879df 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -1,6 +1,6 @@ # System modules +from distutils.version import LooseVersion from functools import wraps -from pkg_resources import packaging import ctypes import locale import os @@ -65,10 +65,10 @@ def fn_neq(x, y): ">=": fn_geq, "<=": fn_leq, } +expected_str = ".".join([str(x) for x in expected]) +actual_str = ".".join([str(x) for x in actual]) -return op_loo
[Lldb-commits] [lldb] [lldb] Standardize command option parsing error messages (PR #82273)
https://github.com/felipepiovezan approved this pull request. This LGTM! I don't think I can see far enough ahead on what you are planning here, but I was just wondering if the ultimate goal is to have the `option_arg.getAsT` return an `Expected`. In this case, wouldn't all these arguments (short option, long option, additional context) have to be part of the interface of `getAsT`? I suspect this is not your goal, but I can't see a way around that https://github.com/llvm/llvm-project/pull/82273 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Centralize the handling of completion for simple argument lists. (PR #82085)
rastogishubham wrote: @jimingham It seems like this change broke greendragon TestCompletion.py https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/66519/ https://github.com/llvm/llvm-project/pull/82085 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 9ed8b27 - Revert "Centralize the handling of completion for simple argument lists. (#82085)"
Author: Shubham Sandeep Rastogi Date: 2024-02-19T18:19:59-08:00 New Revision: 9ed8b272c30a01c450616f0ed8b2373d5d618ebb URL: https://github.com/llvm/llvm-project/commit/9ed8b272c30a01c450616f0ed8b2373d5d618ebb DIFF: https://github.com/llvm/llvm-project/commit/9ed8b272c30a01c450616f0ed8b2373d5d618ebb.diff LOG: Revert "Centralize the handling of completion for simple argument lists. (#82085)" This reverts commit 21631494b068d9364b8dc8f18e59adee9131a0a5. Reverted because of greendragon failure: TEST 'lldb-api :: functionalities/completion/TestCompletion.py' FAILED Script: Added: Modified: lldb/include/lldb/Interpreter/CommandObject.h lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h lldb/include/lldb/lldb-enumerations.h lldb/source/Commands/CommandObjectCommands.cpp lldb/source/Commands/CommandObjectDWIMPrint.cpp lldb/source/Commands/CommandObjectDWIMPrint.h lldb/source/Commands/CommandObjectFrame.cpp lldb/source/Commands/CommandObjectPlatform.cpp lldb/source/Commands/CommandObjectPlugin.cpp lldb/source/Commands/CommandObjectProcess.cpp lldb/source/Commands/CommandObjectRegister.cpp lldb/source/Commands/CommandObjectSession.cpp lldb/source/Commands/CommandObjectSettings.cpp lldb/source/Commands/CommandObjectTarget.cpp lldb/source/Commands/CommandObjectThread.cpp lldb/source/Commands/CommandObjectType.cpp lldb/source/Commands/CommandObjectWatchpoint.cpp lldb/source/Interpreter/CommandObject.cpp lldb/test/API/commands/help/TestHelp.py Removed: diff --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h index a326c6dc38a37a..b99de56f534469 100644 --- a/lldb/include/lldb/Interpreter/CommandObject.h +++ b/lldb/include/lldb/Interpreter/CommandObject.h @@ -242,13 +242,6 @@ class CommandObject : public std::enable_shared_from_this { ///The completion request that needs to be answered. virtual void HandleCompletion(CompletionRequest &request); - /// The default version handles argument definitions that have only one - /// argument type, and use one of the argument types that have an entry in - /// the CommonCompletions. Override this if you have a more complex - /// argument setup. - /// FIXME: we should be able to extend this to more complex argument - /// definitions provided we have completers for all the argument types. - /// /// The input array contains a parsed version of the line. /// /// We've constructed the map of options and their arguments as well if that @@ -258,7 +251,7 @@ class CommandObject : public std::enable_shared_from_this { ///The completion request that needs to be answered. virtual void HandleArgumentCompletion(CompletionRequest &request, - OptionElementVector &opt_element_vector); + OptionElementVector &opt_element_vector) {} bool HelpTextContainsWord(llvm::StringRef search_word, bool search_short_help = true, diff --git a/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h b/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h index ab5eff699b4cf0..d0cf54c31ca73f 100644 --- a/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h +++ b/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h @@ -243,7 +243,7 @@ static constexpr CommandObject::ArgumentTableEntry g_argument_table[] = { { lldb::eArgTypeLogCategory, "log-category", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of a category within a log channel, e.g. all (try \"log list\" to see a list of all channels and their categories." }, { lldb::eArgTypeLogChannel, "log-channel", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of a log channel, e.g. process.gdb-remote (try \"log list\" to see a list of all channels and their categories)." }, { lldb::eArgTypeMethod, "method", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "A C++ method name." }, -{ lldb::eArgTypeName, "name", lldb::eTypeCategoryNameCompletion, {}, { nullptr, false }, "The name of a type category." }, +{ lldb::eArgTypeName, "name", lldb::eTypeCategoryNameCompletion, {}, { nullptr, false }, "Help text goes here." }, { lldb::eArgTypeNewPathPrefix, "new-path-prefix", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Help text goes here." }, { lldb::eArgTypeNumLines, "num-lines", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The number of lines to use." }, { lldb::eArgTypeNumberPerLine, "number-per-line", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The number of items per line to display." }, @@ -262,7 +262,7 @@ static constexpr CommandObject::ArgumentTableEntry g_argument_table[] = { {