[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
https://github.com/vogelsgesang edited https://github.com/llvm/llvm-project/pull/113787 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix statistics dump to report per-target (PR #113723)
https://github.com/jeffreytan81 updated https://github.com/llvm/llvm-project/pull/113723 >From abf234c1009b23b000a2b39684fb888084cf5e8c Mon Sep 17 00:00:00 2001 From: jeffreytan81 Date: Thu, 24 Oct 2024 17:14:55 -0700 Subject: [PATCH 1/2] Report statistics per target --- lldb/include/lldb/API/SBDebugger.h| 2 + lldb/include/lldb/API/SBTarget.h | 3 ++ lldb/include/lldb/Core/Module.h | 2 + lldb/include/lldb/Symbol/SymbolFile.h | 3 ++ lldb/include/lldb/Symbol/SymbolFileOnDemand.h | 2 + lldb/include/lldb/Target/Statistics.h | 12 ++ lldb/source/API/SBDebugger.cpp| 6 +++ lldb/source/API/SBTarget.cpp | 7 lldb/source/Core/Module.cpp | 9 + .../Plugins/SymbolFile/DWARF/DWARFIndex.h | 2 + .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 6 +++ .../SymbolFile/DWARF/SymbolFileDWARF.h| 2 + lldb/source/Symbol/SymbolFileOnDemand.cpp | 6 +++ lldb/source/Target/Statistics.cpp | 24 ++- .../commands/statistics/basic/TestStats.py| 40 ++- .../API/commands/statistics/basic/second.cpp | 5 +++ 16 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 lldb/test/API/commands/statistics/basic/second.cpp diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index 6afa1c932ab050..d80d609b3e7a28 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -426,6 +426,8 @@ class LLDB_API SBDebugger { SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier); + void ResetStatistics(); + #ifndef SWIG /// Run the command interpreter. /// diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h index 35c2ed9c20a238..2e4392990bc4a8 100644 --- a/lldb/include/lldb/API/SBTarget.h +++ b/lldb/include/lldb/API/SBTarget.h @@ -101,6 +101,9 @@ class LLDB_API SBTarget { /// A SBStructuredData with the statistics collected. lldb::SBStructuredData GetStatistics(SBStatisticsOptions options); + /// Reset the statistics collected for this target. + void ResetStatistics(); + /// Return the platform object associated with the target. /// /// After return, the platform object should be checked for diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 5589c1c9a350dc..9170aca3ed7283 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -880,6 +880,8 @@ class Module : public std::enable_shared_from_this, /// ElapsedTime RAII object. StatsDuration &GetSymtabIndexTime() { return m_symtab_index_time; } + void ResetStatistics(); + /// \class LookupInfo Module.h "lldb/Core/Module.h" /// A class that encapsulates name lookup information. /// diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index 8419495da73a22..837b922ae77f75 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -422,6 +422,9 @@ class SymbolFile : public PluginInterface { /// hasn't been indexed yet, or a valid duration if it has. virtual StatsDuration::Duration GetDebugInfoIndexTime() { return {}; } + /// Reset the statistics for the symbol file. + virtual void ResetStatistics() {} + /// Get the additional modules that this symbol file uses to parse debug info. /// /// Some debug info is stored in stand alone object files that are represented diff --git a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h index 8073d1816860e3..7a366bfabec865 100644 --- a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h +++ b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h @@ -182,6 +182,8 @@ class SymbolFileOnDemand : public lldb_private::SymbolFile { lldb_private::StatsDuration::Duration GetDebugInfoParseTime() override; lldb_private::StatsDuration::Duration GetDebugInfoIndexTime() override; + void ResetStatistics() override; + uint32_t GetAbilities() override; Symtab *GetSymtab() override { return m_sym_file_impl->GetSymtab(); } diff --git a/lldb/include/lldb/Target/Statistics.h b/lldb/include/lldb/Target/Statistics.h index f3414ae314f339..91a3ffb5bfa3d3 100644 --- a/lldb/include/lldb/Target/Statistics.h +++ b/lldb/include/lldb/Target/Statistics.h @@ -41,6 +41,8 @@ class StatsDuration { } operator Duration() const { return get(); } + void reset() { value.store(0, std::memory_order_relaxed); } + StatsDuration &operator+=(Duration dur) { value.fetch_add(std::chrono::duration_cast(dur).count(), std::memory_order_relaxed); @@ -311,6 +313,16 @@ class DebuggerStats { ReportStatistics(Debugger &debugger, Target *target, const lldb_private::StatisticsOptions &options); + /// Reset metrics associated with one or all targets in a debugger. + /// + /// \param debugger + /// The
[Lldb-commits] [lldb] Fix statistics dump to report per-target (PR #113723)
@@ -426,6 +426,8 @@ class LLDB_API SBDebugger { SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier); + void ResetStatistics(); jeffreytan81 wrote: Comments added. I do not think we need to clear any breakpoint stats because they are not reused across debug sessions by "reuse lldb-dap" https://github.com/llvm/llvm-project/pull/113723 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
jeffreytan81 wrote: @vogelsgesang, does this feature require compiling target with `-gcolumn-info` to work? If so, any reason I did not see `-gcolumn-info` in the testcase Makefile? https://github.com/llvm/llvm-project/pull/113787 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Search main function with lldb::eFunctionNameTypeFull when getting default file and line. (PR #113980)
https://github.com/ZequanWu created https://github.com/llvm/llvm-project/pull/113980 This is to work around the fact that `SymbolFileNativePDB::FindFunctions` only support `lldb::eFunctionNameTypeFull` and `lldb::eFunctionNameTypeMethod` now. Since `main`'s full name is the same as base name (`main`), it's okay to search with `lldb::eFunctionNameTypeFull` when trying to get the default file and line. With this, `lldb/test/Shell/Driver/TestSingleQuote.test` passes on Windows with NativePDB plugin. >From 2d02fdd5ea12cd5c490c313a314dbe1fcf6a81f6 Mon Sep 17 00:00:00 2001 From: Zequan Wu Date: Mon, 28 Oct 2024 15:24:59 -0700 Subject: [PATCH] [lldb] Search main function with lldb::eFunctionNameTypeFull when getting default file and line. --- lldb/source/Core/SourceManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp index fd5b49946c6a92..27a9edeef4249e 100644 --- a/lldb/source/Core/SourceManager.cpp +++ b/lldb/source/Core/SourceManager.cpp @@ -430,7 +430,7 @@ SourceManager::GetDefaultFileAndLine() { false; // Force it to be a debug symbol. function_options.include_inlines = true; executable_ptr->FindFunctions(main_name, CompilerDeclContext(), - lldb::eFunctionNameTypeBase, + lldb::eFunctionNameTypeFull, function_options, sc_list); for (const SymbolContext &sc : sc_list) { if (sc.function) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Search main function with lldb::eFunctionNameTypeFull when getting default file and line. (PR #113980)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Zequan Wu (ZequanWu) Changes This is to work around the fact that `SymbolFileNativePDB::FindFunctions` only support `lldb::eFunctionNameTypeFull` and `lldb::eFunctionNameTypeMethod` now. Since `main`'s full name is the same as base name (`main`), it's okay to search with `lldb::eFunctionNameTypeFull` when trying to get the default file and line. With this, `lldb/test/Shell/Driver/TestSingleQuote.test` passes on Windows with NativePDB plugin. --- Full diff: https://github.com/llvm/llvm-project/pull/113980.diff 1 Files Affected: - (modified) lldb/source/Core/SourceManager.cpp (+1-1) ``diff diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp index fd5b49946c6a92..27a9edeef4249e 100644 --- a/lldb/source/Core/SourceManager.cpp +++ b/lldb/source/Core/SourceManager.cpp @@ -430,7 +430,7 @@ SourceManager::GetDefaultFileAndLine() { false; // Force it to be a debug symbol. function_options.include_inlines = true; executable_ptr->FindFunctions(main_name, CompilerDeclContext(), - lldb::eFunctionNameTypeBase, + lldb::eFunctionNameTypeFull, function_options, sc_list); for (const SymbolContext &sc : sc_list) { if (sc.function) { `` https://github.com/llvm/llvm-project/pull/113980 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Always pass disableASLR to the DAP executable (PR #113891)
Michael137 wrote: Confirmed the libc++ tests pass. Removing them from this PR https://github.com/llvm/llvm-project/pull/113891 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [DO NOT MERGE] Test libc++ CI LLDB DAP failures (PR #113891)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/113891 >From 40bbe1d8f72f697c0c4759fa68f2bd64a50d742c Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Mon, 28 Oct 2024 10:07:36 + Subject: [PATCH 1/3] Init --- .github/workflows/libcxx-build-and-test.yaml | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml index 184fed2268e818..3521b5d5a3def4 100644 --- a/.github/workflows/libcxx-build-and-test.yaml +++ b/.github/workflows/libcxx-build-and-test.yaml @@ -49,7 +49,8 @@ env: jobs: stage1: if: github.repository_owner == 'llvm' -runs-on: libcxx-runners-8-set +runs-on: libcxx-runners-set +container: ghcr.io/libcxx/actions-builder:testing-2024-09-21 continue-on-error: false strategy: fail-fast: false @@ -84,7 +85,8 @@ jobs: **/crash_diagnostics/* stage2: if: github.repository_owner == 'llvm' -runs-on: libcxx-runners-8-set +runs-on: libcxx-runners-set +container: ghcr.io/libcxx/actions-builder:testing-2024-09-21 needs: [ stage1 ] continue-on-error: false strategy: @@ -160,20 +162,21 @@ jobs: 'benchmarks', 'bootstrapping-build' ] -machine: [ 'libcxx-runners-8-set' ] +machine: [ 'libcxx-runners-set' ] include: - config: 'generic-cxx26' - machine: libcxx-runners-8-set + machine: libcxx-runners-set - config: 'generic-asan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set - config: 'generic-tsan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set - config: 'generic-ubsan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set # Use a larger machine for MSAN to avoid timeout and memory allocation issues. - config: 'generic-msan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set runs-on: ${{ matrix.machine }} +container: ghcr.io/libcxx/actions-builder:testing-2024-09-21 steps: - uses: actions/checkout@v4 - name: ${{ matrix.config }} >From c4bced0ee5ac067fc518fcba0395e86e88ca Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Mon, 28 Oct 2024 11:26:48 + Subject: [PATCH 2/3] Disable ASLR on dap_server@ --- lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py | 1 + 1 file changed, 1 insertion(+) 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 63748a71f1122d..687d4defd0f7f2 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 @@ -833,6 +833,7 @@ def request_launch( args_dict["enableSyntheticChildDebugging"] = enableSyntheticChildDebugging args_dict["displayExtendedBacktrace"] = displayExtendedBacktrace args_dict["commandEscapePrefix"] = commandEscapePrefix +args_dict["disableASLR"] = False command_dict = {"command": "launch", "type": "request", "arguments": args_dict} response = self.send_recv(command_dict) >From 7071fe89e227f5231ac0d2d96bcc276fe89c1749 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Mon, 28 Oct 2024 15:18:09 + Subject: [PATCH 3/3] Disable DAP server change --- .../packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 687d4defd0f7f2..45ec27dc88d534 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 @@ -833,7 +833,7 @@ def request_launch( args_dict["enableSyntheticChildDebugging"] = enableSyntheticChildDebugging args_dict["displayExtendedBacktrace"] = displayExtendedBacktrace args_dict["commandEscapePrefix"] = commandEscapePrefix -args_dict["disableASLR"] = False +#args_dict["disableASLR"] = False command_dict = {"command": "launch", "type": "request", "arguments": args_dict} response = self.send_recv(command_dict) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix statistics dump to report per-target (PR #113723)
https://github.com/clayborg edited https://github.com/llvm/llvm-project/pull/113723 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix statistics dump to report per-target (PR #113723)
@@ -426,6 +426,8 @@ class LLDB_API SBDebugger { SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier); + void ResetStatistics(); clayborg wrote: Add a header doc comment for this to document what this will do: - clear all stats for all modules in all targets - clear all target breakpoint stats? https://github.com/llvm/llvm-project/pull/113723 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix statistics dump to report per-target (PR #113723)
https://github.com/clayborg commented: So this patch seems to just clear the module + symbol file stats, not any breakpoint resolve times, etc. https://github.com/llvm/llvm-project/pull/113723 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix statistics dump to report per-target (PR #113723)
@@ -101,6 +101,9 @@ class LLDB_API SBTarget { /// A SBStructuredData with the statistics collected. lldb::SBStructuredData GetStatistics(SBStatisticsOptions options); + /// Reset the statistics collected for this target. clayborg wrote: Document this a bit better with more explanation https://github.com/llvm/llvm-project/pull/113723 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [NFC][lldb-dap] Clean-up includes (PR #113839)
@@ -6,25 +6,21 @@ // //===--===// -#include #include #include #include #include #include "llvm/ADT/StringRef.h" -#include "llvm/Support/FormatAdapters.h" #include "llvm/Support/FormatVariadic.h" #include "llvm/Support/Path.h" #include "llvm/Support/ScopedPrinter.h" -#include "lldb/API/SBBreakpoint.h" -#include "lldb/API/SBBreakpointLocation.h" #include "lldb/API/SBDeclaration.h" +#include "lldb/API/SBStream.h" #include "lldb/API/SBStringList.h" #include "lldb/API/SBStructuredData.h" #include "lldb/API/SBValue.h" -#include "lldb/Host/PosixApi.h" vogelsgesang wrote: Thanks for fixing! 🙂 https://github.com/llvm/llvm-project/pull/113839 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [debugserver] Mark ASAN memory regions as "heap" (PR #113968)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Felipe de Azevedo Piovezan (felipepiovezan) Changes This memory type is currently not handled, but it makes sense to mark it as a heap allocation in requests asking for memory region info. --- Full diff: https://github.com/llvm/llvm-project/pull/113968.diff 1 Files Affected: - (modified) lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp (+2-1) ``diff diff --git a/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp b/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp index 60d4c3bc293a3c..97908b4acaf284 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp @@ -208,7 +208,8 @@ std::vector MachVMRegion::GetMemoryTypes() const { m_data.user_tag == VM_MEMORY_MALLOC_LARGE_REUSABLE || m_data.user_tag == VM_MEMORY_MALLOC_HUGE || m_data.user_tag == VM_MEMORY_REALLOC || - m_data.user_tag == VM_MEMORY_SBRK) { + m_data.user_tag == VM_MEMORY_SBRK || + m_data.user_tag == VM_MEMORY_SANITIZER) { types.push_back("heap"); if (m_data.user_tag == VM_MEMORY_MALLOC_TINY) { types.push_back("malloc-tiny"); `` https://github.com/llvm/llvm-project/pull/113968 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [debugserver] Mark ASAN memory regions as "heap" (PR #113968)
https://github.com/felipepiovezan closed https://github.com/llvm/llvm-project/pull/113968 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [debugserver] Mark ASAN memory regions as "heap" (PR #113968)
https://github.com/jasonmolenda approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/113968 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
vogelsgesang wrote: > does this feature require compiling target with -gcolumn-info to work? Apparently, `-gcolumn-info` is on by default. If I pass `-gno-column-info`, the test case actually fails. But as long as I don't pass anything, column info seems to be included in the debug info. https://github.com/llvm/llvm-project/pull/113787 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Set return status to Failed when Python command raises uncaught exception (PR #113996)
https://github.com/kastiglione created https://github.com/llvm/llvm-project/pull/113996 None >From 75f96b84c9bd2b3211edb5fa8806092711133251 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Mon, 28 Oct 2024 15:49:50 -0700 Subject: [PATCH] [lldb] Set return status to Failed when Python command raises uncaught exception --- lldb/bindings/python/python-wrapper.swig | 13 +++-- .../script/exception/TestCommandException.py | 27 +++ .../command/script/exception/throw_command.py | 6 + 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 lldb/test/API/commands/command/script/exception/TestCommandException.py create mode 100644 lldb/test/API/commands/command/script/exception/throw_command.py diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig index b72a462d04643b..dfe762e026788a 100644 --- a/lldb/bindings/python/python-wrapper.swig +++ b/lldb/bindings/python/python-wrapper.swig @@ -592,6 +592,8 @@ void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBExecutionContext(PyOb return sb_ptr; } +#include "lldb/Interpreter/CommandReturnObject.h" + bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallCommand( const char *python_function_name, const char *session_dictionary_name, lldb::DebuggerSP debugger, const char *args, @@ -621,6 +623,9 @@ bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallCommand( pfunc(debugger_arg, PythonString(args), SWIGBridge::ToSWIGWrapper(std::move(exe_ctx_ref_sp)), cmd_retobj_arg.obj(), dict); + if (PyErr_Occurred()) +cmd_retobj.SetStatus(eReturnStatusFailed); + return true; } @@ -642,6 +647,9 @@ bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallCommandObject( pfunc(SWIGBridge::ToSWIGWrapper(std::move(debugger)), PythonString(args), SWIGBridge::ToSWIGWrapper(exe_ctx_ref_sp), cmd_retobj_arg.obj()); + if (PyErr_Occurred()) +cmd_retobj.SetStatus(eReturnStatusFailed); + return true; } @@ -740,8 +748,6 @@ lldb_private::python::SWIGBridge::LLDBSwigPythonHandleOptionArgumentCompletionFo return dict_sp; } -#include "lldb/Interpreter/CommandReturnObject.h" - bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallParsedCommandObject( PyObject *implementor, lldb::DebuggerSP debugger, lldb_private::StructuredDataImpl &args_impl, lldb_private::CommandReturnObject &cmd_retobj, @@ -760,6 +766,9 @@ bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallParsedCommandObject( pfunc(SWIGBridge::ToSWIGWrapper(std::move(debugger)), SWIGBridge::ToSWIGWrapper(args_impl), SWIGBridge::ToSWIGWrapper(exe_ctx_ref_sp), SWIGBridge::ToSWIGWrapper(cmd_retobj).obj()); + if (PyErr_Occurred()) +cmd_retobj.SetStatus(eReturnStatusFailed); + return true; } diff --git a/lldb/test/API/commands/command/script/exception/TestCommandException.py b/lldb/test/API/commands/command/script/exception/TestCommandException.py new file mode 100644 index 00..73484137d82b3e --- /dev/null +++ b/lldb/test/API/commands/command/script/exception/TestCommandException.py @@ -0,0 +1,27 @@ +import os +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * + + +class TestCase(TestBase): +NO_DEBUG_INFO_TESTCASE = True + +def test(self): +""" +Check that a Python command, which raises an unhandled exception, has +its status set to failed. +""" +command_path = os.path.join(self.getSourceDir(), "throw_command.py") +self.runCmd(f"command script import {command_path}") + +with open(os.devnull, "w") as devnull: +self.dbg.SetErrorFileHandle(devnull, False) +result = lldb.SBCommandReturnObject() +self.ci.HandleCommand("throw", result) + +self.assertEqual( +result.GetStatus(), +lldb.eReturnStatusFailed, +"command unexpectedly succeeded", +) diff --git a/lldb/test/API/commands/command/script/exception/throw_command.py b/lldb/test/API/commands/command/script/exception/throw_command.py new file mode 100644 index 00..7c4989850cb19a --- /dev/null +++ b/lldb/test/API/commands/command/script/exception/throw_command.py @@ -0,0 +1,6 @@ +import lldb + + +@lldb.command() +def throw(debugger, cmd, ctx, result, _): +raise Exception("command failed") ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Set return status to Failed when Python command raises uncaught exception (PR #113996)
https://github.com/kastiglione edited https://github.com/llvm/llvm-project/pull/113996 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Set return status to Failed when Python command raises uncaught exception (PR #113996)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Dave Lee (kastiglione) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/113996.diff 3 Files Affected: - (modified) lldb/bindings/python/python-wrapper.swig (+11-2) - (added) lldb/test/API/commands/command/script/exception/TestCommandException.py (+27) - (added) lldb/test/API/commands/command/script/exception/throw_command.py (+6) ``diff diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig index b72a462d04643b..dfe762e026788a 100644 --- a/lldb/bindings/python/python-wrapper.swig +++ b/lldb/bindings/python/python-wrapper.swig @@ -592,6 +592,8 @@ void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBExecutionContext(PyOb return sb_ptr; } +#include "lldb/Interpreter/CommandReturnObject.h" + bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallCommand( const char *python_function_name, const char *session_dictionary_name, lldb::DebuggerSP debugger, const char *args, @@ -621,6 +623,9 @@ bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallCommand( pfunc(debugger_arg, PythonString(args), SWIGBridge::ToSWIGWrapper(std::move(exe_ctx_ref_sp)), cmd_retobj_arg.obj(), dict); + if (PyErr_Occurred()) +cmd_retobj.SetStatus(eReturnStatusFailed); + return true; } @@ -642,6 +647,9 @@ bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallCommandObject( pfunc(SWIGBridge::ToSWIGWrapper(std::move(debugger)), PythonString(args), SWIGBridge::ToSWIGWrapper(exe_ctx_ref_sp), cmd_retobj_arg.obj()); + if (PyErr_Occurred()) +cmd_retobj.SetStatus(eReturnStatusFailed); + return true; } @@ -740,8 +748,6 @@ lldb_private::python::SWIGBridge::LLDBSwigPythonHandleOptionArgumentCompletionFo return dict_sp; } -#include "lldb/Interpreter/CommandReturnObject.h" - bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallParsedCommandObject( PyObject *implementor, lldb::DebuggerSP debugger, lldb_private::StructuredDataImpl &args_impl, lldb_private::CommandReturnObject &cmd_retobj, @@ -760,6 +766,9 @@ bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallParsedCommandObject( pfunc(SWIGBridge::ToSWIGWrapper(std::move(debugger)), SWIGBridge::ToSWIGWrapper(args_impl), SWIGBridge::ToSWIGWrapper(exe_ctx_ref_sp), SWIGBridge::ToSWIGWrapper(cmd_retobj).obj()); + if (PyErr_Occurred()) +cmd_retobj.SetStatus(eReturnStatusFailed); + return true; } diff --git a/lldb/test/API/commands/command/script/exception/TestCommandException.py b/lldb/test/API/commands/command/script/exception/TestCommandException.py new file mode 100644 index 00..73484137d82b3e --- /dev/null +++ b/lldb/test/API/commands/command/script/exception/TestCommandException.py @@ -0,0 +1,27 @@ +import os +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * + + +class TestCase(TestBase): +NO_DEBUG_INFO_TESTCASE = True + +def test(self): +""" +Check that a Python command, which raises an unhandled exception, has +its status set to failed. +""" +command_path = os.path.join(self.getSourceDir(), "throw_command.py") +self.runCmd(f"command script import {command_path}") + +with open(os.devnull, "w") as devnull: +self.dbg.SetErrorFileHandle(devnull, False) +result = lldb.SBCommandReturnObject() +self.ci.HandleCommand("throw", result) + +self.assertEqual( +result.GetStatus(), +lldb.eReturnStatusFailed, +"command unexpectedly succeeded", +) diff --git a/lldb/test/API/commands/command/script/exception/throw_command.py b/lldb/test/API/commands/command/script/exception/throw_command.py new file mode 100644 index 00..7c4989850cb19a --- /dev/null +++ b/lldb/test/API/commands/command/script/exception/throw_command.py @@ -0,0 +1,6 @@ +import lldb + + +@lldb.command() +def throw(debugger, cmd, ctx, result, _): +raise Exception("command failed") `` https://github.com/llvm/llvm-project/pull/113996 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [DebugInfo] Add explicit visibility macros to CodeView template functions (PR #113102)
vgvassilev wrote: @JDevlieghere, ping. https://github.com/llvm/llvm-project/pull/113102 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 09c258e - [NFC][lldb-dap] Clean-up includes (#113839)
Author: Adrian Vogelsgesang Date: 2024-10-28T11:01:57+01:00 New Revision: 09c258ef6a2fcca2161488b214d53ef39891fa22 URL: https://github.com/llvm/llvm-project/commit/09c258ef6a2fcca2161488b214d53ef39891fa22 DIFF: https://github.com/llvm/llvm-project/commit/09c258ef6a2fcca2161488b214d53ef39891fa22.diff LOG: [NFC][lldb-dap] Clean-up includes (#113839) This commit cleans up the includes in the `lldb-dap` subfolder. The main motivation was that I got annoyed by `clangd` always complaining about unused includes while working on lldb-dap. Added: Modified: lldb/tools/lldb-dap/Breakpoint.cpp lldb/tools/lldb-dap/Breakpoint.h lldb/tools/lldb-dap/BreakpointBase.cpp lldb/tools/lldb-dap/BreakpointBase.h lldb/tools/lldb-dap/DAP.cpp lldb/tools/lldb-dap/DAP.h lldb/tools/lldb-dap/FifoFiles.cpp lldb/tools/lldb-dap/FifoFiles.h lldb/tools/lldb-dap/FunctionBreakpoint.cpp lldb/tools/lldb-dap/IOStream.cpp lldb/tools/lldb-dap/IOStream.h lldb/tools/lldb-dap/InstructionBreakpoint.cpp lldb/tools/lldb-dap/InstructionBreakpoint.h lldb/tools/lldb-dap/JSONUtils.cpp lldb/tools/lldb-dap/LLDBUtils.cpp lldb/tools/lldb-dap/OutputRedirector.h lldb/tools/lldb-dap/RunInTerminal.cpp lldb/tools/lldb-dap/RunInTerminal.h lldb/tools/lldb-dap/SourceBreakpoint.cpp lldb/tools/lldb-dap/lldb-dap.cpp Removed: diff --git a/lldb/tools/lldb-dap/Breakpoint.cpp b/lldb/tools/lldb-dap/Breakpoint.cpp index 0c33d4b114d760..9ea7a42ca85a1e 100644 --- a/lldb/tools/lldb-dap/Breakpoint.cpp +++ b/lldb/tools/lldb-dap/Breakpoint.cpp @@ -9,6 +9,7 @@ #include "Breakpoint.h" #include "DAP.h" #include "JSONUtils.h" +#include "lldb/API/SBBreakpointLocation.h" #include "llvm/ADT/StringExtras.h" using namespace lldb_dap; diff --git a/lldb/tools/lldb-dap/Breakpoint.h b/lldb/tools/lldb-dap/Breakpoint.h index 47a9d9c59ae2b7..ee9d3736d6190f 100644 --- a/lldb/tools/lldb-dap/Breakpoint.h +++ b/lldb/tools/lldb-dap/Breakpoint.h @@ -10,6 +10,7 @@ #define LLDB_TOOLS_LLDB_DAP_BREAKPOINT_H #include "BreakpointBase.h" +#include "lldb/API/SBBreakpoint.h" namespace lldb_dap { diff --git a/lldb/tools/lldb-dap/BreakpointBase.cpp b/lldb/tools/lldb-dap/BreakpointBase.cpp index 519729f5519ffc..f3cb06a3562d48 100644 --- a/lldb/tools/lldb-dap/BreakpointBase.cpp +++ b/lldb/tools/lldb-dap/BreakpointBase.cpp @@ -7,8 +7,7 @@ //===--===// #include "BreakpointBase.h" -#include "DAP.h" -#include "llvm/ADT/StringExtras.h" +#include "JSONUtils.h" using namespace lldb_dap; diff --git a/lldb/tools/lldb-dap/BreakpointBase.h b/lldb/tools/lldb-dap/BreakpointBase.h index 5a04bb201615fc..79301480e0e588 100644 --- a/lldb/tools/lldb-dap/BreakpointBase.h +++ b/lldb/tools/lldb-dap/BreakpointBase.h @@ -9,10 +9,8 @@ #ifndef LLDB_TOOLS_LLDB_DAP_BREAKPOINTBASE_H #define LLDB_TOOLS_LLDB_DAP_BREAKPOINTBASE_H -#include "lldb/API/SBBreakpoint.h" #include "llvm/Support/JSON.h" #include -#include namespace lldb_dap { diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp index 68559e382006db..283392270ba26c 100644 --- a/lldb/tools/lldb-dap/DAP.cpp +++ b/lldb/tools/lldb-dap/DAP.cpp @@ -10,11 +10,14 @@ #include #include #include -#include #include "DAP.h" +#include "JSONUtils.h" #include "LLDBUtils.h" #include "lldb/API/SBCommandInterpreter.h" +#include "lldb/API/SBLanguageRuntime.h" +#include "lldb/API/SBListener.h" +#include "lldb/API/SBStream.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/FormatVariadic.h" diff --git a/lldb/tools/lldb-dap/DAP.h b/lldb/tools/lldb-dap/DAP.h index acc10ade75fd14..dab4ce44ab202c 100644 --- a/lldb/tools/lldb-dap/DAP.h +++ b/lldb/tools/lldb-dap/DAP.h @@ -9,16 +9,10 @@ #ifndef LLDB_TOOLS_LLDB_DAP_DAP_H #define LLDB_TOOLS_LLDB_DAP_DAP_H -#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX - -#include -#include #include -#include #include #include #include -#include #include #include "llvm/ADT/DenseMap.h" @@ -30,24 +24,12 @@ #include "llvm/Support/raw_ostream.h" #include "lldb/API/SBAttachInfo.h" -#include "lldb/API/SBBreakpoint.h" -#include "lldb/API/SBBreakpointLocation.h" #include "lldb/API/SBCommandInterpreter.h" #include "lldb/API/SBCommandReturnObject.h" -#include "lldb/API/SBCommunication.h" #include "lldb/API/SBDebugger.h" #include "lldb/API/SBEvent.h" #include "lldb/API/SBFormat.h" -#include "lldb/API/SBHostOS.h" -#include "lldb/API/SBInstruction.h" -#include "lldb/API/SBInstructionList.h" -#include "lldb/API/SBLanguageRuntime.h" #include "lldb/API/SBLaunchInfo.h" -#include "lldb/API/SBLineEntry.h" -#include "lldb/API/SBListener.h" -#include "lldb/API/SBProcess.h" -#include "lldb/API/SBStream.h" -#include "lldb/API/SBStringList.h" #include "lldb/API/SBTarget.h" #include "lldb/API/SBThread.h" @@ -56,7 +38,6 @@ #
[Lldb-commits] [lldb] [NFC][lldb-dap] Clean-up includes (PR #113839)
https://github.com/vogelsgesang closed https://github.com/llvm/llvm-project/pull/113839 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
https://github.com/ashgti edited https://github.com/llvm/llvm-project/pull/113787 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)
https://github.com/jimingham updated https://github.com/llvm/llvm-project/pull/112939 >From 9c6705b21df14dc911665e1082c9b31ce00d7e7c Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Thu, 3 Oct 2024 18:24:46 -0700 Subject: [PATCH 01/12] Add the ability to break on call-site locations, report the correct position in the virtual inlined call stack when they are hit, and step through the inlined stack from there. --- .../lldb/Breakpoint/BreakpointLocation.h | 31 lldb/include/lldb/Breakpoint/BreakpointSite.h | 5 + lldb/include/lldb/Target/StopInfo.h | 11 ++ .../lldb/Target/ThreadPlanStepInRange.h | 4 +- lldb/source/Breakpoint/BreakpointLocation.cpp | 61 ++- lldb/source/Breakpoint/BreakpointResolver.cpp | 12 ++ lldb/source/Breakpoint/BreakpointSite.cpp | 16 ++ lldb/source/Core/Declaration.cpp | 2 +- lldb/source/Symbol/CompileUnit.cpp| 104 ++- lldb/source/Target/StackFrameList.cpp | 170 ++ lldb/source/Target/StopInfo.cpp | 55 ++ lldb/source/Target/Thread.cpp | 8 + lldb/source/Target/ThreadPlanStepInRange.cpp | 24 ++- .../source/Target/ThreadPlanStepOverRange.cpp | 2 +- .../inline-stepping/TestInlineStepping.py | 54 ++ .../inline-stepping/calling.cpp | 31 16 files changed, 462 insertions(+), 128 deletions(-) diff --git a/lldb/include/lldb/Breakpoint/BreakpointLocation.h b/lldb/include/lldb/Breakpoint/BreakpointLocation.h index cca00335bc3c67..f9c258daf137f7 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointLocation.h +++ b/lldb/include/lldb/Breakpoint/BreakpointLocation.h @@ -11,10 +11,12 @@ #include #include +#include #include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Breakpoint/StoppointHitCounter.h" #include "lldb/Core/Address.h" +#include "lldb/Symbol/LineEntry.h" #include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" @@ -281,6 +283,18 @@ class BreakpointLocation /// Returns the breakpoint location ID. lldb::break_id_t GetID() const { return m_loc_id; } + + // Set the line entry that should be shown to users for this location. + // It is up to the caller to verify that this is a valid entry to show. + // The current use of this is to distinguish among line entries from a + // virtual inlined call stack that all share the same address. + void SetPreferredLineEntry(const LineEntry &line_entry) { +m_preferred_line_entry = line_entry; + } + + const std::optional GetPreferredLineEntry() { +return m_preferred_line_entry; + } protected: friend class BreakpointSite; @@ -305,6 +319,16 @@ class BreakpointLocation /// It also takes care of decrementing the ignore counters. /// If it returns false we should continue, otherwise stop. bool IgnoreCountShouldStop(); + + // If this location knows that the virtual stack frame it represents is + // not frame 0, return the suggested stack frame instead. This will happen + // when the location's address contains a "virtual inlined call stack" and the + // breakpoint was set on a file & line that are not at the bottom of that + // stack. For now we key off the "preferred line entry" - looking for that + // in the blocks that start with the stop PC. + // This version of the API doesn't take an "inlined" parameter because it + // only changes frames in the inline stack. + std::optional GetSuggestedStackFrameIndex(); private: void SwapLocation(lldb::BreakpointLocationSP swap_from); @@ -369,6 +393,13 @@ class BreakpointLocation lldb::break_id_t m_loc_id; ///< Breakpoint location ID. StoppointHitCounter m_hit_counter; ///< Number of times this breakpoint /// location has been hit. + std::optional m_preferred_line_entry; // If this exists, use it to print the stop +// description rather than the LineEntry +// m_address resolves to directly. Use this +// for instance when the location was given +// somewhere in the virtual inlined call +// stack since the Address always resolves +// to the lowest entry in the stack. void SetShouldResolveIndirectFunctions(bool do_resolve) { m_should_resolve_indirect_functions = do_resolve; diff --git a/lldb/include/lldb/Breakpoint/BreakpointSite.h b/lldb/include/lldb/Breakpoint/BreakpointSite.h index 17b76d51c1ae53..30cb5a80b908e0 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointSite.h +++ b/lldb/include/lldb/Breakpoint/BreakpointSite.h @@ -169,6 +169,11 @@ class BreakpointSite : public std::enable_shared_from_this, /// /// \see lldb::DescriptionLevel void GetDescription(Stream *s, lldb::DescriptionLevel level); + + // This runs through all the breakpoint locations owning this
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
https://github.com/ashgti approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/113787 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Skip libc++ tests if it is linked statically (PR #113935)
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 8ae39c8e34de2d24c46827b324c76bac845c18b0...77b2ad3e3975ed5b4e0f23efd64999abc92175e7 lldb/packages/Python/lldbsuite/test/dotest.py lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py `` View the diff from darker here. ``diff --- packages/Python/lldbsuite/test/dotest.py2024-10-28 16:33:13.00 + +++ packages/Python/lldbsuite/test/dotest.py2024-10-28 16:41:15.277640 + @@ -774,11 +774,19 @@ if lldbplatformutil.target_is_android() or lldbplatformutil.platformIsDarwin(): return True, "libc++ always present" if platform == "linux": with tempfile.NamedTemporaryFile() as f: -cmd = [configuration.compiler, "-xc++", "-stdlib=libc++", "-l:libc++.so", "-o", f.name, "-"] +cmd = [ +configuration.compiler, +"-xc++", +"-stdlib=libc++", +"-l:libc++.so", +"-o", +f.name, +"-", +] p = subprocess.Popen( cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, `` https://github.com/llvm/llvm-project/pull/113935 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `lldb-x86_64-debian` running on `lldb-x86_64-debian` while building `lldb` at step 6 "test". Full details are available at: https://lab.llvm.org/buildbot/#/builders/162/builds/9193 Here is the relevant piece of the build log for the reference ``` Step 6 (test) failure: build (failure) ... PASS: lldb-api :: linux/builtin_trap/TestBuiltinTrap.py (608 of 2695) PASS: lldb-api :: functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py (609 of 2695) PASS: lldb-api :: functionalities/thread/concurrent_events/exit/TestConcurrentThreadExit.py (610 of 2695) PASS: lldb-api :: commands/expression/radar_9531204/TestPrintfAfterUp.py (611 of 2695) PASS: lldb-api :: functionalities/optimized_code/TestNoASanExceptionAfterEvalOP_piece.py (612 of 2695) PASS: lldb-api :: functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py (613 of 2695) PASS: lldb-api :: functionalities/data-formatter/data-formatter-enum-format/TestDataFormatterEnumFormat.py (614 of 2695) PASS: lldb-api :: lang/cpp/unsigned_types/TestUnsignedTypes.py (615 of 2695) PASS: lldb-api :: lang/c/stepping/TestThreadStepInAvoidRegexp.py (616 of 2695) PASS: lldb-api :: commands/expression/completion-crash-incomplete-record/TestCompletionCrashIncompleteRecord.py (617 of 2695) FAIL: lldb-api :: functionalities/gdb_remote_client/TestGDBRemoteClient.py (618 of 2695) TEST 'lldb-api :: functionalities/gdb_remote_client/TestGDBRemoteClient.py' FAILED Script: -- /usr/bin/python3 /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./lib --env LLVM_INCLUDE_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/include --env LLVM_TOOLS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./bin --arch x86_64 --build-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex --lldb-module-cache-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/lldb --compiler /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/clang --dsymutil /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/dsymutil --make /usr/bin/make --llvm-tools-dir /home/worker/2.0.1/lldb-x86_64-debian/build/./bin --lldb-obj-root /home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb --lldb-libs-dir /home/worker/2.0.1/lldb-x86_64-debian/build/./lib -t /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/functionalities/gdb_remote_client -p TestGDBRemoteClient.py -- Exit Code: 1 Command Output (stdout): -- lldb version 20.0.0git (https://github.com/llvm/llvm-project.git revision f14743794587db102c6d1b20f9c87a1ac20decfd) clang revision f14743794587db102c6d1b20f9c87a1ac20decfd llvm revision f14743794587db102c6d1b20f9c87a1ac20decfd Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc'] -- Command Output (stderr): -- Change dir to: /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/functionalities/gdb_remote_client runCmd: settings clear -all output: runCmd: settings set symbols.enable-external-lookup false output: runCmd: settings set target.inherit-tcc true output: runCmd: settings set target.disable-aslr false output: runCmd: settings set target.detach-on-error false output: ``` https://github.com/llvm/llvm-project/pull/112939 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Revert "Add the ability to break on call-site locations, improve inli… (PR #113947)
https://github.com/jimingham created https://github.com/llvm/llvm-project/pull/113947 …ne stepping (#112939)" This was breaking some gdb-remote packet counting tests on the bots. I can't see how this patch could cause that breakage, but I'm reverting to figure that out. This reverts commit f14743794587db102c6d1b20f9c87a1ac20decfd. >From f762e521560ebe1140bec2b615d088e8746f030a Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Mon, 28 Oct 2024 11:50:09 -0700 Subject: [PATCH] Revert "Add the ability to break on call-site locations, improve inline stepping (#112939)" This was breaking some gdb-remote packet counting tests on the bots. I can't see how this patch could cause that breakage, but I'm reverting to figure that out. This reverts commit f14743794587db102c6d1b20f9c87a1ac20decfd. --- .../lldb/Breakpoint/BreakpointLocation.h | 36 lldb/include/lldb/Breakpoint/BreakpointSite.h | 5 - lldb/include/lldb/Core/Declaration.h | 6 +- lldb/include/lldb/Target/StopInfo.h | 12 -- .../lldb/Target/ThreadPlanStepInRange.h | 4 +- lldb/source/Breakpoint/BreakpointLocation.cpp | 63 +-- lldb/source/Breakpoint/BreakpointResolver.cpp | 15 -- lldb/source/Breakpoint/BreakpointSite.cpp | 17 -- lldb/source/Core/Declaration.cpp | 5 +- lldb/source/Symbol/Block.cpp | 2 +- lldb/source/Symbol/CompileUnit.cpp| 111 +--- lldb/source/Target/StackFrameList.cpp | 171 -- lldb/source/Target/StopInfo.cpp | 55 -- lldb/source/Target/Thread.cpp | 8 - lldb/source/Target/ThreadPlanStepInRange.cpp | 24 +-- .../source/Target/ThreadPlanStepOverRange.cpp | 2 +- .../inline-stepping/TestInlineStepping.py | 63 --- .../inline-stepping/calling.cpp | 25 --- 18 files changed, 131 insertions(+), 493 deletions(-) diff --git a/lldb/include/lldb/Breakpoint/BreakpointLocation.h b/lldb/include/lldb/Breakpoint/BreakpointLocation.h index 3592291bb2d06e..cca00335bc3c67 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointLocation.h +++ b/lldb/include/lldb/Breakpoint/BreakpointLocation.h @@ -11,12 +11,10 @@ #include #include -#include #include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Breakpoint/StoppointHitCounter.h" #include "lldb/Core/Address.h" -#include "lldb/Symbol/LineEntry.h" #include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" @@ -284,25 +282,6 @@ class BreakpointLocation /// Returns the breakpoint location ID. lldb::break_id_t GetID() const { return m_loc_id; } - /// Set the line entry that should be shown to users for this location. - /// It is up to the caller to verify that this is a valid entry to show. - /// The current use of this is to distinguish among line entries from a - /// virtual inlined call stack that all share the same address. - /// The line entry must have the same start address as the address for this - /// location. - bool SetPreferredLineEntry(const LineEntry &line_entry) { -if (m_address == line_entry.range.GetBaseAddress()) { - m_preferred_line_entry = line_entry; - return true; -} -assert(0 && "Tried to set a preferred line entry with a different address"); -return false; - } - - const std::optional GetPreferredLineEntry() { -return m_preferred_line_entry; - } - protected: friend class BreakpointSite; friend class BreakpointLocationList; @@ -327,16 +306,6 @@ class BreakpointLocation /// If it returns false we should continue, otherwise stop. bool IgnoreCountShouldStop(); - /// If this location knows that the virtual stack frame it represents is - /// not frame 0, return the suggested stack frame instead. This will happen - /// when the location's address contains a "virtual inlined call stack" and - /// the breakpoint was set on a file & line that are not at the bottom of that - /// stack. For now we key off the "preferred line entry" - looking for that - /// in the blocks that start with the stop PC. - /// This version of the API doesn't take an "inlined" parameter because it - /// only changes frames in the inline stack. - std::optional GetSuggestedStackFrameIndex(); - private: void SwapLocation(lldb::BreakpointLocationSP swap_from); @@ -400,11 +369,6 @@ class BreakpointLocation lldb::break_id_t m_loc_id; ///< Breakpoint location ID. StoppointHitCounter m_hit_counter; ///< Number of times this breakpoint /// location has been hit. - /// If this exists, use it to print the stop description rather than the - /// LineEntry m_address resolves to directly. Use this for instance when the - /// location was given somewhere in the virtual inlined call stack since the - /// Address always resolves to the lowest entry in the stack. - std::optional m_preferred_line_entry; void SetShouldResolveIndirectFunctions(bool do_resolve) { m_should_res
[Lldb-commits] [lldb] b54bc10 - Revert "Add the ability to break on call-site locations, improve inli… (#113947)
Author: jimingham Date: 2024-10-28T11:52:32-07:00 New Revision: b54bc104ea87e301816b450ee117d2d864c7d82d URL: https://github.com/llvm/llvm-project/commit/b54bc104ea87e301816b450ee117d2d864c7d82d DIFF: https://github.com/llvm/llvm-project/commit/b54bc104ea87e301816b450ee117d2d864c7d82d.diff LOG: Revert "Add the ability to break on call-site locations, improve inli… (#113947) …ne stepping (#112939)" This was breaking some gdb-remote packet counting tests on the bots. I can't see how this patch could cause that breakage, but I'm reverting to figure that out. This reverts commit f14743794587db102c6d1b20f9c87a1ac20decfd. Added: Modified: lldb/include/lldb/Breakpoint/BreakpointLocation.h lldb/include/lldb/Breakpoint/BreakpointSite.h lldb/include/lldb/Core/Declaration.h lldb/include/lldb/Target/StopInfo.h lldb/include/lldb/Target/ThreadPlanStepInRange.h lldb/source/Breakpoint/BreakpointLocation.cpp lldb/source/Breakpoint/BreakpointResolver.cpp lldb/source/Breakpoint/BreakpointSite.cpp lldb/source/Core/Declaration.cpp lldb/source/Symbol/Block.cpp lldb/source/Symbol/CompileUnit.cpp lldb/source/Target/StackFrameList.cpp lldb/source/Target/StopInfo.cpp lldb/source/Target/Thread.cpp lldb/source/Target/ThreadPlanStepInRange.cpp lldb/source/Target/ThreadPlanStepOverRange.cpp lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py lldb/test/API/functionalities/inline-stepping/calling.cpp Removed: diff --git a/lldb/include/lldb/Breakpoint/BreakpointLocation.h b/lldb/include/lldb/Breakpoint/BreakpointLocation.h index 3592291bb2d06e..cca00335bc3c67 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointLocation.h +++ b/lldb/include/lldb/Breakpoint/BreakpointLocation.h @@ -11,12 +11,10 @@ #include #include -#include #include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Breakpoint/StoppointHitCounter.h" #include "lldb/Core/Address.h" -#include "lldb/Symbol/LineEntry.h" #include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" @@ -284,25 +282,6 @@ class BreakpointLocation /// Returns the breakpoint location ID. lldb::break_id_t GetID() const { return m_loc_id; } - /// Set the line entry that should be shown to users for this location. - /// It is up to the caller to verify that this is a valid entry to show. - /// The current use of this is to distinguish among line entries from a - /// virtual inlined call stack that all share the same address. - /// The line entry must have the same start address as the address for this - /// location. - bool SetPreferredLineEntry(const LineEntry &line_entry) { -if (m_address == line_entry.range.GetBaseAddress()) { - m_preferred_line_entry = line_entry; - return true; -} -assert(0 && "Tried to set a preferred line entry with a diff erent address"); -return false; - } - - const std::optional GetPreferredLineEntry() { -return m_preferred_line_entry; - } - protected: friend class BreakpointSite; friend class BreakpointLocationList; @@ -327,16 +306,6 @@ class BreakpointLocation /// If it returns false we should continue, otherwise stop. bool IgnoreCountShouldStop(); - /// If this location knows that the virtual stack frame it represents is - /// not frame 0, return the suggested stack frame instead. This will happen - /// when the location's address contains a "virtual inlined call stack" and - /// the breakpoint was set on a file & line that are not at the bottom of that - /// stack. For now we key off the "preferred line entry" - looking for that - /// in the blocks that start with the stop PC. - /// This version of the API doesn't take an "inlined" parameter because it - /// only changes frames in the inline stack. - std::optional GetSuggestedStackFrameIndex(); - private: void SwapLocation(lldb::BreakpointLocationSP swap_from); @@ -400,11 +369,6 @@ class BreakpointLocation lldb::break_id_t m_loc_id; ///< Breakpoint location ID. StoppointHitCounter m_hit_counter; ///< Number of times this breakpoint /// location has been hit. - /// If this exists, use it to print the stop description rather than the - /// LineEntry m_address resolves to directly. Use this for instance when the - /// location was given somewhere in the virtual inlined call stack since the - /// Address always resolves to the lowest entry in the stack. - std::optional m_preferred_line_entry; void SetShouldResolveIndirectFunctions(bool do_resolve) { m_should_resolve_indirect_functions = do_resolve; diff --git a/lldb/include/lldb/Breakpoint/BreakpointSite.h b/lldb/include/lldb/Breakpoint/BreakpointSite.h index 7b3f7be23639f2..17b76d51c1ae53 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointSite.h +++ b/lldb/include/lldb/Breakpoint/BreakpointSite.h @@ -170,11 +170,6 @@ c
[Lldb-commits] [lldb] Revert "Add the ability to break on call-site locations, improve inli… (PR #113947)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: None (jimingham) Changes …ne stepping (#112939)" This was breaking some gdb-remote packet counting tests on the bots. I can't see how this patch could cause that breakage, but I'm reverting to figure that out. This reverts commit f14743794587db102c6d1b20f9c87a1ac20decfd. --- Patch is 40.91 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/113947.diff 18 Files Affected: - (modified) lldb/include/lldb/Breakpoint/BreakpointLocation.h (-36) - (modified) lldb/include/lldb/Breakpoint/BreakpointSite.h (-5) - (modified) lldb/include/lldb/Core/Declaration.h (+1-5) - (modified) lldb/include/lldb/Target/StopInfo.h (-12) - (modified) lldb/include/lldb/Target/ThreadPlanStepInRange.h (+2-2) - (modified) lldb/source/Breakpoint/BreakpointLocation.cpp (+2-61) - (modified) lldb/source/Breakpoint/BreakpointResolver.cpp (-15) - (modified) lldb/source/Breakpoint/BreakpointSite.cpp (-17) - (modified) lldb/source/Core/Declaration.cpp (+2-3) - (modified) lldb/source/Symbol/Block.cpp (+1-1) - (modified) lldb/source/Symbol/CompileUnit.cpp (+1-110) - (modified) lldb/source/Target/StackFrameList.cpp (+115-56) - (modified) lldb/source/Target/StopInfo.cpp (-55) - (modified) lldb/source/Target/Thread.cpp (-8) - (modified) lldb/source/Target/ThreadPlanStepInRange.cpp (+6-18) - (modified) lldb/source/Target/ThreadPlanStepOverRange.cpp (+1-1) - (modified) lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py (-63) - (modified) lldb/test/API/functionalities/inline-stepping/calling.cpp (-25) ``diff diff --git a/lldb/include/lldb/Breakpoint/BreakpointLocation.h b/lldb/include/lldb/Breakpoint/BreakpointLocation.h index 3592291bb2d06e..cca00335bc3c67 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointLocation.h +++ b/lldb/include/lldb/Breakpoint/BreakpointLocation.h @@ -11,12 +11,10 @@ #include #include -#include #include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Breakpoint/StoppointHitCounter.h" #include "lldb/Core/Address.h" -#include "lldb/Symbol/LineEntry.h" #include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" @@ -284,25 +282,6 @@ class BreakpointLocation /// Returns the breakpoint location ID. lldb::break_id_t GetID() const { return m_loc_id; } - /// Set the line entry that should be shown to users for this location. - /// It is up to the caller to verify that this is a valid entry to show. - /// The current use of this is to distinguish among line entries from a - /// virtual inlined call stack that all share the same address. - /// The line entry must have the same start address as the address for this - /// location. - bool SetPreferredLineEntry(const LineEntry &line_entry) { -if (m_address == line_entry.range.GetBaseAddress()) { - m_preferred_line_entry = line_entry; - return true; -} -assert(0 && "Tried to set a preferred line entry with a different address"); -return false; - } - - const std::optional GetPreferredLineEntry() { -return m_preferred_line_entry; - } - protected: friend class BreakpointSite; friend class BreakpointLocationList; @@ -327,16 +306,6 @@ class BreakpointLocation /// If it returns false we should continue, otherwise stop. bool IgnoreCountShouldStop(); - /// If this location knows that the virtual stack frame it represents is - /// not frame 0, return the suggested stack frame instead. This will happen - /// when the location's address contains a "virtual inlined call stack" and - /// the breakpoint was set on a file & line that are not at the bottom of that - /// stack. For now we key off the "preferred line entry" - looking for that - /// in the blocks that start with the stop PC. - /// This version of the API doesn't take an "inlined" parameter because it - /// only changes frames in the inline stack. - std::optional GetSuggestedStackFrameIndex(); - private: void SwapLocation(lldb::BreakpointLocationSP swap_from); @@ -400,11 +369,6 @@ class BreakpointLocation lldb::break_id_t m_loc_id; ///< Breakpoint location ID. StoppointHitCounter m_hit_counter; ///< Number of times this breakpoint /// location has been hit. - /// If this exists, use it to print the stop description rather than the - /// LineEntry m_address resolves to directly. Use this for instance when the - /// location was given somewhere in the virtual inlined call stack since the - /// Address always resolves to the lowest entry in the stack. - std::optional m_preferred_line_entry; void SetShouldResolveIndirectFunctions(bool do_resolve) { m_should_resolve_indirect_functions = do_resolve; diff --git a/lldb/include/lldb/Breakpoint/BreakpointSite.h b/lldb/include/lldb/Breakpoint/BreakpointSite.h index 7b3f7be23639f2..17b76d51c1ae53 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointSite.h +++ b/lldb/include/lldb/Breakpoint
[Lldb-commits] [lldb] [lldb-dap] Always pass disableASLR to the DAP executable (PR #113891)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/113891 >From 5da7c345986693a4156ccc2f3ea6de3877e4330d Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Mon, 28 Oct 2024 17:07:38 + Subject: [PATCH] [lldb-dap] Always pass disableASLR to the DAP executable More context can be found in https://github.com/llvm/llvm-project/pull/110303 For DAP tests running in constrained environments (e.g., Docker containers), disabling ASLR isn't allowed. So we set `disableASLR=False` (since https://github.com/llvm/llvm-project/pull/113593). However, the `dap_server.py` will currently only forward the value of `disableASLR` to the DAP executable if it's set to `True`. If the DAP executable wasn't provided a `disableASLR` field it defaults to `true` too (https://github.com/llvm/llvm-project/blob/f14743794587db102c6d1b20f9c87a1ac20decfd/lldb/tools/lldb-dap/lldb-dap.cpp#L2103-L2104). This means that passing `disableASLR=False` from the tests is currently not possible. This is also true for many of the other boolean arguments of `request_launch`. But this patch only addresses `disableASLR` for now since it's blocking a libc++ patch. --- .../Python/lldbsuite/test/tools/lldb-dap/dap_server.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 63748a71f1122d..c29992ce9c7848 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 @@ -793,8 +793,6 @@ def request_launch( args_dict["env"] = env if stopOnEntry: args_dict["stopOnEntry"] = stopOnEntry -if disableASLR: -args_dict["disableASLR"] = disableASLR if disableSTDIO: args_dict["disableSTDIO"] = disableSTDIO if shellExpandArguments: @@ -829,6 +827,7 @@ def request_launch( if customThreadFormat: args_dict["customThreadFormat"] = customThreadFormat +args_dict["disableASLR"] = disableASLR args_dict["enableAutoVariableSummaries"] = enableAutoVariableSummaries args_dict["enableSyntheticChildDebugging"] = enableSyntheticChildDebugging args_dict["displayExtendedBacktrace"] = displayExtendedBacktrace ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Revert "Add the ability to break on call-site locations, improve inli… (PR #113947)
https://github.com/jimingham closed https://github.com/llvm/llvm-project/pull/113947 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
@@ -78,7 +78,7 @@ class DWARFDebugLine { /// The maximum number of individual operations that may be encoded in an /// instruction. uint8_t MaxOpsPerInst; -/// The initial value of theis_stmtregister. +/// The initial value of the is_stmt register. dwblaikie wrote: Could you commit this unrelated change separately (doesn't need precommit review/a PR, can be pushed directly if you have commit access) https://github.com/llvm/llvm-project/pull/113787 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [DO NOT MERGE] Test libc++ CI LLDB DAP failures (PR #113891)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/113891 >From 0c676a6001ac38cab2eacb54a6cce57df178007a Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Mon, 28 Oct 2024 10:07:36 + Subject: [PATCH 1/2] [DO-NOT-MERGE] libc++ CI change for testing --- .github/workflows/libcxx-build-and-test.yaml | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml index 184fed2268e818..3521b5d5a3def4 100644 --- a/.github/workflows/libcxx-build-and-test.yaml +++ b/.github/workflows/libcxx-build-and-test.yaml @@ -49,7 +49,8 @@ env: jobs: stage1: if: github.repository_owner == 'llvm' -runs-on: libcxx-runners-8-set +runs-on: libcxx-runners-set +container: ghcr.io/libcxx/actions-builder:testing-2024-09-21 continue-on-error: false strategy: fail-fast: false @@ -84,7 +85,8 @@ jobs: **/crash_diagnostics/* stage2: if: github.repository_owner == 'llvm' -runs-on: libcxx-runners-8-set +runs-on: libcxx-runners-set +container: ghcr.io/libcxx/actions-builder:testing-2024-09-21 needs: [ stage1 ] continue-on-error: false strategy: @@ -160,20 +162,21 @@ jobs: 'benchmarks', 'bootstrapping-build' ] -machine: [ 'libcxx-runners-8-set' ] +machine: [ 'libcxx-runners-set' ] include: - config: 'generic-cxx26' - machine: libcxx-runners-8-set + machine: libcxx-runners-set - config: 'generic-asan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set - config: 'generic-tsan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set - config: 'generic-ubsan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set # Use a larger machine for MSAN to avoid timeout and memory allocation issues. - config: 'generic-msan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set runs-on: ${{ matrix.machine }} +container: ghcr.io/libcxx/actions-builder:testing-2024-09-21 steps: - uses: actions/checkout@v4 - name: ${{ matrix.config }} >From e83559222d0edcf01e2401ee45948aba2eba9032 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Mon, 28 Oct 2024 17:07:38 + Subject: [PATCH 2/2] [lldb-dap] Always pass disableASLR to the DAP executable More context can be found in https://github.com/llvm/llvm-project/pull/110303 For DAP tests running in constrained environments (e.g., Docker containers), disabling ASLR isn't allowed. So we set `disableASLR=False` (since https://github.com/llvm/llvm-project/pull/113593). However, the `dap_server.py` will currently only forward the value of `disableASLR` to the DAP executable if it's set to `True`. If the DAP executable wasn't provided a `disableASLR` field it defaults to `true` too (https://github.com/llvm/llvm-project/blob/f14743794587db102c6d1b20f9c87a1ac20decfd/lldb/tools/lldb-dap/lldb-dap.cpp#L2103-L2104). This means that passing `disableASLR=False` from the tests is currently not possible. This is also true for many of the other boolean arguments of `request_launch`. But this patch only addresses `disableASLR` for now since it's blocking a libc++ patch. --- .../Python/lldbsuite/test/tools/lldb-dap/dap_server.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 63748a71f1122d..c29992ce9c7848 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 @@ -793,8 +793,6 @@ def request_launch( args_dict["env"] = env if stopOnEntry: args_dict["stopOnEntry"] = stopOnEntry -if disableASLR: -args_dict["disableASLR"] = disableASLR if disableSTDIO: args_dict["disableSTDIO"] = disableSTDIO if shellExpandArguments: @@ -829,6 +827,7 @@ def request_launch( if customThreadFormat: args_dict["customThreadFormat"] = customThreadFormat +args_dict["disableASLR"] = disableASLR args_dict["enableAutoVariableSummaries"] = enableAutoVariableSummaries args_dict["enableSyntheticChildDebugging"] = enableSyntheticChildDebugging args_dict["displayExtendedBacktrace"] = displayExtendedBacktrace ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [DO NOT MERGE] Test libc++ CI LLDB DAP failures (PR #113891)
https://github.com/Michael137 ready_for_review https://github.com/llvm/llvm-project/pull/113891 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [DO NOT MERGE] Test libc++ CI LLDB DAP failures (PR #113891)
llvmbot wrote: @llvm/pr-subscribers-lldb @llvm/pr-subscribers-libcxx Author: Michael Buch (Michael137) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/113891.diff 2 Files Affected: - (modified) .github/workflows/libcxx-build-and-test.yaml (+11-8) - (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py (+1-2) ``diff diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml index 184fed2268e818..3521b5d5a3def4 100644 --- a/.github/workflows/libcxx-build-and-test.yaml +++ b/.github/workflows/libcxx-build-and-test.yaml @@ -49,7 +49,8 @@ env: jobs: stage1: if: github.repository_owner == 'llvm' -runs-on: libcxx-runners-8-set +runs-on: libcxx-runners-set +container: ghcr.io/libcxx/actions-builder:testing-2024-09-21 continue-on-error: false strategy: fail-fast: false @@ -84,7 +85,8 @@ jobs: **/crash_diagnostics/* stage2: if: github.repository_owner == 'llvm' -runs-on: libcxx-runners-8-set +runs-on: libcxx-runners-set +container: ghcr.io/libcxx/actions-builder:testing-2024-09-21 needs: [ stage1 ] continue-on-error: false strategy: @@ -160,20 +162,21 @@ jobs: 'benchmarks', 'bootstrapping-build' ] -machine: [ 'libcxx-runners-8-set' ] +machine: [ 'libcxx-runners-set' ] include: - config: 'generic-cxx26' - machine: libcxx-runners-8-set + machine: libcxx-runners-set - config: 'generic-asan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set - config: 'generic-tsan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set - config: 'generic-ubsan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set # Use a larger machine for MSAN to avoid timeout and memory allocation issues. - config: 'generic-msan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set runs-on: ${{ matrix.machine }} +container: ghcr.io/libcxx/actions-builder:testing-2024-09-21 steps: - uses: actions/checkout@v4 - name: ${{ matrix.config }} 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 63748a71f1122d..c29992ce9c7848 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 @@ -793,8 +793,6 @@ def request_launch( args_dict["env"] = env if stopOnEntry: args_dict["stopOnEntry"] = stopOnEntry -if disableASLR: -args_dict["disableASLR"] = disableASLR if disableSTDIO: args_dict["disableSTDIO"] = disableSTDIO if shellExpandArguments: @@ -829,6 +827,7 @@ def request_launch( if customThreadFormat: args_dict["customThreadFormat"] = customThreadFormat +args_dict["disableASLR"] = disableASLR args_dict["enableAutoVariableSummaries"] = enableAutoVariableSummaries args_dict["enableSyntheticChildDebugging"] = enableSyntheticChildDebugging args_dict["displayExtendedBacktrace"] = displayExtendedBacktrace `` https://github.com/llvm/llvm-project/pull/113891 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Always pass disableASLR to the DAP executable (PR #113891)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/113891 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Always pass disableASLR to the DAP executable (PR #113891)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/113891 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Always pass disableASLR to the DAP executable (PR #113891)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/113891 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Always pass disableASLR to the DAP executable (PR #113891)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/113891 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Always pass disableASLR to the DAP executable (PR #113891)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/113891 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
@@ -910,6 +911,183 @@ void request_attach(const llvm::json::Object &request) { } } +// "BreakpointLocationsRequest": { +// "allOf": [ { "$ref": "#/definitions/Request" }, { +// "type": "object", +// "description": "The `breakpointLocations` request returns all possible +// locations for source breakpoints in a given range.\nClients should only +// call this request if the corresponding capability +// `supportsBreakpointLocationsRequest` is true.", +// "properties": { +// "command": { +// "type": "string", +// "enum": [ "breakpointLocations" ] +// }, +// "arguments": { +// "$ref": "#/definitions/BreakpointLocationsArguments" +// } +// }, +// "required": [ "command" ] +// }] +// }, +// "BreakpointLocationsArguments": { +// "type": "object", +// "description": "Arguments for `breakpointLocations` request.", +// "properties": { +// "source": { +// "$ref": "#/definitions/Source", +// "description": "The source location of the breakpoints; either +// `source.path` or `source.sourceReference` must be specified." +// }, +// "line": { +// "type": "integer", +// "description": "Start line of range to search possible breakpoint +// locations in. If only the line is specified, the request returns all +// possible locations in that line." +// }, +// "column": { +// "type": "integer", +// "description": "Start position within `line` to search possible +// breakpoint locations in. It is measured in UTF-16 code units and the +// client capability `columnsStartAt1` determines whether it is 0- or +// 1-based. If no column is given, the first position in the start line is +// assumed." +// }, +// "endLine": { +// "type": "integer", +// "description": "End line of range to search possible breakpoint +// locations in. If no end line is given, then the end line is assumed to +// be the start line." +// }, +// "endColumn": { +// "type": "integer", +// "description": "End position within `endLine` to search possible +// breakpoint locations in. It is measured in UTF-16 code units and the +// client capability `columnsStartAt1` determines whether it is 0- or +// 1-based. If no end column is given, the last position in the end line +// is assumed." +// } +// }, +// "required": [ "source", "line" ] +// }, +// "BreakpointLocationsResponse": { +// "allOf": [ { "$ref": "#/definitions/Response" }, { +// "type": "object", +// "description": "Response to `breakpointLocations` request.\nContains +// possible locations for source breakpoints.", +// "properties": { +// "body": { +// "type": "object", +// "properties": { +// "breakpoints": { +// "type": "array", +// "items": { +// "$ref": "#/definitions/BreakpointLocation" +// }, +// "description": "Sorted set of possible breakpoint locations." +// } +// }, +// "required": [ "breakpoints" ] +// } +// }, +// "required": [ "body" ] +// }] +// }, +// "BreakpointLocation": { +// "type": "object", +// "description": "Properties of a breakpoint location returned from the +// `breakpointLocations` request.", +// "properties": { +// "line": { +// "type": "integer", +// "description": "Start line of breakpoint location." +// }, +// "column": { +// "type": "integer", +// "description": "The start position of a breakpoint location. Position +// is measured in UTF-16 code units and the client capability +// `columnsStartAt1` determines whether it is 0- or 1-based." +// }, +// "endLine": { +// "type": "integer", +// "description": "The end line of breakpoint location if the location +// covers a range." +// }, +// "endColumn": { +// "type": "integer", +// "description": "The end position of a breakpoint location (if the +// location covers a range). Position is measured in UTF-16 code units and +// the client capability `columnsStartAt1` determines whether it is 0- or +// 1-based." +// } +// }, +// "required": [ "line" ] +// }, +void request_breakpointLocations(const llvm::json::Object &request) { vogelsgesang wrote: VSCode makes this request after setting a normal line-breakpoint. In particular, it does not send this request on hovers. As such, we should be fine as long as the performance of this call is in the same ball park as the performance of the `SetBreakpoint` call itself. The high-level algorithm in this PR should be fine, given that the `SetBreakpoint` itself also iterates the list in a very similar way (see `LineTable::FindLineEntryIndexByFileIndexImpl`. The implementation of that algorithm might be s
[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `lldb-arm-ubuntu` running on `linaro-lldb-arm-ubuntu` while building `lldb` at step 6 "test". Full details are available at: https://lab.llvm.org/buildbot/#/builders/18/builds/6021 Here is the relevant piece of the build log for the reference ``` Step 6 (test) failure: build (failure) ... PASS: lldb-api :: functionalities/gdb_remote_client/TestAArch64XMLRegOffsets.py (448 of 2820) PASS: lldb-api :: functionalities/float-display/TestFloatDisplay.py (449 of 2820) PASS: lldb-api :: functionalities/gdb_remote_client/TestArmRegisterDefinition.py (450 of 2820) PASS: lldb-api :: functionalities/fork/resumes-child/TestForkResumesChild.py (451 of 2820) PASS: lldb-api :: functionalities/gdb_remote_client/TestContinue.py (452 of 2820) PASS: lldb-api :: functionalities/gdb_remote_client/TestDynamicLoaderDarwin.py (453 of 2820) PASS: lldb-api :: functionalities/gdb_remote_client/TestFork.py (454 of 2820) PASS: lldb-api :: functionalities/gdb_remote_client/TestAArch64XMLRegistersSVEOnly.py (455 of 2820) PASS: lldb-api :: functionalities/gdb_remote_client/TestGDBRemoteDiskFileCompletion.py (456 of 2820) PASS: lldb-api :: functionalities/gdb_remote_client/TestGDBRemoteLoad.py (457 of 2820) FAIL: lldb-api :: functionalities/gdb_remote_client/TestGDBRemoteClient.py (458 of 2820) TEST 'lldb-api :: functionalities/gdb_remote_client/TestGDBRemoteClient.py' FAILED Script: -- /usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --arch armv8l --build-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/dsymutil --make /usr/bin/make --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/functionalities/gdb_remote_client -p TestGDBRemoteClient.py -- Exit Code: 1 Command Output (stdout): -- lldb version 20.0.0git (https://github.com/llvm/llvm-project.git revision f14743794587db102c6d1b20f9c87a1ac20decfd) clang revision f14743794587db102c6d1b20f9c87a1ac20decfd llvm revision f14743794587db102c6d1b20f9c87a1ac20decfd Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc'] -- Command Output (stderr): -- PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_attach_fail (TestGDBRemoteClient.TestGDBRemoteClient) PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_connect (TestGDBRemoteClient.TestGDBRemoteClient) PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_detach_no_multiprocess (TestGDBRemoteClient.TestGDBRemoteClient) PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_detach_pid (TestGDBRemoteClient.TestGDBRemoteClient) PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_launch_A (TestGDBRemoteClient.TestGDBRemoteClient) PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_launch_QEnvironment (TestGDBRemoteClient.TestGDBRemoteClient) PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_launch_QEnvironmentHexEncoded_only (TestGDBRemoteClient.TestGDBRemoteClient) PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_launch_fail (TestGDBRemoteClient.TestGDBRemoteClient) PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_launch_rich_error (TestGDBRemoteClient.TestGDBRemoteClient) PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_launch_vRun (TestGDBRemoteClient.TestGDBRemoteClient) FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_read_registers_using_g_packets (TestGDBRemoteClient.TestGDBRemoteClient) PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_read_registers_using_p_packets (TestGDBRemoteClient.TestGDBRemoteClient) PASS: LLDB (/home/tcwg-buildb
[Lldb-commits] [lldb] [lldb][test] Skip libc++ tests if it is linked statically (PR #113935)
https://github.com/dzhidzhoev updated https://github.com/llvm/llvm-project/pull/113935 >From 9186c689391a96b09f947e6799d205054cf199ab Mon Sep 17 00:00:00 2001 From: Vladislav Dzhidzhoev Date: Mon, 28 Oct 2024 16:46:39 +0100 Subject: [PATCH 1/3] Revert "[lldb][test] Skip Test*FromStdModule tests on Linux for now (#112530)" This reverts commit 87f126243beb69b8b02e5cd4df762bc8a6f1f8cc. --- .../expression/import-std-module/array/TestArrayFromStdModule.py | 1 - .../TestDbgInfoContentVectorFromStdModule.py | 1 - .../vector-of-vectors/TestVectorOfVectorsFromStdModule.py| 1 - 3 files changed, 3 deletions(-) diff --git a/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py index bafc7628296217..13ab6b0c9ac1fb 100644 --- a/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py @@ -10,7 +10,6 @@ class TestCase(TestBase): @add_test_categories(["libc++"]) @skipIf(compiler=no_match("clang")) -@skipIfLinux # https://discourse.llvm.org/t/lldb-test-failures-on-linux/80095 def test(self): self.build() diff --git a/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py index 71eaeef20e792d..1c3e64f14c 100644 --- a/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py @@ -14,7 +14,6 @@ class TestDbgInfoContentVector(TestBase): @skipIf(compiler="clang", compiler_version=["<", "12.0"]) @skipIf(macos_version=["<", "14.0"]) @skipIfDarwin # https://github.com/llvm/llvm-project/issues/106475 -@skipIfLinux # https://discourse.llvm.org/t/lldb-test-failures-on-linux/80095 def test(self): self.build() diff --git a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py index e9415fd53651f7..a1f33271f39d2f 100644 --- a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py @@ -10,7 +10,6 @@ class TestVectorOfVectors(TestBase): @add_test_categories(["libc++"]) @skipIf(compiler=no_match("clang")) -@skipIfLinux # https://discourse.llvm.org/t/lldb-test-failures-on-linux/80095 def test(self): self.build() >From 77b2ad3e3975ed5b4e0f23efd64999abc92175e7 Mon Sep 17 00:00:00 2001 From: Vladislav Dzhidzhoev Date: Wed, 16 Oct 2024 17:29:07 +0200 Subject: [PATCH 2/3] [lldb][test] Skip libc++ tests if it is linked statically. Some tests from 'import-std-module' used to fail on the builder https://lab.llvm.org/staging/#/builders/195/builds/4470, since libcxx is set up to be linked statically with the binary on it. Thus, they were temporarily disabled in #112530. Here, this commit is reverted. When libcxx is linked with a program as an archive of static libraries, functions that aren't used in the program are omitted. Then, jitted expressions from the tests try calling several functions that aren't present in the process image, which causes the failure. LLD (and GNU ld AFAIK) links a binary with libcxx shared library if libc++.so is present in corresponding library search paths. Otherwise, it tries static linking. Here, a linker flag is added to a clang call in libcxx configuration, that ensures that libc++.so is present and found by linker. Forcing linker to keep all functions from libcxx archive in this way #98701, without checking whether libcxx is linked statically looks like a less clean solution, but I'm not sure about that. --- lldb/packages/Python/lldbsuite/test/dotest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index 681ea1638f2d6f..46673a9886c57e 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -776,7 +776,7 @@ def canRunLibcxxTests(): if platform == "linux": with tempfile.NamedTemporaryFile() as f: -cmd = [configuration.compiler, "-xc++", "-stdlib=libc++", "-o", f.name, "-"] +cmd = [configuration.compiler, "-xc++", "-stdlib=libc++", "-l:libc++.so", "-o", f.name, "-"] p = subprocess.Popen( cmd, st
[Lldb-commits] [lldb] f147437 - Add the ability to break on call-site locations, improve inline stepping (#112939)
Author: jimingham Date: 2024-10-28T10:01:57-07:00 New Revision: f14743794587db102c6d1b20f9c87a1ac20decfd URL: https://github.com/llvm/llvm-project/commit/f14743794587db102c6d1b20f9c87a1ac20decfd DIFF: https://github.com/llvm/llvm-project/commit/f14743794587db102c6d1b20f9c87a1ac20decfd.diff LOG: Add the ability to break on call-site locations, improve inline stepping (#112939) Previously lldb didn't support setting breakpoints on call site locations. This patch adds that ability. It would be very slow if we did this by searching all the debug information for every inlined subroutine record looking for a call-site match, so I added one restriction to the call-site support. This change will find all call sites for functions that also supply at least one line to the regular line table. That way we can use the fact that the line table search will move the location to that subsequent line (but only within the same function). When we find an actually moved source line match, we can search in the function that contained that line table entry for the call-site, and set the breakpoint location back to that. When I started writing tests for this new ability, it quickly became obvious that our support for virtual inline stepping was pretty buggy. We didn't print the right file & line number for the breakpoint, and we didn't set the position in the "virtual inlined stack" correctly when we hit the breakpoint. We also didn't step through the inlined frames correctly. There was code to try to detect the right inlined stack position, but it had been refactored a while back with the comment that it was super confusing and the refactor was supposed to make it clearer, but the refactor didn't work either. That code was made much clearer by abstracting the job of "handling the stack readjustment" to the various StopInfo's. Previously, there was a big (and buggy) switch over stop info's. Moving the responsibility to the stop info made this code much easier to reason about. We also had no tests for virtual inlined stepping (our inlined stepping test was actually written specifically to avoid the formation of a virtual inlined stack... So I also added tests for that along with the tests for setting the call-site breakpoints. Added: Modified: lldb/include/lldb/Breakpoint/BreakpointLocation.h lldb/include/lldb/Breakpoint/BreakpointSite.h lldb/include/lldb/Core/Declaration.h lldb/include/lldb/Target/StopInfo.h lldb/include/lldb/Target/ThreadPlanStepInRange.h lldb/source/Breakpoint/BreakpointLocation.cpp lldb/source/Breakpoint/BreakpointResolver.cpp lldb/source/Breakpoint/BreakpointSite.cpp lldb/source/Core/Declaration.cpp lldb/source/Symbol/Block.cpp lldb/source/Symbol/CompileUnit.cpp lldb/source/Target/StackFrameList.cpp lldb/source/Target/StopInfo.cpp lldb/source/Target/Thread.cpp lldb/source/Target/ThreadPlanStepInRange.cpp lldb/source/Target/ThreadPlanStepOverRange.cpp lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py lldb/test/API/functionalities/inline-stepping/calling.cpp Removed: diff --git a/lldb/include/lldb/Breakpoint/BreakpointLocation.h b/lldb/include/lldb/Breakpoint/BreakpointLocation.h index cca00335bc3c67..3592291bb2d06e 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointLocation.h +++ b/lldb/include/lldb/Breakpoint/BreakpointLocation.h @@ -11,10 +11,12 @@ #include #include +#include #include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Breakpoint/StoppointHitCounter.h" #include "lldb/Core/Address.h" +#include "lldb/Symbol/LineEntry.h" #include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" @@ -282,6 +284,25 @@ class BreakpointLocation /// Returns the breakpoint location ID. lldb::break_id_t GetID() const { return m_loc_id; } + /// Set the line entry that should be shown to users for this location. + /// It is up to the caller to verify that this is a valid entry to show. + /// The current use of this is to distinguish among line entries from a + /// virtual inlined call stack that all share the same address. + /// The line entry must have the same start address as the address for this + /// location. + bool SetPreferredLineEntry(const LineEntry &line_entry) { +if (m_address == line_entry.range.GetBaseAddress()) { + m_preferred_line_entry = line_entry; + return true; +} +assert(0 && "Tried to set a preferred line entry with a diff erent address"); +return false; + } + + const std::optional GetPreferredLineEntry() { +return m_preferred_line_entry; + } + protected: friend class BreakpointSite; friend class BreakpointLocationList; @@ -306,6 +327,16 @@ class BreakpointLocation /// If it returns false we should continue, otherwise stop. bool IgnoreCountShouldStop(); + /// If this location knows that the virtual stack frame it
[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)
https://github.com/jimingham closed https://github.com/llvm/llvm-project/pull/112939 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Skip libc++ tests if it is linked statically (PR #113935)
https://github.com/dzhidzhoev edited https://github.com/llvm/llvm-project/pull/113935 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Skip libc++ tests if it is linked statically (PR #113935)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Vladislav Dzhidzhoev (dzhidzhoev) Changes Some tests from 'import-std-module' used to fail on the builder https://lab.llvm.org/staging/#/builders/195/builds/4470, since libcxx is set up to be linked statically with the binary on it. Thus, they were temporarily disabled in https://github.com/llvm/llvm-project/pull/112530. Here, this commit is reverted. When libcxx is linked with a program as an archive of static libraries, functions that aren't used in the program are omitted. Then, jitted expressions from the tests try calling several functions that aren't present in the process image, which causes the failure. LLD (and GNU ld AFAIK) links a binary with libcxx shared library if libc++.so is present in corresponding library search paths. Otherwise, it tries static linking. Here, a linker flag is added to a clang call in libcxx configuration, which ensures that libc++.so is present and found by linker. Forcing linker to keep all functions from libcxx archive in this way https://github.com/llvm/llvm-project/pull/98701, without checking whether libcxx is linked statically looks like a less clean solution, but I'm not sure about that. --- Full diff: https://github.com/llvm/llvm-project/pull/113935.diff 4 Files Affected: - (modified) lldb/packages/Python/lldbsuite/test/dotest.py (+1-1) - (modified) lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py (-1) - (modified) lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py (-1) - (modified) lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py (-1) ``diff diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index 681ea1638f2d6f..46673a9886c57e 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -776,7 +776,7 @@ def canRunLibcxxTests(): if platform == "linux": with tempfile.NamedTemporaryFile() as f: -cmd = [configuration.compiler, "-xc++", "-stdlib=libc++", "-o", f.name, "-"] +cmd = [configuration.compiler, "-xc++", "-stdlib=libc++", "-l:libc++.so", "-o", f.name, "-"] p = subprocess.Popen( cmd, stdin=subprocess.PIPE, diff --git a/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py index bafc7628296217..13ab6b0c9ac1fb 100644 --- a/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py @@ -10,7 +10,6 @@ class TestCase(TestBase): @add_test_categories(["libc++"]) @skipIf(compiler=no_match("clang")) -@skipIfLinux # https://discourse.llvm.org/t/lldb-test-failures-on-linux/80095 def test(self): self.build() diff --git a/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py index 71eaeef20e792d..1c3e64f14c 100644 --- a/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py @@ -14,7 +14,6 @@ class TestDbgInfoContentVector(TestBase): @skipIf(compiler="clang", compiler_version=["<", "12.0"]) @skipIf(macos_version=["<", "14.0"]) @skipIfDarwin # https://github.com/llvm/llvm-project/issues/106475 -@skipIfLinux # https://discourse.llvm.org/t/lldb-test-failures-on-linux/80095 def test(self): self.build() diff --git a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py index e9415fd53651f7..a1f33271f39d2f 100644 --- a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py @@ -10,7 +10,6 @@ class TestVectorOfVectors(TestBase): @add_test_categories(["libc++"]) @skipIf(compiler=no_match("clang")) -@skipIfLinux # https://discourse.llvm.org/t/lldb-test-failures-on-linux/80095 def test(self): self.build() `` https://github.com/llvm/llvm-project/pull/113935 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-co
[Lldb-commits] [lldb] [lldb][test] Skip libc++ tests if it is linked statically (PR #113935)
https://github.com/dzhidzhoev edited https://github.com/llvm/llvm-project/pull/113935 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
@@ -910,6 +911,183 @@ void request_attach(const llvm::json::Object &request) { } } +// "BreakpointLocationsRequest": { +// "allOf": [ { "$ref": "#/definitions/Request" }, { +// "type": "object", +// "description": "The `breakpointLocations` request returns all possible +// locations for source breakpoints in a given range.\nClients should only +// call this request if the corresponding capability +// `supportsBreakpointLocationsRequest` is true.", +// "properties": { +// "command": { +// "type": "string", +// "enum": [ "breakpointLocations" ] +// }, +// "arguments": { +// "$ref": "#/definitions/BreakpointLocationsArguments" +// } +// }, +// "required": [ "command" ] +// }] +// }, +// "BreakpointLocationsArguments": { +// "type": "object", +// "description": "Arguments for `breakpointLocations` request.", +// "properties": { +// "source": { +// "$ref": "#/definitions/Source", +// "description": "The source location of the breakpoints; either +// `source.path` or `source.sourceReference` must be specified." +// }, +// "line": { +// "type": "integer", +// "description": "Start line of range to search possible breakpoint +// locations in. If only the line is specified, the request returns all +// possible locations in that line." +// }, +// "column": { +// "type": "integer", +// "description": "Start position within `line` to search possible +// breakpoint locations in. It is measured in UTF-16 code units and the +// client capability `columnsStartAt1` determines whether it is 0- or +// 1-based. If no column is given, the first position in the start line is +// assumed." +// }, +// "endLine": { +// "type": "integer", +// "description": "End line of range to search possible breakpoint +// locations in. If no end line is given, then the end line is assumed to +// be the start line." +// }, +// "endColumn": { +// "type": "integer", +// "description": "End position within `endLine` to search possible +// breakpoint locations in. It is measured in UTF-16 code units and the +// client capability `columnsStartAt1` determines whether it is 0- or +// 1-based. If no end column is given, the last position in the end line +// is assumed." +// } +// }, +// "required": [ "source", "line" ] +// }, +// "BreakpointLocationsResponse": { +// "allOf": [ { "$ref": "#/definitions/Response" }, { +// "type": "object", +// "description": "Response to `breakpointLocations` request.\nContains +// possible locations for source breakpoints.", +// "properties": { +// "body": { +// "type": "object", +// "properties": { +// "breakpoints": { +// "type": "array", +// "items": { +// "$ref": "#/definitions/BreakpointLocation" +// }, +// "description": "Sorted set of possible breakpoint locations." +// } +// }, +// "required": [ "breakpoints" ] +// } +// }, +// "required": [ "body" ] +// }] +// }, +// "BreakpointLocation": { +// "type": "object", +// "description": "Properties of a breakpoint location returned from the +// `breakpointLocations` request.", +// "properties": { +// "line": { +// "type": "integer", +// "description": "Start line of breakpoint location." +// }, +// "column": { +// "type": "integer", +// "description": "The start position of a breakpoint location. Position +// is measured in UTF-16 code units and the client capability +// `columnsStartAt1` determines whether it is 0- or 1-based." +// }, +// "endLine": { +// "type": "integer", +// "description": "The end line of breakpoint location if the location +// covers a range." +// }, +// "endColumn": { +// "type": "integer", +// "description": "The end position of a breakpoint location (if the +// location covers a range). Position is measured in UTF-16 code units and +// the client capability `columnsStartAt1` determines whether it is 0- or +// 1-based." +// } +// }, +// "required": [ "line" ] +// }, +void request_breakpointLocations(const llvm::json::Object &request) { ashgti wrote: Do you know how often VSCode makes this request? Is this something that should be cached once we calculate the values? I'm not sure how often this is called or how expensive it is to look up the compilation unit by path. https://github.com/llvm/llvm-project/pull/113787 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Skip libc++ tests if it is linked statically (PR #113935)
https://github.com/dzhidzhoev created https://github.com/llvm/llvm-project/pull/113935 Some tests from 'import-std-module' used to fail on the builder https://lab.llvm.org/staging/#/builders/195/builds/4470, since libcxx is set up to be linked statically with the binary on it. Thus, they were temporarily disabled in https://github.com/llvm/llvm-project/pull/112530. Here, this commit is reverted. When libcxx is linked with a program as an archive of static libraries, functions that aren't used in the program are omitted. Then, jitted expressions from the tests try calling several functions that aren't present in the process image, which causes the failure. LLD (and GNU ld AFAIK) links a binary with libcxx shared library if libc++.so is present in corresponding library search paths. Otherwise, it tries static linking. Here, a linker flag is added to a clang call in libcxx configuration, which ensures that libc++.so is present and found by linker. Forcing linker to keep all functions from libcxx archive in this way https://github.com/llvm/llvm-project/pull/98701, without checking whether libcxx is linked statically looks like a less clean solution, but I'm not sure about that. >From 9186c689391a96b09f947e6799d205054cf199ab Mon Sep 17 00:00:00 2001 From: Vladislav Dzhidzhoev Date: Mon, 28 Oct 2024 16:46:39 +0100 Subject: [PATCH 1/2] Revert "[lldb][test] Skip Test*FromStdModule tests on Linux for now (#112530)" This reverts commit 87f126243beb69b8b02e5cd4df762bc8a6f1f8cc. --- .../expression/import-std-module/array/TestArrayFromStdModule.py | 1 - .../TestDbgInfoContentVectorFromStdModule.py | 1 - .../vector-of-vectors/TestVectorOfVectorsFromStdModule.py| 1 - 3 files changed, 3 deletions(-) diff --git a/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py index bafc7628296217..13ab6b0c9ac1fb 100644 --- a/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py @@ -10,7 +10,6 @@ class TestCase(TestBase): @add_test_categories(["libc++"]) @skipIf(compiler=no_match("clang")) -@skipIfLinux # https://discourse.llvm.org/t/lldb-test-failures-on-linux/80095 def test(self): self.build() diff --git a/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py index 71eaeef20e792d..1c3e64f14c 100644 --- a/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py @@ -14,7 +14,6 @@ class TestDbgInfoContentVector(TestBase): @skipIf(compiler="clang", compiler_version=["<", "12.0"]) @skipIf(macos_version=["<", "14.0"]) @skipIfDarwin # https://github.com/llvm/llvm-project/issues/106475 -@skipIfLinux # https://discourse.llvm.org/t/lldb-test-failures-on-linux/80095 def test(self): self.build() diff --git a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py index e9415fd53651f7..a1f33271f39d2f 100644 --- a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py @@ -10,7 +10,6 @@ class TestVectorOfVectors(TestBase): @add_test_categories(["libc++"]) @skipIf(compiler=no_match("clang")) -@skipIfLinux # https://discourse.llvm.org/t/lldb-test-failures-on-linux/80095 def test(self): self.build() >From 77b2ad3e3975ed5b4e0f23efd64999abc92175e7 Mon Sep 17 00:00:00 2001 From: Vladislav Dzhidzhoev Date: Wed, 16 Oct 2024 17:29:07 +0200 Subject: [PATCH 2/2] [lldb][test] Skip libc++ tests if it is linked statically. Some tests from 'import-std-module' used to fail on the builder https://lab.llvm.org/staging/#/builders/195/builds/4470, since libcxx is set up to be linked statically with the binary on it. Thus, they were temporarily disabled in #112530. Here, this commit is reverted. When libcxx is linked with a program as an archive of static libraries, functions that aren't used in the program are omitted. Then, jitted expressions from the tests try calling several functions that aren't present in the process image, which causes the failure. LLD (and GNU ld AFAIK) links a binary with libcxx shared library if libc++.so is present in corresponding library search paths. Otherwise
[Lldb-commits] [lldb] 19c0a74 - [lldb] Fix lldb windows build breakage from https://github.com/llvm/llvm-project/pull/113839.
Author: Zequan Wu Date: 2024-10-28T11:13:00-07:00 New Revision: 19c0a74ad6baa9eb38dbe0a20af7c67999c41821 URL: https://github.com/llvm/llvm-project/commit/19c0a74ad6baa9eb38dbe0a20af7c67999c41821 DIFF: https://github.com/llvm/llvm-project/commit/19c0a74ad6baa9eb38dbe0a20af7c67999c41821.diff LOG: [lldb] Fix lldb windows build breakage from https://github.com/llvm/llvm-project/pull/113839. Added: Modified: lldb/tools/lldb-dap/JSONUtils.cpp Removed: diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index fd09e4ae505e6d..97fe6b4f9f05db 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -21,6 +21,7 @@ #include "lldb/API/SBStringList.h" #include "lldb/API/SBStructuredData.h" #include "lldb/API/SBValue.h" +#include "lldb/Host/PosixApi.h" #include "DAP.h" #include "ExceptionBreakpoint.h" ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [NFC][lldb-dap] Clean-up includes (PR #113839)
@@ -6,25 +6,21 @@ // //===--===// -#include #include #include #include #include #include "llvm/ADT/StringRef.h" -#include "llvm/Support/FormatAdapters.h" #include "llvm/Support/FormatVariadic.h" #include "llvm/Support/Path.h" #include "llvm/Support/ScopedPrinter.h" -#include "lldb/API/SBBreakpoint.h" -#include "lldb/API/SBBreakpointLocation.h" #include "lldb/API/SBDeclaration.h" +#include "lldb/API/SBStream.h" #include "lldb/API/SBStringList.h" #include "lldb/API/SBStructuredData.h" #include "lldb/API/SBValue.h" -#include "lldb/Host/PosixApi.h" ZequanWu wrote: Removing this include breaks lldb windows build because it includes `lldb/Host/windows/PosixApi.h` on windows. That provides the definition for `PATH_MAX`, used later in this file. I fixed it on https://github.com/llvm/llvm-project/commit/19c0a74ad6baa9eb38dbe0a20af7c67999c41821 https://github.com/llvm/llvm-project/pull/113839 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [DO NOT MERGE] Test libc++ CI LLDB DAP failures (PR #113891)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/113891 >From 40bbe1d8f72f697c0c4759fa68f2bd64a50d742c Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Mon, 28 Oct 2024 10:07:36 + Subject: [PATCH 1/2] Init --- .github/workflows/libcxx-build-and-test.yaml | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml index 184fed2268e818..3521b5d5a3def4 100644 --- a/.github/workflows/libcxx-build-and-test.yaml +++ b/.github/workflows/libcxx-build-and-test.yaml @@ -49,7 +49,8 @@ env: jobs: stage1: if: github.repository_owner == 'llvm' -runs-on: libcxx-runners-8-set +runs-on: libcxx-runners-set +container: ghcr.io/libcxx/actions-builder:testing-2024-09-21 continue-on-error: false strategy: fail-fast: false @@ -84,7 +85,8 @@ jobs: **/crash_diagnostics/* stage2: if: github.repository_owner == 'llvm' -runs-on: libcxx-runners-8-set +runs-on: libcxx-runners-set +container: ghcr.io/libcxx/actions-builder:testing-2024-09-21 needs: [ stage1 ] continue-on-error: false strategy: @@ -160,20 +162,21 @@ jobs: 'benchmarks', 'bootstrapping-build' ] -machine: [ 'libcxx-runners-8-set' ] +machine: [ 'libcxx-runners-set' ] include: - config: 'generic-cxx26' - machine: libcxx-runners-8-set + machine: libcxx-runners-set - config: 'generic-asan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set - config: 'generic-tsan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set - config: 'generic-ubsan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set # Use a larger machine for MSAN to avoid timeout and memory allocation issues. - config: 'generic-msan' - machine: libcxx-runners-8-set + machine: libcxx-runners-set runs-on: ${{ matrix.machine }} +container: ghcr.io/libcxx/actions-builder:testing-2024-09-21 steps: - uses: actions/checkout@v4 - name: ${{ matrix.config }} >From c4bced0ee5ac067fc518fcba0395e86e88ca Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Mon, 28 Oct 2024 11:26:48 + Subject: [PATCH 2/2] Disable ASLR on dap_server@ --- lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py | 1 + 1 file changed, 1 insertion(+) 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 63748a71f1122d..687d4defd0f7f2 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 @@ -833,6 +833,7 @@ def request_launch( args_dict["enableSyntheticChildDebugging"] = enableSyntheticChildDebugging args_dict["displayExtendedBacktrace"] = displayExtendedBacktrace args_dict["commandEscapePrefix"] = commandEscapePrefix +args_dict["disableASLR"] = False command_dict = {"command": "launch", "type": "request", "arguments": args_dict} response = self.send_recv(command_dict) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Load embedded type summary section (#7859) (#8040) (PR #113743)
@@ -1537,6 +1538,76 @@ static void LoadScriptingResourceForModule(const ModuleSP &module_sp, feedback_stream.GetData()); } +// Load type summaries embedded in the binary. These are type summaries provided +// by the authors of the code. +static void LoadTypeSummariesForModule(ModuleSP module_sp) { + auto *sections = module_sp->GetSectionList(); + if (!sections) +return; + + auto summaries_sp = + sections->FindSectionByType(eSectionTypeLLDBTypeSummaries, true); + if (!summaries_sp) +return; + + Log *log = GetLog(LLDBLog::DataFormatters); + const char *module_name = module_sp->GetObjectName().GetCString(); + + TypeCategoryImplSP category; + DataVisualization::Categories::GetCategory(ConstString("default"), category); + + // The type summary record is serialized as follows. + // + // Each record contains, in order: + // * Version number of the record format + // * The remaining size of the record + // * The size of the type identifier + // * The type identifier, either a type name, or a regex + // * The size of the summary string + // * The summary string + // + // Integers are encoded using ULEB. + // + // Strings are encoded with first a length (ULEB), then the string contents, + // and lastly a null terminator. The length includes the null. + + DataExtractor extractor; + auto section_size = summaries_sp->GetSectionData(extractor); + lldb::offset_t offset = 0; + while (offset < section_size) { +uint64_t version = extractor.GetULEB128(&offset); +uint64_t record_size = extractor.GetULEB128(&offset); +if (version == 1) { + uint64_t type_size = extractor.GetULEB128(&offset); + llvm::StringRef type_name = extractor.GetCStr(&offset, type_size); + uint64_t summary_size = extractor.GetULEB128(&offset); + llvm::StringRef summary_string = extractor.GetCStr(&offset, summary_size); + if (!type_name.empty() && !summary_string.empty()) { +TypeSummaryImpl::Flags flags; +auto summary_sp = +std::make_shared(flags, summary_string.data()); +FormatterMatchType match_type = eFormatterMatchExact; +if (summary_string.front() == '^' && summary_string.back() == '$') + match_type = eFormatterMatchRegex; +category->AddTypeSummary(type_name, match_type, summary_sp); +LLDB_LOGF(log, "Loaded embedded type summary for '%s' from %s.", + type_name.data(), module_name); + } else { +if (type_name.empty()) + LLDB_LOGF(log, "Missing string(s) in embedded type summary in %s.", +module_name); + } +} else { DavidSpickett wrote: Could `if version != 1: continue` instead of putting this at the end of the loop. Also you could `if (type_name.empty() || summary_string.empty()): log(whatever); continue;` to again exit this iteration early. https://github.com/llvm/llvm-project/pull/113743 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Load embedded type summary section (#7859) (#8040) (PR #113743)
@@ -0,0 +1,22 @@ +#include + +struct Player { + char *name; + int number; +}; + +__attribute__((used, section("__DATA_CONST,__lldbsummaries"))) unsigned char +_Player_type_summary[] = "\x01" // version + "\x25" // record size + "\x07" // type name size + "Player\0" // type name + "\x1c" // summary string size + "${var.name} (${var.number})"; // summary string + +int main() { + struct Player player; + player.name = "Dirk"; + player.number = 41; + puts("break here"); DavidSpickett wrote: Does this actually show up in the logs? If so `return 0 // break here` would be a bit more tidy. https://github.com/llvm/llvm-project/pull/113743 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Load embedded type summary section (#7859) (#8040) (PR #113743)
@@ -1537,6 +1538,76 @@ static void LoadScriptingResourceForModule(const ModuleSP &module_sp, feedback_stream.GetData()); } +// Load type summaries embedded in the binary. These are type summaries provided +// by the authors of the code. +static void LoadTypeSummariesForModule(ModuleSP module_sp) { + auto *sections = module_sp->GetSectionList(); + if (!sections) +return; + + auto summaries_sp = + sections->FindSectionByType(eSectionTypeLLDBTypeSummaries, true); + if (!summaries_sp) +return; + + Log *log = GetLog(LLDBLog::DataFormatters); + const char *module_name = module_sp->GetObjectName().GetCString(); + + TypeCategoryImplSP category; + DataVisualization::Categories::GetCategory(ConstString("default"), category); + + // The type summary record is serialized as follows. + // + // Each record contains, in order: + // * Version number of the record format + // * The remaining size of the record + // * The size of the type identifier + // * The type identifier, either a type name, or a regex + // * The size of the summary string + // * The summary string + // + // Integers are encoded using ULEB. + // + // Strings are encoded with first a length (ULEB), then the string contents, + // and lastly a null terminator. The length includes the null. + + DataExtractor extractor; + auto section_size = summaries_sp->GetSectionData(extractor); + lldb::offset_t offset = 0; + while (offset < section_size) { +uint64_t version = extractor.GetULEB128(&offset); +uint64_t record_size = extractor.GetULEB128(&offset); +if (version == 1) { + uint64_t type_size = extractor.GetULEB128(&offset); + llvm::StringRef type_name = extractor.GetCStr(&offset, type_size); + uint64_t summary_size = extractor.GetULEB128(&offset); + llvm::StringRef summary_string = extractor.GetCStr(&offset, summary_size); + if (!type_name.empty() && !summary_string.empty()) { +TypeSummaryImpl::Flags flags; +auto summary_sp = +std::make_shared(flags, summary_string.data()); +FormatterMatchType match_type = eFormatterMatchExact; +if (summary_string.front() == '^' && summary_string.back() == '$') + match_type = eFormatterMatchRegex; +category->AddTypeSummary(type_name, match_type, summary_sp); +LLDB_LOGF(log, "Loaded embedded type summary for '%s' from %s.", + type_name.data(), module_name); + } else { +if (type_name.empty()) + LLDB_LOGF(log, "Missing string(s) in embedded type summary in %s.", +module_name); + } +} else { + // Skip unsupported record. + offset += record_size; + LLDB_LOGF( + log, + "Skipping unsupported embedded type summary of version %llu in %s.", DavidSpickett wrote: Use the `PRIu64` and other generic 64 bit printf options so that I don't have to fix a warning on Arm 32 bit later :) https://github.com/llvm/llvm-project/pull/113743 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Load embedded type summary section (#7859) (#8040) (PR #113743)
@@ -1537,6 +1538,76 @@ static void LoadScriptingResourceForModule(const ModuleSP &module_sp, feedback_stream.GetData()); } +// Load type summaries embedded in the binary. These are type summaries provided +// by the authors of the code. +static void LoadTypeSummariesForModule(ModuleSP module_sp) { + auto *sections = module_sp->GetSectionList(); + if (!sections) +return; + + auto summaries_sp = + sections->FindSectionByType(eSectionTypeLLDBTypeSummaries, true); + if (!summaries_sp) +return; + + Log *log = GetLog(LLDBLog::DataFormatters); + const char *module_name = module_sp->GetObjectName().GetCString(); + + TypeCategoryImplSP category; + DataVisualization::Categories::GetCategory(ConstString("default"), category); + + // The type summary record is serialized as follows. + // + // Each record contains, in order: + // * Version number of the record format + // * The remaining size of the record + // * The size of the type identifier + // * The type identifier, either a type name, or a regex + // * The size of the summary string + // * The summary string + // + // Integers are encoded using ULEB. + // + // Strings are encoded with first a length (ULEB), then the string contents, + // and lastly a null terminator. The length includes the null. + + DataExtractor extractor; + auto section_size = summaries_sp->GetSectionData(extractor); + lldb::offset_t offset = 0; + while (offset < section_size) { +uint64_t version = extractor.GetULEB128(&offset); +uint64_t record_size = extractor.GetULEB128(&offset); +if (version == 1) { + uint64_t type_size = extractor.GetULEB128(&offset); + llvm::StringRef type_name = extractor.GetCStr(&offset, type_size); + uint64_t summary_size = extractor.GetULEB128(&offset); + llvm::StringRef summary_string = extractor.GetCStr(&offset, summary_size); + if (!type_name.empty() && !summary_string.empty()) { +TypeSummaryImpl::Flags flags; +auto summary_sp = +std::make_shared(flags, summary_string.data()); +FormatterMatchType match_type = eFormatterMatchExact; +if (summary_string.front() == '^' && summary_string.back() == '$') + match_type = eFormatterMatchRegex; +category->AddTypeSummary(type_name, match_type, summary_sp); +LLDB_LOGF(log, "Loaded embedded type summary for '%s' from %s.", + type_name.data(), module_name); + } else { +if (type_name.empty()) DavidSpickett wrote: Should this log message always be printed? It looks like you have to have both strings so if you get to the else, one of them is empty. This will only log if one of them is empty but not the other one. Might as well put in what strings they are too. "Missing type or summary string in". https://github.com/llvm/llvm-project/pull/113743 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Load embedded type summary section (#7859) (#8040) (PR #113743)
DavidSpickett wrote: > This upstreams the embedded type summary feature from the swiftlang branch of > LLDB, since it shares a lot of the same goals and design points with > https://github.com/llvm/llvm-project/pull/113398 Just want to be extra clear here, this shares some of the same goals but is not part of that thing. This is simply upstreaming a thing that already exists in the Swift fork, correct? https://github.com/llvm/llvm-project/pull/113743 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
https://github.com/vogelsgesang updated https://github.com/llvm/llvm-project/pull/113787 >From af45bc2e24623d7225d24a4680a28630d67d636e Mon Sep 17 00:00:00 2001 From: Adrian Vogelsgesang Date: Sat, 26 Oct 2024 14:34:31 + Subject: [PATCH 1/3] [lldb-dap] Support column breakpoints This commit adds support for column breakpoints to lldb-dap. To do so, support for `breakpointLocations` was added. To find all available breakpoint positions, we iterate over the line table. The `setBreakpoints` request already forwarded the column correctly to `SBTarget::BreakpointCreateByLocation`. However, `SourceBreakpointMap` did not keep track of multiple breakpoints in the same line. To do so, the `SourceBreakpointMap` is now indexed by line+column instead of by line only. See http://jonasdevlieghere.com/post/lldb-column-breakpoints/ for a high-level introduction to column breakpoints. --- .../test/tools/lldb-dap/dap_server.py | 30 ++- .../API/tools/lldb-dap/breakpoint/Makefile| 2 +- .../breakpoint/TestDAP_breakpointLocations.py | 74 +++ .../breakpoint/TestDAP_setBreakpoints.py | 172 +-- lldb/tools/lldb-dap/DAP.h | 2 +- lldb/tools/lldb-dap/lldb-dap.cpp | 197 +- .../llvm/DebugInfo/DWARF/DWARFDebugLine.h | 2 +- 7 files changed, 393 insertions(+), 86 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py 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 63748a71f1122d..659408c709a249 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 @@ -612,6 +612,22 @@ def request_attach( command_dict = {"command": "attach", "type": "request", "arguments": args_dict} return self.send_recv(command_dict) +def request_breakpointLocations(self, file_path, line, end_line=None, column=None, end_column=None): +(dir, base) = os.path.split(file_path) +source_dict = {"name": base, "path": file_path} +args_dict = {} +args_dict["source"] = source_dict +if line is not None: + args_dict["line"] = line +if end_line is not None: +args_dict["endLine"] = end_line +if column is not None: +args_dict["column"] = column +if end_column is not None: +args_dict["endColumn"] = end_column +command_dict = {"command": "breakpointLocations", "type": "request", "arguments": args_dict} +return self.send_recv(command_dict) + def request_configurationDone(self): command_dict = { "command": "configurationDone", @@ -912,18 +928,14 @@ def request_setBreakpoints(self, file_path, line_array, data=None): breakpoint_data = data[i] bp = {"line": line} if breakpoint_data is not None: -if "condition" in breakpoint_data and breakpoint_data["condition"]: +if breakpoint_data.get("condition"): bp["condition"] = breakpoint_data["condition"] -if ( -"hitCondition" in breakpoint_data -and breakpoint_data["hitCondition"] -): +if breakpoint_data.get("hitCondition"): bp["hitCondition"] = breakpoint_data["hitCondition"] -if ( -"logMessage" in breakpoint_data -and breakpoint_data["logMessage"] -): +if breakpoint_data.get("logMessage"): bp["logMessage"] = breakpoint_data["logMessage"] +if breakpoint_data.get("column"): +bp["column"] = breakpoint_data["column"] breakpoints.append(bp) args_dict["breakpoints"] = breakpoints diff --git a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile index 7634f513e85233..06438b3e6e3139 100644 --- a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile +++ b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile @@ -16,4 +16,4 @@ main-copy.cpp: main.cpp # The following shared library will be used to test breakpoints under dynamic loading libother: other-copy.c "$(MAKE)" -f $(MAKEFILE_RULES) \ - DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other + DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other diff --git a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py new file mode 100644 index 00..d84ce843e3fba8 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_b
[Lldb-commits] [lldb] [lldb] Add a compiler/interpreter of LLDB data formatter bytecode to lldb/examples (PR #113398)
@@ -0,0 +1,165 @@ +# A bytecode for (LLDB) data formatters + +## Background + +LLDB provides very rich customization options to display data types (see https://lldb.llvm.org/use/variable.html ). To use custom data formatters, developers typically need to edit the global `~/.lldbinit` file to make sure they are found and loaded. An example for this workflow is the `llvm/utils/lldbDataFormatters.py` script. Because of the manual configuration that is involved, this workflow doesn't scale very well. What would be nice is if developers or library authors could ship ship data formatters with their code and LLDB automatically finds them. + +In Swift we added the `DebugDescription` macro (see https://www.swift.org/blog/announcing-swift-6/#debugging ) that translates Swift string interpolation into LLDB summary strings, and puts them into a `.lldbsummaries` section, where LLDB can find them. This works well for simple summaries, but doesn't scale to synthetic child providers or summaries that need to perform some kind of conditional logic or computation. The logical next step would be to store full Python formatters instead of summary strings, but Python code is larger and more importantly it is potentially dangerous to just load an execute untrusted Python code in LLDB. + +This document describes a minimal bytecode tailored to running LLDB formatters. It defines a human-readable assembler representation for the language, an efficient binary encoding, a virtual machine for evaluating it, and format for embedding formatters into binary containers. + +### Goals + +Provide an efficient and secure encoding for data formatters that can be used as a compilation target from user-friendly representations (such as DIL, Swift DebugDescription, or NatVis). + +### Non-goals + +While humans could write the assembler syntax, making it user-friendly is not a goal. + +## Design of the virtual machine + +The LLDB formatter virtual machine uses a stack-based bytecode, comparable with DWARF expressions, but with higher-level data types and functions. + +The virtual machine has two stacks, a data and a control stack. The control stack is kept separate to make it easier to reason about the security aspects of the VM. + +### Data types +These data types are "host" data types, in LLDB parlance. +- _String_ (UTF-8) +- _Int_ (64 bit) +- _UInt_ (64 bit) +- _Object_ (Basically an `SBValue`) +- _Type_ (Basically an `SBType`) +- _Selector_ (One of the predefine functions) + +_Object_ and _Type_ are opaque, they can only be used as a parameters of `call`. + +## Instruction set + +### Stack operations + +These manipulate the data stack directly. + +- `dup (x -> x x)` +- `drop (x y -> x)` +- `pick (x ... UInt -> x ... x)` +- `over (x y -> y)` +- `swap (x y -> y x)` +- `rot (x y z -> z x y)` + +### Control flow + +- `{` pushes a code block address onto the control stack +- `}` (technically not an opcode) denotes the end of a code block +- `if` pops a block from the control stack, if the top of the data stack is nonzero, executes it +- `ifelse` pops two blocks from the control stack, if the top of the data stack is nonzero, executes the first, otherwise the second. + +### Literals for basic types + +- `123u ( -> UInt)` an unsigned 64-bit host integer. +- `123 ( -> Int)` a signed 64-bit host integer. +- `"abc" ( -> String)` a UTF-8 host string. +- `@strlen ( -> Selector)` one of the predefined functions supported by the VM. + +### Arithmetic, logic, and comparison operations +- `+ (x y -> [x+y])` +- `-` etc ... +- `*` +- `/` +- `%` +- `<<` +- `>>` +- `shra` (arithmetic shift right) +- `~` +- `|` +- `^` +- `=` +- `!=` +- `<` +- `>` +- `=<` +- `>=` + +### Function calls + +For security reasons the list of functions callable with `call` is predefined. The supported functions are either existing methods on `SBValue`, or string formatting operations. + +- `call (Object arg0 ... Selector -> retval)` + +Method is one of a predefined set of _Selectors_ +- `(Object @summary -> String)` +- `(Object @type_summary -> String)` + +- `(Object @get_num_children -> UInt)` +- `(Object UInt @get_child_at_index -> Object)` +- `(Object String @get_child_index -> UInt)` +- `(Object @get_type -> Type)` +- `(Object UInt @get_template_argument_type -> Type)` +- `(Object @get_value -> Object)` +- `(Object @get_value_as_unsigned -> UInt)` +- `(Object @get_value_as_signed -> Int)` +- `(Object @get_value_as_address -> UInt)` +- `(Object Type @cast -> Object)` + +- `(UInt @read_memory_byte -> UInt)` +- `(UInt @read_memory_uint32 -> UInt)` +- `(UInt @read_memory_int32 -> Int)` +- `(UInt @read_memory_unsigned -> UInt)` +- `(UInt @read_memory_signed -> Int)` +- `(UInt @read_memory_address -> UInt)` +- `(UInt Type @read_memory -> Object)` + +- `(String arg0 ... fmt -> String)` +- `(String arg0 ... sprintf -> String)` +- `(String strlen -> String)` + +## Byte Code + +Most instructions are just a single byte opcode. The only exceptions
[Lldb-commits] [lldb] [lldb] Add a compiler/interpreter of LLDB data formatter bytecode to lldb/examples (PR #113398)
@@ -0,0 +1,486 @@ +""" +Specification, compiler, disassembler, and interpreter +for LLDB dataformatter bytecode. + +See formatter-bytecode.md for more details. +""" +from __future__ import annotations + +# Types +type_String = 1 +type_Int = 2 +type_UInt = 3 +type_Object = 4 +type_Type = 5 + +# Opcodes +opcode = dict() + + +def define_opcode(n, mnemonic, name): +globals()["op_" + name] = n +if mnemonic: +opcode[mnemonic] = n +opcode[n] = mnemonic + + +define_opcode(1, "dup", "dup") +define_opcode(2, "drop", "drop") +define_opcode(3, "pick", "pick") +define_opcode(4, "over", "over") +define_opcode(5, "swap", "swap") +define_opcode(6, "rot", "rot") + +define_opcode(0x10, "{", "begin") +define_opcode(0x11, "if", "if") +define_opcode(0x12, "ifelse", "ifelse") + +define_opcode(0x20, None, "lit_uint") +define_opcode(0x21, None, "lit_int") +define_opcode(0x22, None, "lit_string") +define_opcode(0x23, None, "lit_selector") + +define_opcode(0x30, "+", "plus") +define_opcode(0x31, "-", "minus") +define_opcode(0x32, "*", "mul") +define_opcode(0x33, "/", "div") +define_opcode(0x34, "%", "mod") +define_opcode(0x35, "<<", "shl") +define_opcode(0x36, ">>", "shr") +define_opcode(0x37, "shra", "shra") + +define_opcode(0x40, "&", "and") +define_opcode(0x41, "|", "or") +define_opcode(0x42, "^", "xor") +define_opcode(0x43, "~", "not") + +define_opcode(0x50, "=", "eq") +define_opcode(0x51, "!=", "neq") +define_opcode(0x52, "<", "lt") +define_opcode(0x53, ">", "gt") +define_opcode(0x54, "=<", "le") +define_opcode(0x55, ">=", "ge") + +define_opcode(0x60, "call", "call") + +# Function signatures +sig_summary = 0 +sig_init = 1 +sig_get_num_children = 2 +sig_get_child_index = 3 +sig_get_child_at_index = 4 + +# Selectors +selector = dict() DavidSpickett wrote: Makes sense, thanks. https://github.com/llvm/llvm-project/pull/113398 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add a compiler/interpreter of LLDB data formatter bytecode to lldb/examples (PR #113398)
@@ -0,0 +1,165 @@ +# A bytecode for (LLDB) data formatters + +## Background + +LLDB provides very rich customization options to display data types (see https://lldb.llvm.org/use/variable.html ). To use custom data formatters, developers typically need to edit the global `~/.lldbinit` file to make sure they are found and loaded. An example for this workflow is the `llvm/utils/lldbDataFormatters.py` script. Because of the manual configuration that is involved, this workflow doesn't scale very well. What would be nice is if developers or library authors could ship ship data formatters with their code and LLDB automatically finds them. + +In Swift we added the `DebugDescription` macro (see https://www.swift.org/blog/announcing-swift-6/#debugging ) that translates Swift string interpolation into LLDB summary strings, and puts them into a `.lldbsummaries` section, where LLDB can find them. This works well for simple summaries, but doesn't scale to synthetic child providers or summaries that need to perform some kind of conditional logic or computation. The logical next step would be to store full Python formatters instead of summary strings, but Python code is larger and more importantly it is potentially dangerous to just load an execute untrusted Python code in LLDB. + +This document describes a minimal bytecode tailored to running LLDB formatters. It defines a human-readable assembler representation for the language, an efficient binary encoding, a virtual machine for evaluating it, and format for embedding formatters into binary containers. + +### Goals + +Provide an efficient and secure encoding for data formatters that can be used as a compilation target from user-friendly representations (such as DIL, Swift DebugDescription, or NatVis). + +### Non-goals + +While humans could write the assembler syntax, making it user-friendly is not a goal. + +## Design of the virtual machine + +The LLDB formatter virtual machine uses a stack-based bytecode, comparable with DWARF expressions, but with higher-level data types and functions. + +The virtual machine has two stacks, a data and a control stack. The control stack is kept separate to make it easier to reason about the security aspects of the VM. + +### Data types +These data types are "host" data types, in LLDB parlance. +- _String_ (UTF-8) +- _Int_ (64 bit) +- _UInt_ (64 bit) +- _Object_ (Basically an `SBValue`) +- _Type_ (Basically an `SBType`) +- _Selector_ (One of the predefine functions) + +_Object_ and _Type_ are opaque, they can only be used as a parameters of `call`. + +## Instruction set + +### Stack operations + +These manipulate the data stack directly. + +- `dup (x -> x x)` +- `drop (x y -> x)` +- `pick (x ... UInt -> x ... x)` +- `over (x y -> y)` +- `swap (x y -> y x)` +- `rot (x y z -> z x y)` + +### Control flow + +- `{` pushes a code block address onto the control stack +- `}` (technically not an opcode) denotes the end of a code block +- `if` pops a block from the control stack, if the top of the data stack is nonzero, executes it +- `ifelse` pops two blocks from the control stack, if the top of the data stack is nonzero, executes the first, otherwise the second. + +### Literals for basic types + +- `123u ( -> UInt)` an unsigned 64-bit host integer. +- `123 ( -> Int)` a signed 64-bit host integer. +- `"abc" ( -> String)` a UTF-8 host string. +- `@strlen ( -> Selector)` one of the predefined functions supported by the VM. + +### Arithmetic, logic, and comparison operations +- `+ (x y -> [x+y])` +- `-` etc ... +- `*` +- `/` +- `%` +- `<<` +- `>>` +- `shra` (arithmetic shift right) +- `~` +- `|` +- `^` +- `=` +- `!=` +- `<` +- `>` +- `=<` +- `>=` + +### Function calls + +For security reasons the list of functions callable with `call` is predefined. The supported functions are either existing methods on `SBValue`, or string formatting operations. + +- `call (Object arg0 ... Selector -> retval)` + +Method is one of a predefined set of _Selectors_ +- `(Object @summary -> String)` +- `(Object @type_summary -> String)` + +- `(Object @get_num_children -> UInt)` +- `(Object UInt @get_child_at_index -> Object)` +- `(Object String @get_child_index -> UInt)` +- `(Object @get_type -> Type)` +- `(Object UInt @get_template_argument_type -> Type)` +- `(Object @get_value -> Object)` +- `(Object @get_value_as_unsigned -> UInt)` +- `(Object @get_value_as_signed -> Int)` +- `(Object @get_value_as_address -> UInt)` +- `(Object Type @cast -> Object)` + +- `(UInt @read_memory_byte -> UInt)` +- `(UInt @read_memory_uint32 -> UInt)` +- `(UInt @read_memory_int32 -> Int)` +- `(UInt @read_memory_unsigned -> UInt)` +- `(UInt @read_memory_signed -> Int)` +- `(UInt @read_memory_address -> UInt)` +- `(UInt Type @read_memory -> Object)` + +- `(String arg0 ... fmt -> String)` +- `(String arg0 ... sprintf -> String)` +- `(String strlen -> String)` + +## Byte Code + +Most instructions are just a single byte opcode. The only exceptions
[Lldb-commits] [lldb] [llvm] [DO NOT MERGE] Test libc++ CI LLDB DAP failures (PR #113891)
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 09c258ef6a2fcca2161488b214d53ef39891fa22...7071fe89e227f5231ac0d2d96bcc276fe89c1749 lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py `` View the diff from darker here. ``diff --- dap_server.py 2024-10-28 15:18:09.00 + +++ dap_server.py 2024-10-28 15:21:22.391867 + @@ -831,11 +831,11 @@ args_dict["enableAutoVariableSummaries"] = enableAutoVariableSummaries args_dict["enableSyntheticChildDebugging"] = enableSyntheticChildDebugging args_dict["displayExtendedBacktrace"] = displayExtendedBacktrace args_dict["commandEscapePrefix"] = commandEscapePrefix -#args_dict["disableASLR"] = False +# args_dict["disableASLR"] = False command_dict = {"command": "launch", "type": "request", "arguments": args_dict} response = self.send_recv(command_dict) if response["success"]: # Wait for a 'process' and 'initialized' event in any order `` https://github.com/llvm/llvm-project/pull/113891 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 474234a - [debugserver] Mark ASAN memory regions as "heap" (#113968)
Author: Felipe de Azevedo Piovezan Date: 2024-10-28T15:02:07-07:00 New Revision: 474234a09655e57b7a4270150f0926db77e864b4 URL: https://github.com/llvm/llvm-project/commit/474234a09655e57b7a4270150f0926db77e864b4 DIFF: https://github.com/llvm/llvm-project/commit/474234a09655e57b7a4270150f0926db77e864b4.diff LOG: [debugserver] Mark ASAN memory regions as "heap" (#113968) This memory type is currently not handled, but it makes sense to mark it as a heap allocation in requests asking for memory region info. Added: Modified: lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp Removed: diff --git a/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp b/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp index 60d4c3bc293a3c..97908b4acaf284 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp @@ -208,7 +208,8 @@ std::vector MachVMRegion::GetMemoryTypes() const { m_data.user_tag == VM_MEMORY_MALLOC_LARGE_REUSABLE || m_data.user_tag == VM_MEMORY_MALLOC_HUGE || m_data.user_tag == VM_MEMORY_REALLOC || - m_data.user_tag == VM_MEMORY_SBRK) { + m_data.user_tag == VM_MEMORY_SBRK || + m_data.user_tag == VM_MEMORY_SANITIZER) { types.push_back("heap"); if (m_data.user_tag == VM_MEMORY_MALLOC_TINY) { types.push_back("malloc-tiny"); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix statistics dump to report per-target (PR #113723)
@@ -1600,6 +1600,15 @@ bool Module::MergeArchitecture(const ArchSpec &arch_spec) { return SetArchitecture(merged_arch); } +void Module::ResetStatistics() { + m_symtab_parse_time.reset(); + m_symtab_index_time.reset(); + SymbolFile *sym_file = GetSymbolFile(); + if (sym_file) { +sym_file->ResetStatistics(); + } clayborg wrote: remove braces from single line "if" statement per llvm coding guidelines https://github.com/llvm/llvm-project/pull/113723 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [debugserver] Mark ASAN memory regions as "heap" (PR #113968)
https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/113968 This memory type is currently not handled, but it makes sense to mark it as a heap allocation in requests asking for memory region info. >From 55d3e6002d05e71750daca208a93aa308dbb7512 Mon Sep 17 00:00:00 2001 From: Felipe de Azevedo Piovezan Date: Mon, 28 Oct 2024 14:27:55 -0700 Subject: [PATCH] [debugserver] Mark ASAN memory regions as "heap" This memory type is currently not handled, but it makes sense to mark it as a heap allocation in requests asking for memory region info. --- lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp b/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp index 60d4c3bc293a3c..97908b4acaf284 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp @@ -208,7 +208,8 @@ std::vector MachVMRegion::GetMemoryTypes() const { m_data.user_tag == VM_MEMORY_MALLOC_LARGE_REUSABLE || m_data.user_tag == VM_MEMORY_MALLOC_HUGE || m_data.user_tag == VM_MEMORY_REALLOC || - m_data.user_tag == VM_MEMORY_SBRK) { + m_data.user_tag == VM_MEMORY_SBRK || + m_data.user_tag == VM_MEMORY_SANITIZER) { types.push_back("heap"); if (m_data.user_tag == VM_MEMORY_MALLOC_TINY) { types.push_back("malloc-tiny"); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits