[Lldb-commits] [lldb] [lldb][Test] Add C++ tests for DumpValueObjectOptions and enums (PR #93158)
DavidSpickett wrote: I only intend to use the (soon to be) proposed new options from C++, so I'm going to land this as is, but we certainly could pursue the API route later. https://github.com/llvm/llvm-project/pull/93158 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 7cdd53d - [lldb][Test] Add C++ tests for DumpValueObjectOptions and enums (#93158)
Author: David Spickett Date: 2024-05-28T09:40:50+01:00 New Revision: 7cdd53dacdfd9eef3d46ecddde872c71ec4292a1 URL: https://github.com/llvm/llvm-project/commit/7cdd53dacdfd9eef3d46ecddde872c71ec4292a1 DIFF: https://github.com/llvm/llvm-project/commit/7cdd53dacdfd9eef3d46ecddde872c71ec4292a1.diff LOG: [lldb][Test] Add C++ tests for DumpValueObjectOptions and enums (#93158) DumpValueObjectOptions can only be created and modified from C++. This means it's currently only testable from Python by calling some command that happens to use one, and even so, you can't pick which options get chosen. So we have decent coverage for the major options that way, but I want to add more niche options that will be harder to test from Python (register field options). So this change adds some "unit tests", though it's stretching the definition to the point it's more "test written in C++". So we can test future options in isolation. Since I want to add options specific to enums, that's all it covers. There is a test class that sets up the type system so it will be easy to test other types in future (e.g. structs, which register fields also use). Added: lldb/unittests/ValueObject/CMakeLists.txt lldb/unittests/ValueObject/DumpValueObjectOptionsTests.cpp Modified: lldb/unittests/CMakeLists.txt Removed: diff --git a/lldb/unittests/CMakeLists.txt b/lldb/unittests/CMakeLists.txt index c92c28f7b6897..a2585a94b6155 100644 --- a/lldb/unittests/CMakeLists.txt +++ b/lldb/unittests/CMakeLists.txt @@ -73,6 +73,7 @@ add_subdirectory(tools) add_subdirectory(UnwindAssembly) add_subdirectory(Utility) add_subdirectory(Thread) +add_subdirectory(ValueObject) if(LLDB_CAN_USE_DEBUGSERVER AND LLDB_TOOL_DEBUGSERVER_BUILD AND NOT LLDB_USE_SYSTEM_DEBUGSERVER) add_subdirectory(debugserver) diff --git a/lldb/unittests/ValueObject/CMakeLists.txt b/lldb/unittests/ValueObject/CMakeLists.txt new file mode 100644 index 0..fb31f76506286 --- /dev/null +++ b/lldb/unittests/ValueObject/CMakeLists.txt @@ -0,0 +1,10 @@ +add_lldb_unittest(LLDBValueObjectTests + DumpValueObjectOptionsTests.cpp + + LINK_LIBS +lldbPluginPlatformLinux +lldbPluginScriptInterpreterNone + + LINK_COMPONENTS +Support + ) diff --git a/lldb/unittests/ValueObject/DumpValueObjectOptionsTests.cpp b/lldb/unittests/ValueObject/DumpValueObjectOptionsTests.cpp new file mode 100644 index 0..31068a04d8dfe --- /dev/null +++ b/lldb/unittests/ValueObject/DumpValueObjectOptionsTests.cpp @@ -0,0 +1,176 @@ +//===-- DumpValueObjectOptionsTests.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 "Plugins/Platform/Linux/PlatformLinux.h" +#include "Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h" +#include "Plugins/TypeSystem/Clang/TypeSystemClang.h" +#include "TestingSupport/SubsystemRAII.h" +#include "TestingSupport/Symbol/ClangTestUtils.h" +#include "lldb/Core/Debugger.h" +#include "lldb/Core/ValueObject.h" +#include "lldb/Core/ValueObjectConstResult.h" +#include "lldb/DataFormatters/DumpValueObjectOptions.h" + +#include "gtest/gtest.h" + +using namespace lldb; +using namespace lldb_private; + +struct MockProcess : Process { + MockProcess(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp) + : Process(target_sp, listener_sp) {} + + llvm::StringRef GetPluginName() override { return "mock process"; } + + bool CanDebug(lldb::TargetSP target, bool plugin_specified_by_name) override { +return false; + }; + + Status DoDestroy() override { return {}; } + + void RefreshStateAfterStop() override {} + + bool DoUpdateThreadList(ThreadList &old_thread_list, + ThreadList &new_thread_list) override { +return false; + }; + + size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, + Status &error) override { +// No need to read memory in these tests. +return size; + } +}; + +class ValueObjectMockProcessTest : public ::testing::Test { +public: + void SetUp() override { +ArchSpec arch("i386-pc-linux"); +Platform::SetHostPlatform( +platform_linux::PlatformLinux::CreateInstance(true, &arch)); +m_debugger_sp = Debugger::CreateInstance(); +ASSERT_TRUE(m_debugger_sp); +m_debugger_sp->GetTargetList().CreateTarget(*m_debugger_sp, "", arch, +eLoadDependentsNo, +m_platform_sp, m_target_sp); +ASSERT_TRUE(m_target_sp); +ASSERT_TRUE(m_target_sp->GetArchitecture().IsValid()); +ASSERT_TRUE(m_platform_sp); +m_listener_sp = Listener::MakeListene
[Lldb-commits] [lldb] [lldb][Test] Add C++ tests for DumpValueObjectOptions and enums (PR #93158)
https://github.com/DavidSpickett closed https://github.com/llvm/llvm-project/pull/93158 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add ability to show enum as name and value at the same time (PR #90059)
https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/90059 >From 6344ce3feff235f6a3b1bc1d5eb1e50e5695d320 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Mon, 11 Mar 2024 10:18:51 + Subject: [PATCH] [lldb] Add format eFormatEnumWithValues to ensure raw enum value is always shown When an enum is used to represent certain data it can be useful to know its name and the value of it. For instance, register fields are often set in source code as numbers, but in the debugger you'd like to see the meaning as well. (lldb) register read fpcr fpcr = 0x = (... RMode = RN (0), ...) Often you do just want the meaning but the value saves you having to manually decode it if you want to confirm what your source code has done, or try to replicate the current state in your source code. This also works for bitfield like enums, with the added change that if a bitfield like enum has the value 0, we will print 0 if asked to always show a value. Normally we don't print a 0 there because 0 means no flags are set. I did not intend to make this new format avaialable to the user, but it ended up being so. So you can do: expression --format "enumeration with values" -- foo So testing is mainly from c++ but I have added a couple to the Python tests. --- lldb/include/lldb/lldb-enumerations.h | 12 +--- lldb/source/Commands/CommandObjectMemory.cpp | 1 + lldb/source/Core/DumpDataExtractor.cpp| 1 + lldb/source/Core/ValueObject.cpp | 3 +- lldb/source/DataFormatters/FormatManager.cpp | 1 + lldb/source/DataFormatters/VectorType.cpp | 2 ++ .../TypeSystem/Clang/TypeSystemClang.cpp | 28 ++- .../API/lang/c/enum_types/TestEnumTypes.py| 20 + lldb/unittests/Core/DumpDataExtractorTest.cpp | 1 + .../DumpValueObjectOptionsTests.cpp | 16 +++ 10 files changed, 73 insertions(+), 12 deletions(-) diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 8e05f6ba9c876..99b2ec820e608 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -195,11 +195,15 @@ enum Format { ///< character arrays that can contain non printable ///< characters eFormatAddressInfo,///< Describe what an address points to (func + offset - ///< with file/line, symbol + offset, data, etc) - eFormatHexFloat,///< ISO C99 hex float string - eFormatInstruction, ///< Disassemble an opcode - eFormatVoid,///< Do not print this + ///< with file/line, symbol + offset, data, etc) + eFormatHexFloat, ///< ISO C99 hex float string + eFormatInstruction,///< Disassemble an opcode + eFormatVoid, ///< Do not print this eFormatUnicode8, + eFormatEnumWithValues, ///< Format as an enum but if the value matches one or + ///< more enumerators, print the enumerator name and + ///< value of those enumerators. For example "foo (1)" + ///< instead of "foo". kNumFormats }; diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index b78a0492cca55..7748aa5b7f083 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -1387,6 +1387,7 @@ class CommandObjectMemoryWrite : public CommandObjectParsed { case eFormatBytesWithASCII: case eFormatComplex: case eFormatEnum: + case eFormatEnumWithValues: case eFormatUnicode8: case eFormatUnicode16: case eFormatUnicode32: diff --git a/lldb/source/Core/DumpDataExtractor.cpp b/lldb/source/Core/DumpDataExtractor.cpp index 826edd7bab046..e3fe2343b240d 100644 --- a/lldb/source/Core/DumpDataExtractor.cpp +++ b/lldb/source/Core/DumpDataExtractor.cpp @@ -496,6 +496,7 @@ lldb::offset_t lldb_private::DumpDataExtractor( case eFormatEnum: // Print enum value as a signed integer when we don't get // the enum type +case eFormatEnumWithValues: case eFormatDecimal: if (item_byte_size <= 8) s->Printf("%" PRId64, diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 1443d9dfc3280..d816f33b005ec 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -1189,7 +1189,8 @@ bool ValueObject::DumpPrintableRepresentation( return !error.Fail(); } - if (custom_format == eFormatEnum) + if (custom_format == eFormatEnum || + custom_format == eFormatEnumWithValues) return false; // this only works for arrays, because I have no way to know when the diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp index d7ba5b4b70c94..24ee2becabd3e 100644 --- a/lldb/so
[Lldb-commits] [lldb] [lldb] Add ability to show enum as name and value at the same time (PR #90059)
https://github.com/DavidSpickett edited https://github.com/llvm/llvm-project/pull/90059 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add ability to show enum as name and value at the same time (PR #90059)
https://github.com/DavidSpickett edited https://github.com/llvm/llvm-project/pull/90059 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add format eFormatEnumWithValues to ensure raw enum value is always shown (PR #90059)
https://github.com/DavidSpickett edited https://github.com/llvm/llvm-project/pull/90059 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add format eFormatEnumWithValues to ensure raw enum value is always shown (PR #90059)
DavidSpickett wrote: @clayborg I have updated this to instead use a format, inspired by `eFormatBytesWithASCII`. Which is also one value printed twice. There are examples in the added c++ tests. https://github.com/llvm/llvm-project/pull/90059 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add format eFormatEnumWithValues to ensure raw enum value is always shown (PR #90059)
@@ -195,11 +195,15 @@ enum Format { ///< character arrays that can contain non printable ///< characters eFormatAddressInfo,///< Describe what an address points to (func + offset - ///< with file/line, symbol + offset, data, etc) - eFormatHexFloat,///< ISO C99 hex float string - eFormatInstruction, ///< Disassemble an opcode - eFormatVoid,///< Do not print this + ///< with file/line, symbol + offset, data, etc) + eFormatHexFloat, ///< ISO C99 hex float string + eFormatInstruction,///< Disassemble an opcode + eFormatVoid, ///< Do not print this eFormatUnicode8, + eFormatEnumWithValues, ///< Format as an enum but if the value matches one or + ///< more enumerators, print the enumerator name and + ///< value of those enumerators. For example "foo (1)" + ///< instead of "foo". DavidSpickett wrote: This enum is used in the API so I've added to the end of it. https://github.com/llvm/llvm-project/pull/90059 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add format eFormatEnumWithValues to ensure raw enum value is always shown (PR #90059)
DavidSpickett wrote: @Endilll This being a format type now might mean you can use it from the formatters. I'm not familiar with what parts of the API you're using there. https://github.com/llvm/llvm-project/pull/90059 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Don't call GetNumChildren on non-indexed synthetic variables (PR #93534)
https://github.com/labath created https://github.com/llvm/llvm-project/pull/93534 A synthetic child provider might need to do considerable amount of work to compute the number of children. lldb-dap is currently calling that for all synthethic variables, but it's only actually using the value for values which it deems to be "indexed" (which is determined by looking at the name of the first child). This patch reverses the logic so that GetNumChildren is only called for variables with a suitable first child. >From 1e96acf526eb00e470ce620e5ab523cc21939390 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 28 May 2024 11:11:27 + Subject: [PATCH] [lldb-dap] Don't call GetNumChildren on non-indexed synthetic variables A synthetic child provider might need to do considerable amount of work to compute the number of children. lldb-dap is currently calling that for all synthethic variables, but it's only actually using the value for values which it deems to be "indexed" (which is determined by looking at the name of the first child). This patch reverses the logic so that GetNumChildren is only called for variables with a suitable first child. --- .../lldb-dap/variables/children/Makefile | 3 ++ .../children/TestDAP_variables_children.py| 42 + .../lldb-dap/variables/children/formatter.py | 42 + .../lldb-dap/variables/children/main.cpp | 8 lldb/tools/lldb-dap/JSONUtils.cpp | 45 ++- 5 files changed, 118 insertions(+), 22 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/variables/children/Makefile create mode 100644 lldb/test/API/tools/lldb-dap/variables/children/TestDAP_variables_children.py create mode 100644 lldb/test/API/tools/lldb-dap/variables/children/formatter.py create mode 100644 lldb/test/API/tools/lldb-dap/variables/children/main.cpp diff --git a/lldb/test/API/tools/lldb-dap/variables/children/Makefile b/lldb/test/API/tools/lldb-dap/variables/children/Makefile new file mode 100644 index 0..8b20bcb05 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/variables/children/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/variables/children/TestDAP_variables_children.py b/lldb/test/API/tools/lldb-dap/variables/children/TestDAP_variables_children.py new file mode 100644 index 0..54fb318289aec --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/variables/children/TestDAP_variables_children.py @@ -0,0 +1,42 @@ +import os + +import dap_server +import lldbdap_testcase +from lldbsuite.test import lldbutil +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * + + +class TestDAP_variables_children(lldbdap_testcase.DAPTestCaseBase): +def test_get_num_children(self): +"""Test that GetNumChildren is not called for formatters not producing indexed children.""" +program = self.getBuildArtifact("a.out") +self.build_and_launch( +program, +preRunCommands=[ +"command script import '%s'" % self.getSourcePath("formatter.py") +], +) +source = "main.cpp" +breakpoint1_line = line_number(source, "// break here") +lines = [breakpoint1_line] + +breakpoint_ids = self.set_source_breakpoints( +source, [line_number(source, "// break here")] +) +self.continue_to_breakpoints(breakpoint_ids) + +local_vars = self.dap_server.get_local_variables() +print(local_vars) +indexed = next(filter(lambda x: x["name"] == "indexed", local_vars)) +not_indexed = next(filter(lambda x: x["name"] == "not_indexed", local_vars)) +self.assertIn("indexedVariables", indexed) +self.assertEquals(indexed["indexedVariables"], 1) +self.assertNotIn("indexedVariables", not_indexed) + +self.assertIn( +"['Indexed']", +self.dap_server.request_evaluate( +"`script formatter.num_children_calls", context="repl" +)["body"]["result"], +) diff --git a/lldb/test/API/tools/lldb-dap/variables/children/formatter.py b/lldb/test/API/tools/lldb-dap/variables/children/formatter.py new file mode 100644 index 0..b578faf4f1d3d --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/variables/children/formatter.py @@ -0,0 +1,42 @@ +import lldb + + +num_children_calls = [] + + +class TestSyntheticProvider: +def __init__(self, valobj, dict): +target = valobj.GetTarget() +self._type = valobj.GetType() +data = lldb.SBData.CreateDataFromCString(lldb.eByteOrderLittle, 8, "S") +name = "child" if "Not" in self._type.GetName() else "[0]" +self._child = valobj.CreateValueFromData( +name, data, target.GetBasicType(lldb.eBasicTypeChar) +) + +def num_children(self): +num_children_calls.append(self._type.GetName()) +
[Lldb-commits] [lldb] [lldb-dap] Don't call GetNumChildren on non-indexed synthetic variables (PR #93534)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Pavel Labath (labath) Changes A synthetic child provider might need to do considerable amount of work to compute the number of children. lldb-dap is currently calling that for all synthethic variables, but it's only actually using the value for values which it deems to be "indexed" (which is determined by looking at the name of the first child). This patch reverses the logic so that GetNumChildren is only called for variables with a suitable first child. --- Full diff: https://github.com/llvm/llvm-project/pull/93534.diff 5 Files Affected: - (added) lldb/test/API/tools/lldb-dap/variables/children/Makefile (+3) - (added) lldb/test/API/tools/lldb-dap/variables/children/TestDAP_variables_children.py (+42) - (added) lldb/test/API/tools/lldb-dap/variables/children/formatter.py (+42) - (added) lldb/test/API/tools/lldb-dap/variables/children/main.cpp (+8) - (modified) lldb/tools/lldb-dap/JSONUtils.cpp (+23-22) ``diff diff --git a/lldb/test/API/tools/lldb-dap/variables/children/Makefile b/lldb/test/API/tools/lldb-dap/variables/children/Makefile new file mode 100644 index 0..8b20bcb05 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/variables/children/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/variables/children/TestDAP_variables_children.py b/lldb/test/API/tools/lldb-dap/variables/children/TestDAP_variables_children.py new file mode 100644 index 0..54fb318289aec --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/variables/children/TestDAP_variables_children.py @@ -0,0 +1,42 @@ +import os + +import dap_server +import lldbdap_testcase +from lldbsuite.test import lldbutil +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * + + +class TestDAP_variables_children(lldbdap_testcase.DAPTestCaseBase): +def test_get_num_children(self): +"""Test that GetNumChildren is not called for formatters not producing indexed children.""" +program = self.getBuildArtifact("a.out") +self.build_and_launch( +program, +preRunCommands=[ +"command script import '%s'" % self.getSourcePath("formatter.py") +], +) +source = "main.cpp" +breakpoint1_line = line_number(source, "// break here") +lines = [breakpoint1_line] + +breakpoint_ids = self.set_source_breakpoints( +source, [line_number(source, "// break here")] +) +self.continue_to_breakpoints(breakpoint_ids) + +local_vars = self.dap_server.get_local_variables() +print(local_vars) +indexed = next(filter(lambda x: x["name"] == "indexed", local_vars)) +not_indexed = next(filter(lambda x: x["name"] == "not_indexed", local_vars)) +self.assertIn("indexedVariables", indexed) +self.assertEquals(indexed["indexedVariables"], 1) +self.assertNotIn("indexedVariables", not_indexed) + +self.assertIn( +"['Indexed']", +self.dap_server.request_evaluate( +"`script formatter.num_children_calls", context="repl" +)["body"]["result"], +) diff --git a/lldb/test/API/tools/lldb-dap/variables/children/formatter.py b/lldb/test/API/tools/lldb-dap/variables/children/formatter.py new file mode 100644 index 0..b578faf4f1d3d --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/variables/children/formatter.py @@ -0,0 +1,42 @@ +import lldb + + +num_children_calls = [] + + +class TestSyntheticProvider: +def __init__(self, valobj, dict): +target = valobj.GetTarget() +self._type = valobj.GetType() +data = lldb.SBData.CreateDataFromCString(lldb.eByteOrderLittle, 8, "S") +name = "child" if "Not" in self._type.GetName() else "[0]" +self._child = valobj.CreateValueFromData( +name, data, target.GetBasicType(lldb.eBasicTypeChar) +) + +def num_children(self): +num_children_calls.append(self._type.GetName()) +return 1 + +def get_child_at_index(self, index): +if index != 0: +return None +return self._child + +def get_child_index(self, name): +if name == self._child.GetName(): +return 0 +return None + + +def __lldb_init_module(debugger, dict): +cat = debugger.CreateCategory("TestCategory") +cat.AddTypeSynthetic( +lldb.SBTypeNameSpecifier("Indexed"), + lldb.SBTypeSynthetic.CreateWithClassName("formatter.TestSyntheticProvider"), +) +cat.AddTypeSynthetic( +lldb.SBTypeNameSpecifier("NotIndexed"), + lldb.SBTypeSynthetic.CreateWithClassName("formatter.TestSyntheticProvider"), +) +cat.SetEnabled(True) diff --git a/lldb/test/API/tools/lldb-dap/variables/children/main.cpp b/lldb/test/API/tools/lldb-dap/variables/children/main.cpp new file mode 100644 index 00
[Lldb-commits] [lldb] [lldb] Fix module name tab completion (PR #93458)
https://github.com/labath updated https://github.com/llvm/llvm-project/pull/93458 >From 824ad3beb35adb83600e3d4dbce7c6e274fca1a1 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 27 May 2024 11:02:56 + Subject: [PATCH] [lldb] Fix module name tab completion Module names can be matched either by a full path or just their basename. The completion machinery tried to do both, but had several bugs: - it always inserted the basename as a completion candidate, even if the string being completed was a full path - due to FileSpec canonicalization, it lost information about trailing slashes (it treated "lib/" as "lib", even though it's clear the former was trying to complete a directory name) - due to both of the previous issues, the completion candidates could end up being shorter than the string being completed, which caused crashes (string out of range errors) when attempting to substitute the results. This patch rewrites to logic to remove these kinds of issues: - basename and full path completion are handled separately - full path completion is attempted always, basename only if the input string does not contain a slash - the code remembers both the canonical and original spelling or the completed argument. The canonical arg is used for matching, while the original spelling is used for completion. This way "/foo///.//b" can still match "/foo/bar", but it will complete to "/foo///.//bar". --- lldb/source/Commands/CommandCompletions.cpp | 58 --- .../completion/TestCompletion.py | 35 +++ 2 files changed, 72 insertions(+), 21 deletions(-) diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp index 16078a92ab5fe..baa9dda1f68e6 100644 --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -6,7 +6,9 @@ // //===--===// +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSet.h" #include "lldb/Breakpoint/Watchpoint.h" @@ -262,9 +264,26 @@ class ModuleCompleter : public Completer { public: ModuleCompleter(CommandInterpreter &interpreter, CompletionRequest &request) : Completer(interpreter, request) { -FileSpec partial_spec(m_request.GetCursorArgumentPrefix()); -m_file_name = partial_spec.GetFilename().GetCString(); -m_dir_name = partial_spec.GetDirectory().GetCString(); +llvm::StringRef request_str = m_request.GetCursorArgumentPrefix(); +// We can match the full path, or the file name only. The full match will be +// attempted always, the file name match only if the request does not +// contain a path separator. + +// Preserve both the path as spelled by the user (used for completion) and +// the canonical version (used for matching). +m_spelled_path = request_str; +m_canonical_path = FileSpec(m_spelled_path).GetPath(); +if (!m_spelled_path.empty() && +llvm::sys::path::is_separator(m_spelled_path.back()) && +!llvm::StringRef(m_canonical_path).ends_with(m_spelled_path.back())) { + m_canonical_path += m_spelled_path.back(); +} + +bool has_separator = llvm::find_if(request_str, [](char c) { + return llvm::sys::path::is_separator(c); + }) != request_str.end(); +m_file_name = +has_separator ? llvm::sys::path::get_separator() : request_str; } lldb::SearchDepth GetDepth() override { return lldb::eSearchDepthModule; } @@ -273,22 +292,18 @@ class ModuleCompleter : public Completer { SymbolContext &context, Address *addr) override { if (context.module_sp) { - const char *cur_file_name = - context.module_sp->GetFileSpec().GetFilename().GetCString(); - const char *cur_dir_name = - context.module_sp->GetFileSpec().GetDirectory().GetCString(); - - bool match = false; - if (m_file_name && cur_file_name && - strstr(cur_file_name, m_file_name) == cur_file_name) -match = true; - - if (match && m_dir_name && cur_dir_name && - strstr(cur_dir_name, m_dir_name) != cur_dir_name) -match = false; - - if (match) { -m_request.AddCompletion(cur_file_name); + // Attempt a full path match. + std::string cur_path = context.module_sp->GetFileSpec().GetPath(); + llvm::StringRef cur_path_view = cur_path; + if (cur_path_view.consume_front(m_canonical_path)) +m_request.AddCompletion((m_spelled_path + cur_path_view).str()); + + // And a file name match. + if (m_file_name) { +llvm::StringRef cur_file_name = +context.module_sp->GetFileSpec().GetFilename().GetStringRef(); +if (cur_file_name.starts_with(*m_file_name)) + m_request.AddCo
[Lldb-commits] [lldb] [lldb] Fix module name tab completion (PR #93458)
@@ -297,8 +312,9 @@ class ModuleCompleter : public Completer { void DoCompletion(SearchFilter *filter) override { filter->Search(*this); } private: - const char *m_file_name; - const char *m_dir_name; + std::optional m_file_name; DavidSpickett wrote: Unless there's another constructor I'm not seeing, m_file_name is always assigned to so there's always some value in the optional. Should it just be stringref? https://github.com/llvm/llvm-project/pull/93458 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix module name tab completion (PR #93458)
@@ -906,3 +906,38 @@ def test_ambiguous_command(self): def test_ambiguous_subcommand(self): """Test completing a subcommand of an ambiguous command""" self.complete_from_to("settings s ta", []) + +def test_shlib_name(self): +self.build() +target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) +self.assertTrue(target, VALID_TARGET) +self.registerSharedLibrariesWithTarget(target, ["shared"]) + +basenames = [] +paths = [] +for m in target.modules: +basenames.append(m.file.basename) +paths.append(m.file.fullpath) + +# To see all the diffs +self.maxDiff = None + +# An empty string completes to everything +self.completions_match("target symbols add -s ", basenames + paths) + +# Base name completion +self.completions_match("target symbols add -s a.", ["a.out"]) + +# Full path completion +prefix = os.path.commonpath(paths) +self.completions_match("target symbols add -s '" + prefix, paths) DavidSpickett wrote: Is the `'` some kind of escape character? https://github.com/llvm/llvm-project/pull/93458 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add timestamps to protocol logs (PR #93540)
https://github.com/labath created https://github.com/llvm/llvm-project/pull/93540 I've found them very useful as a rudimentary form of benchmark. >From 2f3cb04a141d39c184afcb0d59acb7ea6cbb16d9 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 28 May 2024 12:16:49 + Subject: [PATCH] [lldb-dap] Add timestamps to protocol logs I've found them very useful as a rudimentary form of benchmark. --- lldb/tools/lldb-dap/DAP.cpp | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp index c7eb3db4304a9..d419f821999e6 100644 --- a/lldb/tools/lldb-dap/DAP.cpp +++ b/lldb/tools/lldb-dap/DAP.cpp @@ -103,7 +103,9 @@ void DAP::SendJSON(const llvm::json::Value &json) { SendJSON(json_str); if (log) { -*log << "<-- " << std::endl +auto now = std::chrono::duration( +std::chrono::system_clock::now().time_since_epoch()); +*log << llvm::formatv("{0:f9} <-- ", now.count()).str() << std::endl << "Content-Length: " << json_str.size() << "\r\n\r\n" << llvm::formatv("{0:2}", json).str() << std::endl; } @@ -130,9 +132,12 @@ std::string DAP::ReadJSON() { if (!input.read_full(log.get(), length, json_str)) return json_str; - if (log) -*log << "--> " << std::endl << "Content-Length: " << length << "\r\n\r\n"; - + if (log) { +auto now = std::chrono::duration( +std::chrono::system_clock::now().time_since_epoch()); +*log << llvm::formatv("{0:f9} --> ", now.count()).str() << std::endl + << "Content-Length: " << length << "\r\n\r\n"; + } return json_str; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add timestamps to protocol logs (PR #93540)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Pavel Labath (labath) Changes I've found them very useful as a rudimentary form of benchmark. --- Full diff: https://github.com/llvm/llvm-project/pull/93540.diff 1 Files Affected: - (modified) lldb/tools/lldb-dap/DAP.cpp (+9-4) ``diff diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp index c7eb3db4304a9..d419f821999e6 100644 --- a/lldb/tools/lldb-dap/DAP.cpp +++ b/lldb/tools/lldb-dap/DAP.cpp @@ -103,7 +103,9 @@ void DAP::SendJSON(const llvm::json::Value &json) { SendJSON(json_str); if (log) { -*log << "<-- " << std::endl +auto now = std::chrono::duration( +std::chrono::system_clock::now().time_since_epoch()); +*log << llvm::formatv("{0:f9} <-- ", now.count()).str() << std::endl << "Content-Length: " << json_str.size() << "\r\n\r\n" << llvm::formatv("{0:2}", json).str() << std::endl; } @@ -130,9 +132,12 @@ std::string DAP::ReadJSON() { if (!input.read_full(log.get(), length, json_str)) return json_str; - if (log) -*log << "--> " << std::endl << "Content-Length: " << length << "\r\n\r\n"; - + if (log) { +auto now = std::chrono::duration( +std::chrono::system_clock::now().time_since_epoch()); +*log << llvm::formatv("{0:f9} --> ", now.count()).str() << std::endl + << "Content-Length: " << length << "\r\n\r\n"; + } return json_str; } `` https://github.com/llvm/llvm-project/pull/93540 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [IRInterpreter] Return zero address for missing weak function (PR #93548)
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/93548 If a weak function is missing, still return it's address (zero) rather than failing interpretation. Otherwise we have a mismatch between Interpret() and CanInterpret() resulting in failures that would not occur with JIT execution. Alternatively, we could try to look for weak symbols in CanInterpret() and generally reject them there. This is the root cause for the issue exposed by https://github.com/llvm/llvm-project/pull/92885. Previously, the case affected by that always fell back to JIT because an icmp constant expression was used, which is not supported by the interpreter. Now a normal icmp instruction is used, which is supported. However, we fail to interpret due to incorrect handling of weak function addresses. >From 0e74f5e94e99c97a8948a521b270f2e1413cc53b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 28 May 2024 15:34:55 +0200 Subject: [PATCH] [IRInterpreter] Return zero address for missing weak function If a weak function is missing, still return it's address (zero) rather than failing interpretation. Otherwise we have a mismatch between Interpret() and CanInterpret() resulting in failures that would not occur with JIT execution. Alternatively, we could try to look for weak symbols in CanInterpret() and generally reject them there. This is the root cause for the issue exposed by https://github.com/llvm/llvm-project/pull/92885. Previously, the case affected by that always fell back to JIT because an icmp constant expression was used, which is not supported by the interpreter. Now a normal icmp instruction is used, which is supported. However, we fail to interpret due to incorrect handling of weak function addresses. --- lldb/source/Expression/IRInterpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp index df02922708663..5b670067b5c43 100644 --- a/lldb/source/Expression/IRInterpreter.cpp +++ b/lldb/source/Expression/IRInterpreter.cpp @@ -264,7 +264,7 @@ class InterpreterStackFrame { lldb_private::ConstString name(constant_func->getName()); bool missing_weak = false; lldb::addr_t addr = m_execution_unit.FindSymbol(name, missing_weak); -if (addr == LLDB_INVALID_ADDRESS || missing_weak) +if (addr == LLDB_INVALID_ADDRESS) return false; value = APInt(m_target_data.getPointerSizeInBits(), addr); return true; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [IRInterpreter] Return zero address for missing weak function (PR #93548)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Nikita Popov (nikic) Changes If a weak function is missing, still return it's address (zero) rather than failing interpretation. Otherwise we have a mismatch between Interpret() and CanInterpret() resulting in failures that would not occur with JIT execution. Alternatively, we could try to look for weak symbols in CanInterpret() and generally reject them there. This is the root cause for the issue exposed by https://github.com/llvm/llvm-project/pull/92885. Previously, the case affected by that always fell back to JIT because an icmp constant expression was used, which is not supported by the interpreter. Now a normal icmp instruction is used, which is supported. However, we fail to interpret due to incorrect handling of weak function addresses. --- Full diff: https://github.com/llvm/llvm-project/pull/93548.diff 1 Files Affected: - (modified) lldb/source/Expression/IRInterpreter.cpp (+1-1) ``diff diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp index df02922708663..5b670067b5c43 100644 --- a/lldb/source/Expression/IRInterpreter.cpp +++ b/lldb/source/Expression/IRInterpreter.cpp @@ -264,7 +264,7 @@ class InterpreterStackFrame { lldb_private::ConstString name(constant_func->getName()); bool missing_weak = false; lldb::addr_t addr = m_execution_unit.FindSymbol(name, missing_weak); -if (addr == LLDB_INVALID_ADDRESS || missing_weak) +if (addr == LLDB_INVALID_ADDRESS) return false; value = APInt(m_target_data.getPointerSizeInBits(), addr); return true; `` https://github.com/llvm/llvm-project/pull/93548 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)
https://github.com/mbucko updated https://github.com/llvm/llvm-project/pull/92014 >From a436c3faf4017b0c84b45046f6eedef9229d3e1d Mon Sep 17 00:00:00 2001 From: Miro Bucko Date: Fri, 10 May 2024 12:42:03 -0700 Subject: [PATCH] Add AddressRange to SB API Summary: This adds new SB API calls and classes to allow a user of the SB API to obtain an address range from SBFunction and SBBlock. Test Plan: llvm-lit -sv llvm-project/lldb/test/API/python_api/address_range/TestAddressRange.py Reviewers: clayborg Subscribers: lldb-commits Tasks: Tags: --- lldb/bindings/headers.swig| 2 + .../interface/SBAddressRangeDocstrings.i | 3 + .../interface/SBAddressRangeExtensions.i | 11 + .../interface/SBAddressRangeListDocstrings.i | 3 + .../interface/SBAddressRangeListExtensions.i | 29 ++ lldb/bindings/interfaces.swig | 6 + lldb/include/lldb/API/LLDB.h | 2 + lldb/include/lldb/API/SBAddress.h | 1 + lldb/include/lldb/API/SBAddressRange.h| 66 + lldb/include/lldb/API/SBAddressRangeList.h| 54 lldb/include/lldb/API/SBBlock.h | 4 + lldb/include/lldb/API/SBDefines.h | 2 + lldb/include/lldb/API/SBFunction.h| 3 + lldb/include/lldb/API/SBStream.h | 2 + lldb/include/lldb/API/SBTarget.h | 1 + lldb/include/lldb/Core/AddressRange.h | 14 + lldb/include/lldb/Core/AddressRangeListImpl.h | 51 lldb/include/lldb/Symbol/Block.h | 2 + lldb/include/lldb/lldb-forward.h | 3 + lldb/source/API/CMakeLists.txt| 2 + lldb/source/API/SBAddressRange.cpp| 103 +++ lldb/source/API/SBAddressRangeList.cpp| 94 +++ lldb/source/API/SBBlock.cpp | 10 + lldb/source/API/SBFunction.cpp| 14 + lldb/source/Core/AddressRange.cpp | 43 +++ lldb/source/Core/AddressRangeListImpl.cpp | 50 lldb/source/Core/CMakeLists.txt | 1 + lldb/source/Symbol/Block.cpp | 16 ++ .../API/python_api/address_range/Makefile | 3 + .../address_range/TestAddressRange.py | 256 ++ .../API/python_api/address_range/main.cpp | 8 + 31 files changed, 859 insertions(+) create mode 100644 lldb/bindings/interface/SBAddressRangeDocstrings.i create mode 100644 lldb/bindings/interface/SBAddressRangeExtensions.i create mode 100644 lldb/bindings/interface/SBAddressRangeListDocstrings.i create mode 100644 lldb/bindings/interface/SBAddressRangeListExtensions.i create mode 100644 lldb/include/lldb/API/SBAddressRange.h create mode 100644 lldb/include/lldb/API/SBAddressRangeList.h create mode 100644 lldb/include/lldb/Core/AddressRangeListImpl.h create mode 100644 lldb/source/API/SBAddressRange.cpp create mode 100644 lldb/source/API/SBAddressRangeList.cpp create mode 100644 lldb/source/Core/AddressRangeListImpl.cpp create mode 100644 lldb/test/API/python_api/address_range/Makefile create mode 100644 lldb/test/API/python_api/address_range/TestAddressRange.py create mode 100644 lldb/test/API/python_api/address_range/main.cpp diff --git a/lldb/bindings/headers.swig b/lldb/bindings/headers.swig index ffdc3c31ec883..c91504604b6ac 100644 --- a/lldb/bindings/headers.swig +++ b/lldb/bindings/headers.swig @@ -8,6 +8,8 @@ %{ #include "lldb/lldb-public.h" #include "lldb/API/SBAddress.h" +#include "lldb/API/SBAddressRange.h" +#include "lldb/API/SBAddressRangeList.h" #include "lldb/API/SBAttachInfo.h" #include "lldb/API/SBBlock.h" #include "lldb/API/SBBreakpoint.h" diff --git a/lldb/bindings/interface/SBAddressRangeDocstrings.i b/lldb/bindings/interface/SBAddressRangeDocstrings.i new file mode 100644 index 0..650195704d73e --- /dev/null +++ b/lldb/bindings/interface/SBAddressRangeDocstrings.i @@ -0,0 +1,3 @@ +%feature("docstring", +"API clients can get address range information." +) lldb::SBAddressRange; diff --git a/lldb/bindings/interface/SBAddressRangeExtensions.i b/lldb/bindings/interface/SBAddressRangeExtensions.i new file mode 100644 index 0..31bcfcb64590b --- /dev/null +++ b/lldb/bindings/interface/SBAddressRangeExtensions.i @@ -0,0 +1,11 @@ +%extend lldb::SBAddressRange { +#ifdef SWIGPYTHON +%pythoncode%{ + def __repr__(self): +import lldb +stream = lldb.SBStream() +self.GetDescription(stream, lldb.target if lldb.target else lldb.SBTarget()) +return stream.GetData() +%} +#endif +} diff --git a/lldb/bindings/interface/SBAddressRangeListDocstrings.i b/lldb/bindings/interface/SBAddressRangeListDocstrings.i new file mode 100644 index 0..e4b96b9ca5931 --- /dev/null +++ b/lldb/bindings/interface/SBAddressRangeListDocstrings.i @@ -0,0 +1,3 @@ +%feature("docstring", +"Represents a list of :py:class:`SBAddressRange`." +) lldb::SBAddressRangeList; diff --git a/lldb/bindings/interface/SBAddressRan
[Lldb-commits] [lldb] [lldb][lldb-dap] Cleanup breakpoint filters. (PR #87550)
https://github.com/oontvoo updated https://github.com/llvm/llvm-project/pull/87550 >From e86d5f95f74a0b2b5f8ec334d8fd4ff519fe7b27 Mon Sep 17 00:00:00 2001 From: Vy Nguyen Date: Fri, 24 May 2024 09:19:12 -0400 Subject: [PATCH 1/2] [lldb]Clean up breakpoint filters - added util function for querying whether a language is supported by the type system - populate the breakpoint filters table based on the supported language(s) --- lldb/include/lldb/API/SBDebugger.h| 2 ++ lldb/include/lldb/Symbol/TypeSystem.h | 1 + lldb/source/API/SBDebugger.cpp| 4 +++ lldb/source/Symbol/TypeSystem.cpp | 11 lldb/tools/lldb-dap/DAP.cpp | 36 +-- lldb/tools/lldb-dap/DAP.h | 3 +++ lldb/tools/lldb-dap/lldb-dap.cpp | 1 + 7 files changed, 50 insertions(+), 8 deletions(-) diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index af19b1faf3bf5..84ea9c0f772e1 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -57,6 +57,8 @@ class LLDB_API SBDebugger { static const char *GetBroadcasterClass(); + static bool SupportsLanguage(lldb::LanguageType language); + lldb::SBBroadcaster GetBroadcaster(); /// Get progress data from a SBEvent whose type is eBroadcastBitProgress. diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index b4025c173a186..7d48f9b316138 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -209,6 +209,7 @@ class TypeSystem : public PluginInterface, // TypeSystems can support more than one language virtual bool SupportsLanguage(lldb::LanguageType language) = 0; + static bool SupportsLanguageStatic(lldb::LanguageType language); // Type Completion virtual bool GetCompleteType(lldb::opaque_compiler_type_t type) = 0; diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index 7ef0d6efd4aaa..29da7d33dd80b 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -1742,3 +1742,7 @@ bool SBDebugger::InterruptRequested() { return m_opaque_sp->InterruptRequested(); return false; } + +bool SBDebugger::SupportsLanguage(lldb::LanguageType language) { + return TypeSystem::SupportsLanguageStatic(language); +} diff --git a/lldb/source/Symbol/TypeSystem.cpp b/lldb/source/Symbol/TypeSystem.cpp index 4956f10a0b0a7..f7d14420fba69 100644 --- a/lldb/source/Symbol/TypeSystem.cpp +++ b/lldb/source/Symbol/TypeSystem.cpp @@ -335,3 +335,14 @@ TypeSystemMap::GetTypeSystemForLanguage(lldb::LanguageType language, } return GetTypeSystemForLanguage(language); } + +bool TypeSystem::SupportsLanguageStatic(lldb::LanguageType language) { + if (language == eLanguageTypeUnknown) +return false; + + LanguageSet plugins = + PluginManager::GetAllTypeSystemSupportedLanguagesForTypes(); + if (plugins.Empty()) +return false; + return plugins[language]; +} diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp index c7eb3db4304a9..81aabc55b08da 100644 --- a/lldb/tools/lldb-dap/DAP.cpp +++ b/lldb/tools/lldb-dap/DAP.cpp @@ -32,14 +32,7 @@ namespace lldb_dap { DAP g_dap; DAP::DAP() -: broadcaster("lldb-dap"), - exception_breakpoints( - {{"cpp_catch", "C++ Catch", lldb::eLanguageTypeC_plus_plus}, - {"cpp_throw", "C++ Throw", lldb::eLanguageTypeC_plus_plus}, - {"objc_catch", "Objective-C Catch", lldb::eLanguageTypeObjC}, - {"objc_throw", "Objective-C Throw", lldb::eLanguageTypeObjC}, - {"swift_catch", "Swift Catch", lldb::eLanguageTypeSwift}, - {"swift_throw", "Swift Throw", lldb::eLanguageTypeSwift}}), +: broadcaster("lldb-dap"), exception_breakpoints(), focus_tid(LLDB_INVALID_THREAD_ID), stop_at_entry(false), is_attach(false), enable_auto_variable_summaries(false), enable_synthetic_child_debugging(false), @@ -61,11 +54,37 @@ DAP::DAP() #endif if (log_file_path) log.reset(new std::ofstream(log_file_path)); + + bp_initted = false; } DAP::~DAP() = default; +void DAP::PopulateExceptionBreakpoints() { + if (debugger.SupportsLanguage(lldb::eLanguageTypeC_plus_plus)) { +exception_breakpoints.emplace_back( +{"cpp_catch", "C++ Catch", lldb::eLanguageTypeC_plus_plus}); +exception_breakpoints.emplace_back( +{"cpp_throw", "C++ Throw", lldb::eLanguageTypeC_plus_plus}); + } + if (debugger.SupportsLanguage(lldb::eLanguageTypeObjC)) { +exception_breakpoints.emplace_back( +{"objc_catch", "Objective-C Catch", lldb::eLanguageTypeObjC}); +exception_breakpoints.emplace_back( +{"objc_throw", "Objective-C Throw", lldb::eLanguageTypeObjC}); + } + if (debugger.SupportsLanguage(lldb::eLanguageTypeSwift)) { +exception_breakpoints.emplace_back( +{"swift_catch", "Swift Catch", lldb::eLanguageTypeSwift}); +exception_breakpoints.emplace_ba
[Lldb-commits] [lldb] [lldb][lldb-dap] Cleanup breakpoint filters. (PR #87550)
https://github.com/oontvoo updated https://github.com/llvm/llvm-project/pull/87550 >From e86d5f95f74a0b2b5f8ec334d8fd4ff519fe7b27 Mon Sep 17 00:00:00 2001 From: Vy Nguyen Date: Fri, 24 May 2024 09:19:12 -0400 Subject: [PATCH 1/3] [lldb]Clean up breakpoint filters - added util function for querying whether a language is supported by the type system - populate the breakpoint filters table based on the supported language(s) --- lldb/include/lldb/API/SBDebugger.h| 2 ++ lldb/include/lldb/Symbol/TypeSystem.h | 1 + lldb/source/API/SBDebugger.cpp| 4 +++ lldb/source/Symbol/TypeSystem.cpp | 11 lldb/tools/lldb-dap/DAP.cpp | 36 +-- lldb/tools/lldb-dap/DAP.h | 3 +++ lldb/tools/lldb-dap/lldb-dap.cpp | 1 + 7 files changed, 50 insertions(+), 8 deletions(-) diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index af19b1faf3bf5..84ea9c0f772e1 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -57,6 +57,8 @@ class LLDB_API SBDebugger { static const char *GetBroadcasterClass(); + static bool SupportsLanguage(lldb::LanguageType language); + lldb::SBBroadcaster GetBroadcaster(); /// Get progress data from a SBEvent whose type is eBroadcastBitProgress. diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index b4025c173a186..7d48f9b316138 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -209,6 +209,7 @@ class TypeSystem : public PluginInterface, // TypeSystems can support more than one language virtual bool SupportsLanguage(lldb::LanguageType language) = 0; + static bool SupportsLanguageStatic(lldb::LanguageType language); // Type Completion virtual bool GetCompleteType(lldb::opaque_compiler_type_t type) = 0; diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index 7ef0d6efd4aaa..29da7d33dd80b 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -1742,3 +1742,7 @@ bool SBDebugger::InterruptRequested() { return m_opaque_sp->InterruptRequested(); return false; } + +bool SBDebugger::SupportsLanguage(lldb::LanguageType language) { + return TypeSystem::SupportsLanguageStatic(language); +} diff --git a/lldb/source/Symbol/TypeSystem.cpp b/lldb/source/Symbol/TypeSystem.cpp index 4956f10a0b0a7..f7d14420fba69 100644 --- a/lldb/source/Symbol/TypeSystem.cpp +++ b/lldb/source/Symbol/TypeSystem.cpp @@ -335,3 +335,14 @@ TypeSystemMap::GetTypeSystemForLanguage(lldb::LanguageType language, } return GetTypeSystemForLanguage(language); } + +bool TypeSystem::SupportsLanguageStatic(lldb::LanguageType language) { + if (language == eLanguageTypeUnknown) +return false; + + LanguageSet plugins = + PluginManager::GetAllTypeSystemSupportedLanguagesForTypes(); + if (plugins.Empty()) +return false; + return plugins[language]; +} diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp index c7eb3db4304a9..81aabc55b08da 100644 --- a/lldb/tools/lldb-dap/DAP.cpp +++ b/lldb/tools/lldb-dap/DAP.cpp @@ -32,14 +32,7 @@ namespace lldb_dap { DAP g_dap; DAP::DAP() -: broadcaster("lldb-dap"), - exception_breakpoints( - {{"cpp_catch", "C++ Catch", lldb::eLanguageTypeC_plus_plus}, - {"cpp_throw", "C++ Throw", lldb::eLanguageTypeC_plus_plus}, - {"objc_catch", "Objective-C Catch", lldb::eLanguageTypeObjC}, - {"objc_throw", "Objective-C Throw", lldb::eLanguageTypeObjC}, - {"swift_catch", "Swift Catch", lldb::eLanguageTypeSwift}, - {"swift_throw", "Swift Throw", lldb::eLanguageTypeSwift}}), +: broadcaster("lldb-dap"), exception_breakpoints(), focus_tid(LLDB_INVALID_THREAD_ID), stop_at_entry(false), is_attach(false), enable_auto_variable_summaries(false), enable_synthetic_child_debugging(false), @@ -61,11 +54,37 @@ DAP::DAP() #endif if (log_file_path) log.reset(new std::ofstream(log_file_path)); + + bp_initted = false; } DAP::~DAP() = default; +void DAP::PopulateExceptionBreakpoints() { + if (debugger.SupportsLanguage(lldb::eLanguageTypeC_plus_plus)) { +exception_breakpoints.emplace_back( +{"cpp_catch", "C++ Catch", lldb::eLanguageTypeC_plus_plus}); +exception_breakpoints.emplace_back( +{"cpp_throw", "C++ Throw", lldb::eLanguageTypeC_plus_plus}); + } + if (debugger.SupportsLanguage(lldb::eLanguageTypeObjC)) { +exception_breakpoints.emplace_back( +{"objc_catch", "Objective-C Catch", lldb::eLanguageTypeObjC}); +exception_breakpoints.emplace_back( +{"objc_throw", "Objective-C Throw", lldb::eLanguageTypeObjC}); + } + if (debugger.SupportsLanguage(lldb::eLanguageTypeSwift)) { +exception_breakpoints.emplace_back( +{"swift_catch", "Swift Catch", lldb::eLanguageTypeSwift}); +exception_breakpoints.emplace_ba
[Lldb-commits] [lldb] [lldb][lldb-dap] Cleanup breakpoint filters. (PR #87550)
oontvoo wrote: @clayborg Hi, do you have any further comments/feedback on this? Thanks! (If not, I plan to merge this in the next few days) https://github.com/llvm/llvm-project/pull/87550 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)
nikic wrote: > > FYI this causes a minor compile-time improvement in stage1 builds using > > gcc: > > https://llvm-compile-time-tracker.com/compare.php?from=32c3561d44aa792ef08d72b5a4c342c9965bc4c2&to=4feae05c6abda364a9295aecfa600d7d4e7dfeb6&stat=instructions:u > > While that's nice, it does suggest that the flags are not the same as > > before. > > @nikic Can you elaborate on those numbers? Do you say that Clang (compiled > with GCC) which compiles those tests works faster now? Yes, exactly. Clang compiled with GCC is faster. Clang compiled with Clang is not. So it seems like something changed in the options for GCC. https://github.com/llvm/llvm-project/pull/92953 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] cde1ae4 - [lldb][NativePDB] Fix uninitialized values found by msan.
Author: Zequan Wu Date: 2024-05-28T11:12:21-04:00 New Revision: cde1ae4c14eecd47215f04d4387845231021d939 URL: https://github.com/llvm/llvm-project/commit/cde1ae4c14eecd47215f04d4387845231021d939 DIFF: https://github.com/llvm/llvm-project/commit/cde1ae4c14eecd47215f04d4387845231021d939.diff LOG: [lldb][NativePDB] Fix uninitialized values found by msan. Added: Modified: lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp Removed: diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp index fab3ca989c0ec..17c5f6118603f 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp @@ -47,15 +47,18 @@ UdtRecordCompleter::UdtRecordCompleter( CVType cvt = m_index.tpi().getType(m_id.index); switch (cvt.kind()) { case LF_ENUM: +m_cvr.er.Options = ClassOptions::None; llvm::cantFail(TypeDeserializer::deserializeAs(cvt, m_cvr.er)); break; case LF_UNION: +m_cvr.ur.Options = ClassOptions::None; llvm::cantFail(TypeDeserializer::deserializeAs(cvt, m_cvr.ur)); m_layout.bit_size = m_cvr.ur.getSize() * 8; m_record.record.kind = Member::Union; break; case LF_CLASS: case LF_STRUCTURE: +m_cvr.cr.Options = ClassOptions::None; llvm::cantFail(TypeDeserializer::deserializeAs(cvt, m_cvr.cr)); m_layout.bit_size = m_cvr.cr.getSize() * 8; m_record.record.kind = Member::Struct; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #92328)
https://github.com/ZequanWu updated https://github.com/llvm/llvm-project/pull/92328 >From d6de8d9a8bc709b5c4761e9a05f9befede938734 Mon Sep 17 00:00:00 2001 From: Zequan Wu Date: Wed, 15 May 2024 13:58:42 -0400 Subject: [PATCH 1/3] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. This reapplies 9a7262c2601874e5aa64c5db19746770212d4b44 and a7eff59f78f08f8ef0487dfe2a136fb311af4fd0 with a fix. It was causing tests on macos to fail because `SymbolFileDWARF::GetForwardDeclCompilerTypeToDIE` returned the map owned by this symol file. When there were two symbol files, two different maps were created for caching from compiler type to DIE even if they are for the same module. The solution is to do the same as `SymbolFileDWARF::GetUniqueDWARFASTTypeMap`: inquery SymbolFileDWARFDebugMap first to get the shared underlying SymbolFile so the map is shared among multiple SymbolFileDWARF. --- .../Plugins/SymbolFile/DWARF/DWARFASTParser.h | 2 + .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 402 ++ .../SymbolFile/DWARF/DWARFASTParserClang.h| 197 - .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 44 +- .../SymbolFile/DWARF/SymbolFileDWARF.h| 7 +- .../SymbolFile/DWARF/UniqueDWARFASTType.cpp | 107 ++--- .../SymbolFile/DWARF/UniqueDWARFASTType.h | 36 +- .../delayed-definition-die-searching.test | 36 ++ 8 files changed, 447 insertions(+), 384 deletions(-) create mode 100644 lldb/test/Shell/SymbolFile/DWARF/delayed-definition-die-searching.test diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h index 66db396279e06..e144cf0f9bd94 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h @@ -60,6 +60,8 @@ class DWARFASTParser { virtual ConstString GetDIEClassTemplateParams(const DWARFDIE &die) = 0; + virtual lldb_private::Type *FindDefinitionTypeForDIE(const DWARFDIE &die) = 0; + static std::optional ParseChildArrayInfo(const DWARFDIE &parent_die, const ExecutionContext *exe_ctx = nullptr); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index f8101aba5c627..2a46be9216121 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -154,6 +154,26 @@ static bool TagIsRecordType(dw_tag_t tag) { } } +static bool IsForwardDeclaration(const DWARFDIE &die, + const ParsedDWARFTypeAttributes &attrs, + LanguageType cu_language) { + if (attrs.is_forward_declaration) +return true; + + // Work around an issue with clang at the moment where forward + // declarations for objective C classes are emitted as: + // DW_TAG_structure_type [2] + // DW_AT_name( "ForwardObjcClass" ) + // DW_AT_byte_size( 0x00 ) + // DW_AT_decl_file( "..." ) + // DW_AT_decl_line( 1 ) + // + // Note that there is no DW_AT_declaration and there are no children, + // and the byte size is zero. + return attrs.byte_size && *attrs.byte_size == 0 && attrs.name && + !die.HasChildren() && cu_language == eLanguageTypeObjC; +} + TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const SymbolContext &sc, const DWARFDIE &die, Log *log) { @@ -249,11 +269,9 @@ static void ForcefullyCompleteType(CompilerType type) { /// This function serves a similar purpose as RequireCompleteType above, but it /// avoids completing the type if it is not immediately necessary. It only /// ensures we _can_ complete the type later. -static void PrepareContextToReceiveMembers(TypeSystemClang &ast, - ClangASTImporter &ast_importer, - clang::DeclContext *decl_ctx, - DWARFDIE die, - const char *type_name_cstr) { +void DWARFASTParserClang::PrepareContextToReceiveMembers( +clang::DeclContext *decl_ctx, const DWARFDIE &decl_ctx_die, +const DWARFDIE &die, const char *type_name_cstr) { auto *tag_decl_ctx = clang::dyn_cast(decl_ctx); if (!tag_decl_ctx) return; // Non-tag context are always ready. @@ -268,7 +286,8 @@ static void PrepareContextToReceiveMembers(TypeSystemClang &ast, // gmodules case), we can complete the type by doing a full import. // If this type was not imported from an external AST, there's nothing to do. - CompilerType type = ast.GetTypeForDecl(tag_decl_ctx); + CompilerType type = m_ast.GetTypeForDecl(tag_decl_ctx); + ClangASTImporter &ast_importer = GetClangASTImporter(); if (type && ast_importer.CanImport(type))
[Lldb-commits] [lldb] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #92328)
ZequanWu wrote: I removed the checking for DW_AT_declaration attributes when completing type from a DIE and applied https://github.com/llvm/llvm-project/pull/91808 to here to ensure we always have a definition DIE at that point. https://github.com/llvm/llvm-project/pull/92328 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #92328)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 71fbbb69d63c461f391cbabf1e32cd9977c4ce68 a2442a2211e75d19db99a24c22961bdfe7c80e07 -- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.h `` View the diff from clang-format here. ``diff diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp index 22f581943e..0c7170c002 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp @@ -84,7 +84,7 @@ bool DebugNamesDWARFIndex::ProcessEntry( if (!die) return true; // Clang erroneously emits index entries for declaration DIEs in case when the - // definition is in a type unit (llvm.org/pr77696). Weed those out. + // definition is in a type unit (llvm.org/pr77696). Weed those out. if (die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0)) return true; return callback(die); `` https://github.com/llvm/llvm-project/pull/92328 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #92328)
https://github.com/ZequanWu updated https://github.com/llvm/llvm-project/pull/92328 >From d6de8d9a8bc709b5c4761e9a05f9befede938734 Mon Sep 17 00:00:00 2001 From: Zequan Wu Date: Wed, 15 May 2024 13:58:42 -0400 Subject: [PATCH 1/4] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. This reapplies 9a7262c2601874e5aa64c5db19746770212d4b44 and a7eff59f78f08f8ef0487dfe2a136fb311af4fd0 with a fix. It was causing tests on macos to fail because `SymbolFileDWARF::GetForwardDeclCompilerTypeToDIE` returned the map owned by this symol file. When there were two symbol files, two different maps were created for caching from compiler type to DIE even if they are for the same module. The solution is to do the same as `SymbolFileDWARF::GetUniqueDWARFASTTypeMap`: inquery SymbolFileDWARFDebugMap first to get the shared underlying SymbolFile so the map is shared among multiple SymbolFileDWARF. --- .../Plugins/SymbolFile/DWARF/DWARFASTParser.h | 2 + .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 402 ++ .../SymbolFile/DWARF/DWARFASTParserClang.h| 197 - .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 44 +- .../SymbolFile/DWARF/SymbolFileDWARF.h| 7 +- .../SymbolFile/DWARF/UniqueDWARFASTType.cpp | 107 ++--- .../SymbolFile/DWARF/UniqueDWARFASTType.h | 36 +- .../delayed-definition-die-searching.test | 36 ++ 8 files changed, 447 insertions(+), 384 deletions(-) create mode 100644 lldb/test/Shell/SymbolFile/DWARF/delayed-definition-die-searching.test diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h index 66db396279e06..e144cf0f9bd94 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h @@ -60,6 +60,8 @@ class DWARFASTParser { virtual ConstString GetDIEClassTemplateParams(const DWARFDIE &die) = 0; + virtual lldb_private::Type *FindDefinitionTypeForDIE(const DWARFDIE &die) = 0; + static std::optional ParseChildArrayInfo(const DWARFDIE &parent_die, const ExecutionContext *exe_ctx = nullptr); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index f8101aba5c627..2a46be9216121 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -154,6 +154,26 @@ static bool TagIsRecordType(dw_tag_t tag) { } } +static bool IsForwardDeclaration(const DWARFDIE &die, + const ParsedDWARFTypeAttributes &attrs, + LanguageType cu_language) { + if (attrs.is_forward_declaration) +return true; + + // Work around an issue with clang at the moment where forward + // declarations for objective C classes are emitted as: + // DW_TAG_structure_type [2] + // DW_AT_name( "ForwardObjcClass" ) + // DW_AT_byte_size( 0x00 ) + // DW_AT_decl_file( "..." ) + // DW_AT_decl_line( 1 ) + // + // Note that there is no DW_AT_declaration and there are no children, + // and the byte size is zero. + return attrs.byte_size && *attrs.byte_size == 0 && attrs.name && + !die.HasChildren() && cu_language == eLanguageTypeObjC; +} + TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const SymbolContext &sc, const DWARFDIE &die, Log *log) { @@ -249,11 +269,9 @@ static void ForcefullyCompleteType(CompilerType type) { /// This function serves a similar purpose as RequireCompleteType above, but it /// avoids completing the type if it is not immediately necessary. It only /// ensures we _can_ complete the type later. -static void PrepareContextToReceiveMembers(TypeSystemClang &ast, - ClangASTImporter &ast_importer, - clang::DeclContext *decl_ctx, - DWARFDIE die, - const char *type_name_cstr) { +void DWARFASTParserClang::PrepareContextToReceiveMembers( +clang::DeclContext *decl_ctx, const DWARFDIE &decl_ctx_die, +const DWARFDIE &die, const char *type_name_cstr) { auto *tag_decl_ctx = clang::dyn_cast(decl_ctx); if (!tag_decl_ctx) return; // Non-tag context are always ready. @@ -268,7 +286,8 @@ static void PrepareContextToReceiveMembers(TypeSystemClang &ast, // gmodules case), we can complete the type by doing a full import. // If this type was not imported from an external AST, there's nothing to do. - CompilerType type = ast.GetTypeForDecl(tag_decl_ctx); + CompilerType type = m_ast.GetTypeForDecl(tag_decl_ctx); + ClangASTImporter &ast_importer = GetClangASTImporter(); if (type && ast_importer.CanImport(type))
[Lldb-commits] [lldb] Improve performance of .debug_names lookups when DW_IDX_parent attributes are used (PR #91808)
ZequanWu wrote: Discussed with Pavel, I applied this change to https://github.com/llvm/llvm-project/pull/92328/ so we can ensure the DIEs from the index is always definition DIEs and avoid duplicate/expensive checks later. https://github.com/llvm/llvm-project/pull/91808 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Don't call GetNumChildren on non-indexed synthetic variables (PR #93534)
https://github.com/walter-erquinigo approved this pull request. Thanks for doing this. Btw, that was a clever way of testing this functionality. https://github.com/llvm/llvm-project/pull/93534 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #92328)
https://github.com/ZequanWu edited https://github.com/llvm/llvm-project/pull/92328 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 51dd4ea - Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (#92328)
Author: Zequan Wu Date: 2024-05-28T11:49:07-04:00 New Revision: 51dd4eaaa29683c16151f5168e7f8645acbd6e6c URL: https://github.com/llvm/llvm-project/commit/51dd4eaaa29683c16151f5168e7f8645acbd6e6c DIFF: https://github.com/llvm/llvm-project/commit/51dd4eaaa29683c16151f5168e7f8645acbd6e6c.diff LOG: Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (#92328) This reapplies https://github.com/llvm/llvm-project/commit/9a7262c2601874e5aa64c5db19746770212d4b44 (#90663) and added https://github.com/llvm/llvm-project/pull/91808 as a fix. It was causing tests on macos to fail because `SymbolFileDWARF::GetForwardDeclCompilerTypeToDIE` returned the map owned by this symol file. When there were two symbol files, two different maps were created for caching from compiler type to DIE even if they are for the same module. The solution is to do the same as `SymbolFileDWARF::GetUniqueDWARFASTTypeMap`: inquery SymbolFileDWARFDebugMap first to get the shared underlying SymbolFile so the map is shared among multiple SymbolFileDWARF. Added: lldb/test/Shell/SymbolFile/DWARF/delayed-definition-die-searching.test Modified: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.h Removed: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h index 66db396279e06..e144cf0f9bd94 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h @@ -60,6 +60,8 @@ class DWARFASTParser { virtual ConstString GetDIEClassTemplateParams(const DWARFDIE &die) = 0; + virtual lldb_private::Type *FindDefinitionTypeForDIE(const DWARFDIE &die) = 0; + static std::optional ParseChildArrayInfo(const DWARFDIE &parent_die, const ExecutionContext *exe_ctx = nullptr); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index f8101aba5c627..e0b1b430b266f 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -154,6 +154,26 @@ static bool TagIsRecordType(dw_tag_t tag) { } } +static bool IsForwardDeclaration(const DWARFDIE &die, + const ParsedDWARFTypeAttributes &attrs, + LanguageType cu_language) { + if (attrs.is_forward_declaration) +return true; + + // Work around an issue with clang at the moment where forward + // declarations for objective C classes are emitted as: + // DW_TAG_structure_type [2] + // DW_AT_name( "ForwardObjcClass" ) + // DW_AT_byte_size( 0x00 ) + // DW_AT_decl_file( "..." ) + // DW_AT_decl_line( 1 ) + // + // Note that there is no DW_AT_declaration and there are no children, + // and the byte size is zero. + return attrs.byte_size && *attrs.byte_size == 0 && attrs.name && + !die.HasChildren() && cu_language == eLanguageTypeObjC; +} + TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const SymbolContext &sc, const DWARFDIE &die, Log *log) { @@ -249,11 +269,9 @@ static void ForcefullyCompleteType(CompilerType type) { /// This function serves a similar purpose as RequireCompleteType above, but it /// avoids completing the type if it is not immediately necessary. It only /// ensures we _can_ complete the type later. -static void PrepareContextToReceiveMembers(TypeSystemClang &ast, - ClangASTImporter &ast_importer, - clang::DeclContext *decl_ctx, - DWARFDIE die, - const char *type_name_cstr) { +void DWARFASTParserClang::PrepareContextToReceiveMembers( +clang::DeclContext *decl_ctx, const DWARFDIE &decl_ctx_die, +const DWARFDIE &die, const char *type_name_cstr) { auto *tag_decl_ctx = clang::dyn_cast(decl_ctx); if (!tag_decl_ctx) return; // Non-tag context are always ready. @@ -268,7 +286,8 @@ static void PrepareContextToReceiveMembers
[Lldb-commits] [lldb] Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #92328)
https://github.com/ZequanWu closed https://github.com/llvm/llvm-project/pull/92328 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add timestamps to protocol logs (PR #93540)
@@ -103,7 +103,9 @@ void DAP::SendJSON(const llvm::json::Value &json) { SendJSON(json_str); if (log) { -*log << "<-- " << std::endl +auto now = std::chrono::duration( +std::chrono::system_clock::now().time_since_epoch()); walter-erquinigo wrote: wouldn't it be better to use steady_clock? that's more stable for benchmarking https://github.com/llvm/llvm-project/pull/93540 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix module name tab completion (PR #93458)
https://github.com/labath updated https://github.com/llvm/llvm-project/pull/93458 >From 824ad3beb35adb83600e3d4dbce7c6e274fca1a1 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 27 May 2024 11:02:56 + Subject: [PATCH 1/2] [lldb] Fix module name tab completion Module names can be matched either by a full path or just their basename. The completion machinery tried to do both, but had several bugs: - it always inserted the basename as a completion candidate, even if the string being completed was a full path - due to FileSpec canonicalization, it lost information about trailing slashes (it treated "lib/" as "lib", even though it's clear the former was trying to complete a directory name) - due to both of the previous issues, the completion candidates could end up being shorter than the string being completed, which caused crashes (string out of range errors) when attempting to substitute the results. This patch rewrites to logic to remove these kinds of issues: - basename and full path completion are handled separately - full path completion is attempted always, basename only if the input string does not contain a slash - the code remembers both the canonical and original spelling or the completed argument. The canonical arg is used for matching, while the original spelling is used for completion. This way "/foo///.//b" can still match "/foo/bar", but it will complete to "/foo///.//bar". --- lldb/source/Commands/CommandCompletions.cpp | 58 --- .../completion/TestCompletion.py | 35 +++ 2 files changed, 72 insertions(+), 21 deletions(-) diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp index 16078a92ab5fe..baa9dda1f68e6 100644 --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -6,7 +6,9 @@ // //===--===// +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSet.h" #include "lldb/Breakpoint/Watchpoint.h" @@ -262,9 +264,26 @@ class ModuleCompleter : public Completer { public: ModuleCompleter(CommandInterpreter &interpreter, CompletionRequest &request) : Completer(interpreter, request) { -FileSpec partial_spec(m_request.GetCursorArgumentPrefix()); -m_file_name = partial_spec.GetFilename().GetCString(); -m_dir_name = partial_spec.GetDirectory().GetCString(); +llvm::StringRef request_str = m_request.GetCursorArgumentPrefix(); +// We can match the full path, or the file name only. The full match will be +// attempted always, the file name match only if the request does not +// contain a path separator. + +// Preserve both the path as spelled by the user (used for completion) and +// the canonical version (used for matching). +m_spelled_path = request_str; +m_canonical_path = FileSpec(m_spelled_path).GetPath(); +if (!m_spelled_path.empty() && +llvm::sys::path::is_separator(m_spelled_path.back()) && +!llvm::StringRef(m_canonical_path).ends_with(m_spelled_path.back())) { + m_canonical_path += m_spelled_path.back(); +} + +bool has_separator = llvm::find_if(request_str, [](char c) { + return llvm::sys::path::is_separator(c); + }) != request_str.end(); +m_file_name = +has_separator ? llvm::sys::path::get_separator() : request_str; } lldb::SearchDepth GetDepth() override { return lldb::eSearchDepthModule; } @@ -273,22 +292,18 @@ class ModuleCompleter : public Completer { SymbolContext &context, Address *addr) override { if (context.module_sp) { - const char *cur_file_name = - context.module_sp->GetFileSpec().GetFilename().GetCString(); - const char *cur_dir_name = - context.module_sp->GetFileSpec().GetDirectory().GetCString(); - - bool match = false; - if (m_file_name && cur_file_name && - strstr(cur_file_name, m_file_name) == cur_file_name) -match = true; - - if (match && m_dir_name && cur_dir_name && - strstr(cur_dir_name, m_dir_name) != cur_dir_name) -match = false; - - if (match) { -m_request.AddCompletion(cur_file_name); + // Attempt a full path match. + std::string cur_path = context.module_sp->GetFileSpec().GetPath(); + llvm::StringRef cur_path_view = cur_path; + if (cur_path_view.consume_front(m_canonical_path)) +m_request.AddCompletion((m_spelled_path + cur_path_view).str()); + + // And a file name match. + if (m_file_name) { +llvm::StringRef cur_file_name = +context.module_sp->GetFileSpec().GetFilename().GetStringRef(); +if (cur_file_name.starts_with(*m_file_name)) + m_request.A
[Lldb-commits] [lldb] [lldb] Adds additional fields to ProcessInfo (PR #91544)
feg208 wrote: @clayborg This pr is ready for re-review https://github.com/llvm/llvm-project/pull/91544 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)
https://github.com/clayborg approved this pull request. https://github.com/llvm/llvm-project/pull/92014 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 42944e4 - Add SBAddressRange and SBAddressRangeList to SB API (#92014)
Author: Miro Bucko Date: 2024-05-28T09:29:10-07:00 New Revision: 42944e4600827738fae868f0df831fb2678be8b4 URL: https://github.com/llvm/llvm-project/commit/42944e4600827738fae868f0df831fb2678be8b4 DIFF: https://github.com/llvm/llvm-project/commit/42944e4600827738fae868f0df831fb2678be8b4.diff LOG: Add SBAddressRange and SBAddressRangeList to SB API (#92014) This adds new SB API calls and classes to allow a user of the SB API to obtain an address ranges from SBFunction and SBBlock. Added: lldb/bindings/interface/SBAddressRangeDocstrings.i lldb/bindings/interface/SBAddressRangeExtensions.i lldb/bindings/interface/SBAddressRangeListDocstrings.i lldb/bindings/interface/SBAddressRangeListExtensions.i lldb/include/lldb/API/SBAddressRange.h lldb/include/lldb/API/SBAddressRangeList.h lldb/include/lldb/Core/AddressRangeListImpl.h lldb/source/API/SBAddressRange.cpp lldb/source/API/SBAddressRangeList.cpp lldb/source/Core/AddressRangeListImpl.cpp lldb/test/API/python_api/address_range/Makefile lldb/test/API/python_api/address_range/TestAddressRange.py lldb/test/API/python_api/address_range/main.cpp Modified: lldb/bindings/headers.swig lldb/bindings/interfaces.swig lldb/include/lldb/API/LLDB.h lldb/include/lldb/API/SBAddress.h lldb/include/lldb/API/SBBlock.h lldb/include/lldb/API/SBDefines.h lldb/include/lldb/API/SBFunction.h lldb/include/lldb/API/SBStream.h lldb/include/lldb/API/SBTarget.h lldb/include/lldb/Core/AddressRange.h lldb/include/lldb/Symbol/Block.h lldb/include/lldb/lldb-forward.h lldb/source/API/CMakeLists.txt lldb/source/API/SBBlock.cpp lldb/source/API/SBFunction.cpp lldb/source/Core/AddressRange.cpp lldb/source/Core/CMakeLists.txt lldb/source/Symbol/Block.cpp Removed: diff --git a/lldb/bindings/headers.swig b/lldb/bindings/headers.swig index ffdc3c31ec883..c91504604b6ac 100644 --- a/lldb/bindings/headers.swig +++ b/lldb/bindings/headers.swig @@ -8,6 +8,8 @@ %{ #include "lldb/lldb-public.h" #include "lldb/API/SBAddress.h" +#include "lldb/API/SBAddressRange.h" +#include "lldb/API/SBAddressRangeList.h" #include "lldb/API/SBAttachInfo.h" #include "lldb/API/SBBlock.h" #include "lldb/API/SBBreakpoint.h" diff --git a/lldb/bindings/interface/SBAddressRangeDocstrings.i b/lldb/bindings/interface/SBAddressRangeDocstrings.i new file mode 100644 index 0..650195704d73e --- /dev/null +++ b/lldb/bindings/interface/SBAddressRangeDocstrings.i @@ -0,0 +1,3 @@ +%feature("docstring", +"API clients can get address range information." +) lldb::SBAddressRange; diff --git a/lldb/bindings/interface/SBAddressRangeExtensions.i b/lldb/bindings/interface/SBAddressRangeExtensions.i new file mode 100644 index 0..31bcfcb64590b --- /dev/null +++ b/lldb/bindings/interface/SBAddressRangeExtensions.i @@ -0,0 +1,11 @@ +%extend lldb::SBAddressRange { +#ifdef SWIGPYTHON +%pythoncode%{ + def __repr__(self): +import lldb +stream = lldb.SBStream() +self.GetDescription(stream, lldb.target if lldb.target else lldb.SBTarget()) +return stream.GetData() +%} +#endif +} diff --git a/lldb/bindings/interface/SBAddressRangeListDocstrings.i b/lldb/bindings/interface/SBAddressRangeListDocstrings.i new file mode 100644 index 0..e4b96b9ca5931 --- /dev/null +++ b/lldb/bindings/interface/SBAddressRangeListDocstrings.i @@ -0,0 +1,3 @@ +%feature("docstring", +"Represents a list of :py:class:`SBAddressRange`." +) lldb::SBAddressRangeList; diff --git a/lldb/bindings/interface/SBAddressRangeListExtensions.i b/lldb/bindings/interface/SBAddressRangeListExtensions.i new file mode 100644 index 0..e281a84d73d27 --- /dev/null +++ b/lldb/bindings/interface/SBAddressRangeListExtensions.i @@ -0,0 +1,29 @@ +%extend lldb::SBAddressRangeList { +#ifdef SWIGPYTHON +%pythoncode%{ +def __len__(self): + '''Return the number of address ranges in a lldb.SBAddressRangeList object.''' + return self.GetSize() + +def __iter__(self): + '''Iterate over all the address ranges in a lldb.SBAddressRangeList object.''' + return lldb_iter(self, 'GetSize', 'GetAddressRangeAtIndex') + +def __getitem__(self, idx): + '''Get the address range at a given index in an lldb.SBAddressRangeList object.''' + if not isinstance(idx, int): +raise TypeError("unsupported index type: %s" % type(idx)) + count = len(self) + if not (-count <= idx < count): +raise IndexError("list index out of range") + idx %= count + return self.GetAddressRangeAtIndex(idx) + +def __repr__(self): + import lldb + stream = lldb.SBStream() + self.GetDescription(stream, lldb.target if lldb.target else lldb.SBTarget()) + return stream.GetData() +%} +#endif +} diff --git a/lldb/bindings/interfaces.
[Lldb-commits] [lldb] Add AddressRange to SB API (PR #92014)
https://github.com/clayborg closed https://github.com/llvm/llvm-project/pull/92014 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Summarize std::string's when created from data. (PR #89110)
@@ -254,13 +254,17 @@ bool lldb_private::formatters::LibStdcppStringSummaryProvider( } else addr_of_string = valobj.GetAddressOf(scalar_is_load_addr, &addr_type); - if (addr_of_string != LLDB_INVALID_ADDRESS) { + + // We have to check for host address here + // because GetAddressOf returns INVALID for all non load addresses. + // But we can still format strings in host memory. + if (addr_of_string != LLDB_INVALID_ADDRESS || +addr_type == eAddressTypeHost) { clayborg wrote: > I think we need to be more careful here. GetAddressOf is really meant to do > "can you find an address in the target for this object". We use it that way > in a whole bunch of places, e.g.: > > ``` > cstr_address = GetAddressOf(true, &cstr_address_type); > } else { > // We have a pointer > cstr_address = GetPointerValue(&cstr_address_type); > } > > if (cstr_address == 0 || cstr_address == LLDB_INVALID_ADDRESS) { > if (cstr_address_type == eAddressTypeHost && is_array) { > const char *cstr = GetDataExtractor().PeekCStr(0); > ``` > > So in that case we are expecting a host address type to return an invalid > address from GetAddressOf. > > This change worries me, I don't think it will be what other code expects? > Maybe you can get the value you need like the code above does instead? The code above works, but I think it doesn't total sense from a readability standpoint. We have a `GetAddressOf` function that return the address kind and a value, I am not sure why we wouldn't want to take advantage of that and use it? The above code is a bit interesting as it makes a bunch of assumptions like "is this a host address and if this is an array, I know my data is in the data extractor at offset zero". I mean it works, but does it make sense to duplicate these kind of assumptions? Make sense to fix GetAddressOf to take advantage of the API it is implementing. If the address kind can be host and we can return a valid host address value, I would say we use it. We will need to look over all uses of this API internally if we do change it. https://github.com/llvm/llvm-project/pull/89110 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Summarize std::string's when created from data. (PR #89110)
@@ -254,13 +254,17 @@ bool lldb_private::formatters::LibStdcppStringSummaryProvider( } else addr_of_string = valobj.GetAddressOf(scalar_is_load_addr, &addr_type); - if (addr_of_string != LLDB_INVALID_ADDRESS) { + + // We have to check for host address here + // because GetAddressOf returns INVALID for all non load addresses. + // But we can still format strings in host memory. + if (addr_of_string != LLDB_INVALID_ADDRESS || +addr_type == eAddressTypeHost) { jimingham wrote: That's fine too, but you have to be careful here since getting host vrs. target address attribution wrong is one quick way to crash lldb. https://github.com/llvm/llvm-project/pull/89110 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix module name tab completion (PR #93458)
@@ -906,3 +906,38 @@ def test_ambiguous_command(self): def test_ambiguous_subcommand(self): """Test completing a subcommand of an ambiguous command""" self.complete_from_to("settings s ta", []) + +def test_shlib_name(self): +self.build() +target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) +self.assertTrue(target, VALID_TARGET) +self.registerSharedLibrariesWithTarget(target, ["shared"]) + +basenames = [] +paths = [] +for m in target.modules: +basenames.append(m.file.basename) +paths.append(m.file.fullpath) + +# To see all the diffs +self.maxDiff = None + +# An empty string completes to everything +self.completions_match("target symbols add -s ", basenames + paths) + +# Base name completion +self.completions_match("target symbols add -s a.", ["a.out"]) + +# Full path completion +prefix = os.path.commonpath(paths) +self.completions_match("target symbols add -s '" + prefix, paths) labath wrote: it's a quote, just in case the path contains spaces, backslashes, etc. https://github.com/llvm/llvm-project/pull/93458 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix module name tab completion (PR #93458)
@@ -297,8 +312,9 @@ class ModuleCompleter : public Completer { void DoCompletion(SearchFilter *filter) override { filter->Search(*this); } private: - const char *m_file_name; - const char *m_dir_name; + std::optional m_file_name; labath wrote: Yeah, this was my mistake. I originally wrote this using `"/"` as the invalid file name (thinking `/` cannot appear in a file name), but then I changed it because: a) I though it was too clever; b) I realized that if `"/"` is the whole path, then `/` *is* the file name. And then I only updated half of the code... https://github.com/llvm/llvm-project/pull/93458 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add timestamps to protocol logs (PR #93540)
@@ -103,7 +103,9 @@ void DAP::SendJSON(const llvm::json::Value &json) { SendJSON(json_str); if (log) { -*log << "<-- " << std::endl +auto now = std::chrono::duration( +std::chrono::system_clock::now().time_since_epoch()); labath wrote: for a benchmark yes, but this is only a "benchmark" (with *very* large quotes). Like, I won't be using this during daylight savings switchover, and I don't think it's suitable for anything automated. And it's kinda nice it matches the time stamps for regular lldb logs (I literally copied this code from there). https://github.com/llvm/llvm-project/pull/93540 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add timestamps to protocol logs (PR #93540)
https://github.com/walter-erquinigo approved this pull request. sounds good then! https://github.com/llvm/llvm-project/pull/93540 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] A few updates around "transcript" (PR #92843)
@@ -362,6 +363,36 @@ llvm::json::Value DebuggerStats::ReportStatistics( global_stats.try_emplace("modules", std::move(json_modules)); global_stats.try_emplace("memory", std::move(json_memory)); global_stats.try_emplace("commands", std::move(cmd_stats)); + +// When transcript is available, add it to the to-be-returned statistics. +// +// NOTE: +// When the statistics is polled by an LLDB command: +// - The transcript in the returned statistics *will NOT* contain the +// returned statistics itself. +// - The returned statistics *will* be written to the internal transcript +// buffer as the output of the said LLDB command. It *will* appear in +// the next statistcs or transcript poll. +// +// For example, let's say the following commands are run in order: +// - "version" +// - "statistics dump" <- call it "A" +// - "statistics dump" <- call it "B" +// The output of "A" will contain the transcript of "version" and +// "statistics dump" (A), with the latter having empty output. The output +// of B will contain the trascnript of "version", "statistics dump" (A), +// "statistics dump" (B), with A's output populated and B's output empty. clayborg wrote: If we have the data, we should include everything. I would say we might want to add a new option to "statistics dump" like "statistics dump --transcript" to let the user enable this. As the output can be quite large https://github.com/llvm/llvm-project/pull/92843 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Summarize std::string's when created from data. (PR #89110)
@@ -254,13 +254,17 @@ bool lldb_private::formatters::LibStdcppStringSummaryProvider( } else addr_of_string = valobj.GetAddressOf(scalar_is_load_addr, &addr_type); - if (addr_of_string != LLDB_INVALID_ADDRESS) { + + // We have to check for host address here + // because GetAddressOf returns INVALID for all non load addresses. + // But we can still format strings in host memory. + if (addr_of_string != LLDB_INVALID_ADDRESS || +addr_type == eAddressTypeHost) { Jlalond wrote: > Make sense to fix GetAddressOf to take advantage of the API it is > implementing. If the address kind can be host and we can return a valid host > address value, I would say we use it. We will need to look over all uses of > this API internally if we do change it. If we decide to go forward with this refactor, I think we should probably split this out into it's own independent PR and put this one on pause. As Jim mentioned above there are currently places that make assumptions based on the value object being host and getting back an invalid address, and we would need to correct for that. https://github.com/llvm/llvm-project/pull/89110 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] A few updates around "transcript" (PR #92843)
@@ -320,10 +320,13 @@ class SBCommandInterpreter { /// Returns a list of handled commands, output and error. Each element in /// the list is a dictionary with the following keys/values: - /// - "command" (string): The command that was executed. + /// - "command" (string): The command that was given by the user. + /// - "resolvedCommand" (string): The expanded command that was executed. clayborg wrote: We might also want just the command's internal name without the arguments. It would be nice to gather stats on the different kinds of commands and what the average times were. We currently have some stats on commands like: ``` "commands": { "breakpoint set": 2, "command container add": 1, "command regex": 2, "command script add": 41, "command script import": 54, "command source": 1, "command unalias": 3, "process launch": 1, "statistics dump": 1, "target create": 1, "type category define": 1, "type format add": 1, "type summary add": 78, "type synthetic add": 27 }, ``` This is breaking down the number of calls to a command by the base name of the command. So maybe instead of "resolvedCommand" we have: ``` "commandName": "breakpoint set", "commandArguments": "--file main.cpp --line 23" ``` As this will allow us to go through all entries in the transcript and grab each `durationInSeconds` entry so we can average the times for each `commandName` and include those at the top level https://github.com/llvm/llvm-project/pull/92843 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove lldbassert in AppleObjCTypeEncodingParser (PR #93332)
https://github.com/bulbazord approved this pull request. Makes sense to me. https://github.com/llvm/llvm-project/pull/93332 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] d1d863c - [lldb] Remove lldbassert in AppleObjCTypeEncodingParser (#93332)
Author: Jonas Devlieghere Date: 2024-05-28T10:32:09-07:00 New Revision: d1d863c012cf3d5b407ae06d23a5628ec9510b7c URL: https://github.com/llvm/llvm-project/commit/d1d863c012cf3d5b407ae06d23a5628ec9510b7c DIFF: https://github.com/llvm/llvm-project/commit/d1d863c012cf3d5b407ae06d23a5628ec9510b7c.diff LOG: [lldb] Remove lldbassert in AppleObjCTypeEncodingParser (#93332) AppleObjCTypeEncodingParser::BuildObjCObjectPointerType currently contains an lldbassert to detect situations where we have a forward declaration without a definition. According to the accompanying comment, its purpose is to catch "weird cases" during test suite runs. However, because this is an lldbassert, we show a scary message to our users who think this is a problem and report the issue to us. Unfortunately those reports aren't very actionable without a way to know the name of the type. This patch changes the lldbassert to a regular assert and emits a log message to the types log when this happens. rdar://127439898 Added: Modified: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp Removed: diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp index ca582cb1d5a46..4871c59faefcc 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp @@ -13,6 +13,8 @@ #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" #include "lldb/Utility/StringLexer.h" #include "clang/Basic/TargetInfo.h" @@ -234,12 +236,15 @@ clang::QualType AppleObjCTypeEncodingParser::BuildObjCObjectPointerType( auto types = decl_vendor->FindTypes(ConstString(name), /*max_matches*/ 1); -// The user can forward-declare something that has no definition. The runtime -// doesn't prohibit this at all. This is a rare and very weird case. We keep -// this assert in debug builds so we catch other weird cases. -lldbassert(!types.empty()); -if (types.empty()) +if (types.empty()) { + // The user can forward-declare something that has no definition. The + // runtime doesn't prohibit this at all. This is a rare and very weird + // case. Assert assert in debug builds so we catch other weird cases. + assert(false && "forward declaration without definition"); + LLDB_LOG(GetLog(LLDBLog::Types), + "forward declaration without definition: {0}", name) return ast_ctx.getObjCIdType(); +} return ClangUtil::GetQualType(types.front().GetPointerType()); } else { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove lldbassert in AppleObjCTypeEncodingParser (PR #93332)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/93332 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] f69b6d2 - [lldb] Add missing semicolon (NFC)
Author: Jonas Devlieghere Date: 2024-05-28T10:36:20-07:00 New Revision: f69b6d2c99a10847a2d73c7fcd656d2ae22937ce URL: https://github.com/llvm/llvm-project/commit/f69b6d2c99a10847a2d73c7fcd656d2ae22937ce DIFF: https://github.com/llvm/llvm-project/commit/f69b6d2c99a10847a2d73c7fcd656d2ae22937ce.diff LOG: [lldb] Add missing semicolon (NFC) Added: Modified: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp Removed: diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp index 4871c59faefcc..ddaa7a8a597b4 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp @@ -242,7 +242,7 @@ clang::QualType AppleObjCTypeEncodingParser::BuildObjCObjectPointerType( // case. Assert assert in debug builds so we catch other weird cases. assert(false && "forward declaration without definition"); LLDB_LOG(GetLog(LLDBLog::Types), - "forward declaration without definition: {0}", name) + "forward declaration without definition: {0}", name); return ast_ctx.getObjCIdType(); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
https://github.com/santhoshe447 updated https://github.com/llvm/llvm-project/pull/91570 >From 960351c9abf51f42d92604ac6297aa5b76ddfba5 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Ellendula Date: Fri, 17 Nov 2023 15:09:10 +0530 Subject: [PATCH 1/8] [lldb][test] Add the ability to extract the variable value out of the summary. --- .../Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py index 9d79872b029a3..0cf9d4fde4948 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py @@ -195,6 +195,9 @@ def collect_console(self, duration): def get_local_as_int(self, name, threadId=None): value = self.dap_server.get_local_variable_value(name, threadId=threadId) +# 'value' may have the variable value and summary. +# Extract the variable value since summary can have nonnumeric characters. +value = value.split(" ")[0] if value.startswith("0x"): return int(value, 16) elif value.startswith("0"): >From ab44a6991c5bc8ac5764c3f71cbe3acc747b3776 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Ellendula Date: Fri, 3 May 2024 02:47:05 -0700 Subject: [PATCH 2/8] [lldb-dap] Added "port" property to vscode "attach" command. Adding a "port" property to the VsCode "attach" command likely extends the functionality of the debugger configuratiuon to allow attaching to a process using PID or PORT number. Currently, the "Attach" configuration lets the user specify a pid. We tell the user to use the attachCommands property to run "gdb-remote ". Followed the below conditions for "attach" command with "port" and "pid" We should add a "port" property. If port is specified and pid is not, use that port to attach. If both port and pid are specified, return an error saying that the user can't specify both pid and port. Ex - launch.json { "version": "0.2.0", "configurations": [ { "name": "lldb-dap Debug", "type": "lldb-dap", "request": "attach", "port":1234, "program": "${workspaceFolder}/a.out", "args": [], "stopOnEntry": false, "cwd": "${workspaceFolder}", "env": [], } ] } --- lldb/include/lldb/lldb-defines.h | 1 + .../Python/lldbsuite/test/lldbtest.py | 9 ++ .../test/tools/lldb-dap/dap_server.py | 6 + .../test/tools/lldb-dap/lldbdap_testcase.py | 20 +++ .../attach/TestDAP_attachByPortNum.py | 120 ++ lldb/tools/lldb-dap/lldb-dap.cpp | 36 +- lldb/tools/lldb-dap/package.json | 11 ++ 7 files changed, 199 insertions(+), 4 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py diff --git a/lldb/include/lldb/lldb-defines.h b/lldb/include/lldb/lldb-defines.h index c7bd019c5c90e..a1e6ee2ce468c 100644 --- a/lldb/include/lldb/lldb-defines.h +++ b/lldb/include/lldb/lldb-defines.h @@ -96,6 +96,7 @@ #define LLDB_INVALID_QUEUE_ID 0 #define LLDB_INVALID_CPU_ID UINT32_MAX #define LLDB_INVALID_WATCHPOINT_RESOURCE_ID UINT32_MAX +#define LLDB_INVALID_PORT_NUMBER 0 /// CPU Type definitions #define LLDB_ARCH_DEFAULT "systemArch" diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 5fd686c143e9f..fb3cd22959df2 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -1572,6 +1572,15 @@ def findBuiltClang(self): return os.environ["CC"] +def getBuiltServerTool(self, server_tool): +# Tries to find simulation/lldb-server/gdbserver tool at the same folder as the lldb. +lldb_dir = os.path.dirname(lldbtest_config.lldbExec) +path = shutil.which(server_tool, path=lldb_dir) +if path is not None: +return path + +return "" + def yaml2obj(self, yaml_path, obj_path, max_size=None): """ Create an object file at the given path from a yaml file. diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 5838281bcb1a1..96d312565f953 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -568,6 +568,8 @@ def request_attach( coreFile=None, postRunCommands=None, sourceMap=None, +port=None, +hostname=None ): args_dict = {} if pid is not None: @@ -597,6 +599,10 @@ def request_attach( args_dict["postRunCommands"] = postRunComman
[Lldb-commits] [lldb] [lldb-dap] Add timestamps to protocol logs (PR #93540)
https://github.com/clayborg approved this pull request. https://github.com/llvm/llvm-project/pull/93540 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Summarize std::string's when created from data. (PR #89110)
@@ -254,13 +254,17 @@ bool lldb_private::formatters::LibStdcppStringSummaryProvider( } else addr_of_string = valobj.GetAddressOf(scalar_is_load_addr, &addr_type); - if (addr_of_string != LLDB_INVALID_ADDRESS) { + + // We have to check for host address here + // because GetAddressOf returns INVALID for all non load addresses. + // But we can still format strings in host memory. + if (addr_of_string != LLDB_INVALID_ADDRESS || +addr_type == eAddressTypeHost) { clayborg wrote: > > Make sense to fix GetAddressOf to take advantage of the API it is > > implementing. If the address kind can be host and we can return a valid > > host address value, I would say we use it. We will need to look over all > > uses of this API internally if we do change it. > > If we decide to go forward with this refactor, I think we should probably > split this out into it's own independent PR and put this one on pause. As Jim > mentioned above there are currently places that make assumptions based on the > value object being host and getting back an invalid address, and we would > need to correct for that. I would be interesting to see how many places do this kind of pattern. If it is only a few locations, then yes a quick PR to enable this correctly would be nice, but if it is many, we can just copy the code that Jim mentions to work around the issue. https://github.com/llvm/llvm-project/pull/89110 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
https://github.com/santhoshe447 updated https://github.com/llvm/llvm-project/pull/91570 >From 960351c9abf51f42d92604ac6297aa5b76ddfba5 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Ellendula Date: Fri, 17 Nov 2023 15:09:10 +0530 Subject: [PATCH 1/9] [lldb][test] Add the ability to extract the variable value out of the summary. --- .../Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py index 9d79872b029a3..0cf9d4fde4948 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py @@ -195,6 +195,9 @@ def collect_console(self, duration): def get_local_as_int(self, name, threadId=None): value = self.dap_server.get_local_variable_value(name, threadId=threadId) +# 'value' may have the variable value and summary. +# Extract the variable value since summary can have nonnumeric characters. +value = value.split(" ")[0] if value.startswith("0x"): return int(value, 16) elif value.startswith("0"): >From ab44a6991c5bc8ac5764c3f71cbe3acc747b3776 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Ellendula Date: Fri, 3 May 2024 02:47:05 -0700 Subject: [PATCH 2/9] [lldb-dap] Added "port" property to vscode "attach" command. Adding a "port" property to the VsCode "attach" command likely extends the functionality of the debugger configuratiuon to allow attaching to a process using PID or PORT number. Currently, the "Attach" configuration lets the user specify a pid. We tell the user to use the attachCommands property to run "gdb-remote ". Followed the below conditions for "attach" command with "port" and "pid" We should add a "port" property. If port is specified and pid is not, use that port to attach. If both port and pid are specified, return an error saying that the user can't specify both pid and port. Ex - launch.json { "version": "0.2.0", "configurations": [ { "name": "lldb-dap Debug", "type": "lldb-dap", "request": "attach", "port":1234, "program": "${workspaceFolder}/a.out", "args": [], "stopOnEntry": false, "cwd": "${workspaceFolder}", "env": [], } ] } --- lldb/include/lldb/lldb-defines.h | 1 + .../Python/lldbsuite/test/lldbtest.py | 9 ++ .../test/tools/lldb-dap/dap_server.py | 6 + .../test/tools/lldb-dap/lldbdap_testcase.py | 20 +++ .../attach/TestDAP_attachByPortNum.py | 120 ++ lldb/tools/lldb-dap/lldb-dap.cpp | 36 +- lldb/tools/lldb-dap/package.json | 11 ++ 7 files changed, 199 insertions(+), 4 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py diff --git a/lldb/include/lldb/lldb-defines.h b/lldb/include/lldb/lldb-defines.h index c7bd019c5c90e..a1e6ee2ce468c 100644 --- a/lldb/include/lldb/lldb-defines.h +++ b/lldb/include/lldb/lldb-defines.h @@ -96,6 +96,7 @@ #define LLDB_INVALID_QUEUE_ID 0 #define LLDB_INVALID_CPU_ID UINT32_MAX #define LLDB_INVALID_WATCHPOINT_RESOURCE_ID UINT32_MAX +#define LLDB_INVALID_PORT_NUMBER 0 /// CPU Type definitions #define LLDB_ARCH_DEFAULT "systemArch" diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 5fd686c143e9f..fb3cd22959df2 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -1572,6 +1572,15 @@ def findBuiltClang(self): return os.environ["CC"] +def getBuiltServerTool(self, server_tool): +# Tries to find simulation/lldb-server/gdbserver tool at the same folder as the lldb. +lldb_dir = os.path.dirname(lldbtest_config.lldbExec) +path = shutil.which(server_tool, path=lldb_dir) +if path is not None: +return path + +return "" + def yaml2obj(self, yaml_path, obj_path, max_size=None): """ Create an object file at the given path from a yaml file. diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 5838281bcb1a1..96d312565f953 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -568,6 +568,8 @@ def request_attach( coreFile=None, postRunCommands=None, sourceMap=None, +port=None, +hostname=None ): args_dict = {} if pid is not None: @@ -597,6 +599,10 @@ def request_attach( args_dict["postRunCommands"] = postRunComman
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
@@ -0,0 +1,146 @@ +""" +Test lldb-dap "port" configuration to "attach" request +""" + + +import dap_server +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil +from lldbsuite.test import lldbplatformutil +import lldbgdbserverutils +import lldbdap_testcase +import os +import shutil +import subprocess +import tempfile +import threading +import time +import sys + + +class TestDAP_attachByPortNum(lldbdap_testcase.DAPTestCaseBase): +def runTargetProgramOnPort(self, port=None, program=None): +server_tool = None +if lldbplatformutil.getPlatform() == "linux": +server_tool = lldbgdbserverutils.get_lldb_server_exe() +if server_tool is None: +self.dap_server.request_disconnect(terminateDebuggee=True) +self.assertIsNotNone(server_tool, "lldb-server not found.") +server_tool += " g localhost:" + port + " " +elif lldbplatformutil.getPlatform() == "macosx": +server_tool = lldbgdbserverutils.get_debugserver_exe() +if server_tool is None: +self.dap_server.request_disconnect(terminateDebuggee=True) +self.assertIsNotNone(server_tool, "debugserver not found.") +server_tool += " --listen localhost:" + port + " " santhoshe447 wrote: 1. Moved this piece of code into lldbdap_testcase.py: getBuiltinServerToolWithPortArg(self, port): https://github.com/llvm/llvm-project/pull/91570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff c09787b7d05083791b417c5b97a8cfd6d0874ed9 023b51e61e3e5127dc2289ea47e2e4d3e7a6db26 -- lldb/tools/lldb-dap/lldb-dap.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp index 9fedad8a41..e5165459dd 100644 --- a/lldb/tools/lldb-dap/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/lldb-dap.cpp @@ -739,8 +739,7 @@ void request_attach(const llvm::json::Object &request) { return; } - if ((pid == LLDB_INVALID_PROCESS_ID || port == invalid_port) && - wait_for) { + if ((pid == LLDB_INVALID_PROCESS_ID || port == invalid_port) && wait_for) { char attach_msg[256]; auto attach_msg_len = snprintf(attach_msg, sizeof(attach_msg), "Waiting to attach to \"%s\"...", @@ -754,8 +753,7 @@ void request_attach(const llvm::json::Object &request) { // the launch call and the launch will happen synchronously g_dap.debugger.SetAsync(false); if (core_file.empty()) { - if ((pid != LLDB_INVALID_PROCESS_ID) && - (port != invalid_port)) { + if ((pid != LLDB_INVALID_PROCESS_ID) && (port != invalid_port)) { // If both pid and port numbers are specified. error.SetErrorString("The user can't specify both pid and port"); } else if (port != invalid_port) { `` https://github.com/llvm/llvm-project/pull/91570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
https://github.com/santhoshe447 updated https://github.com/llvm/llvm-project/pull/91570 >From 960351c9abf51f42d92604ac6297aa5b76ddfba5 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Ellendula Date: Fri, 17 Nov 2023 15:09:10 +0530 Subject: [PATCH 01/10] [lldb][test] Add the ability to extract the variable value out of the summary. --- .../Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py index 9d79872b029a3..0cf9d4fde4948 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py @@ -195,6 +195,9 @@ def collect_console(self, duration): def get_local_as_int(self, name, threadId=None): value = self.dap_server.get_local_variable_value(name, threadId=threadId) +# 'value' may have the variable value and summary. +# Extract the variable value since summary can have nonnumeric characters. +value = value.split(" ")[0] if value.startswith("0x"): return int(value, 16) elif value.startswith("0"): >From ab44a6991c5bc8ac5764c3f71cbe3acc747b3776 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Ellendula Date: Fri, 3 May 2024 02:47:05 -0700 Subject: [PATCH 02/10] [lldb-dap] Added "port" property to vscode "attach" command. Adding a "port" property to the VsCode "attach" command likely extends the functionality of the debugger configuratiuon to allow attaching to a process using PID or PORT number. Currently, the "Attach" configuration lets the user specify a pid. We tell the user to use the attachCommands property to run "gdb-remote ". Followed the below conditions for "attach" command with "port" and "pid" We should add a "port" property. If port is specified and pid is not, use that port to attach. If both port and pid are specified, return an error saying that the user can't specify both pid and port. Ex - launch.json { "version": "0.2.0", "configurations": [ { "name": "lldb-dap Debug", "type": "lldb-dap", "request": "attach", "port":1234, "program": "${workspaceFolder}/a.out", "args": [], "stopOnEntry": false, "cwd": "${workspaceFolder}", "env": [], } ] } --- lldb/include/lldb/lldb-defines.h | 1 + .../Python/lldbsuite/test/lldbtest.py | 9 ++ .../test/tools/lldb-dap/dap_server.py | 6 + .../test/tools/lldb-dap/lldbdap_testcase.py | 20 +++ .../attach/TestDAP_attachByPortNum.py | 120 ++ lldb/tools/lldb-dap/lldb-dap.cpp | 36 +- lldb/tools/lldb-dap/package.json | 11 ++ 7 files changed, 199 insertions(+), 4 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py diff --git a/lldb/include/lldb/lldb-defines.h b/lldb/include/lldb/lldb-defines.h index c7bd019c5c90e..a1e6ee2ce468c 100644 --- a/lldb/include/lldb/lldb-defines.h +++ b/lldb/include/lldb/lldb-defines.h @@ -96,6 +96,7 @@ #define LLDB_INVALID_QUEUE_ID 0 #define LLDB_INVALID_CPU_ID UINT32_MAX #define LLDB_INVALID_WATCHPOINT_RESOURCE_ID UINT32_MAX +#define LLDB_INVALID_PORT_NUMBER 0 /// CPU Type definitions #define LLDB_ARCH_DEFAULT "systemArch" diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 5fd686c143e9f..fb3cd22959df2 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -1572,6 +1572,15 @@ def findBuiltClang(self): return os.environ["CC"] +def getBuiltServerTool(self, server_tool): +# Tries to find simulation/lldb-server/gdbserver tool at the same folder as the lldb. +lldb_dir = os.path.dirname(lldbtest_config.lldbExec) +path = shutil.which(server_tool, path=lldb_dir) +if path is not None: +return path + +return "" + def yaml2obj(self, yaml_path, obj_path, max_size=None): """ Create an object file at the given path from a yaml file. diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 5838281bcb1a1..96d312565f953 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -568,6 +568,8 @@ def request_attach( coreFile=None, postRunCommands=None, sourceMap=None, +port=None, +hostname=None ): args_dict = {} if pid is not None: @@ -597,6 +599,10 @@ def request_attach( args_dict["postRunCommands"] = postRunCo
[Lldb-commits] [lldb] New ThreadPlanSingleThreadTimeout to resolve potential deadlock in single thread stepping (PR #90930)
https://github.com/jeffreytan81 updated https://github.com/llvm/llvm-project/pull/90930 >From b72df8cf2a047ed731913609b58bdb4a3601e111 Mon Sep 17 00:00:00 2001 From: jeffreytan81 Date: Thu, 2 May 2024 18:12:04 -0700 Subject: [PATCH 1/5] Single thread timeout feature --- lldb/include/lldb/Target/Process.h| 11 +- lldb/include/lldb/Target/StopInfo.h | 4 + lldb/include/lldb/Target/Thread.h | 2 + lldb/include/lldb/Target/ThreadPlan.h | 8 +- .../Target/ThreadPlanSingleThreadTimeout.h| 89 lldb/include/lldb/Target/ThreadPlanStepOut.h | 1 + .../lldb/Target/ThreadPlanStepOverRange.h | 5 + lldb/include/lldb/lldb-enumerations.h | 1 + lldb/source/API/SBThread.cpp | 6 + .../source/Interpreter/CommandInterpreter.cpp | 2 +- .../GDBRemoteCommunicationServerLLGS.cpp | 2 + .../Process/gdb-remote/ProcessGDBRemote.cpp | 61 +- .../Process/gdb-remote/ProcessGDBRemote.h | 6 + lldb/source/Target/CMakeLists.txt | 1 + lldb/source/Target/Process.cpp| 23 +- lldb/source/Target/StopInfo.cpp | 37 lldb/source/Target/TargetProperties.td| 4 + lldb/source/Target/Thread.cpp | 9 +- lldb/source/Target/ThreadPlan.cpp | 1 + .../Target/ThreadPlanSingleThreadTimeout.cpp | 205 ++ lldb/source/Target/ThreadPlanStepInRange.cpp | 2 + .../source/Target/ThreadPlanStepOverRange.cpp | 17 +- lldb/source/Target/ThreadPlanStepRange.cpp| 9 +- .../single-thread-step/Makefile | 4 + .../TestSingleThreadStepTimeout.py| 123 +++ .../single-thread-step/main.cpp | 62 ++ lldb/tools/lldb-dap/JSONUtils.cpp | 3 + lldb/tools/lldb-dap/LLDBUtils.cpp | 1 + 28 files changed, 671 insertions(+), 28 deletions(-) create mode 100644 lldb/include/lldb/Target/ThreadPlanSingleThreadTimeout.h create mode 100644 lldb/source/Target/ThreadPlanSingleThreadTimeout.cpp create mode 100644 lldb/test/API/functionalities/single-thread-step/Makefile create mode 100644 lldb/test/API/functionalities/single-thread-step/TestSingleThreadStepTimeout.py create mode 100644 lldb/test/API/functionalities/single-thread-step/main.cpp diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index aac0cf51680a9..7e758dbb9f645 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -1312,11 +1312,13 @@ class Process : public std::enable_shared_from_this, size_t GetThreadStatus(Stream &ostrm, bool only_threads_with_stop_reason, uint32_t start_frame, uint32_t num_frames, - uint32_t num_frames_with_source, - bool stop_format); + uint32_t num_frames_with_source, bool stop_format); void SendAsyncInterrupt(); + // Send an async interrupt and receive stop from a specific /p thread. + void SendAsyncInterrupt(Thread *thread); + // Notify this process class that modules got loaded. // // If subclasses override this method, they must call this version before @@ -3102,6 +3104,11 @@ void PruneThreadPlans(); // Resume will only request a resume, using this // flag to check. + lldb::tid_t m_interrupt_tid; /// The tid of the thread that issued the async + /// interrupt, used by thread plan timeout. It + /// can be LLDB_INVALID_THREAD_ID to indicate + /// user level async interrupt. + /// This is set at the beginning of Process::Finalize() to stop functions /// from looking up or creating things during or after a finalize call. std::atomic m_finalizing; diff --git a/lldb/include/lldb/Target/StopInfo.h b/lldb/include/lldb/Target/StopInfo.h index d1848fcbbbdb1..fae90364deaf0 100644 --- a/lldb/include/lldb/Target/StopInfo.h +++ b/lldb/include/lldb/Target/StopInfo.h @@ -123,6 +123,10 @@ class StopInfo : public std::enable_shared_from_this { const char *description = nullptr, std::optional code = std::nullopt); + static lldb::StopInfoSP + CreateStopReasonWithInterrupt(Thread &thread, int signo, +const char *description); + static lldb::StopInfoSP CreateStopReasonToTrace(Thread &thread); static lldb::StopInfoSP diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h index c17bddf4d98b8..584093348b4c6 100644 --- a/lldb/include/lldb/Target/Thread.h +++ b/lldb/include/lldb/Target/Thread.h @@ -57,6 +57,8 @@ class ThreadProperties : public Properties { bool GetStepOutAvoidsNoDebug() const; uint64_t GetMaxBacktraceDepth() const; + + uint64_t GetSingleThreadPlanTimeout() const; }; class Thread : pub
[Lldb-commits] [clang] [compiler-rt] [lldb] [llvm] [Support] Remove terminfo dependency (PR #92865)
mysterymath wrote: I did some brief investigation on our end. The pkg-config file for libedit includes a private dependency on libncurses, which provides the terminfo functions. The issue here seems to be one uncovered in LLVM's FindLibEdit.cmake. We're building against a static libedit, but that doesn't use the LibEdit_STATIC_LIBRARIES variable that would be aware of the private dependency of libedit on libncurses. We build everything as statically as we can, which is probably why we're the first to notice. @petrhosek mentioned that we've had to deal with similar concerns with ZSTD. I'll take a look at seeing if there's a straightforward to update FindLibEdit.cmake to handle this case. https://github.com/llvm/llvm-project/pull/92865 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add RegisterContextPOSIXCore for RISC-V 64 (PR #93297)
@@ -0,0 +1,84 @@ +//===-- RegisterContextPOSIXCore_riscv64.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 "RegisterContextPOSIXCore_riscv64.h" + +#include "lldb/Utility/DataBufferHeap.h" + +using namespace lldb_private; + +std::unique_ptr +RegisterContextCorePOSIX_riscv64::Create( +lldb_private::Thread &thread, const lldb_private::ArchSpec &arch, +const lldb_private::DataExtractor &gpregset, +llvm::ArrayRef notes) { + Flags flags = 0; + + auto register_info_up = + std::make_unique(arch, flags); + return std::unique_ptr( + new RegisterContextCorePOSIX_riscv64(thread, std::move(register_info_up), + gpregset, notes)); +} + +RegisterContextCorePOSIX_riscv64::RegisterContextCorePOSIX_riscv64( +Thread &thread, std::unique_ptr register_info, +const DataExtractor &gpregset, llvm::ArrayRef notes) +: RegisterContextPOSIX_riscv64(thread, std::move(register_info)) { + + m_gpr_buffer = std::make_shared(gpregset.GetDataStart(), + gpregset.GetByteSize()); + m_gpr.SetData(m_gpr_buffer); + m_gpr.SetByteOrder(gpregset.GetByteOrder()); + + ArchSpec arch = m_register_info_up->GetTargetArchitecture(); + DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc); + m_fpr_buffer = std::make_shared(fpregset.GetDataStart(), + fpregset.GetByteSize()); + m_fpr.SetData(m_fpr_buffer); + m_fpr.SetByteOrder(fpregset.GetByteOrder()); +} + +RegisterContextCorePOSIX_riscv64::~RegisterContextCorePOSIX_riscv64() = default; + +bool RegisterContextCorePOSIX_riscv64::ReadGPR() { return true; } + +bool RegisterContextCorePOSIX_riscv64::ReadFPR() { return true; } + +bool RegisterContextCorePOSIX_riscv64::WriteGPR() { + assert(0); bulbazord wrote: Can you add some strings to these asserts to convey intent? Something like `assert(false && "RegisterContextCorePOSIX_riscv64::WriteGPR not yet implemented");` https://github.com/llvm/llvm-project/pull/93297 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add RegisterContextPOSIXCore for RISC-V 64 (PR #93297)
@@ -0,0 +1,84 @@ +//===-- RegisterContextPOSIXCore_riscv64.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 "RegisterContextPOSIXCore_riscv64.h" + +#include "lldb/Utility/DataBufferHeap.h" + +using namespace lldb_private; bulbazord wrote: You have `lldb_private::` in a bunch of places in this file, but you have `using namespace lldb_private` here. Mind dropping the `lldb_private::` in this file for consistency? https://github.com/llvm/llvm-project/pull/93297 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
@@ -749,9 +752,30 @@ void request_attach(const llvm::json::Object &request) { // Disable async events so the attach will be successful when we return from // the launch call and the launch will happen synchronously g_dap.debugger.SetAsync(false); -if (core_file.empty()) - g_dap.target.Attach(attach_info, error); -else +if (core_file.empty()) { + if ((pid != LLDB_INVALID_PROCESS_ID) && (port != invalid_port)) { +// If both pid and port numbers are specified. +error.SetErrorString("The user can't specify both pid and port"); + } else if (port != invalid_port) { +// If port is specified and pid is not. +lldb::SBListener listener = g_dap.debugger.GetListener(); + +// If the user hasn't provided the hostname property, default localhost +// being used. +std::string connect_url("connect://localhost:"); + +// If the user has provided hostname other than localhost. +if (!hostname.empty() && !hostname.starts_with("localhost")) { walter-erquinigo wrote: wouldn't it just work with `localhost` being passed to `llvm::formatv`? https://github.com/llvm/llvm-project/pull/91570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
@@ -0,0 +1,142 @@ +""" +Test lldb-dap "port" configuration to "attach" request +""" + + +import dap_server +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil +from lldbsuite.test import lldbplatformutil +import lldbgdbserverutils +import lldbdap_testcase +import os +import shutil +import subprocess +import tempfile +import threading +import time +import sys +import socket + + +class TestDAP_attachByPortNum(lldbdap_testcase.DAPTestCaseBase): +def get_free_port(self): +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +s.bind(("", 0)) +port = s.getsockname()[1] +s.close() +return port + +def runTargetProgramOnPort(self, port=None, program=None): +server_tool = self.getBuiltinServerToolWithPortArg(port) +self.process = subprocess.Popen( +[server_tool + program], +shell=True, +stdin=subprocess.PIPE, +stdout=subprocess.PIPE, +stderr=subprocess.PIPE, +) + +return self.process + +def set_and_hit_breakpoint(self, continueToExit=True): +source = "main.c" +main_source_path = os.path.join(os.getcwd(), source) +breakpoint1_line = line_number(main_source_path, "// breakpoint 1") +lines = [breakpoint1_line] +# Set breakpoint in the thread function so we can step the threads +breakpoint_ids = self.set_source_breakpoints(main_source_path, lines) +self.assertEqual( +len(breakpoint_ids), len(lines), "expect correct number of breakpoints" +) +self.continue_to_breakpoints(breakpoint_ids) +if continueToExit: +self.continue_to_exit() + +@skipIfWindows +@skipIfNetBSD +@skipIfRemote +def test_by_port(self): +""" +Tests attaching to a process by port. +""" +self.build_and_create_debug_adaptor() +program = self.getBuildArtifact("a.out") + +port = self.get_free_port() +self.process = self.runTargetProgramOnPort(port=port, program=program) +pid = self.process.pid +response = self.attach(program=program, port=port, sourceInitFile=True) +self.set_and_hit_breakpoint(continueToExit=True) +self.process.kill() + +@skipIfWindows +@skipIfNetBSD +@skipIfRemote +def test_by_port_and_pid(self): +""" +Tests attaching to a process by process ID and port number. +""" +self.build_and_create_debug_adaptor() +program = self.getBuildArtifact("a.out") + +port = self.get_free_port() +self.process = self.runTargetProgramOnPort(port=port, program=program) +pid = self.process.pid +response = self.attach( +program=program, +pid=pid, +port=port, +sourceInitFile=True, +expectFailure=True, +) +if not (response and response["success"]): +self.assertFalse( +response["success"], "The user can't specify both pid and port" +) +self.process.kill() + +@skipIfWindows +@skipIfNetBSD +@skipIfRemote walter-erquinigo wrote: you don't need `@skipIfRemote` anymore https://github.com/llvm/llvm-project/pull/91570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb/DWARF] Bypass the compres^Wconstruction of DIERefs in debug_names (PR #93296)
@@ -183,27 +181,22 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass( llvm::function_ref callback) { // Keep a list of incomplete types as fallback for when we don't find the // complete type. - DIEArray incomplete_types; + std::vector incomplete_types; felipepiovezan wrote: Let me try to run at least one basic experiment here https://github.com/llvm/llvm-project/pull/93296 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb/DWARF] Bypass the compres^Wconstruction of DIERefs in debug_names (PR #93296)
https://github.com/felipepiovezan approved this pull request. I think this should probably be fine (perf-wise)! https://github.com/llvm/llvm-project/pull/93296 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [compiler-rt] [lldb] [llvm] [Support] Remove terminfo dependency (PR #92865)
jimingham wrote: This patch has been causing the Darwin bots on GreenDragon to fail consistently since it was submitted. The problem is that the lldb/unitest/EditLine needs setupterm which comes from libcurses.dylib. However that was finding its way into this build line for this test, it's no longer doing so on Darwin, so the test fails to compile. I can fix this by adding `curses` explicitly to the LINK_LIBS for this directory, but that's clearly the wrong way to do it. I thought LLDB_CURSES_LIBS would be the right thing, but at present that's empty. The file that uses this setupterm is in Host code (not part of this test) but the flags for building LLDB.framework are correct. This seems to be specific to this unit test. https://github.com/llvm/llvm-project/pull/92865 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [compiler-rt] [lldb] [llvm] [Support] Remove terminfo dependency (PR #92865)
JDevlieghere wrote: `LLDB_CURSES_LIBS` is scoped to lldbCore, which the EditLine unit test isn't linking. If its also necessary in Host, then we should hoist it up and link both libraries against it. Anyway, that also means my initial assessment was wrong. I looked for the header include but the code in our editline wrapper forward declares `setupterm` which explains why I missed it. Maybe we should reconsider? Anyway, if I cannot figure this out in the next hour or so, I think we should revert this to get our bots green again. https://github.com/llvm/llvm-project/pull/92865 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb/DWARF] Bypass the compres^Wconstruction of DIERefs in debug_names (PR #93296)
clayborg wrote: LGTM as well. Avoiding bouncing between two different DIE representations is a good thing. https://github.com/llvm/llvm-project/pull/93296 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
@@ -348,6 +348,17 @@ "type": "string", "description": "The time in seconds to wait for a program to stop when attaching using \"attachCommands\". Defaults to 30 seconds." }, + "port": { +"type": [ + "number", + "string" +], +"description": "TCP/IP port to attach to. Specifying both pid and port is an error." + }, + "hostname": { clayborg wrote: `"gdb-remote-hostname"` similar to above comment? https://github.com/llvm/llvm-project/pull/91570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
https://github.com/clayborg edited https://github.com/llvm/llvm-project/pull/91570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
@@ -749,9 +752,30 @@ void request_attach(const llvm::json::Object &request) { // Disable async events so the attach will be successful when we return from // the launch call and the launch will happen synchronously g_dap.debugger.SetAsync(false); -if (core_file.empty()) - g_dap.target.Attach(attach_info, error); -else +if (core_file.empty()) { + if ((pid != LLDB_INVALID_PROCESS_ID) && (port != invalid_port)) { +// If both pid and port numbers are specified. +error.SetErrorString("The user can't specify both pid and port"); + } else if (port != invalid_port) { +// If port is specified and pid is not. +lldb::SBListener listener = g_dap.debugger.GetListener(); + +// If the user hasn't provided the hostname property, default localhost +// being used. +std::string connect_url("connect://localhost:"); + +// If the user has provided hostname other than localhost. +if (!hostname.empty() && !hostname.starts_with("localhost")) { + connect_url = llvm::formatv("connect://{0}:", hostname.data()); +} +connect_url += std::to_string(port); +g_dap.target.ConnectRemote(listener, connect_url.c_str(), "gdb-remote", clayborg wrote: We are hardcoding `"gdb-remote"` here, so it might make sense to either rename the above components or have a `"process-plugin"` attribute that defaults to `"gdb-remote"`? https://github.com/llvm/llvm-project/pull/91570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
@@ -348,6 +348,17 @@ "type": "string", "description": "The time in seconds to wait for a program to stop when attaching using \"attachCommands\". Defaults to 30 seconds." }, + "port": { +"type": [ + "number", + "string" +], +"description": "TCP/IP port to attach to. Specifying both pid and port is an error." + }, clayborg wrote: Do we want to label this `"gdb-remote-port"` instead of `"port"`? I don't think we have any other process plug-ins that support connecting via a port, so it migth be nice to let people know what this is for? https://github.com/llvm/llvm-project/pull/91570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
https://github.com/clayborg commented: Just a few questions if we want to prefix these settings with `"gdb-remote"` as suggested. Please chime in if you have any opinions on the matter. https://github.com/llvm/llvm-project/pull/91570 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 0380044 - Fix the EditLine unittest build on Darwin after PR 92865
Author: Jim Ingham Date: 2024-05-28T17:47:08-07:00 New Revision: 0380044e16a1c016e001a56c0ca7f4db649a6cae URL: https://github.com/llvm/llvm-project/commit/0380044e16a1c016e001a56c0ca7f4db649a6cae DIFF: https://github.com/llvm/llvm-project/commit/0380044e16a1c016e001a56c0ca7f4db649a6cae.diff LOG: Fix the EditLine unittest build on Darwin after PR 92865 There was a Darwin only use of setupterm (under USE_SETUPTERM_WORKAROUND) that required libcurses.dylib. That was added to the main build, but not to the unittest. Added: Modified: lldb/unittests/CMakeLists.txt lldb/unittests/Editline/CMakeLists.txt Removed: diff --git a/lldb/unittests/CMakeLists.txt b/lldb/unittests/CMakeLists.txt index a2585a94b6155..728dec5006d6b 100644 --- a/lldb/unittests/CMakeLists.txt +++ b/lldb/unittests/CMakeLists.txt @@ -51,11 +51,13 @@ if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows") # FIXME: APITests.exe is not a valid googletest binary. add_subdirectory(API) endif() +if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" OR LLDB_ENABLE_CURSES) + add_subdirectory(Editline) +endif() add_subdirectory(Breakpoint) add_subdirectory(Core) add_subdirectory(DataFormatter) add_subdirectory(Disassembler) -add_subdirectory(Editline) add_subdirectory(Expression) add_subdirectory(Host) add_subdirectory(Interpreter) diff --git a/lldb/unittests/Editline/CMakeLists.txt b/lldb/unittests/Editline/CMakeLists.txt index 4b2643d15c5fc..f213bfd1ab581 100644 --- a/lldb/unittests/Editline/CMakeLists.txt +++ b/lldb/unittests/Editline/CMakeLists.txt @@ -5,4 +5,5 @@ add_lldb_unittest(EditlineTests lldbHost lldbUtility LLVMTestingSupport +${CURSES_LIBRARIES} ) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Improve performance of .debug_names lookups when DW_IDX_parent attributes are used (PR #91808)
ayermolo wrote: I have a follow up question. For case talked about here earlier: "namespace A { namespace B { struct State { class InnerState{}; }; } } A::B::State::InnerState get_state() { return A::B::State::InnerState(); }" After David fix clang generates: ``` Name 3 { Hash: 0xE0CDC6A2 String: 0x0018 "InnerState" Entry @ 0x10b { Abbrev: 0x3 Tag: DW_TAG_class_type DW_IDX_type_unit: 0x01 DW_IDX_die_offset: 0x0030 } } ``` Would it affect LLDB negatively if BOLT generates: ``` Name 3 { Hash: 0xE0CDC6A2 String: 0x0018 "InnerState" Entry @ 0x109 { Abbrev: 0x3 Tag: DW_TAG_class_type DW_IDX_type_unit: 0x01 DW_IDX_die_offset: 0x0030 DW_IDX_parent: } } ``` So with DW_IDX_parent: https://github.com/llvm/llvm-project/pull/91808 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [libcxx] [lld] [lldb] [llvm] [mlir] Fix SyntaxWarning messages from python 3.12 (PR #86806)
ldionne wrote: Can we either finish this up or close it, please? I'd like to tidy up the libc++ review queue. https://github.com/llvm/llvm-project/pull/86806 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 6abc387 - Revert "Fix the EditLine unittest build on Darwin after PR 92865"
Author: Jim Ingham Date: 2024-05-28T18:16:13-07:00 New Revision: 6abc3876c35bbe8fb5dd6435dc60f2c816b97ef6 URL: https://github.com/llvm/llvm-project/commit/6abc3876c35bbe8fb5dd6435dc60f2c816b97ef6 DIFF: https://github.com/llvm/llvm-project/commit/6abc3876c35bbe8fb5dd6435dc60f2c816b97ef6.diff LOG: Revert "Fix the EditLine unittest build on Darwin after PR 92865" This reverts commit 0380044e16a1c016e001a56c0ca7f4db649a6cae. While I figure out some mysterious CMake error. Added: Modified: lldb/unittests/CMakeLists.txt lldb/unittests/Editline/CMakeLists.txt Removed: diff --git a/lldb/unittests/CMakeLists.txt b/lldb/unittests/CMakeLists.txt index 728dec5006d6b..a2585a94b6155 100644 --- a/lldb/unittests/CMakeLists.txt +++ b/lldb/unittests/CMakeLists.txt @@ -51,13 +51,11 @@ if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows") # FIXME: APITests.exe is not a valid googletest binary. add_subdirectory(API) endif() -if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" OR LLDB_ENABLE_CURSES) - add_subdirectory(Editline) -endif() add_subdirectory(Breakpoint) add_subdirectory(Core) add_subdirectory(DataFormatter) add_subdirectory(Disassembler) +add_subdirectory(Editline) add_subdirectory(Expression) add_subdirectory(Host) add_subdirectory(Interpreter) diff --git a/lldb/unittests/Editline/CMakeLists.txt b/lldb/unittests/Editline/CMakeLists.txt index f213bfd1ab581..4b2643d15c5fc 100644 --- a/lldb/unittests/Editline/CMakeLists.txt +++ b/lldb/unittests/Editline/CMakeLists.txt @@ -5,5 +5,4 @@ add_lldb_unittest(EditlineTests lldbHost lldbUtility LLVMTestingSupport -${CURSES_LIBRARIES} ) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [libcxx] [lld] [lldb] [llvm] [mlir] Fix SyntaxWarning messages from python 3.12 (PR #86806)
https://github.com/AngryLoki closed https://github.com/llvm/llvm-project/pull/86806 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [libcxx] [lld] [lldb] [llvm] [mlir] Fix SyntaxWarning messages from python 3.12 (PR #86806)
AngryLoki wrote: This is going nowhere, I'll close it and create a separate PR for libcxx. Also `transitive_includes.gen.py` somehow (due to automatic git conflict resolution?) got damaged indentations, so it would require new review anyways. https://github.com/llvm/llvm-project/pull/86806 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Update LLDB testsuite's Makefile.rules in order to support the cross builds on Windows host. (PR #93639)
https://github.com/vvereschaka created https://github.com/llvm/llvm-project/pull/93639 These changes do the following: * avoids usage of $(findstring) within $(CC) to detect a type of specified C compiler. Also they change a way to get a counterpart C++ compiler instead of modifying the original $(CC) variable. Both of those fixes a problem when a compiler name is a part of some word (or itself) used in the path to the compiler. Here is an example where the `cc` compiler is getting detected instead of `clang` compiler inside of $(CC) with the following path: > `".../accesssoftek/.../bin/clang.exe"` and replaces the 'cc' sequence of 'accesssoftek' word with 'c++' sequence to get the C++ compiler name: > `".../ac++esssoftek/.../bin/clang.exe"` The change parses the source $(CC) and put every part into a separate variable instead and uses these parts to build the required tool's references subsequently. Also these parts are used within the conditions to direct comparison instead of using $(findstring) where it is necessary or possible. * avoids the compiler comparison with $(findstring) within the conditions. * fixes SHELL initialization on the Windows build hosts. * moves LLVM_AR initialization from the test's Makefile into Makefile.rules. * adds `USE_LLVM_TOOLS` variable to force using of llvm-ar/llvm-objcopy tool instead of the system default. Passing this variable as `USE_LLVM_TOOLS=1` will configure the build to use `llvm-ar`, `llvm-objcopy` and `llvm-strip` tools for the tests. This variable could be passed via `LLDB_TEST_USER_ARGS="...;--env;USE_LLVM_TOOL=1;..."`. * fix of LDFLAGS guiding through Makefile.rules. >From 663964e45e65b94a4ec8e0b044e971b0195ff574 Mon Sep 17 00:00:00 2001 From: Vladimir Vereschaka Date: Tue, 28 May 2024 21:01:24 -0700 Subject: [PATCH] [lldb] Update LLDB testsuite's Makefile.rules in order to support the cross builds on Windows host. These changes do the following: * avoids usage of $(findstring) within $(CC) to detect a type of specified C compiler. Also they change a way to get a counterpart C++ compiler instead of modifying the original $(CC) variable. * avoids the compiler comparison with $(findstring) within the conditions. * fixes SHELL initialization on the Windows build hosts. * moves LLVM_AR initialization from the test's Makefile into Makefile.rules. * adds USE_LLVM_TOOLS variable to force using of llvm-ar/llvm-objcopy tool instead of the system default. * Passing this variable as USE_LLVM_TOOLS=1 will configure the build to use llvm-ar, llvm-objcopy and llvm-strip tools for the tests. This variable could be passed via LLDB_TEST_USER_ARGS="...;--env;USE_LLVM_TOOL=1;...". * fix of LDFLAGS guiding through Makefile.rules. --- .../Python/lldbsuite/test/make/Makefile.rules | 260 -- 1 file changed, 176 insertions(+), 84 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index bd8eea3d6f5a0..8cf67068af34d 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -26,6 +26,9 @@ # SPLIT_DEBUG_SYMBOLS := YES # CROSS_COMPILE := # USE_PRIVATE_MODULE_CACHE := YES +# +# Specifying USE_LLVM_TOOLS=1 will force usage of the LLVM tools, such as llvm-ar/llvm-objcopy/llvm-strip, +# instead of the system defaults (ar/objcopy/strip accordingly). # Uncomment line below for debugging shell commands # SHELL = /bin/sh -x @@ -39,6 +42,11 @@ MAKEFILE_RULES := $(lastword $(MAKEFILE_LIST)) THIS_FILE_DIR := $(shell dirname $(MAKEFILE_RULES)) LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../ +STRIP ?= strip + +# Empty if not specified. +LDFLAGS ?= + # The test harness invokes the test Makefiles with an explicit 'all' # target, but its handy to be able to recursively call this Makefile # without specifying a goal. You almost certainly want to build 'all', @@ -51,23 +59,25 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../ # # GNUWin32 uname gives "windows32" or "server version windows32" while # some versions of MSYS uname return "MSYS_NT*", but most environments -# standardize on "Windows_NT", so we'll make it consistent here. +# standardize on "Windows_NT", so we'll make it consistent here. # When running tests from Visual Studio, the environment variable isn't # inherited all the way down to the process spawned for make. #-- HOST_OS := $(shell uname -s) -ifneq (,$(findstring windows32,$(HOST_OS))) - HOST_OS := Windows_NT -endif - -ifneq (,$(findstring MSYS_NT,$(HOST_OS))) - HOST_OS := Windows_NT +ifneq (,$(or \ +$(findstring windows32,$(HOST_OS)),\ +$(findstring MSYS_NT,$(HOST_OS +HOST_OS := Windows_NT endif ifeq "$(OS)" "" OS := $(HOST_OS) endif +# Retrieve the host arch. We are going to use $HOST_OS/$HOST_ARCH to +# detect the cro
[Lldb-commits] [lldb] [lldb] Wrap Unix-style path inside appropriate API test Makefiles. (PR #93643)
https://github.com/vvereschaka created https://github.com/llvm/llvm-project/pull/93643 Some of the API tests use Makefiles with the custom rules to manipulate the source code files. This patch normalizes their file pathes to Unix-style on the Windows build host and avoids compiler/linker error because of the broken pathes Depends on #93639 >From 3f05232a4307acd71fee16ca67819f544c8ac450 Mon Sep 17 00:00:00 2001 From: Vladimir Vereschaka Date: Tue, 28 May 2024 21:18:36 -0700 Subject: [PATCH] [lldb] Wrap Unix-style path inside appropriate API test Makefiles. Some of the API tests use Makefiles with the custom rules to manipulate the source code files. This patch normalizes their file pathes to Unix-style on the Windows build host and avoids compiler/linker error because of the broken pathes --- lldb/test/API/commands/settings/use_source_cache/Makefile | 2 +- .../functionalities/breakpoint/comp_dir_symlink/Makefile | 2 +- lldb/test/API/functionalities/inline-sourcefile/Makefile | 2 +- lldb/test/API/functionalities/multiple-slides/Makefile| 2 +- .../functionalities/postmortem/netbsd-core/GNUmakefile| 4 ++-- .../API/functionalities/step-avoids-no-debug/Makefile | 2 +- lldb/test/API/functionalities/valobj_errors/Makefile | 2 +- lldb/test/API/lang/cpp/operator-overload/Makefile | 2 +- lldb/test/API/lang/objcxx/class-name-clash/Makefile | 2 +- lldb/test/API/linux/add-symbols/Makefile | 2 +- lldb/test/API/linux/sepdebugsymlink/Makefile | 2 +- lldb/test/API/macosx/function-starts/Makefile | 2 +- lldb/test/API/macosx/posix_spawn/Makefile | 6 +++--- lldb/test/API/macosx/universal/Makefile | 8 lldb/test/API/macosx/universal64/Makefile | 8 lldb/test/API/source-manager/Makefile | 2 +- lldb/test/API/tools/lldb-dap/breakpoint/Makefile | 4 ++-- 17 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lldb/test/API/commands/settings/use_source_cache/Makefile b/lldb/test/API/commands/settings/use_source_cache/Makefile index 791cb7d868d87..2fc18665303cb 100644 --- a/lldb/test/API/commands/settings/use_source_cache/Makefile +++ b/lldb/test/API/commands/settings/use_source_cache/Makefile @@ -5,4 +5,4 @@ include Makefile.rules # Copy file into the build folder to enable the test to modify it. main-copy.cpp: main.cpp - cp -f $< $@ + cp -f $(call path_wrapper,$<) $@ diff --git a/lldb/test/API/functionalities/breakpoint/comp_dir_symlink/Makefile b/lldb/test/API/functionalities/breakpoint/comp_dir_symlink/Makefile index 1c42301c7b587..ff090a7fd0ea2 100644 --- a/lldb/test/API/functionalities/breakpoint/comp_dir_symlink/Makefile +++ b/lldb/test/API/functionalities/breakpoint/comp_dir_symlink/Makefile @@ -6,4 +6,4 @@ include Makefile.rules # Force relative filenames by copying it into the build directory. relative.cpp: main.cpp - cp -f $< $@ + cp -f $(call path_wrapper,$<) $@ diff --git a/lldb/test/API/functionalities/inline-sourcefile/Makefile b/lldb/test/API/functionalities/inline-sourcefile/Makefile index adb29d3a88e26..76a41fa4ec4b4 100644 --- a/lldb/test/API/functionalities/inline-sourcefile/Makefile +++ b/lldb/test/API/functionalities/inline-sourcefile/Makefile @@ -8,4 +8,4 @@ OBJECTS += inline.o $(EXE): main.c inline.o %.o: %.ll - $(CC) $< -c -o $@ + $(CC) $(call path_wrapper,$<) -c -o $@ diff --git a/lldb/test/API/functionalities/multiple-slides/Makefile b/lldb/test/API/functionalities/multiple-slides/Makefile index 5f83deaa24d77..822af701e7794 100644 --- a/lldb/test/API/functionalities/multiple-slides/Makefile +++ b/lldb/test/API/functionalities/multiple-slides/Makefile @@ -8,5 +8,5 @@ include Makefile.rules # sliding the binary, the address of `first` and # `second` are not slid for some reason on Darwin. main.o: main.c - $(CC) $(CFLAGS_NO_DEBUG) -c $< -o $@ + $(CC) $(CFLAGS_NO_DEBUG) -c $(call path_wrapper,$<) -o $@ diff --git a/lldb/test/API/functionalities/postmortem/netbsd-core/GNUmakefile b/lldb/test/API/functionalities/postmortem/netbsd-core/GNUmakefile index 62c719d3d2ff0..f72ddf4234828 100644 --- a/lldb/test/API/functionalities/postmortem/netbsd-core/GNUmakefile +++ b/lldb/test/API/functionalities/postmortem/netbsd-core/GNUmakefile @@ -8,8 +8,8 @@ clean: rm -f $(CORES) $(EXECS) %.core: % - sysctl -w proc..corename=$@; ulimit -s 16; ! ./$< + sysctl -w proc..corename=$@; ulimit -s 16; ! ./$(call path_wrapper,$<) %.$(ARCH): %.c - $(CC) -o $@ -g $< + $(CC) -o $@ -g $(call path_wrapper,$<) .PHONY: all clean diff --git a/lldb/test/API/functionalities/step-avoids-no-debug/Makefile b/lldb/test/API/functionalities/step-avoids-no-debug/Makefile index 374e58b89a81c..1ea6acec8960c 100644 --- a/lldb/test/API/functionalities/step-avoids-no-debug/Makefile +++ b/lldb/test/API/functionalities/step-avoids-no-debug/M
[Lldb-commits] [lldb] [lldb] Allow using a custom 'strip' tool for the API tests. (PR #93645)
https://github.com/vvereschaka created https://github.com/llvm/llvm-project/pull/93645 Allow passing any custom 'strip' tool, such as 'llvm-strip', to use with the LLDB API tests. The tool can be provided via LLDB_TEST_COMMON_ARGS_VAR CMake variable: `..;--env STRIP=${CMAKE_STRIP};...`. Depends on #93639 >From eb1827cd5c052d7c194e2d60faf5a81edccc27a5 Mon Sep 17 00:00:00 2001 From: Vladimir Vereschaka Date: Tue, 28 May 2024 21:25:50 -0700 Subject: [PATCH] [lldb] Allow using a custom 'strip' tool for the API tests. Allow passing any custom 'strip' tool, such as 'llvm-strip', to use with the LLDB API tests. The tool can be provided via LLDB_TEST_COMMON_ARGS_VAR CMake variable: `..;--env STRIP=${CMAKE_STRIP};...`. --- lldb/test/API/functionalities/json/symbol-file/Makefile | 2 +- lldb/test/API/lang/objc/hidden-ivars/Makefile| 4 ++-- lldb/test/API/lang/objc/objc-ivar-stripped/Makefile | 2 +- lldb/test/API/lang/objc/objc-static-method-stripped/Makefile | 2 +- lldb/test/API/macosx/add-dsym/Makefile | 2 +- lldb/test/API/macosx/dyld-trie-symbols/Makefile | 2 +- lldb/test/API/tools/lldb-dap/module/Makefile | 2 +- lldb/test/API/tools/lldb-dap/terminated-event/Makefile | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lldb/test/API/functionalities/json/symbol-file/Makefile b/lldb/test/API/functionalities/json/symbol-file/Makefile index aff841c364299..13bc164582eee 100644 --- a/lldb/test/API/functionalities/json/symbol-file/Makefile +++ b/lldb/test/API/functionalities/json/symbol-file/Makefile @@ -3,6 +3,6 @@ C_SOURCES := main.c all: stripped.out stripped.out : a.out - strip a.out -o stripped.out + $(STRIP) a.out -o stripped.out include Makefile.rules diff --git a/lldb/test/API/lang/objc/hidden-ivars/Makefile b/lldb/test/API/lang/objc/hidden-ivars/Makefile index 283e8a118fb16..c94c0dee1b9ce 100644 --- a/lldb/test/API/lang/objc/hidden-ivars/Makefile +++ b/lldb/test/API/lang/objc/hidden-ivars/Makefile @@ -14,8 +14,8 @@ endif stripped: a.out libInternalDefiner.dylib mkdir stripped - strip -Sx a.out -o stripped/a.out - strip -Sx libInternalDefiner.dylib -o stripped/libInternalDefiner.dylib + $(STRIP) -Sx a.out -o stripped/a.out + $(STRIP) -Sx libInternalDefiner.dylib -o stripped/libInternalDefiner.dylib ifneq "$(CODESIGN)" "" $(CODESIGN) -fs - stripped/a.out endif diff --git a/lldb/test/API/lang/objc/objc-ivar-stripped/Makefile b/lldb/test/API/lang/objc/objc-ivar-stripped/Makefile index 8b63215d6d9da..eed66d2a965d1 100644 --- a/lldb/test/API/lang/objc/objc-ivar-stripped/Makefile +++ b/lldb/test/API/lang/objc/objc-ivar-stripped/Makefile @@ -6,7 +6,7 @@ all:a.out.stripped include Makefile.rules a.out.stripped: a.out.dSYM - strip -o a.out.stripped a.out + $(STRIP) -o a.out.stripped a.out ifneq "$(CODESIGN)" "" $(CODESIGN) -fs - a.out.stripped endif diff --git a/lldb/test/API/lang/objc/objc-static-method-stripped/Makefile b/lldb/test/API/lang/objc/objc-static-method-stripped/Makefile index ed312938c9cd1..4936553c56f7c 100644 --- a/lldb/test/API/lang/objc/objc-static-method-stripped/Makefile +++ b/lldb/test/API/lang/objc/objc-static-method-stripped/Makefile @@ -4,7 +4,7 @@ LD_EXTRAS := -lobjc -framework Foundation default:a.out.stripped a.out.stripped: a.out.dSYM - strip -o a.out.stripped a.out + $(STRIP) -o a.out.stripped a.out ln -sf a.out.dSYM a.out.stripped.dSYM include Makefile.rules diff --git a/lldb/test/API/macosx/add-dsym/Makefile b/lldb/test/API/macosx/add-dsym/Makefile index 4e1ec2202d0b0..b949b308d3acc 100644 --- a/lldb/test/API/macosx/add-dsym/Makefile +++ b/lldb/test/API/macosx/add-dsym/Makefile @@ -8,7 +8,7 @@ hide.app/Contents/a.out.dSYM: mkdir hide.app mkdir hide.app/Contents mv a.out.dSYM hide.app/Contents - strip -x a.out + $(STRIP) -x a.out ifneq "$(CODESIGN)" "" $(CODESIGN) -fs - a.out endif diff --git a/lldb/test/API/macosx/dyld-trie-symbols/Makefile b/lldb/test/API/macosx/dyld-trie-symbols/Makefile index a0f3424d676cc..50938bb111483 100644 --- a/lldb/test/API/macosx/dyld-trie-symbols/Makefile +++ b/lldb/test/API/macosx/dyld-trie-symbols/Makefile @@ -10,4 +10,4 @@ all: a.out a.out-stripped a.out-stripped: cp a.out a.out-stripped - strip -N a.out-stripped + $(STRIP) -N a.out-stripped diff --git a/lldb/test/API/tools/lldb-dap/module/Makefile b/lldb/test/API/tools/lldb-dap/module/Makefile index b30baf48b972e..c7d626a1a7e4c 100644 --- a/lldb/test/API/tools/lldb-dap/module/Makefile +++ b/lldb/test/API/tools/lldb-dap/module/Makefile @@ -10,7 +10,7 @@ include Makefile.rules all: a.out.stripped a.out.stripped: - strip -o a.out.stripped a.out + $(STRIP) -o a.out.stripped a.out ifneq "$(CODESIGN)" "" $(CODESIGN) -fs - a.out.stripped diff --git a/lldb/test/API
[Lldb-commits] [lldb] [lldb] Allow using a custom 'strip' tool for the API tests. (PR #93645)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Vladimir Vereschaka (vvereschaka) Changes Allow passing any custom 'strip' tool, such as 'llvm-strip', to use with the LLDB API tests. The tool can be provided via LLDB_TEST_COMMON_ARGS_VAR CMake variable: `..;--env STRIP=${CMAKE_STRIP};...`. Depends on #93639 --- Full diff: https://github.com/llvm/llvm-project/pull/93645.diff 8 Files Affected: - (modified) lldb/test/API/functionalities/json/symbol-file/Makefile (+1-1) - (modified) lldb/test/API/lang/objc/hidden-ivars/Makefile (+2-2) - (modified) lldb/test/API/lang/objc/objc-ivar-stripped/Makefile (+1-1) - (modified) lldb/test/API/lang/objc/objc-static-method-stripped/Makefile (+1-1) - (modified) lldb/test/API/macosx/add-dsym/Makefile (+1-1) - (modified) lldb/test/API/macosx/dyld-trie-symbols/Makefile (+1-1) - (modified) lldb/test/API/tools/lldb-dap/module/Makefile (+1-1) - (modified) lldb/test/API/tools/lldb-dap/terminated-event/Makefile (+1-1) ``diff diff --git a/lldb/test/API/functionalities/json/symbol-file/Makefile b/lldb/test/API/functionalities/json/symbol-file/Makefile index aff841c364299..13bc164582eee 100644 --- a/lldb/test/API/functionalities/json/symbol-file/Makefile +++ b/lldb/test/API/functionalities/json/symbol-file/Makefile @@ -3,6 +3,6 @@ C_SOURCES := main.c all: stripped.out stripped.out : a.out - strip a.out -o stripped.out + $(STRIP) a.out -o stripped.out include Makefile.rules diff --git a/lldb/test/API/lang/objc/hidden-ivars/Makefile b/lldb/test/API/lang/objc/hidden-ivars/Makefile index 283e8a118fb16..c94c0dee1b9ce 100644 --- a/lldb/test/API/lang/objc/hidden-ivars/Makefile +++ b/lldb/test/API/lang/objc/hidden-ivars/Makefile @@ -14,8 +14,8 @@ endif stripped: a.out libInternalDefiner.dylib mkdir stripped - strip -Sx a.out -o stripped/a.out - strip -Sx libInternalDefiner.dylib -o stripped/libInternalDefiner.dylib + $(STRIP) -Sx a.out -o stripped/a.out + $(STRIP) -Sx libInternalDefiner.dylib -o stripped/libInternalDefiner.dylib ifneq "$(CODESIGN)" "" $(CODESIGN) -fs - stripped/a.out endif diff --git a/lldb/test/API/lang/objc/objc-ivar-stripped/Makefile b/lldb/test/API/lang/objc/objc-ivar-stripped/Makefile index 8b63215d6d9da..eed66d2a965d1 100644 --- a/lldb/test/API/lang/objc/objc-ivar-stripped/Makefile +++ b/lldb/test/API/lang/objc/objc-ivar-stripped/Makefile @@ -6,7 +6,7 @@ all:a.out.stripped include Makefile.rules a.out.stripped: a.out.dSYM - strip -o a.out.stripped a.out + $(STRIP) -o a.out.stripped a.out ifneq "$(CODESIGN)" "" $(CODESIGN) -fs - a.out.stripped endif diff --git a/lldb/test/API/lang/objc/objc-static-method-stripped/Makefile b/lldb/test/API/lang/objc/objc-static-method-stripped/Makefile index ed312938c9cd1..4936553c56f7c 100644 --- a/lldb/test/API/lang/objc/objc-static-method-stripped/Makefile +++ b/lldb/test/API/lang/objc/objc-static-method-stripped/Makefile @@ -4,7 +4,7 @@ LD_EXTRAS := -lobjc -framework Foundation default:a.out.stripped a.out.stripped: a.out.dSYM - strip -o a.out.stripped a.out + $(STRIP) -o a.out.stripped a.out ln -sf a.out.dSYM a.out.stripped.dSYM include Makefile.rules diff --git a/lldb/test/API/macosx/add-dsym/Makefile b/lldb/test/API/macosx/add-dsym/Makefile index 4e1ec2202d0b0..b949b308d3acc 100644 --- a/lldb/test/API/macosx/add-dsym/Makefile +++ b/lldb/test/API/macosx/add-dsym/Makefile @@ -8,7 +8,7 @@ hide.app/Contents/a.out.dSYM: mkdir hide.app mkdir hide.app/Contents mv a.out.dSYM hide.app/Contents - strip -x a.out + $(STRIP) -x a.out ifneq "$(CODESIGN)" "" $(CODESIGN) -fs - a.out endif diff --git a/lldb/test/API/macosx/dyld-trie-symbols/Makefile b/lldb/test/API/macosx/dyld-trie-symbols/Makefile index a0f3424d676cc..50938bb111483 100644 --- a/lldb/test/API/macosx/dyld-trie-symbols/Makefile +++ b/lldb/test/API/macosx/dyld-trie-symbols/Makefile @@ -10,4 +10,4 @@ all: a.out a.out-stripped a.out-stripped: cp a.out a.out-stripped - strip -N a.out-stripped + $(STRIP) -N a.out-stripped diff --git a/lldb/test/API/tools/lldb-dap/module/Makefile b/lldb/test/API/tools/lldb-dap/module/Makefile index b30baf48b972e..c7d626a1a7e4c 100644 --- a/lldb/test/API/tools/lldb-dap/module/Makefile +++ b/lldb/test/API/tools/lldb-dap/module/Makefile @@ -10,7 +10,7 @@ include Makefile.rules all: a.out.stripped a.out.stripped: - strip -o a.out.stripped a.out + $(STRIP) -o a.out.stripped a.out ifneq "$(CODESIGN)" "" $(CODESIGN) -fs - a.out.stripped diff --git a/lldb/test/API/tools/lldb-dap/terminated-event/Makefile b/lldb/test/API/tools/lldb-dap/terminated-event/Makefile index b30baf48b972e..c7d626a1a7e4c 100644 --- a/lldb/test/API/tools/lldb-dap/terminated-event/Makefile +++ b/lldb/test/API/tools/lldb-dap/terminated-event/Makefile @@ -10,7 +10,7 @@ include Makefile.rules all: a.out.stripped a.out.stri
[Lldb-commits] [lldb] [lldb][tests] Fix passing pthread library to a linker for some API tests. (PR #93648)
https://github.com/vvereschaka created https://github.com/llvm/llvm-project/pull/93648 Specify ENABLE_THREADS := YES within test's Makefile instead passing -lpthread throuhg the compiler's CFLAGS options. Updated the following tests: * lldb/test/API/commands/register/register/aarch64_sme_z_registers/za_dynamic_resize/Makefile * lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/Makefile * lldb/test/API/functionalities/process_save_core_minidump/Makefile * lldb/test/API/tools/lldb-dap/threads/Makefile Fixes the following compiler/linker messages and error: ``` clang: warning: -lpthread: 'linker' input unused [-Wunused-command-line-argument] ... ld.lld: error: undefined symbol: pthread_create ... ``` Depends on #93639 >From dc5913d7c2e65ea6afaa752c4dacb588cc545b8d Mon Sep 17 00:00:00 2001 From: Vladimir Vereschaka Date: Tue, 28 May 2024 21:40:10 -0700 Subject: [PATCH] [lldb][tests] Fix passing pthread library to a linker for some API tests. Specify ENABLE_THREADS := YES within test's Makefile instead passing -lpthread throuhg the compiler's CFLAGS options. Updated the following tests: * lldb/test/API/commands/register/register/aarch64_sme_z_registers/za_dynamic_resize/Makefile * lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/Makefile * lldb/test/API/functionalities/process_save_core_minidump/Makefile * lldb/test/API/tools/lldb-dap/threads/Makefile --- .../aarch64_sme_z_registers/za_dynamic_resize/Makefile | 3 ++- .../aarch64_sve_registers/rw_access_dynamic_resize/Makefile| 3 ++- .../API/functionalities/process_save_core_minidump/Makefile| 2 +- lldb/test/API/tools/lldb-dap/threads/Makefile | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lldb/test/API/commands/register/register/aarch64_sme_z_registers/za_dynamic_resize/Makefile b/lldb/test/API/commands/register/register/aarch64_sme_z_registers/za_dynamic_resize/Makefile index 57d926b37d45c..bee03ac62a60f 100644 --- a/lldb/test/API/commands/register/register/aarch64_sme_z_registers/za_dynamic_resize/Makefile +++ b/lldb/test/API/commands/register/register/aarch64_sme_z_registers/za_dynamic_resize/Makefile @@ -1,5 +1,6 @@ C_SOURCES := main.c -CFLAGS_EXTRAS := -march=armv8-a+sve+sme -lpthread +CFLAGS_EXTRAS := -march=armv8-a+sve+sme +ENABLE_THREADS := YES include Makefile.rules diff --git a/lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/Makefile b/lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/Makefile index efa5ca913f6e2..1c65300b73738 100644 --- a/lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/Makefile +++ b/lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/Makefile @@ -1,5 +1,6 @@ C_SOURCES := main.c -CFLAGS_EXTRAS := -march=armv8-a+sve -lpthread +CFLAGS_EXTRAS := -march=armv8-a+sve +ENABLE_THREADS := YES include Makefile.rules diff --git a/lldb/test/API/functionalities/process_save_core_minidump/Makefile b/lldb/test/API/functionalities/process_save_core_minidump/Makefile index 2d177981fdde1..e9a26189f5dad 100644 --- a/lldb/test/API/functionalities/process_save_core_minidump/Makefile +++ b/lldb/test/API/functionalities/process_save_core_minidump/Makefile @@ -1,6 +1,6 @@ CXX_SOURCES := main.cpp -CFLAGS_EXTRAS := -lpthread +ENABLE_THREADS := YES include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/threads/Makefile b/lldb/test/API/tools/lldb-dap/threads/Makefile index 121868fa8ec33..aa6b054685d61 100644 --- a/lldb/test/API/tools/lldb-dap/threads/Makefile +++ b/lldb/test/API/tools/lldb-dap/threads/Makefile @@ -1,4 +1,5 @@ C_SOURCES := main.c -CFLAGS_EXTRAS := -lpthread + +ENABLE_THREADS := YES include Makefile.rules ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][tests] Fix passing pthread library to a linker for some API tests. (PR #93648)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Vladimir Vereschaka (vvereschaka) Changes Specify ENABLE_THREADS := YES within test's Makefile instead passing -lpthread throuhg the compiler's CFLAGS options. Updated the following tests: * lldb/test/API/commands/register/register/aarch64_sme_z_registers/za_dynamic_resize/Makefile * lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/Makefile * lldb/test/API/functionalities/process_save_core_minidump/Makefile * lldb/test/API/tools/lldb-dap/threads/Makefile Fixes the following compiler/linker messages and error: ``` clang: warning: -lpthread: 'linker' input unused [-Wunused-command-line-argument] ... ld.lld: error: undefined symbol: pthread_create ... ``` Depends on #93639 --- Full diff: https://github.com/llvm/llvm-project/pull/93648.diff 4 Files Affected: - (modified) lldb/test/API/commands/register/register/aarch64_sme_z_registers/za_dynamic_resize/Makefile (+2-1) - (modified) lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/Makefile (+2-1) - (modified) lldb/test/API/functionalities/process_save_core_minidump/Makefile (+1-1) - (modified) lldb/test/API/tools/lldb-dap/threads/Makefile (+2-1) ``diff diff --git a/lldb/test/API/commands/register/register/aarch64_sme_z_registers/za_dynamic_resize/Makefile b/lldb/test/API/commands/register/register/aarch64_sme_z_registers/za_dynamic_resize/Makefile index 57d926b37d45c..bee03ac62a60f 100644 --- a/lldb/test/API/commands/register/register/aarch64_sme_z_registers/za_dynamic_resize/Makefile +++ b/lldb/test/API/commands/register/register/aarch64_sme_z_registers/za_dynamic_resize/Makefile @@ -1,5 +1,6 @@ C_SOURCES := main.c -CFLAGS_EXTRAS := -march=armv8-a+sve+sme -lpthread +CFLAGS_EXTRAS := -march=armv8-a+sve+sme +ENABLE_THREADS := YES include Makefile.rules diff --git a/lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/Makefile b/lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/Makefile index efa5ca913f6e2..1c65300b73738 100644 --- a/lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/Makefile +++ b/lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/Makefile @@ -1,5 +1,6 @@ C_SOURCES := main.c -CFLAGS_EXTRAS := -march=armv8-a+sve -lpthread +CFLAGS_EXTRAS := -march=armv8-a+sve +ENABLE_THREADS := YES include Makefile.rules diff --git a/lldb/test/API/functionalities/process_save_core_minidump/Makefile b/lldb/test/API/functionalities/process_save_core_minidump/Makefile index 2d177981fdde1..e9a26189f5dad 100644 --- a/lldb/test/API/functionalities/process_save_core_minidump/Makefile +++ b/lldb/test/API/functionalities/process_save_core_minidump/Makefile @@ -1,6 +1,6 @@ CXX_SOURCES := main.cpp -CFLAGS_EXTRAS := -lpthread +ENABLE_THREADS := YES include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/threads/Makefile b/lldb/test/API/tools/lldb-dap/threads/Makefile index 121868fa8ec33..aa6b054685d61 100644 --- a/lldb/test/API/tools/lldb-dap/threads/Makefile +++ b/lldb/test/API/tools/lldb-dap/threads/Makefile @@ -1,4 +1,5 @@ C_SOURCES := main.c -CFLAGS_EXTRAS := -lpthread + +ENABLE_THREADS := YES include Makefile.rules `` https://github.com/llvm/llvm-project/pull/93648 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][tests] Fix TestStdCXXDisassembly test when running on the remote Linux targets. (PR #93649)
https://github.com/vvereschaka created https://github.com/llvm/llvm-project/pull/93649 The test expects 'libstdc++' SO module in the module list. Force using StdC++ by specifying USE_LIBSTDCPP := 1 in the test's Makefile. >From 741f69159b88c208ec0848b9c6d97be78f64383f Mon Sep 17 00:00:00 2001 From: Vladimir Vereschaka Date: Tue, 28 May 2024 21:45:10 -0700 Subject: [PATCH] [lldb][tests] Fix TestStdCXXDisassembly test when running on the remote Linux targets. The test expects 'libstdc++' SO module in the module list. Force using StdC++ by specifying USE_LIBSTDCPP := 1 in the test's Makefile. --- lldb/test/API/lang/cpp/stl/Makefile | 2 ++ lldb/test/API/lang/cpp/stl/TestStdCXXDisassembly.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lldb/test/API/lang/cpp/stl/Makefile b/lldb/test/API/lang/cpp/stl/Makefile index 8b20bcb05..bf8e6b8703f36 100644 --- a/lldb/test/API/lang/cpp/stl/Makefile +++ b/lldb/test/API/lang/cpp/stl/Makefile @@ -1,3 +1,5 @@ CXX_SOURCES := main.cpp +USE_LIBSTDCPP := 1 + include Makefile.rules diff --git a/lldb/test/API/lang/cpp/stl/TestStdCXXDisassembly.py b/lldb/test/API/lang/cpp/stl/TestStdCXXDisassembly.py index 1e1b0a4d621f0..cc46989f984b2 100644 --- a/lldb/test/API/lang/cpp/stl/TestStdCXXDisassembly.py +++ b/lldb/test/API/lang/cpp/stl/TestStdCXXDisassembly.py @@ -44,7 +44,7 @@ def test_stdcxx_disasm(self): # module is the corresponding SBModule. self.expect( -lib_stdcxx, "Libraray StdC++ is located", exe=False, substrs=["lib"] +lib_stdcxx, "Library StdC++ is located", exe=False, substrs=["lib"] ) self.runCmd("image dump symtab '%s'" % lib_stdcxx) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][tests] Fix TestStdCXXDisassembly test when running on the remote Linux targets. (PR #93649)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Vladimir Vereschaka (vvereschaka) Changes The test expects 'libstdc++' SO module in the module list. Force using StdC++ by specifying USE_LIBSTDCPP := 1 in the test's Makefile. --- Full diff: https://github.com/llvm/llvm-project/pull/93649.diff 2 Files Affected: - (modified) lldb/test/API/lang/cpp/stl/Makefile (+2) - (modified) lldb/test/API/lang/cpp/stl/TestStdCXXDisassembly.py (+1-1) ``diff diff --git a/lldb/test/API/lang/cpp/stl/Makefile b/lldb/test/API/lang/cpp/stl/Makefile index 8b20bcb05..bf8e6b8703f36 100644 --- a/lldb/test/API/lang/cpp/stl/Makefile +++ b/lldb/test/API/lang/cpp/stl/Makefile @@ -1,3 +1,5 @@ CXX_SOURCES := main.cpp +USE_LIBSTDCPP := 1 + include Makefile.rules diff --git a/lldb/test/API/lang/cpp/stl/TestStdCXXDisassembly.py b/lldb/test/API/lang/cpp/stl/TestStdCXXDisassembly.py index 1e1b0a4d621f0..cc46989f984b2 100644 --- a/lldb/test/API/lang/cpp/stl/TestStdCXXDisassembly.py +++ b/lldb/test/API/lang/cpp/stl/TestStdCXXDisassembly.py @@ -44,7 +44,7 @@ def test_stdcxx_disasm(self): # module is the corresponding SBModule. self.expect( -lib_stdcxx, "Libraray StdC++ is located", exe=False, substrs=["lib"] +lib_stdcxx, "Library StdC++ is located", exe=False, substrs=["lib"] ) self.runCmd("image dump symtab '%s'" % lib_stdcxx) `` https://github.com/llvm/llvm-project/pull/93649 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][tests] Fix TestStdCXXDisassembly test when running on the remote Linux targets. (PR #93649)
https://github.com/vvereschaka edited https://github.com/llvm/llvm-project/pull/93649 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][tests] Fix TestStdCXXDisassembly test when running on the remote Linux targets. (PR #93649)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r cbf6e93ceee7b9de2b7c3e7e8cea3a972eda0e75...741f69159b88c208ec0848b9c6d97be78f64383f lldb/test/API/lang/cpp/stl/TestStdCXXDisassembly.py `` View the diff from darker here. ``diff --- TestStdCXXDisassembly.py2024-05-29 04:45:10.00 + +++ TestStdCXXDisassembly.py2024-05-29 04:49:31.877680 + @@ -41,13 +41,11 @@ break # At this point, lib_stdcxx is the full path to the stdc++ library and # module is the corresponding SBModule. -self.expect( -lib_stdcxx, "Library StdC++ is located", exe=False, substrs=["lib"] -) +self.expect(lib_stdcxx, "Library StdC++ is located", exe=False, substrs=["lib"]) self.runCmd("image dump symtab '%s'" % lib_stdcxx) raw_output = self.res.GetOutput() # Now, look for every 'Code' symbol and feed its load address into the # command: 'disassemble -s load_address -e end_address', where the `` https://github.com/llvm/llvm-project/pull/93649 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits