[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/133624 >From 3240fe49515e5f59c5b9ff9c02423b77504d8a43 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Fri, 28 Mar 2025 14:02:53 -0700 Subject: [PATCH 1/6] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. This converts a number of json::Value's into well defined types that are used throughout lldb-dap and updates the 'launch' command to use the new well defined types. --- .../test/tools/lldb-dap/dap_server.py | 3 +- .../test/tools/lldb-dap/lldbdap_testcase.py | 2 +- .../tools/lldb-dap/launch/TestDAP_launch.py | 6 +- .../restart/TestDAP_restart_runInTerminal.py | 4 +- .../runInTerminal/TestDAP_runInTerminal.py| 16 +- lldb/tools/lldb-dap/DAP.cpp | 82 +--- lldb/tools/lldb-dap/DAP.h | 44 +++-- .../lldb-dap/Handler/AttachRequestHandler.cpp | 33 ++-- .../lldb-dap/Handler/CompletionsHandler.cpp | 7 +- .../Handler/EvaluateRequestHandler.cpp| 3 +- .../lldb-dap/Handler/LaunchRequestHandler.cpp | 118 +++- .../tools/lldb-dap/Handler/RequestHandler.cpp | 96 +- lldb/tools/lldb-dap/Handler/RequestHandler.h | 19 +- .../Handler/RestartRequestHandler.cpp | 54 -- .../Handler/SetVariableRequestHandler.cpp | 3 +- .../Handler/StackTraceRequestHandler.cpp | 2 +- .../Handler/VariablesRequestHandler.cpp | 20 +- lldb/tools/lldb-dap/JSONUtils.cpp | 48 ++--- lldb/tools/lldb-dap/JSONUtils.h | 11 +- .../lldb-dap/Protocol/ProtocolRequests.cpp| 175 +- .../lldb-dap/Protocol/ProtocolRequests.h | 150 +++ lldb/tools/lldb-dap/SourceBreakpoint.cpp | 6 +- 22 files changed, 616 insertions(+), 286 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 01ef4b68f2653..6e13fcddcc933 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 @@ -862,7 +862,8 @@ def request_launch( args_dict["enableAutoVariableSummaries"] = enableAutoVariableSummaries args_dict["enableSyntheticChildDebugging"] = enableSyntheticChildDebugging args_dict["displayExtendedBacktrace"] = displayExtendedBacktrace -args_dict["commandEscapePrefix"] = commandEscapePrefix +if commandEscapePrefix: +args_dict["commandEscapePrefix"] = commandEscapePrefix command_dict = {"command": "launch", "type": "request", "arguments": args_dict} response = self.send_recv(command_dict) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py index 70b04b051e0ec..9ab8a905a79dd 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py @@ -443,7 +443,7 @@ def cleanup(): if not (response and response["success"]): self.assertTrue( -response["success"], "launch failed (%s)" % (response["message"]) +response["success"], "launch failed (%s)" % (response["body"]["error"]["format"]) ) return response diff --git a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py index 64c99019a1c9b..c6a3e9cc879a4 100644 --- a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py +++ b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py @@ -41,7 +41,9 @@ def test_termination(self): self.dap_server.request_disconnect() # Wait until the underlying lldb-dap process dies. - self.dap_server.process.wait(timeout=lldbdap_testcase.DAPTestCaseBase.timeoutval) +self.dap_server.process.wait( +timeout=lldbdap_testcase.DAPTestCaseBase.timeoutval +) # Check the return code self.assertEqual(self.dap_server.process.poll(), 0) @@ -459,7 +461,7 @@ def test_failing_launch_commands(self): self.assertFalse(response["success"]) self.assertRegex( -response["message"], +response["body"]["error"]["format"], r"Failed to run launch commands\. See the Debug Console for more details", ) diff --git a/lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py b/lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py index 5a9938c25c2c8..a94c9860c1508 100644 --- a/lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py +++ b/lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py @@ -21,7 +21,7 @@ def isTestSupported(self): return False @skipIfWindows -@skipIf(archs=["arm"]) #
[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)
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/14470 Here is the relevant piece of the build log for the reference ``` Step 6 (test) failure: build (failure) ... UNSUPPORTED: lldb-api :: tools/lldb-dap/exception/objc/TestDAP_exception_objc.py (1167 of 2954) UNSUPPORTED: lldb-api :: tools/lldb-dap/extendedStackTrace/TestDAP_extendedStackTrace.py (1168 of 2954) PASS: lldb-api :: tools/lldb-dap/exception/cpp/TestDAP_exception_cpp.py (1169 of 2954) PASS: lldb-api :: tools/lldb-dap/instruction-breakpoint/TestDAP_instruction_breakpoint.py (1170 of 2954) PASS: lldb-api :: tools/lldb-dap/disconnect/TestDAP_disconnect.py (1171 of 2954) PASS: lldb-api :: tools/lldb-dap/io/TestDAP_io.py (1172 of 2954) PASS: lldb-api :: tools/lldb-dap/locations/TestDAP_locations.py (1173 of 2954) PASS: lldb-api :: tools/lldb-dap/memory/TestDAP_memory.py (1174 of 2954) PASS: lldb-api :: tools/lldb-dap/optimized/TestDAP_optimized.py (1175 of 2954) UNRESOLVED: lldb-api :: tools/lldb-dap/evaluate/TestDAP_evaluate.py (1176 of 2954) TEST 'lldb-api :: tools/lldb-dap/evaluate/TestDAP_evaluate.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/gmake --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/tools/lldb-dap/evaluate -p TestDAP_evaluate.py -- Exit Code: 1 Command Output (stdout): -- lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 2d30a60e9ff8b22f7e07ca5360fe1582f96be1ac) clang revision 2d30a60e9ff8b22f7e07ca5360fe1582f96be1ac llvm revision 2d30a60e9ff8b22f7e07ca5360fe1582f96be1ac Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc'] -- Command Output (stderr): -- = DEBUG ADAPTER PROTOCOL LOGS = 1744647501.012513399 --> (stdin/stdout) {"command":"initialize","type":"request","arguments":{"adapterID":"lldb-native","clientID":"vscode","columnsStartAt1":true,"linesStartAt1":true,"locale":"en-us","pathFormat":"path","supportsRunInTerminalRequest":true,"supportsVariablePaging":true,"supportsVariableType":true,"supportsStartDebuggingRequest":true,"supportsProgressReporting":true,"$__lldb_sourceInitFile":false},"seq":1} 1744647501.016715050 <-- (stdin/stdout) {"body":{"$__lldb_version":"lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 2d30a60e9ff8b22f7e07ca5360fe1582f96be1ac)\n clang revision 2d30a60e9ff8b22f7e07ca5360fe1582f96be1ac\n llvm revision 2d30a60e9ff8b22f7e07ca5360fe1582f96be1ac","completionTriggerCharacters":["."," ","\t"],"exceptionBreakpointFilters":[{"default":false,"filter":"cpp_catch","label":"C++ Catch"},{"default":false,"filter":"cpp_throw","label":"C++ Throw"},{"default":false,"filter":"objc_catch","label":"Objective-C Catch"},{"default":false,"filter":"objc_throw","label":"Objective-C Throw"}],"supportTerminateDebuggee":true,"supportsBreakpointLocationsRequest":true,"supportsCancelRequest":true,"supportsCompletionsRequest":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsDataBreakpoints":true,"supportsDelayedStackTraceLoading":true,"supportsDisassembleRequest":true,"supportsEvaluateForHovers":true,"supportsExceptionInfoRequest":true,"supportsExceptionOptions":true,"supportsFunctionBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsInstructionBreakpoints":true,"supportsLogPoints":true,"supportsModulesRequest":true,"supportsReadMemoryRequest":true,"supportsRestartRequest":true,"supportsSetVariable":true,"supportsStepInTargetsRequest":true,"supportsSteppingGranularity":true,"supportsValueFormattingOptions":true},"command":"initialize","request_seq":1,"s
[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `lldb-aarch64-windows` running on `linaro-armv8-windows-msvc-05` while building `lldb` at step 4 "build". Full details are available at: https://lab.llvm.org/buildbot/#/builders/141/builds/7879 Here is the relevant piece of the build log for the reference ``` Step 4 (build) failure: build (failure) ... 525.346 [559/10/6144] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\FunctionBreakpoint.cpp.obj 525.379 [558/10/6145] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\Breakpoint.cpp.obj 525.579 [557/10/6146] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\ProgressEvent.cpp.obj 525.617 [556/10/6147] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\RunInTerminal.cpp.obj 525.668 [555/10/6148] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\InstructionBreakpoint.cpp.obj 525.978 [554/10/6149] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\Handler\ResponseHandler.cpp.obj 526.558 [553/10/6150] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\LLDBUtils.cpp.obj 527.696 [552/10/6151] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\OutputRedirector.cpp.obj 528.731 [551/10/6152] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\EventHelper.cpp.obj 531.089 [550/10/6153] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\Transport.cpp.obj FAILED: tools/lldb/tools/lldb-dap/CMakeFiles/lldb-dap.dir/Transport.cpp.obj ccache C:\Users\tcwg\scoop\apps\llvm-arm64\current\bin\clang-cl.exe /nologo -TP -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IC:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\tools\lldb-dap -IC:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\tools\lldb-dap -IC:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\include -IC:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\include -IC:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\include -IC:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\include -IC:\Users\tcwg\scoop\apps\python\current\include -IC:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\llvm\..\clang\include -IC:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\..\clang\include /DWIN32 /D_WINDOWS /Zc:inline /Zc:__cplusplus /Oi /Brepro /bigobj /permissive- -Werror=unguarded-availability-new /W4 -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported /Gw -Wno-vla-extension /O2 /Ob2 /DNDEBUG -std:c++17 -MD -wd4018 -wd4068 -wd4150 -wd4201 -wd4251 -wd4521 -wd4530 -wd4589 /EHs-c- /GR- /showIncludes /Fotools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\Transport.cpp.obj /Fdtools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\ -c -- C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\tools\lldb-dap\Transport.cpp C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\tools\lldb-dap\Transport.cpp(41,49): error: use of undeclared identifier 'eFDTypeSocket' 41 | timeout_supported = descriptor.GetFdType() == eFDTypeSocket; | ^ 1 error generated. 531.532 [550/9/6154] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\JSONUtils.cpp.obj 531.659 [550/8/6155] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\Watchpoint.cpp.obj 531.814 [550/7/6156] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\SourceBreakpoint.cpp.obj 532.888 [550/6/6157] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\Handler\AttachRequestHandler.cpp.obj 533.063 [550/5/6158] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\Handler\BreakpointLocationsHandler.cpp.obj 533.127 [550/4/6159] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\Handler\CancelRequestHandler.cpp.obj 533.229 [550/3/6160] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\lldb-dap.cpp.obj 533.606 [550/2/6161] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\Handler\CompileUnitsRequestHandler.cpp.obj 534.693 [550/1/6162] Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\DAP.cpp.obj ninja: build stopped: subcommand failed. ``` https://github.com/llvm/llvm-project/pull/
[Lldb-commits] [lldb] [LLDB] Add unary operators Dereference and AddressOf to DIL (PR #134428)
@@ -18,6 +18,22 @@ namespace lldb_private::dil { +static lldb::ValueObjectSP +ArrayToPointerConversion(lldb::ValueObjectSP valobj, + std::shared_ptr ctx) { + assert(valobj->IsArrayType() && + "an argument to array-to-pointer conversion must be an array"); + + uint64_t addr = valobj->GetLoadAddress(); + llvm::StringRef name = "result"; + ExecutionContext exe_ctx; + ctx->CalculateExecutionContext(exe_ctx); + return ValueObject::CreateValueObjectFromAddress( + name, addr, exe_ctx, + valobj->GetCompilerType().GetArrayElementType(ctx.get()).GetPointerType(), + /* do_deref */ false); +} + labath wrote: Yes, that's definitely a job for a separate patch. To answer Jim's question, I don't see a specific downside to the second option. Just some open questions. I don't exactly know what the interface of the new methods should be for instance (maybe it should not return a ValueObject since GetChildCompilerTypeAtIndex does not either). Ideally, I also wouldn't want too much code duplication between this and GetChildCompilerTypeAtIndex. But generally, yes, I think this would be better. https://github.com/llvm/llvm-project/pull/134428 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Make sure the process is stopped when computing the symbol context (PR #135458)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/135458 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] returning command completions up to a maximum (PR #135565)
@@ -230,6 +232,10 @@ class SymbolCompleter : public Completer { // Now add the functions & symbols to the list - only add if unique: for (const SymbolContext &sc : sc_list) { +if (m_match_set.size() >= m_request.GetMaxNumberOfResultsToAdd()) { + break; +} JDevlieghere wrote: ```suggestion if (m_match_set.size() >= m_request.GetMaxNumberOfResultsToAdd()) break; ``` https://github.com/llvm/llvm-project/pull/135565 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove ProcessRunLock::TrySetRunning (PR #135455)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/135455 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)
https://github.com/HemangGadhavi updated https://github.com/llvm/llvm-project/pull/134354 >From e7b3d8d95477f96b4c1b1a2bbec5cce49f4c15cd Mon Sep 17 00:00:00 2001 From: HemangGadhavi Date: Fri, 4 Apr 2025 00:59:17 -0500 Subject: [PATCH 1/4] [lldb][AIX] get host info for AIX --- lldb/source/Host/CMakeLists.txt | 1 + lldb/source/Host/aix/Host.cpp | 156 +++- 2 files changed, 156 insertions(+), 1 deletion(-) diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt index a2ae6f1430c38..a02b1c104396e 100644 --- a/lldb/source/Host/CMakeLists.txt +++ b/lldb/source/Host/CMakeLists.txt @@ -141,6 +141,7 @@ else() add_host_subdirectory(aix aix/Host.cpp aix/HostInfoAIX.cpp + linux/Support.cpp ) endif() endif() diff --git a/lldb/source/Host/aix/Host.cpp b/lldb/source/Host/aix/Host.cpp index 751c4fbcc9368..6ba3e05348df1 100644 --- a/lldb/source/Host/aix/Host.cpp +++ b/lldb/source/Host/aix/Host.cpp @@ -6,18 +6,172 @@ // //===--===// +#include +#include +#include + #include "lldb/Host/Host.h" +#include "lldb/Host/linux/Support.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" +#include "lldb/Utility/ProcessInfo.h" #include "lldb/Utility/Status.h" +#include "llvm/BinaryFormat/XCOFF.h" +using namespace llvm; +using namespace lldb; using namespace lldb_private; +namespace { +enum class ProcessState { + Unknown, + Dead, + DiskSleep, + Idle, + Paging, + Parked, + Running, + Sleeping, + TracedOrStopped, + Zombie, +}; +} + +static bool GetStatusInfo(::pid_t Pid, ProcessInstanceInfo &ProcessInfo, + ProcessState &State, ::pid_t &TracerPid, + ::pid_t &Tgid) { + Log *log = GetLog(LLDBLog::Host); + + auto BufferOrError = getProcFile(Pid, "status"); + if (!BufferOrError) +return false; + + llvm::StringRef Rest = BufferOrError.get()->getBuffer(); + while (!Rest.empty()) { +llvm::StringRef Line; +std::tie(Line, Rest) = Rest.split('\n'); + +if (Line.consume_front("Gid:")) { + // Real, effective, saved set, and file system GIDs. Read the first two. + Line = Line.ltrim(); + uint32_t RGid, EGid; + Line.consumeInteger(10, RGid); + Line = Line.ltrim(); + Line.consumeInteger(10, EGid); + + ProcessInfo.SetGroupID(RGid); + ProcessInfo.SetEffectiveGroupID(EGid); +} else if (Line.consume_front("Uid:")) { + // Real, effective, saved set, and file system UIDs. Read the first two. + Line = Line.ltrim(); + uint32_t RUid, EUid; + Line.consumeInteger(10, RUid); + Line = Line.ltrim(); + Line.consumeInteger(10, EUid); + + ProcessInfo.SetUserID(RUid); + ProcessInfo.SetEffectiveUserID(EUid); +} else if (Line.consume_front("PPid:")) { + ::pid_t PPid; + Line.ltrim().consumeInteger(10, PPid); + ProcessInfo.SetParentProcessID(PPid); +} else if (Line.consume_front("State:")) { + State = llvm::StringSwitch(Line.ltrim().take_front(1)) + .Case("D", ProcessState::DiskSleep) + .Case("I", ProcessState::Idle) + .Case("R", ProcessState::Running) + .Case("S", ProcessState::Sleeping) + .CaseLower("T", ProcessState::TracedOrStopped) + .Case("W", ProcessState::Paging) + .Case("P", ProcessState::Parked) + .Case("X", ProcessState::Dead) + .Case("Z", ProcessState::Zombie) + .Default(ProcessState::Unknown); + if (State == ProcessState::Unknown) { +LLDB_LOG(log, "Unknown process state {0}", Line); + } +} else if (Line.consume_front("TracerPid:")) { + Line = Line.ltrim(); + Line.consumeInteger(10, TracerPid); +} else if (Line.consume_front("Tgid:")) { + Line = Line.ltrim(); + Line.consumeInteger(10, Tgid); +} + } + return true; +} + +static void GetExePathAndArch(::pid_t pid, ProcessInstanceInfo &process_info) { + Log *log = GetLog(LLDBLog::Process); + std::string ExePath(PATH_MAX, '\0'); + struct psinfo psinfoData; + + // We can't use getProcFile here because proc/[pid]/exe is a symbolic link. + llvm::SmallString<64> ProcExe; + (llvm::Twine("/proc/") + llvm::Twine(pid) + "/cwd").toVector(ProcExe); + + ssize_t len = readlink(ProcExe.c_str(), &ExePath[0], PATH_MAX); + if (len > 0) { +ExePath.resize(len); + +struct stat statData; + +std::ostringstream oss; + +oss << "/proc/" << std::dec << pid << "/psinfo"; +assert(stat(oss.str().c_str(), &statData) == 0); + +const int fd = open(oss.str().c_str(), O_RDONLY); +assert(fd >= 0); + +ssize_t readNum = read(fd, &psinfoData, sizeof(psinfoData)); +assert(readNum >= 0); + +close(fd); + } else { +LLDB_LOG(log, "failed to read link exe link for {0}: {1}", pid, + Status(errno, e
[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)
https://github.com/HemangGadhavi edited https://github.com/llvm/llvm-project/pull/134354 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)
@@ -141,6 +141,7 @@ else() add_host_subdirectory(aix aix/Host.cpp aix/HostInfoAIX.cpp + linux/Support.cpp HemangGadhavi wrote: Hey @labath Made the changes as per the discussion, I have added the common `posix/Support.cpp` for unix-like system, And kept as it as for three-arg overload linux specific and changed wherever it requires for getProcFile() Please review once and give your comments. Thanks https://github.com/llvm/llvm-project/pull/134354 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)
HemangGadhavi wrote: > > > We have a tests for this function in `unittests/Host/linux/HostTest.cpp` > > > and it looks like at least some of it should apply to other systems as > > > well. We could move it to the "posix" folder so that it applies to your > > > code as well. Depending on the size of linux-specific parts, we could > > > either keep them in the "linux" folder, or `#ifdef` them out > > > > > > Okay, we will create new PR to either move it to posix or we can create > > `HostTest.cpp` for aix separately. @labath or you want me to drop the > > testcase changes in same PR ? > > Let's do that here. The PR is small (as it should be) and it's good to have > tests together with the code being tested. Hi @labath I moved the `unittests/Host/linux/HostTest.cpp` & `SupportTest.cpp` under the `unittests/Host/posix/`, so that unix-like system can used it. Also I have `#ifdef` out some of the tests, which are not applicable for AIX and tested on Linux/AIX all testcases are passed . Please review it and give you comments. Thanks https://github.com/llvm/llvm-project/pull/134354 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)
@@ -7,21 +7,24 @@ //===--===// #include "lldb/Host/linux/Support.h" +#include "lldb/Host/posix/Support.h" #include "llvm/Support/Threading.h" #include "gtest/gtest.h" using namespace lldb_private; TEST(Support, getProcFile_Pid) { - auto BufferOrError = getProcFile(getpid(), "maps"); + auto BufferOrError = getProcFile(getpid(), "status"); HemangGadhavi wrote: I have changed from `maps` to `status` to test `getProcFile()` and here its only testing the `getProcFile()` functions. because `/proc/pid/status` is there in all the Linux, AIX and Android. https://github.com/llvm/llvm-project/pull/134354 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Override Should{Select, Show} in StopReasonBreakpoint (PR #135637)
https://github.com/felipepiovezan updated https://github.com/llvm/llvm-project/pull/135637 >From 0383630d48f60cf25d241deda909737869b65998 Mon Sep 17 00:00:00 2001 From: Felipe de Azevedo Piovezan Date: Mon, 14 Apr 2025 08:56:55 -0700 Subject: [PATCH] [lldb] Override Should{Select,Show} in StopReasonBreakpoint This is necessary so that LLDB does not select (or show the stop reason for) a thread which stopped at an internal breakpoint. Other than manual testing/inspection, which I've done, this does not seem to lend itself to API testing, as we cannot set internal breakpoints through the SBAPI. --- lldb/source/Target/StopInfo.cpp | 4 1 file changed, 4 insertions(+) diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp index f1272a723a8cb..3160446ae1d17 100644 --- a/lldb/source/Target/StopInfo.cpp +++ b/lldb/source/Target/StopInfo.cpp @@ -263,6 +263,10 @@ class StopInfoBreakpoint : public StopInfo { return bp_site_sp->GetSuggestedStackFrameIndex(); } + bool ShouldShow() const override { return !m_was_all_internal; } + + bool ShouldSelect() const override { return !m_was_all_internal; } + protected: bool ShouldStop(Event *event_ptr) override { // This just reports the work done by PerformAction or the synchronous ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Fix win32 build. (PR #135638)
https://github.com/dzhidzhoev approved this pull request. https://github.com/llvm/llvm-project/pull/135638 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Fix win32 build. (PR #135638)
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/135638 This enum was not fully specified. >From 1fe129959d425d8f298e111d73cfa88e429e3cfc Mon Sep 17 00:00:00 2001 From: John Harrison Date: Mon, 14 Apr 2025 09:07:48 -0700 Subject: [PATCH] [lldb-dap] Fix win32 build. This enum was not fully specified. --- lldb/tools/lldb-dap/Transport.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/tools/lldb-dap/Transport.cpp b/lldb/tools/lldb-dap/Transport.cpp index 96b8a48fdf61e..ffd0c49f1770b 100644 --- a/lldb/tools/lldb-dap/Transport.cpp +++ b/lldb/tools/lldb-dap/Transport.cpp @@ -38,7 +38,7 @@ ReadFull(IOObject &descriptor, size_t length, bool timeout_supported = true; // FIXME: SelectHelper does not work with NativeFile on Win32. #if _WIN32 - timeout_supported = descriptor.GetFdType() == eFDTypeSocket; + timeout_supported = descriptor.GetFdType() == IOObject::eFDTypeSocket; #endif if (timeout && timeout_supported) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Fix win32 build. (PR #135638)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: John Harrison (ashgti) Changes This enum was not fully specified. --- Full diff: https://github.com/llvm/llvm-project/pull/135638.diff 1 Files Affected: - (modified) lldb/tools/lldb-dap/Transport.cpp (+1-1) ``diff diff --git a/lldb/tools/lldb-dap/Transport.cpp b/lldb/tools/lldb-dap/Transport.cpp index 96b8a48fdf61e..ffd0c49f1770b 100644 --- a/lldb/tools/lldb-dap/Transport.cpp +++ b/lldb/tools/lldb-dap/Transport.cpp @@ -38,7 +38,7 @@ ReadFull(IOObject &descriptor, size_t length, bool timeout_supported = true; // FIXME: SelectHelper does not work with NativeFile on Win32. #if _WIN32 - timeout_supported = descriptor.GetFdType() == eFDTypeSocket; + timeout_supported = descriptor.GetFdType() == IOObject::eFDTypeSocket; #endif if (timeout && timeout_supported) { `` https://github.com/llvm/llvm-project/pull/135638 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)
ashgti wrote: PR #135638 should fix the build failure. https://github.com/llvm/llvm-project/pull/130169 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/133624 >From 3240fe49515e5f59c5b9ff9c02423b77504d8a43 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Fri, 28 Mar 2025 14:02:53 -0700 Subject: [PATCH 1/8] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. This converts a number of json::Value's into well defined types that are used throughout lldb-dap and updates the 'launch' command to use the new well defined types. --- .../test/tools/lldb-dap/dap_server.py | 3 +- .../test/tools/lldb-dap/lldbdap_testcase.py | 2 +- .../tools/lldb-dap/launch/TestDAP_launch.py | 6 +- .../restart/TestDAP_restart_runInTerminal.py | 4 +- .../runInTerminal/TestDAP_runInTerminal.py| 16 +- lldb/tools/lldb-dap/DAP.cpp | 82 +--- lldb/tools/lldb-dap/DAP.h | 44 +++-- .../lldb-dap/Handler/AttachRequestHandler.cpp | 33 ++-- .../lldb-dap/Handler/CompletionsHandler.cpp | 7 +- .../Handler/EvaluateRequestHandler.cpp| 3 +- .../lldb-dap/Handler/LaunchRequestHandler.cpp | 118 +++- .../tools/lldb-dap/Handler/RequestHandler.cpp | 96 +- lldb/tools/lldb-dap/Handler/RequestHandler.h | 19 +- .../Handler/RestartRequestHandler.cpp | 54 -- .../Handler/SetVariableRequestHandler.cpp | 3 +- .../Handler/StackTraceRequestHandler.cpp | 2 +- .../Handler/VariablesRequestHandler.cpp | 20 +- lldb/tools/lldb-dap/JSONUtils.cpp | 48 ++--- lldb/tools/lldb-dap/JSONUtils.h | 11 +- .../lldb-dap/Protocol/ProtocolRequests.cpp| 175 +- .../lldb-dap/Protocol/ProtocolRequests.h | 150 +++ lldb/tools/lldb-dap/SourceBreakpoint.cpp | 6 +- 22 files changed, 616 insertions(+), 286 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 01ef4b68f2653..6e13fcddcc933 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 @@ -862,7 +862,8 @@ def request_launch( args_dict["enableAutoVariableSummaries"] = enableAutoVariableSummaries args_dict["enableSyntheticChildDebugging"] = enableSyntheticChildDebugging args_dict["displayExtendedBacktrace"] = displayExtendedBacktrace -args_dict["commandEscapePrefix"] = commandEscapePrefix +if commandEscapePrefix: +args_dict["commandEscapePrefix"] = commandEscapePrefix command_dict = {"command": "launch", "type": "request", "arguments": args_dict} response = self.send_recv(command_dict) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py index 70b04b051e0ec..9ab8a905a79dd 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py @@ -443,7 +443,7 @@ def cleanup(): if not (response and response["success"]): self.assertTrue( -response["success"], "launch failed (%s)" % (response["message"]) +response["success"], "launch failed (%s)" % (response["body"]["error"]["format"]) ) return response diff --git a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py index 64c99019a1c9b..c6a3e9cc879a4 100644 --- a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py +++ b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py @@ -41,7 +41,9 @@ def test_termination(self): self.dap_server.request_disconnect() # Wait until the underlying lldb-dap process dies. - self.dap_server.process.wait(timeout=lldbdap_testcase.DAPTestCaseBase.timeoutval) +self.dap_server.process.wait( +timeout=lldbdap_testcase.DAPTestCaseBase.timeoutval +) # Check the return code self.assertEqual(self.dap_server.process.poll(), 0) @@ -459,7 +461,7 @@ def test_failing_launch_commands(self): self.assertFalse(response["success"]) self.assertRegex( -response["message"], +response["body"]["error"]["format"], r"Failed to run launch commands\. See the Debug Console for more details", ) diff --git a/lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py b/lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py index 5a9938c25c2c8..a94c9860c1508 100644 --- a/lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py +++ b/lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py @@ -21,7 +21,7 @@ def isTestSupported(self): return False @skipIfWindows -@skipIf(archs=["arm"]) #
[Lldb-commits] [lldb] 6b863e8 - [lldb-dap] Fix win32 build. (#135638)
Author: John Harrison Date: 2025-04-14T09:56:58-07:00 New Revision: 6b863e810d6decb689bff8f6620e8ea07b356d86 URL: https://github.com/llvm/llvm-project/commit/6b863e810d6decb689bff8f6620e8ea07b356d86 DIFF: https://github.com/llvm/llvm-project/commit/6b863e810d6decb689bff8f6620e8ea07b356d86.diff LOG: [lldb-dap] Fix win32 build. (#135638) This enum was not fully specified. Added: Modified: lldb/tools/lldb-dap/Transport.cpp Removed: diff --git a/lldb/tools/lldb-dap/Transport.cpp b/lldb/tools/lldb-dap/Transport.cpp index 96b8a48fdf61e..ffd0c49f1770b 100644 --- a/lldb/tools/lldb-dap/Transport.cpp +++ b/lldb/tools/lldb-dap/Transport.cpp @@ -38,7 +38,7 @@ ReadFull(IOObject &descriptor, size_t length, bool timeout_supported = true; // FIXME: SelectHelper does not work with NativeFile on Win32. #if _WIN32 - timeout_supported = descriptor.GetFdType() == eFDTypeSocket; + timeout_supported = descriptor.GetFdType() == IOObject::eFDTypeSocket; #endif if (timeout && timeout_supported) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 2d30a60 - [lldb-dap] Adding support for cancelling a request. (#130169)
Author: John Harrison Date: 2025-04-14T08:29:02-07:00 New Revision: 2d30a60e9ff8b22f7e07ca5360fe1582f96be1ac URL: https://github.com/llvm/llvm-project/commit/2d30a60e9ff8b22f7e07ca5360fe1582f96be1ac DIFF: https://github.com/llvm/llvm-project/commit/2d30a60e9ff8b22f7e07ca5360fe1582f96be1ac.diff LOG: [lldb-dap] Adding support for cancelling a request. (#130169) Adding support for cancelling requests. There are two forms of request cancellation. * Preemptively cancelling a request that is in the queue. * Actively cancelling the in progress request as a best effort attempt using `SBDebugger.RequestInterrupt()`. Added: lldb/test/API/tools/lldb-dap/cancel/Makefile lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py lldb/test/API/tools/lldb-dap/cancel/main.c lldb/tools/lldb-dap/Handler/CancelRequestHandler.cpp Modified: lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py lldb/tools/lldb-dap/CMakeLists.txt lldb/tools/lldb-dap/DAP.cpp lldb/tools/lldb-dap/DAP.h lldb/tools/lldb-dap/Handler/RequestHandler.cpp lldb/tools/lldb-dap/Handler/RequestHandler.h lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp lldb/tools/lldb-dap/Protocol/ProtocolRequests.h lldb/tools/lldb-dap/Transport.cpp lldb/tools/lldb-dap/Transport.h lldb/tools/lldb-dap/lldb-dap.cpp Removed: diff --git a/lldb/test/API/tools/lldb-dap/cancel/Makefile b/lldb/test/API/tools/lldb-dap/cancel/Makefile new file mode 100644 index 0..10495940055b6 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/cancel/Makefile @@ -0,0 +1,3 @@ +C_SOURCES := main.c + +include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py b/lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py new file mode 100644 index 0..ca4cc0ee2f77a --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py @@ -0,0 +1,101 @@ +""" +Test lldb-dap cancel request +""" + +import time + +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +import lldbdap_testcase + + +class TestDAP_launch(lldbdap_testcase.DAPTestCaseBase): +def send_async_req(self, command: str, arguments={}) -> int: +seq = self.dap_server.sequence +self.dap_server.send_packet( +{ +"type": "request", +"command": command, +"arguments": arguments, +} +) +return seq + +def async_blocking_request(self, duration: float) -> int: +""" +Sends an evaluate request that will sleep for the specified duration to +block the request handling thread. +""" +return self.send_async_req( +command="evaluate", +arguments={ +"expression": '`script import time; print("starting sleep", file=lldb.debugger.GetOutputFileHandle()); time.sleep({})'.format( +duration +), +"context": "repl", +}, +) + +def async_cancel(self, requestId: int) -> int: +return self.send_async_req(command="cancel", arguments={"requestId": requestId}) + +def test_pending_request(self): +""" +Tests cancelling a pending request. +""" +program = self.getBuildArtifact("a.out") +self.build_and_launch(program, stopOnEntry=True) +self.continue_to_next_stop() + +# Use a relatively short timeout since this is only to ensure the +# following request is queued. +blocking_seq = self.async_blocking_request(duration=1.0) +# Use a longer timeout to ensure we catch if the request was interrupted +# properly. +pending_seq = self.async_blocking_request(duration=self.timeoutval / 2) +cancel_seq = self.async_cancel(requestId=pending_seq) + +blocking_resp = self.dap_server.recv_packet(filter_type=["response"]) +self.assertEqual(blocking_resp["request_seq"], blocking_seq) +self.assertEqual(blocking_resp["command"], "evaluate") +self.assertEqual(blocking_resp["success"], True) + +pending_resp = self.dap_server.recv_packet(filter_type=["response"]) +self.assertEqual(pending_resp["request_seq"], pending_seq) +self.assertEqual(pending_resp["command"], "evaluate") +self.assertEqual(pending_resp["success"], False) +self.assertEqual(pending_resp["message"], "cancelled") + +cancel_resp = self.dap_server.recv_packet(filter_type=["response"]) +self.assertEqual(cancel_resp["request_seq"], cancel_seq) +self.assertEqual(cancel_resp["command"], "cancel") +self.assertEqual(cancel_resp["success"], True) +self.continue_to_exit() + +def test_inflight_request(self): +""" +Tests cancelling an inflight request. +""" +program = self.getBuildArtifact("a.out"
[Lldb-commits] [lldb] [lldb] Fix SBTarget::ReadInstruction with flavor (PR #134626)
da-viper wrote: /cherrypick dda53bef35c5ab49967e8755e69ce893ecb525c4 5b384c3015100ad815f4d994d7ef35cc947db711 https://github.com/llvm/llvm-project/pull/134626 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add unary operators Dereference and AddressOf to DIL (PR #134428)
@@ -18,6 +18,22 @@ namespace lldb_private::dil { +static lldb::ValueObjectSP +ArrayToPointerConversion(lldb::ValueObjectSP valobj, + std::shared_ptr ctx) { + assert(valobj->IsArrayType() && + "an argument to array-to-pointer conversion must be an array"); + + uint64_t addr = valobj->GetLoadAddress(); + llvm::StringRef name = "result"; + ExecutionContext exe_ctx; + ctx->CalculateExecutionContext(exe_ctx); + return ValueObject::CreateValueObjectFromAddress( + name, addr, exe_ctx, + valobj->GetCompilerType().GetArrayElementType(ctx.get()).GetPointerType(), + /* do_deref */ false); +} + kuilpd wrote: Should I make a separate PR and merge this one as is? As I understand, I should make a `CompilerType::Dereference` function that calls `TypeSystem::Dereference` that will be implemented in `TypeSystemClang`? And then call that function from `ValueObject::Dereference` instead of `GetChildCompilerTypeAtIndex`, but without type checks beforehand. https://github.com/llvm/llvm-project/pull/134428 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland: [clang] preserve class type sugar when taking pointer to member (PR #132401)
mizvekov wrote: One thing that looks fishy, but that is even a different node, is this early return on `VisitSubstNonTypeTemplateParmPackExpr` in `ASTReaderStmt`. ```C++ if (ArgPack.getKind() != TemplateArgument::Pack) return; ``` This looks impossible to hit, because `getArgumentPack` calls a constructor which can only return Packs. Can you turn that into an assert and try again? ```C++ assert (ArgPack.getKind() == TemplateArgument::Pack); ``` https://github.com/llvm/llvm-project/pull/132401 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Fix win32 build. (PR #135638)
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/135638 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Fix win32 build. (PR #135638)
slydiman wrote: @ashgti Did you test #130169 on Windows? This patch will fix the building, but I'm not sure that it will work on Windows considering this: ``` // TODO: On Windows this should be a HANDLE, and wait should use // WaitForMultipleObjects typedef int WaitableHandle; IOObject::WaitableHandle Socket::GetWaitableHandle() { // TODO: On Windows, use WSAEventSelect return m_socket; } ``` It seems you need a Windows specific implementation. https://github.com/llvm/llvm-project/pull/135638 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland: [clang] preserve class type sugar when taking pointer to member (PR #132401)
eaeltsin wrote: Comparing bcanalyzer --dump outputs for non-deterministic pcms, I see a lot of op values that differ by 1. I wonder if this might be something like the mismatch of Read Write UnsignedOrNone vs unsigned ... https://github.com/llvm/llvm-project/pull/132401 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix use-color settings not persistent (PR #135626)
https://github.com/da-viper created https://github.com/llvm/llvm-project/pull/135626 Fixes https://github.com/llvm/llvm-project/issues/22981 Do you think it is necessary for the`SetUseColor` to return a bool for the interface >From 0487d125beb27f87acc2c137b1554e08a52d195d Mon Sep 17 00:00:00 2001 From: Ebuka Ezike Date: Mon, 14 Apr 2025 12:08:38 +0100 Subject: [PATCH 1/2] [lldb] Fix use-color has no effect after starting lldb the m_color option in Editline cannot be updated after its construction. the commit fixes that Fixes #22981 Signed-off-by: Ebuka Ezike --- lldb/include/lldb/Core/IOHandler.h| 8 lldb/include/lldb/Host/Editline.h | 11 +++ .../include/lldb/Interpreter/CommandInterpreter.h | 2 ++ lldb/source/Core/Debugger.cpp | 14 -- lldb/source/Core/IOHandler.cpp| 15 +++ lldb/source/Host/common/Editline.cpp | 2 ++ lldb/source/Interpreter/CommandInterpreter.cpp| 7 ++- 7 files changed, 52 insertions(+), 7 deletions(-) diff --git a/lldb/include/lldb/Core/IOHandler.h b/lldb/include/lldb/Core/IOHandler.h index 794d229bc1337..fba1e158bf7eb 100644 --- a/lldb/include/lldb/Core/IOHandler.h +++ b/lldb/include/lldb/Core/IOHandler.h @@ -99,6 +99,12 @@ class IOHandler { // Prompt support isn't mandatory return false; } + + virtual bool SetUseColor(bool use_color) { +// Use color isn't mandatory +return false; + }; + bool SetPrompt(const char *) = delete; virtual llvm::StringRef GetControlSequence(char ch) { return {}; } @@ -375,6 +381,8 @@ class IOHandlerEditline : public IOHandler { bool SetPrompt(llvm::StringRef prompt) override; bool SetPrompt(const char *prompt) = delete; + bool SetUseColor(bool use_color) override; + const char *GetContinuationPrompt(); void SetContinuationPrompt(llvm::StringRef prompt); diff --git a/lldb/include/lldb/Host/Editline.h b/lldb/include/lldb/Host/Editline.h index 705ec9c49f7c7..c202a76758e13 100644 --- a/lldb/include/lldb/Host/Editline.h +++ b/lldb/include/lldb/Host/Editline.h @@ -168,6 +168,9 @@ class Editline { DisplayCompletions(Editline &editline, llvm::ArrayRef results); + /// Sets if editline should use color. + void UseColor(bool use_color); + /// Sets a string to be used as a prompt, or combined with a line number to /// form a prompt. void SetPrompt(const char *prompt); @@ -223,21 +226,29 @@ class Editline { void SetPromptAnsiPrefix(std::string prefix) { if (m_color) m_prompt_ansi_prefix = std::move(prefix); +else + m_prompt_ansi_prefix.clear(); } void SetPromptAnsiSuffix(std::string suffix) { if (m_color) m_prompt_ansi_suffix = std::move(suffix); +else + m_prompt_ansi_suffix.clear(); } void SetSuggestionAnsiPrefix(std::string prefix) { if (m_color) m_suggestion_ansi_prefix = std::move(prefix); +else + m_suggestion_ansi_prefix.clear(); } void SetSuggestionAnsiSuffix(std::string suffix) { if (m_color) m_suggestion_ansi_suffix = std::move(suffix); +else + m_suggestion_ansi_suffix.clear(); } /// Prompts for and reads a single line of user input. diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h index b65edcf68b251..724d88d65f6ac 100644 --- a/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -476,6 +476,8 @@ class CommandInterpreter : public Broadcaster, void UpdatePrompt(llvm::StringRef prompt); + void UpdateUseColor(bool use_color); + bool Confirm(llvm::StringRef message, bool default_answer); void LoadCommandDictionary(); diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index ce6fb6ed5ec54..2f79415a959e3 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -237,16 +237,16 @@ Status Debugger::SetPropertyValue(const ExecutionContext *exe_ctx, CommandInterpreter::eBroadcastBitResetPrompt, bytes.release()); GetCommandInterpreter().BroadcastEvent(prompt_change_event_sp); } else if (property_path == g_debugger_properties[ePropertyUseColor].name) { - // use-color changed. Ping the prompt so it can reset the ansi terminal - // codes. - SetPrompt(GetPrompt()); + // use-color changed. set use-color, this also pings the prompt so it can + // reset the ansi terminal codes. + SetUseColor(GetUseColor()); } else if (property_path == g_debugger_properties[ePropertyPromptAnsiPrefix].name || property_path == g_debugger_properties[ePropertyPromptAnsiSuffix].name) { - // Prompt colors changed. Ping the prompt so it can reset the ansi - // terminal codes. - SetPrompt(GetPrompt()); + // Prompt color changed.
[Lldb-commits] [lldb] [lldb][AArch64] Fix Apple M4 on Linux (PR #135563)
https://github.com/laverdet closed https://github.com/llvm/llvm-project/pull/135563 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `lldb-remote-linux-win` running on `as-builder-10` while building `lldb` at step 8 "build-default". Full details are available at: https://lab.llvm.org/buildbot/#/builders/197/builds/3983 Here is the relevant piece of the build log for the reference ``` Step 8 (build-default) failure: cmake (failure) ... 65.993 [210/75/5142]Linking CXX executable bin\llvm-cgdata.exe 66.009 [209/75/5143]Building CXX object tools\clang\tools\clang-refactor\CMakeFiles\clang-refactor.dir\ClangRefactor.cpp.obj 66.053 [209/74/5144]Building CXX object tools\clang\lib\StaticAnalyzer\Checkers\CMakeFiles\obj.clangStaticAnalyzerCheckers.dir\WebKit\RefCntblBaseVirtualDtorChecker.cpp.obj 66.053 [209/73/5145]Linking CXX executable bin\llvm-cfi-verify.exe 66.069 [208/73/5146]Linking CXX static library lib\lldbPluginSymbolFileNativePDB.lib 66.078 [207/73/5147]Building CXX object tools\clang\lib\StaticAnalyzer\Checkers\CMakeFiles\obj.clangStaticAnalyzerCheckers.dir\WebKit\RawPtrRefLocalVarsChecker.cpp.obj 66.150 [207/72/5148]Linking CXX executable bin\llc.exe 66.263 [206/72/5149]Linking CXX static library lib\lldbPluginSymbolFileDWARF.lib 66.398 [205/72/5150]Building CXX object tools\clang\tools\libclang\CMakeFiles\libclang.dir\CIndex.cpp.obj 66.427 [205/71/5151]Building CXX object tools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\Transport.cpp.obj FAILED: tools/lldb/tools/lldb-dap/CMakeFiles/lldb-dap.dir/Transport.cpp.obj ccache C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\cl.exe /nologo /TP -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_GLIBCXX_ASSERTIONS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\tools\lldb-dap -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\tools\lldb-dap -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\include -IC:\Python312\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\..\clang\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\..\clang\include -D__OPTIMIZE__ /Zc:inline /Zc:preprocessor /Zc:__cplusplus /Oi /bigobj /permissive- /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -wd4251 -wd4275 -w14062 -we4238 /Gw /O2 /Ob2 -MD -wd4018 -wd4068 -wd4150 -wd4201 -wd4251 -wd4521 -wd4530 -wd4589 /EHs-c- /GR- -UNDEBUG -std:c++17 /showIncludes /Fotools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\Transport.cpp.obj /Fdtools\lldb\tools\lldb-dap\CMakeFiles\lldb-dap.dir\ /FS -c C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\tools\lldb-dap\Transport.cpp C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\tools\lldb-dap\Transport.cpp(41): error C2065: 'eFDTypeSocket': undeclared identifier 66.435 [205/70/5152]Linking CXX executable bin\llvm-cvtres.exe 66.551 [205/69/5153]Linking CXX executable bin\llvm-cxxfilt.exe 66.566 [205/68/5154]Building CXX object tools\lldb\source\Commands\CMakeFiles\lldbCommands.dir\CommandObjectTarget.cpp.obj 66.588 [205/67/5155]Building CXX object tools\clang\lib\StaticAnalyzer\Checkers\CMakeFiles\obj.clangStaticAnalyzerCheckers.dir\WebKit\RetainPtrCtorAdoptChecker.cpp.obj 66.600 [205/66/5156]Building CXX object tools\clang\tools\libclang\CMakeFiles\libclang.dir\Indexing.cpp.obj 66.697 [205/65/5157]Linking CXX executable bin\llvm-cov.exe 66.723 [205/64/5158]Building CXX object tools\clang\tools\libclang\CMakeFiles\libclang.dir\CXExtractAPI.cpp.obj 66.831 [205/63/5159]Building CXX object tools\lldb\tools\lldb-instr\CMakeFiles\lldb-instr.dir\Instrument.cpp.obj 66.947 [205/62/5160]Building CXX object tools\clang\tools\clang-installapi\CMakeFiles\clang-installapi.dir\ClangInstallAPI.cpp.obj 66.971 [205/61/5161]Building CXX object tools\lldb\source\Plugins\ExpressionParser\Clang\CMakeFiles\lldbPluginExpressionParserClang.dir\ASTResultSynthesizer.cpp.obj 67.000 [205/60/5162]Building CXX object tools\lldb\source\Plugins\ExpressionParser\Clang\CMakeFiles\lldbPluginExpressionParserClang.dir\ClangModulesDeclVendor.cpp.obj 67.046 [205/59/5163]Building CXX object tools\lldb\source\Plugins\ExpressionParser\Clang\CMakeFiles\lldbPluginExpressionParserClang.dir\ASTStructExtractor.cpp.obj 67.107 [205/58/5164]Building CXX object tools\clang\tools\clan
[Lldb-commits] [lldb] [lldb] Override Should{Select, Show} in StopReasonBreakpoint (PR #135637)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Felipe de Azevedo Piovezan (felipepiovezan) Changes This is necessary so that LLDB does not select (or show the stop reason for) a thread which stopped at an internal breakpoint. Other than manual testing/inspection, which I've done, this does not seem to lend itself to API testing, as we cannot set internal breakpoints through the SBAPI. --- Full diff: https://github.com/llvm/llvm-project/pull/135637.diff 1 Files Affected: - (modified) lldb/source/Target/StopInfo.cpp (+8) ``diff diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp index f1272a723a8cb..6bdc467af6746 100644 --- a/lldb/source/Target/StopInfo.cpp +++ b/lldb/source/Target/StopInfo.cpp @@ -263,6 +263,14 @@ class StopInfoBreakpoint : public StopInfo { return bp_site_sp->GetSuggestedStackFrameIndex(); } + bool ShouldShow() const override { +return !m_was_all_internal; + } + + bool ShouldSelect() const override { +return !m_was_all_internal; + } + protected: bool ShouldStop(Event *event_ptr) override { // This just reports the work done by PerformAction or the synchronous `` https://github.com/llvm/llvm-project/pull/135637 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland: [clang] preserve class type sugar when taking pointer to member (PR #132401)
eaeltsin wrote: Using library with assertions, I'm seeing out-of-bounds source location read called from `ASTStmtReader::VisitSubstNonTypeTemplateParmExpr` - [trace](https://gist.github.com/eaeltsin/845fb9cc6f65f47ed03a64aca5aff923) https://github.com/llvm/llvm-project/pull/132401 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Override Should{Select, Show} in StopReasonBreakpoint (PR #135637)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff HEAD~1 HEAD --extensions cpp -- lldb/source/Target/StopInfo.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp index 6bdc467af..3160446ae 100644 --- a/lldb/source/Target/StopInfo.cpp +++ b/lldb/source/Target/StopInfo.cpp @@ -263,13 +263,9 @@ public: return bp_site_sp->GetSuggestedStackFrameIndex(); } - bool ShouldShow() const override { -return !m_was_all_internal; - } + bool ShouldShow() const override { return !m_was_all_internal; } - bool ShouldSelect() const override { -return !m_was_all_internal; - } + bool ShouldSelect() const override { return !m_was_all_internal; } protected: bool ShouldStop(Event *event_ptr) override { `` https://github.com/llvm/llvm-project/pull/135637 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/130169 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)
@@ -9,127 +9,66 @@ #include "DAP.h" #include "EventHelper.h" #include "JSONUtils.h" +#include "Protocol/ProtocolRequests.h" #include "RequestHandler.h" #include "llvm/Support/FileSystem.h" namespace lldb_dap { -// "LaunchRequest": { -// "allOf": [ { "$ref": "#/definitions/Request" }, { -// "type": "object", -// "description": "Launch request; value of command field is 'launch'.", -// "properties": { -// "command": { -// "type": "string", -// "enum": [ "launch" ] -// }, -// "arguments": { -// "$ref": "#/definitions/LaunchRequestArguments" -// } -// }, -// "required": [ "command", "arguments" ] -// }] -// }, -// "LaunchRequestArguments": { -// "type": "object", -// "description": "Arguments for 'launch' request.", -// "properties": { -// "noDebug": { -// "type": "boolean", -// "description": "If noDebug is true the launch request should launch -// the program without enabling debugging." -// } -// } -// }, -// "LaunchResponse": { -// "allOf": [ { "$ref": "#/definitions/Response" }, { -// "type": "object", -// "description": "Response to 'launch' request. This is just an -// acknowledgement, so no body field is required." -// }] -// } -void LaunchRequestHandler::operator()(const llvm::json::Object &request) const { - dap.is_attach = false; - dap.last_launch_or_attach_request = request; - llvm::json::Object response; - FillResponse(request, response); - const auto *arguments = request.getObject("arguments"); - dap.configuration.initCommands = GetStrings(arguments, "initCommands"); - dap.configuration.preRunCommands = GetStrings(arguments, "preRunCommands"); - dap.configuration.stopCommands = GetStrings(arguments, "stopCommands"); - dap.configuration.exitCommands = GetStrings(arguments, "exitCommands"); - dap.configuration.terminateCommands = - GetStrings(arguments, "terminateCommands"); - dap.configuration.postRunCommands = GetStrings(arguments, "postRunCommands"); - dap.stop_at_entry = GetBoolean(arguments, "stopOnEntry").value_or(false); - const llvm::StringRef debuggerRoot = - GetString(arguments, "debuggerRoot").value_or(""); - dap.configuration.enableAutoVariableSummaries = - GetBoolean(arguments, "enableAutoVariableSummaries").value_or(false); - dap.configuration.enableSyntheticChildDebugging = - GetBoolean(arguments, "enableSyntheticChildDebugging").value_or(false); - dap.configuration.displayExtendedBacktrace = - GetBoolean(arguments, "displayExtendedBacktrace").value_or(false); - dap.configuration.commandEscapePrefix = - GetString(arguments, "commandEscapePrefix").value_or("`"); - dap.SetFrameFormat(GetString(arguments, "customFrameFormat").value_or("")); - dap.SetThreadFormat(GetString(arguments, "customThreadFormat").value_or("")); +/// Launch request; value of command field is 'launch'. +llvm::Expected LaunchRequestHandler::Run( +const protocol::LaunchRequestArguments &arguments) const { + dap.SetConfiguration(arguments.configuration, /*is_attach=*/false); + dap.last_launch_request = arguments; + dap.stop_at_entry = arguments.stopOnEntry; PrintWelcomeMessage(); // This is a hack for loading DWARF in .o files on Mac where the .o files // in the debug map of the main executable have relative paths which // require the lldb-dap binary to have its working directory set to that // relative root for the .o files in order to be able to load debug info. + const std::string debuggerRoot = dap.configuration.debuggerRoot.value_or(""); if (!debuggerRoot.empty()) llvm::sys::fs::set_current_path(debuggerRoot); // Run any initialize LLDB commands the user specified in the launch.json. // This is run before target is created, so commands can't do anything with // the targets - preRunCommands are run with the target. - if (llvm::Error err = dap.RunInitCommands()) { -response["success"] = false; -EmplaceSafeString(response, "message", llvm::toString(std::move(err))); -dap.SendJSON(llvm::json::Value(std::move(response))); -return; - } + if (llvm::Error err = dap.RunInitCommands()) +return err; - SetSourceMapFromArguments(*arguments); + dap.ConfigureSourceMaps(); lldb::SBError status; - dap.SetTarget(dap.CreateTargetFromArguments(*arguments, status)); - if (status.Fail()) { -response["success"] = llvm::json::Value(false); -EmplaceSafeString(response, "message", status.GetCString()); -dap.SendJSON(llvm::json::Value(std::move(response))); -return; - } + dap.SetTarget(dap.CreateTargetFromArguments( + arguments.program.value_or(""), arguments.targetTriple.value_or(""), + arguments.platformName.value_or(""), status)); + if (status.Fail()) +return llvm::make_error(status.GetCString()); // Run any pre run LLDB commands the user specified in the launch.json - if (llvm::Error err =
[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)
@@ -33,15 +35,12 @@ MakeArgv(const llvm::ArrayRef &strs) { return argv; } -static uint32_t SetLaunchFlag(uint32_t flags, const llvm::json::Object *obj, - llvm::StringRef key, lldb::LaunchFlags mask) { - if (const auto opt_value = GetBoolean(obj, key)) { -if (*opt_value) - flags |= mask; -else - flags &= ~mask; - } - +static uint32_t SetLaunchFlag(uint32_t flags, bool opt, + lldb::LaunchFlags mask) { + if (opt) +flags |= mask; + else +flags &= ~mask; return flags; } ashgti wrote: Converted the bools back to optionals. https://github.com/llvm/llvm-project/pull/133624 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Fix win32 build. (PR #135638)
ashgti wrote: This should fix https://lab.llvm.org/buildbot/#/builders/197/builds/3983 https://github.com/llvm/llvm-project/pull/135638 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland: [clang] preserve class type sugar when taking pointer to member (PR #132401)
eaeltsin wrote: Didn't fire so far. Though this is non-deterministic, I might be (un)lucky. https://github.com/llvm/llvm-project/pull/132401 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Draft: test (PR #135630)
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/135630 >From a1320e77fc49c78a5915335e07c7eb7e8823cd0a Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Mon, 14 Apr 2025 11:56:01 -0300 Subject: [PATCH] Draft: test With change: 1) 4m46s - https://buildkite.com/llvm-project/github-pull-requests/builds/168411#_ 2) 4m36s - https://buildkite.com/llvm-project/github-pull-requests/builds/168431#01963503-57a4-4934-9de8-f298abe3c432 3) 4m05s - https://buildkite.com/llvm-project/github-pull-requests/builds/168455#01963544-0108-4474-bcfe-781e6facc804 --- lldb/DELETE.ME | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 lldb/DELETE.ME diff --git a/lldb/DELETE.ME b/lldb/DELETE.ME new file mode 100644 index 0..e69de29bb2d1d ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] Draft: test (PR #135630)
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/135630 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [CI] monolithic-linux improvements (PR #135499)
@@ -52,6 +52,8 @@ "clang": {"clang-tools-extra", "compiler-rt", "cross-project-tests"}, "clang-tools-extra": {"libc"}, "mlir": {"flang"}, +# Test everyything if ci scripts are changed. +".ci": {"llvm", "clang", "lld", "lldb"}, boomanaiden154 wrote: It doesn't seem like anything actually got fixed here? https://github.com/llvm/llvm-project/pull/135499 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [CI] monolithic-linux improvements (PR #135499)
@@ -49,17 +52,31 @@ trap at-exit EXIT projects="${1}" targets="${2}" +runtimes="${3}" lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests" echo "--- cmake" export PIP_BREAK_SYSTEM_PACKAGES=1 + pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt + +# This is an lldb requirement which is not listed above. +pip install -q swig + +# Set the system llvm-symbolizer as preferred. +export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer` +[[ ! -f "${LLVM_SYMBOLIZER_PATH}" ]] && echo "llvm-symbolizer not found!" + +# Set up all runtimes either way. libcxx is a dependency of LLDB. boomanaiden154 wrote: What's the build/test time impact because of this? We need to make sure we account for capacity constraints. https://github.com/llvm/llvm-project/pull/135499 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [CI] monolithic-linux improvements (PR #135499)
@@ -49,17 +52,31 @@ trap at-exit EXIT projects="${1}" targets="${2}" +runtimes="${3}" lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests" echo "--- cmake" export PIP_BREAK_SYSTEM_PACKAGES=1 + pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt + +# This is an lldb requirement which is not listed above. +pip install -q swig + +# Set the system llvm-symbolizer as preferred. +export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer` +[[ ! -f "${LLVM_SYMBOLIZER_PATH}" ]] && echo "llvm-symbolizer not found!" + +# Set up all runtimes either way. libcxx is a dependency of LLDB. mizvekov wrote: I am not sure what impact you mean. This p https://github.com/llvm/llvm-project/pull/135499 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxxabi] [lldb] [llvm] [lldb] Add frame-format option to highlight function names in backtraces (PR #131836)
Michael137 wrote: Latest set of commits should be reviewable. I updated the PR description with an overview of the commits. One remaining issue I haven't dealt with yet is `TestCxxFrameFormatRecursive.test` where we set the `plugin.cplusplus.language.function-name-format` variable to `${function.name-with-args}`. Which would cause infinite recursion as `${function.name-with-args}` tries to format according to `plugin.cplusplus.language.function-name-format`. Don't think we've had precendent for something like that yet, so there aren't any safeguards for this https://github.com/llvm/llvm-project/pull/131836 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] cbbf562 - [lldb][Format][NFC] Remove unused FormatEntity::FormatCString
Author: Michael Buch Date: 2025-04-14T13:42:35+01:00 New Revision: cbbf562d1c2a076de83d50fedfee78acfb4d8003 URL: https://github.com/llvm/llvm-project/commit/cbbf562d1c2a076de83d50fedfee78acfb4d8003 DIFF: https://github.com/llvm/llvm-project/commit/cbbf562d1c2a076de83d50fedfee78acfb4d8003.diff LOG: [lldb][Format][NFC] Remove unused FormatEntity::FormatCString One can use `FormatStringRef` instead anyway Added: Modified: lldb/include/lldb/Core/FormatEntity.h lldb/source/Core/FormatEntity.cpp Removed: diff --git a/lldb/include/lldb/Core/FormatEntity.h b/lldb/include/lldb/Core/FormatEntity.h index 51e9ce37e54e7..c3f147ea3a7a2 100644 --- a/lldb/include/lldb/Core/FormatEntity.h +++ b/lldb/include/lldb/Core/FormatEntity.h @@ -217,11 +217,6 @@ bool FormatStringRef(const llvm::StringRef &format, Stream &s, const Address *addr, ValueObject *valobj, bool function_changed, bool initial_function); -bool FormatCString(const char *format, Stream &s, const SymbolContext *sc, - const ExecutionContext *exe_ctx, const Address *addr, - ValueObject *valobj, bool function_changed, - bool initial_function); - Status Parse(const llvm::StringRef &format, Entry &entry); Status ExtractVariableInfo(llvm::StringRef &format_str, diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index 23e5999bd80cb..fc4359d7d310a 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -1235,23 +1235,6 @@ bool FormatEntity::FormatStringRef(const llvm::StringRef &format_str, Stream &s, return false; } -bool FormatEntity::FormatCString(const char *format, Stream &s, - const SymbolContext *sc, - const ExecutionContext *exe_ctx, - const Address *addr, ValueObject *valobj, - bool function_changed, bool initial_function) { - if (format && format[0]) { -FormatEntity::Entry root; -llvm::StringRef format_str(format); -Status error = FormatEntity::Parse(format_str, root); -if (error.Success()) { - return FormatEntity::Format(root, s, sc, exe_ctx, addr, valobj, - function_changed, initial_function); -} - } - return false; -} - bool FormatEntity::Format(const Entry &entry, Stream &s, const SymbolContext *sc, const ExecutionContext *exe_ctx, const Address *addr, ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] returning command completions up to a maximum (PR #135565)
@@ -157,6 +162,23 @@ class CompletionRequest { size_t GetCursorIndex() const { return m_cursor_index; } + size_t GetMaxReturnElements() const { return m_max_return_elements; } + + /// Returns true if the maximum number of completions has been reached + /// already. + bool ShouldStopAddingResults() const { +return m_result.GetNumberOfResults() >= m_max_return_elements; + } JDevlieghere wrote: I would consider inverting this to avoid the double negation in the for-loop. ```suggestion bool ShouldAddResult() const { return m_result.GetNumberOfResults() < m_max_return_elements; } ``` https://github.com/llvm/llvm-project/pull/135565 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)
https://github.com/HemangGadhavi edited https://github.com/llvm/llvm-project/pull/134354 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Reapply refactored CPlusPlusLanguage::MethodName to break lldb-server dependencies (PR #135033)
slydiman wrote: Ping https://github.com/llvm/llvm-project/pull/135033 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] returning command completions up to a maximum (PR #135565)
https://github.com/JDevlieghere commented: This definitely needs a test. https://github.com/llvm/llvm-project/pull/135565 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 73b554d - [lldb] Make sure the process is stopped when computing the symbol context (#135458)
Author: Jonas Devlieghere Date: 2025-04-14T10:09:43+02:00 New Revision: 73b554d7a0a666e252f3c837510a55ee1acb1df5 URL: https://github.com/llvm/llvm-project/commit/73b554d7a0a666e252f3c837510a55ee1acb1df5 DIFF: https://github.com/llvm/llvm-project/commit/73b554d7a0a666e252f3c837510a55ee1acb1df5.diff LOG: [lldb] Make sure the process is stopped when computing the symbol context (#135458) Make sure the process is stopped when computing the symbol context. Both Adrian and Felipe reported a handful of crashes in GetSymbolContext called from Statusline::Redraw on the default event thread. Given that we're handling a StackFrameSP, it's not clear to me how that could have gotten invalidated, but Jim points out that it doesn't make sense to compute the symbol context for the frame when the process isn't stopped. Depends on #135455 Added: Modified: lldb/source/Core/Statusline.cpp Removed: diff --git a/lldb/source/Core/Statusline.cpp b/lldb/source/Core/Statusline.cpp index ed5308ef53eb0..e14691e2538a2 100644 --- a/lldb/source/Core/Statusline.cpp +++ b/lldb/source/Core/Statusline.cpp @@ -12,6 +12,7 @@ #include "lldb/Host/StreamFile.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Target/Process.h" #include "lldb/Target/StackFrame.h" #include "lldb/Utility/AnsiTerminal.h" #include "lldb/Utility/StreamString.h" @@ -134,8 +135,15 @@ void Statusline::Redraw(bool update) { exe_ctx.SetTargetPtr(&m_debugger.GetSelectedOrDummyTarget()); SymbolContext symbol_ctx; - if (auto frame_sp = exe_ctx.GetFrameSP()) -symbol_ctx = frame_sp->GetSymbolContext(eSymbolContextEverything); + if (ProcessSP process_sp = exe_ctx.GetProcessSP()) { +// Check if the process is stopped, and if it is, make sure it remains +// stopped until we've computed the symbol context. +Process::StopLocker stop_locker; +if (stop_locker.TryLock(&process_sp->GetRunLock())) { + if (auto frame_sp = exe_ctx.GetFrameSP()) +symbol_ctx = frame_sp->GetSymbolContext(eSymbolContextEverything); +} + } StreamString stream; if (auto *format = m_debugger.GetStatuslineFormat()) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] fix inconsistent debugAdapterHostname argument name (PR #135544)
JDevlieghere wrote: CC @matthewbastien https://github.com/llvm/llvm-project/pull/135544 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxxabi] [lldb] [llvm] [lldb] Add new per-language frame-format variables for formatting function names (PR #131836)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/131836 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] fix inconsistent debugAdapterHostname argument name (PR #135544)
https://github.com/JDevlieghere approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/135544 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxxabi] [lldb] [llvm] [lldb] Add new per-language frame-format variables for formatting function names (PR #131836)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/131836 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxxabi] [lldb] [llvm] [lldb] Add new per-language frame-format variables for formatting function names (PR #131836)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/131836 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxxabi] [lldb] [llvm] [lldb] Add new per-language frame-format variables for formatting function names (PR #131836)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/131836 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [CI] monolithic-linux improvements (PR #135499)
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/135499 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxxabi] [lldb] [llvm] [lldb] Add frame-format option to highlight function names in backtraces (PR #131836)
@@ -208,6 +209,152 @@ static bool PrettyPrintFunctionNameWithArgs(Stream &out_stream, return true; } +static std::optional GetDemangledBasename(Function &function) { + auto demangled_name = function.GetName().GetStringRef(); + if (demangled_name.empty()) +return std::nullopt; + + const std::optional &info = + function.GetMangled().GetDemangledInfo(); + if (!info) +return std::nullopt; + + // Function without a basename is nonsense. + if (!info->hasBasename()) +return std::nullopt; + + assert(info->BasenameRange.first < demangled_name.size()); + assert(info->BasenameRange.second < demangled_name.size()); + + return demangled_name.substr(info->BasenameRange.first, + info->BasenameRange.second - + info->BasenameRange.first); +} + +static std::optional +GetDemangledTemplateArguments(Function &function) { + auto demangled_name = function.GetName().GetStringRef(); + if (demangled_name.empty()) +return std::nullopt; + + const std::optional &info = + function.GetMangled().GetDemangledInfo(); + if (!info) +return std::nullopt; + + // Function without a basename is nonsense. + if (!info->hasBasename()) +return std::nullopt; + + assert(info->BasenameRange.second < demangled_name.size()); + assert(info->ArgumentsRange.first < demangled_name.size()); + assert(info->ArgumentsRange.first >= info->BasenameRange.second); + + return demangled_name.substr(info->BasenameRange.second, + info->ArgumentsRange.first - + info->BasenameRange.second); +} + +static std::optional +GetDemangledReturnTypeLHS(Function &function) { + auto demangled_name = function.GetName().GetStringRef(); + if (demangled_name.empty()) +return std::nullopt; + + const std::optional &info = + function.GetMangled().GetDemangledInfo(); + if (!info) +return std::nullopt; + + // Function without a basename is nonsense. + if (!info->hasBasename()) +return std::nullopt; + + assert(info->ScopeRange.first < demangled_name.size()); + + return demangled_name.substr(0, info->ScopeRange.first); +} + +static std::optional +GetDemangledFunctionQualifiers(Function &function) { + auto demangled_name = function.GetName().GetStringRef(); + if (demangled_name.empty()) +return std::nullopt; + + const std::optional &info = + function.GetMangled().GetDemangledInfo(); + if (!info) +return std::nullopt; + + // Function without a basename is nonsense. + if (!info->hasBasename()) +return std::nullopt; + + assert(info->QualifiersRange.first <= demangled_name.size()); + assert(info->QualifiersRange.second <= demangled_name.size()); + assert(info->QualifiersRange.second >= info->QualifiersRange.first); + + return demangled_name.substr(info->QualifiersRange.first, + info->QualifiersRange.second - + info->QualifiersRange.first); Michael137 wrote: Unfortunately this is only the case for the scope and basename. For the other parts the logic is slightly different https://github.com/llvm/llvm-project/pull/131836 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxxabi] [lldb] [llvm] [lldb] Add frame-format option to highlight function names in backtraces (PR #131836)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/131836 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [CI] monolithic-linux improvements (PR #135499)
@@ -52,6 +52,8 @@ "clang": {"clang-tools-extra", "compiler-rt", "cross-project-tests"}, "clang-tools-extra": {"libc"}, "mlir": {"flang"}, +# Test everyything if ci scripts are changed. +".ci": {"llvm", "clang", "lld", "lldb"}, boomanaiden154 wrote: Sorry for missing the comment, LGTM. https://github.com/llvm/llvm-project/pull/135499 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb/cmake] Normalize use of HAVE_LIBCOMPRESSION (PR #135528)
https://github.com/JDevlieghere approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/135528 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix use-color settings not persistent (PR #135626)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Ebuka Ezike (da-viper) Changes Fixes https://github.com/llvm/llvm-project/issues/22981 Do you think it is necessary for the`SetUseColor` to return a bool for the interface --- Full diff: https://github.com/llvm/llvm-project/pull/135626.diff 8 Files Affected: - (modified) lldb/include/lldb/Core/IOHandler.h (+8) - (modified) lldb/include/lldb/Host/Editline.h (+11) - (modified) lldb/include/lldb/Interpreter/CommandInterpreter.h (+2) - (modified) lldb/source/Core/Debugger.cpp (+8-6) - (modified) lldb/source/Core/IOHandler.cpp (+15) - (modified) lldb/source/Host/common/Editline.cpp (+2) - (modified) lldb/source/Interpreter/CommandInterpreter.cpp (+6-1) - (modified) lldb/test/API/terminal/TestEditline.py (+23) ``diff diff --git a/lldb/include/lldb/Core/IOHandler.h b/lldb/include/lldb/Core/IOHandler.h index 794d229bc1337..fba1e158bf7eb 100644 --- a/lldb/include/lldb/Core/IOHandler.h +++ b/lldb/include/lldb/Core/IOHandler.h @@ -99,6 +99,12 @@ class IOHandler { // Prompt support isn't mandatory return false; } + + virtual bool SetUseColor(bool use_color) { +// Use color isn't mandatory +return false; + }; + bool SetPrompt(const char *) = delete; virtual llvm::StringRef GetControlSequence(char ch) { return {}; } @@ -375,6 +381,8 @@ class IOHandlerEditline : public IOHandler { bool SetPrompt(llvm::StringRef prompt) override; bool SetPrompt(const char *prompt) = delete; + bool SetUseColor(bool use_color) override; + const char *GetContinuationPrompt(); void SetContinuationPrompt(llvm::StringRef prompt); diff --git a/lldb/include/lldb/Host/Editline.h b/lldb/include/lldb/Host/Editline.h index 705ec9c49f7c7..c202a76758e13 100644 --- a/lldb/include/lldb/Host/Editline.h +++ b/lldb/include/lldb/Host/Editline.h @@ -168,6 +168,9 @@ class Editline { DisplayCompletions(Editline &editline, llvm::ArrayRef results); + /// Sets if editline should use color. + void UseColor(bool use_color); + /// Sets a string to be used as a prompt, or combined with a line number to /// form a prompt. void SetPrompt(const char *prompt); @@ -223,21 +226,29 @@ class Editline { void SetPromptAnsiPrefix(std::string prefix) { if (m_color) m_prompt_ansi_prefix = std::move(prefix); +else + m_prompt_ansi_prefix.clear(); } void SetPromptAnsiSuffix(std::string suffix) { if (m_color) m_prompt_ansi_suffix = std::move(suffix); +else + m_prompt_ansi_suffix.clear(); } void SetSuggestionAnsiPrefix(std::string prefix) { if (m_color) m_suggestion_ansi_prefix = std::move(prefix); +else + m_suggestion_ansi_prefix.clear(); } void SetSuggestionAnsiSuffix(std::string suffix) { if (m_color) m_suggestion_ansi_suffix = std::move(suffix); +else + m_suggestion_ansi_suffix.clear(); } /// Prompts for and reads a single line of user input. diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h index b65edcf68b251..724d88d65f6ac 100644 --- a/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -476,6 +476,8 @@ class CommandInterpreter : public Broadcaster, void UpdatePrompt(llvm::StringRef prompt); + void UpdateUseColor(bool use_color); + bool Confirm(llvm::StringRef message, bool default_answer); void LoadCommandDictionary(); diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index ce6fb6ed5ec54..2f79415a959e3 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -237,16 +237,16 @@ Status Debugger::SetPropertyValue(const ExecutionContext *exe_ctx, CommandInterpreter::eBroadcastBitResetPrompt, bytes.release()); GetCommandInterpreter().BroadcastEvent(prompt_change_event_sp); } else if (property_path == g_debugger_properties[ePropertyUseColor].name) { - // use-color changed. Ping the prompt so it can reset the ansi terminal - // codes. - SetPrompt(GetPrompt()); + // use-color changed. set use-color, this also pings the prompt so it can + // reset the ansi terminal codes. + SetUseColor(GetUseColor()); } else if (property_path == g_debugger_properties[ePropertyPromptAnsiPrefix].name || property_path == g_debugger_properties[ePropertyPromptAnsiSuffix].name) { - // Prompt colors changed. Ping the prompt so it can reset the ansi - // terminal codes. - SetPrompt(GetPrompt()); + // Prompt color changed. set use-color, this also pings the prompt so it + // can reset the ansi terminal codes. + SetUseColor(GetUseColor()); } else if (property_path == g_debugger_properties[ePropertyShowStatusline].name) { // Statusline setting changed. If we have a stat
[Lldb-commits] [lldb] [LLDB] Reapply refactored CPlusPlusLanguage::MethodName to break lldb-server dependencies (PR #135033)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/135033 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove ProcessRunLock::TrySetRunning (PR #135455)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/135455 >From b1416c5e13207eaa56985c84e9c2ac74db6a4d2b Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Fri, 11 Apr 2025 22:48:44 + Subject: [PATCH 1/3] [lldb] Remove ProcessRunLock::TrySetRunning I traced the issue reported by Caroline and Pavel in #134757 back to the call to ProcessRunLock::TrySetRunning. When that fails, we get a somewhat misleading error message: > process resume at entry point failed: Resume request failed - process still > running. This is incorrect: the problem was not that the process was in a running state, but rather that the RunLock was being held by another thread (i.e. the Statusline). TrySetRunning would return false in both cases and the call site only accounted for the former. Besides the odd semantics, the current implementation is inherently race-y and I believe incorrect. If someone is holding the RunLock, the resume call should block, rather than give up, and with the lock held, switch the running state and report the old running state. This patch removes ProcessRunLock::TrySetRunning and updates all callers to use ProcessRunLock::SetRunning instead. To support that, ProcessRunLock::SetRunning (and ProcessRunLock::SetStopped, for consistency) now report whether the process was stopped or running respectively. Previously, both methods returned true unconditionally. The old code has been around pretty much pretty much forever, there's nothing in the git history to indicate that this was done purposely to solve a particular issue. I've tested this on both Linux and macOS and confirmed that this solves the statusline issue. A big thank you to Jim for reviewing my proposed solution offline and trying to poke holes in it. --- lldb/include/lldb/Host/ProcessRunLock.h | 7 ++- lldb/source/Host/common/ProcessRunLock.cpp | 18 ++- lldb/source/Host/windows/ProcessRunLock.cpp | 16 ++ lldb/source/Target/Process.cpp | 59 - 4 files changed, 35 insertions(+), 65 deletions(-) diff --git a/lldb/include/lldb/Host/ProcessRunLock.h b/lldb/include/lldb/Host/ProcessRunLock.h index b5b5328b4a33f..c83cab53a9a65 100644 --- a/lldb/include/lldb/Host/ProcessRunLock.h +++ b/lldb/include/lldb/Host/ProcessRunLock.h @@ -29,8 +29,13 @@ class ProcessRunLock { bool ReadTryLock(); bool ReadUnlock(); + + /// Set the process to running. Returns true if the process was stopped. + /// Return true if the process was running. bool SetRunning(); - bool TrySetRunning(); + + /// Set the process to stopped. Returns true if the process was stopped. + /// Returns false if the process was running. bool SetStopped(); class ProcessRunLocker { diff --git a/lldb/source/Host/common/ProcessRunLock.cpp b/lldb/source/Host/common/ProcessRunLock.cpp index da59f40576978..f9bde96ae8ac9 100644 --- a/lldb/source/Host/common/ProcessRunLock.cpp +++ b/lldb/source/Host/common/ProcessRunLock.cpp @@ -37,21 +37,10 @@ bool ProcessRunLock::ReadUnlock() { bool ProcessRunLock::SetRunning() { ::pthread_rwlock_wrlock(&m_rwlock); + bool was_stopped = !m_running; m_running = true; ::pthread_rwlock_unlock(&m_rwlock); - return true; -} - -bool ProcessRunLock::TrySetRunning() { - bool r; - - if (::pthread_rwlock_trywrlock(&m_rwlock) == 0) { -r = !m_running; -m_running = true; -::pthread_rwlock_unlock(&m_rwlock); -return r; - } - return false; + return was_stopped; } bool ProcessRunLock::SetStopped() { @@ -60,6 +49,7 @@ bool ProcessRunLock::SetStopped() { ::pthread_rwlock_unlock(&m_rwlock); return true; } -} + +} // namespace lldb_private #endif diff --git a/lldb/source/Host/windows/ProcessRunLock.cpp b/lldb/source/Host/windows/ProcessRunLock.cpp index 693641e42ed73..9f144b4c918f8 100644 --- a/lldb/source/Host/windows/ProcessRunLock.cpp +++ b/lldb/source/Host/windows/ProcessRunLock.cpp @@ -58,24 +58,16 @@ bool ProcessRunLock::ReadUnlock() { return ::ReadUnlock(m_rwlock); } bool ProcessRunLock::SetRunning() { WriteLock(m_rwlock); + bool was_stopped = !m_running; m_running = true; WriteUnlock(m_rwlock); - return true; -} - -bool ProcessRunLock::TrySetRunning() { - if (WriteTryLock(m_rwlock)) { -bool was_running = m_running; -m_running = true; -WriteUnlock(m_rwlock); -return !was_running; - } - return false; + return was_stopped; } bool ProcessRunLock::SetStopped() { WriteLock(m_rwlock); + bool was_running = m_running; m_running = false; WriteUnlock(m_rwlock); - return true; + return was_running; } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index a9787823b9108..cd5b8c1e8a6fa 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -577,9 +577,7 @@ void Process::Finalize(bool destructing) { // contain events that have ProcessSP values in them which can keep this // process around forever. These events need to be
[Lldb-commits] [lldb] [llvm] [CI] monolithic-linux improvements (PR #135499)
@@ -49,17 +52,31 @@ trap at-exit EXIT projects="${1}" targets="${2}" +runtimes="${3}" lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests" echo "--- cmake" export PIP_BREAK_SYSTEM_PACKAGES=1 + pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt + +# This is an lldb requirement which is not listed above. +pip install -q swig + +# Set the system llvm-symbolizer as preferred. +export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer` +[[ ! -f "${LLVM_SYMBOLIZER_PATH}" ]] && echo "llvm-symbolizer not found!" + +# Set up all runtimes either way. libcxx is a dependency of LLDB. mizvekov wrote: I am not sure what impact you mean. This patch does not cause any extra tests to be run, lldb testing is still disabled. There might be small differences in relation to configure time and installing dependencies, but should be few seconds. Now if lldb gets added back, then a few extra tests are run, but some of that is offset by the fact libcxx will be only built once instead of twice. Also that the extra lldb tests being run are the ones that are actually useful for clang. https://github.com/llvm/llvm-project/pull/135499 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] d792094 - [lldb] Remove ProcessRunLock::TrySetRunning (#135455)
Author: Jonas Devlieghere Date: 2025-04-14T10:09:19+02:00 New Revision: d792094c26dc6b40136f1e6c2e393c041062e371 URL: https://github.com/llvm/llvm-project/commit/d792094c26dc6b40136f1e6c2e393c041062e371 DIFF: https://github.com/llvm/llvm-project/commit/d792094c26dc6b40136f1e6c2e393c041062e371.diff LOG: [lldb] Remove ProcessRunLock::TrySetRunning (#135455) I traced the issue reported by Caroline and Pavel in #134757 back to the call to ProcessRunLock::TrySetRunning. When that fails, we get a somewhat misleading error message: > process resume at entry point failed: Resume request failed - process still running. This is incorrect: the problem was not that the process was in a running state, but rather that the RunLock was being held by another thread (i.e. the Statusline). TrySetRunning would return false in both cases and the call site only accounted for the former. Besides the odd semantics, the current implementation is inherently race-y and I believe incorrect. If someone is holding the RunLock, the resume call should block, rather than give up, and with the lock held, switch the running state and report the old running state. This patch removes ProcessRunLock::TrySetRunning and updates all callers to use ProcessRunLock::SetRunning instead. To support that, ProcessRunLock::SetRunning (and ProcessRunLock::SetStopped, for consistency) now report whether the process was stopped or running respectively. Previously, both methods returned true unconditionally. The old code has been around pretty much pretty much forever, there's nothing in the git history to indicate that this was done purposely to solve a particular issue. I've tested this on both Linux and macOS and confirmed that this solves the statusline issue. A big thank you to Jim for reviewing my proposed solution offline and trying to poke holes in it. Added: Modified: lldb/include/lldb/Host/ProcessRunLock.h lldb/source/Host/common/ProcessRunLock.cpp lldb/source/Host/windows/ProcessRunLock.cpp lldb/source/Target/Process.cpp Removed: diff --git a/lldb/include/lldb/Host/ProcessRunLock.h b/lldb/include/lldb/Host/ProcessRunLock.h index b5b5328b4a33f..94683673024d5 100644 --- a/lldb/include/lldb/Host/ProcessRunLock.h +++ b/lldb/include/lldb/Host/ProcessRunLock.h @@ -29,8 +29,13 @@ class ProcessRunLock { bool ReadTryLock(); bool ReadUnlock(); + + /// Set the process to running. Returns true if the process was stopped. + /// Return false if the process was running. bool SetRunning(); - bool TrySetRunning(); + + /// Set the process to stopped. Returns true if the process was running. + /// Returns false if the process was stopped. bool SetStopped(); class ProcessRunLocker { diff --git a/lldb/source/Host/common/ProcessRunLock.cpp b/lldb/source/Host/common/ProcessRunLock.cpp index da59f40576978..8e7ef45e1e350 100644 --- a/lldb/source/Host/common/ProcessRunLock.cpp +++ b/lldb/source/Host/common/ProcessRunLock.cpp @@ -37,29 +37,20 @@ bool ProcessRunLock::ReadUnlock() { bool ProcessRunLock::SetRunning() { ::pthread_rwlock_wrlock(&m_rwlock); + bool was_stopped = !m_running; m_running = true; ::pthread_rwlock_unlock(&m_rwlock); - return true; -} - -bool ProcessRunLock::TrySetRunning() { - bool r; - - if (::pthread_rwlock_trywrlock(&m_rwlock) == 0) { -r = !m_running; -m_running = true; -::pthread_rwlock_unlock(&m_rwlock); -return r; - } - return false; + return was_stopped; } bool ProcessRunLock::SetStopped() { ::pthread_rwlock_wrlock(&m_rwlock); + bool was_running = m_running; m_running = false; ::pthread_rwlock_unlock(&m_rwlock); - return true; -} + return was_running; } +} // namespace lldb_private + #endif diff --git a/lldb/source/Host/windows/ProcessRunLock.cpp b/lldb/source/Host/windows/ProcessRunLock.cpp index 693641e42ed73..9f144b4c918f8 100644 --- a/lldb/source/Host/windows/ProcessRunLock.cpp +++ b/lldb/source/Host/windows/ProcessRunLock.cpp @@ -58,24 +58,16 @@ bool ProcessRunLock::ReadUnlock() { return ::ReadUnlock(m_rwlock); } bool ProcessRunLock::SetRunning() { WriteLock(m_rwlock); + bool was_stopped = !m_running; m_running = true; WriteUnlock(m_rwlock); - return true; -} - -bool ProcessRunLock::TrySetRunning() { - if (WriteTryLock(m_rwlock)) { -bool was_running = m_running; -m_running = true; -WriteUnlock(m_rwlock); -return !was_running; - } - return false; + return was_stopped; } bool ProcessRunLock::SetStopped() { WriteLock(m_rwlock); + bool was_running = m_running; m_running = false; WriteUnlock(m_rwlock); - return true; + return was_running; } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index a9787823b9108..633f7488dc76a 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -577,9 +577,7 @@ void Process::Finalize(bool destru
[Lldb-commits] [lldb] [llvm] [CI] monolithic-linux improvements (PR #135499)
@@ -49,17 +52,31 @@ trap at-exit EXIT projects="${1}" targets="${2}" +runtimes="${3}" lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests" echo "--- cmake" export PIP_BREAK_SYSTEM_PACKAGES=1 + pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt + +# This is an lldb requirement which is not listed above. +pip install -q swig + +# Set the system llvm-symbolizer as preferred. +export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer` +[[ ! -f "${LLVM_SYMBOLIZER_PATH}" ]] && echo "llvm-symbolizer not found!" + +# Set up all runtimes either way. libcxx is a dependency of LLDB. boomanaiden154 wrote: I'm not saying that the tests aren't useful. But we presumably have to build the runtimes and then run additional tests. Throughput is pretty important to think about for premerge given we have limited compute, the frequency of commits, and how much testing we are already doing. Could you collect timing data (preferrably n=3) on testing a lldb change? https://github.com/llvm/llvm-project/pull/135499 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] e4a672b - [LLDB] Reapply refactored CPlusPlusLanguage::MethodName to break lldb-server dependencies (#135033)
Author: Dmitry Vasilyev Date: 2025-04-14T14:30:09+04:00 New Revision: e4a672bc17a2a7dc39e51c9f5e656d705312a12b URL: https://github.com/llvm/llvm-project/commit/e4a672bc17a2a7dc39e51c9f5e656d705312a12b DIFF: https://github.com/llvm/llvm-project/commit/e4a672bc17a2a7dc39e51c9f5e656d705312a12b.diff LOG: [LLDB] Reapply refactored CPlusPlusLanguage::MethodName to break lldb-server dependencies (#135033) The original PR is #132274. Co-authored-by: @bulbazord Alex Langford Added: Modified: lldb/include/lldb/Core/Mangled.h lldb/include/lldb/Core/RichManglingContext.h lldb/include/lldb/Target/Language.h lldb/source/Core/CMakeLists.txt lldb/source/Core/Mangled.cpp lldb/source/Core/Module.cpp lldb/source/Core/RichManglingContext.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp lldb/source/Plugins/Language/ObjC/ObjCLanguage.h lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp lldb/unittests/Core/CMakeLists.txt lldb/unittests/Core/RichManglingContextTest.cpp lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp lldb/unittests/Language/ObjC/ObjCLanguageTest.cpp Removed: diff --git a/lldb/include/lldb/Core/Mangled.h b/lldb/include/lldb/Core/Mangled.h index 5988d919a89b8..7db63eeeb6ee0 100644 --- a/lldb/include/lldb/Core/Mangled.h +++ b/lldb/include/lldb/Core/Mangled.h @@ -246,6 +246,8 @@ class Mangled { /// for s, otherwise the enumerator for the mangling scheme detected. static Mangled::ManglingScheme GetManglingScheme(llvm::StringRef const name); + static bool IsMangledName(llvm::StringRef name); + /// Decode a serialized version of this object from data. /// /// \param data diff --git a/lldb/include/lldb/Core/RichManglingContext.h b/lldb/include/lldb/Core/RichManglingContext.h index 3b79924e88a9a..50ec2ae361098 100644 --- a/lldb/include/lldb/Core/RichManglingContext.h +++ b/lldb/include/lldb/Core/RichManglingContext.h @@ -12,6 +12,7 @@ #include "lldb/lldb-forward.h" #include "lldb/lldb-private.h" +#include "lldb/Target/Language.h" #include "lldb/Utility/ConstString.h" #include "llvm/ADT/Any.h" @@ -67,11 +68,7 @@ class RichManglingContext { char *m_ipd_buf; size_t m_ipd_buf_size = 2048; - /// Members for PluginCxxLanguage - /// Cannot forward declare inner class CPlusPlusLanguage::MethodName. The - /// respective header is in Plugins and including it from here causes cyclic - /// dependency. Instead keep a llvm::Any and cast it on-access in the cpp. - llvm::Any m_cxx_method_parser; + std::unique_ptr m_cxx_method_parser; /// Clean up memory when using PluginCxxLanguage void ResetCxxMethodParser(); @@ -81,15 +78,6 @@ class RichManglingContext { /// Uniform handling of string buffers for ItaniumPartialDemangler. llvm::StringRef processIPDStrResult(char *ipd_res, size_t res_len); - - /// Cast the given parser to the given type. Ideally we would have a type - /// trait to deduce \a ParserT from a given InfoProvider, but unfortunately we - /// can't access CPlusPlusLanguage::MethodName from within the header. - template static ParserT *get(llvm::Any parser) { -assert(parser.has_value()); -assert(llvm::any_cast(&parser)); -return *llvm::any_cast(&parser); - } }; } // namespace lldb_private diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h index da2c2cc451dae..fa856843871e3 100644 --- a/lldb/include/lldb/Target/Language.h +++ b/lldb/include/lldb/Target/Language.h @@ -214,6 +214,104 @@ class Language : public PluginInterface { return std::vector(); }; + class MethodName { + public: +MethodName() {} + +MethodName(ConstString full) +: m_full(full), m_basename(), m_context(), m_arguments(), + m_qualifiers(), m_return_type(), m_scope_qualified(), m_parsed(false), + m_parse_error(false) {} + +virtual ~MethodName() {}; + +void Clear() { + m_full.Clear(); + m_basename = llvm::StringRef(); + m_context = llvm::StringRef(); + m_arguments = llvm::StringRef(); + m_qualifiers = llvm::StringRef(); + m_return_type = llvm::StringRef(); + m_scope_qualified.clear(); + m_parsed = false; + m_parse_error = false; +} + +bool IsValid() { + if (!m_parsed) +Parse(); + if (m_parse_error) +return false; + return (bool)m_full; +} + +ConstString GetFullName() const { return m_full; } + +llvm::StringRef GetBasename() { +
[Lldb-commits] [lldb] [lldb] returning command completions up to a maximum (PR #135565)
@@ -231,6 +253,8 @@ class CompletionRequest { size_t m_cursor_index; /// The cursor position in the argument indexed by m_cursor_index. size_t m_cursor_char_position; + /// The maximum number of completions that should be returned. + size_t m_max_return_elements = SIZE_MAX; JDevlieghere wrote: ```suggestion size_t m_max_return_elements = std::numeric_limits::max(); ``` https://github.com/llvm/llvm-project/pull/135565 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxxabi] [lldb] [llvm] [lldb] Add frame-format option to highlight function names in backtraces (PR #131836)
@@ -0,0 +1,60 @@ +# Test the ${function.arguments} frame-format variable. Michael137 wrote: done https://github.com/llvm/llvm-project/pull/131836 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [CI] monolithic-linux improvements (PR #135499)
https://github.com/mizvekov deleted https://github.com/llvm/llvm-project/pull/135499 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [CI] monolithic-linux improvements (PR #135499)
@@ -52,6 +52,8 @@ "clang": {"clang-tools-extra", "compiler-rt", "cross-project-tests"}, "clang-tools-extra": {"libc"}, "mlir": {"flang"}, +# Test everyything if ci scripts are changed. +".ci": {"llvm", "clang", "lld", "lldb"}, mizvekov wrote: I left a comment, saying we should actually enumerate everything here at some point, which I thought you said is fine. https://github.com/llvm/llvm-project/pull/135499 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxxabi] [lldb] [llvm] [lldb] Add frame-format option to highlight function names in backtraces (PR #131836)
JDevlieghere wrote: Please also update the [website/docs](https://lldb.llvm.org/use/formatting.html#variables) with the new format variables. https://github.com/llvm/llvm-project/pull/131836 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Override Should{Select, Show} in StopReasonBreakpoint (PR #135637)
jimingham wrote: I'm also not sure how you would test this. Pretty much all the predictable internal breakpoints that we set get converted to different StopInfo's before the public stop. At some point it would be nice to add a "testing only" library - like the SB API set but only available while testing. Then you could add a "SetInternalBreakpoint" API and test what happened when you hit it. Short of that, I can't see anything that would be stable. But this is clearly the right behavior. By the time we get to a public stop, if a thread's stop reason is an internal breakpoint, we don't want to either show that reason, or set that thread as the "currently selected thread". https://github.com/llvm/llvm-project/pull/135637 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Do not bump memory modificator ID when "internal" debugger memory is updated (PR #129092)
https://github.com/jimingham approved this pull request. LGTM, thanks for working on this! https://github.com/llvm/llvm-project/pull/129092 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [CI] monolithic-linux improvements (PR #135499)
@@ -49,17 +52,31 @@ trap at-exit EXIT projects="${1}" targets="${2}" +runtimes="${3}" lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests" echo "--- cmake" export PIP_BREAK_SYSTEM_PACKAGES=1 + pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt + +# This is an lldb requirement which is not listed above. +pip install -q swig + +# Set the system llvm-symbolizer as preferred. +export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer` +[[ ! -f "${LLVM_SYMBOLIZER_PATH}" ]] && echo "llvm-symbolizer not found!" + +# Set up all runtimes either way. libcxx is a dependency of LLDB. mizvekov wrote: Here are some numbers for LLDB-only change: With change: 1) 4m46s - https://buildkite.com/llvm-project/github-pull-requests/builds/168411#_ 2) 4m36s - https://buildkite.com/llvm-project/github-pull-requests/builds/168431#01963503-57a4-4934-9de8-f298abe3c432 3) 4m05s - https://buildkite.com/llvm-project/github-pull-requests/builds/168455#01963544-0108-4474-bcfe-781e6facc804 Without change: 1) 3m41s - https://buildkite.com/llvm-project/github-pull-requests/builds/168504#019635ca-f0cc-4ab7-8723-c761a640a701 2) 3m30s - https://buildkite.com/llvm-project/github-pull-requests/builds/168559#01963642-adc3-4e7c-ac07-aaf8e589c53b 3) 3m45s - https://buildkite.com/llvm-project/github-pull-requests/builds/168599#019636c2-d22a-442f-a4a8-d33fd2d95191 https://github.com/llvm/llvm-project/pull/135499 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Slide eh_frame unwind plan if it doesn't begin at function boundary (PR #135333)
https://github.com/jasonmolenda approved this pull request. OK looks reasonable. https://github.com/llvm/llvm-project/pull/135333 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][lldb-dap] explicitly set the expr as an alias for expression. (PR #134562)
jimingham wrote: We may use the word `expr` in documentation, but that doesn't mean that a user could decide they wanted to use `expr` for something completely different. And even if we added an explicit alias for `expr` someone who was using it for another purpose will just get a little annoyed, then do: command unalias expr command alias expr So it doesn't seem wise for DAP to depend on the fixed meaning of aliases. https://github.com/llvm/llvm-project/pull/134562 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland: [clang] preserve class type sugar when taking pointer to member (PR #132401)
mizvekov wrote: Could it be you are hitting an overflow/wrap around perhaps? Some of these nodes store the unsignedOrNone representation in a bitfield, but that's still 15 bits. https://github.com/llvm/llvm-project/pull/132401 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 7491ff7 - [lldb] Override Should{Select, Show} in StopReasonBreakpoint (#135637)
Author: Felipe de Azevedo Piovezan Date: 2025-04-14T16:21:24-07:00 New Revision: 7491ff74d2b99c0e5e879ec7fd370fe9654528c4 URL: https://github.com/llvm/llvm-project/commit/7491ff74d2b99c0e5e879ec7fd370fe9654528c4 DIFF: https://github.com/llvm/llvm-project/commit/7491ff74d2b99c0e5e879ec7fd370fe9654528c4.diff LOG: [lldb] Override Should{Select,Show} in StopReasonBreakpoint (#135637) This is necessary so that LLDB does not select (or show the stop reason for) a thread which stopped at an internal breakpoint. Other than manual testing/inspection, which I've done, this does not seem to lend itself to API testing, as we cannot set internal breakpoints through the SBAPI. Added: Modified: lldb/source/Target/StopInfo.cpp Removed: diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp index f1272a723a8cb..3160446ae1d17 100644 --- a/lldb/source/Target/StopInfo.cpp +++ b/lldb/source/Target/StopInfo.cpp @@ -263,6 +263,10 @@ class StopInfoBreakpoint : public StopInfo { return bp_site_sp->GetSuggestedStackFrameIndex(); } + bool ShouldShow() const override { return !m_was_all_internal; } + + bool ShouldSelect() const override { return !m_was_all_internal; } + protected: bool ShouldStop(Event *event_ptr) override { // This just reports the work done by PerformAction or the synchronous ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] returning command completions up to a maximum (PR #135565)
https://github.com/JDevlieghere edited https://github.com/llvm/llvm-project/pull/135565 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Reapply refactored CPlusPlusLanguage::MethodName to break lldb-server dependencies (PR #135033)
https://github.com/JDevlieghere approved this pull request. All tests pas on macOS. Thanks! https://github.com/llvm/llvm-project/pull/135033 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Make SBProcess thread related actions listen to StopLocker (PR #134339)
https://github.com/kusmour updated https://github.com/llvm/llvm-project/pull/134339 >From 4f0ac25e9e7f93d64940e8af2949569bf9898c4e Mon Sep 17 00:00:00 2001 From: Wanyi Ye Date: Thu, 3 Apr 2025 22:29:13 -0700 Subject: [PATCH 1/3] [lldb] Make SBProcess thread related actions listen to StopLocker --- lldb/source/API/SBProcess.cpp | 20 ++- .../tools/lldb-dap/attach/TestDAP_attach.py | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp index 23ea449b30cca..ba77b2beed5ea 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -193,10 +193,11 @@ uint32_t SBProcess::GetNumThreads() { if (process_sp) { Process::StopLocker stop_locker; -const bool can_update = stop_locker.TryLock(&process_sp->GetRunLock()); -std::lock_guard guard( -process_sp->GetTarget().GetAPIMutex()); -num_threads = process_sp->GetThreadList().GetSize(can_update); +if (stop_locker.TryLock(&process_sp->GetRunLock())) { + std::lock_guard guard( + process_sp->GetTarget().GetAPIMutex()); + num_threads = process_sp->GetThreadList().GetSize(); +} } return num_threads; @@ -393,11 +394,12 @@ SBThread SBProcess::GetThreadAtIndex(size_t index) { ProcessSP process_sp(GetSP()); if (process_sp) { Process::StopLocker stop_locker; -const bool can_update = stop_locker.TryLock(&process_sp->GetRunLock()); -std::lock_guard guard( -process_sp->GetTarget().GetAPIMutex()); -thread_sp = process_sp->GetThreadList().GetThreadAtIndex(index, can_update); -sb_thread.SetThread(thread_sp); +if (stop_locker.TryLock(&process_sp->GetRunLock())) { + std::lock_guard guard( + process_sp->GetTarget().GetAPIMutex()); + thread_sp = process_sp->GetThreadList().GetThreadAtIndex(index, false); + sb_thread.SetThread(thread_sp); +} } return sb_thread; diff --git a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py index 9df44cc454d5d..b9fbf2c8d14f9 100644 --- a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py +++ b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py @@ -1,5 +1,5 @@ """ -Test lldb-dap setBreakpoints request +Test lldb-dap attach request """ >From 13f72497031f3933625e4ad845e231354959f6bf Mon Sep 17 00:00:00 2001 From: Wanyi Ye Date: Tue, 8 Apr 2025 22:52:19 -0700 Subject: [PATCH 2/3] [lldb-dap] Client expects initial threads request not empty --- .../test/tools/lldb-dap/dap_server.py | 4 lldb/tools/lldb-dap/DAP.h | 3 +++ .../ConfigurationDoneRequestHandler.cpp| 10 +- .../lldb-dap/Handler/ThreadsRequestHandler.cpp | 18 -- lldb/tools/lldb-dap/JSONUtils.cpp | 10 ++ lldb/tools/lldb-dap/JSONUtils.h| 2 ++ 6 files changed, 40 insertions(+), 7 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 45403e9df8525..61d7fa94479b8 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 @@ -649,6 +649,10 @@ def request_configurationDone(self): response = self.send_recv(command_dict) if response: self.configuration_done_sent = True +# Client requests the baseline of currently existing threads after +# a successful launch or attach. +# Kick off the threads request that follows +self.request_threads() return response def _process_stopped(self): diff --git a/lldb/tools/lldb-dap/DAP.h b/lldb/tools/lldb-dap/DAP.h index 8d32a18fb711e..f126ec5cf2dd8 100644 --- a/lldb/tools/lldb-dap/DAP.h +++ b/lldb/tools/lldb-dap/DAP.h @@ -211,6 +211,9 @@ struct DAP { /// The set of features supported by the connected client. llvm::DenseSet clientFeatures; + /// The initial thread list upon attaching + std::optional initial_thread_list; + /// Creates a new DAP sessions. /// /// \param[in] log diff --git a/lldb/tools/lldb-dap/Handler/ConfigurationDoneRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/ConfigurationDoneRequestHandler.cpp index cd120e1fdfaba..f39bbdefdbb95 100644 --- a/lldb/tools/lldb-dap/Handler/ConfigurationDoneRequestHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/ConfigurationDoneRequestHandler.cpp @@ -44,6 +44,7 @@ namespace lldb_dap { // just an acknowledgement, so no body field is required." // }] // }, + void ConfigurationDoneRequestHandler::operator()( const llvm::json::Object &request) const { llvm::json::Object response; @@ -52,8 +53,15 @@ void ConfigurationDoneRequestHandler::operator()( dap.configuration_done_sent = true; if (dap.stop_at_entry) SendThreadStop
[Lldb-commits] [lldb] Draft: test (PR #135630)
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/135630 >From 1571fc17e789839bd2f177cca80c0b9f69233cf6 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Mon, 14 Apr 2025 11:56:01 -0300 Subject: [PATCH] Draft: test With change: 1) 4m46s - https://buildkite.com/llvm-project/github-pull-requests/builds/168411#_ 2) 4m36s - https://buildkite.com/llvm-project/github-pull-requests/builds/168431#01963503-57a4-4934-9de8-f298abe3c432 3) 4m05s - https://buildkite.com/llvm-project/github-pull-requests/builds/168455#01963544-0108-4474-bcfe-781e6facc804 Without change: 1) 3m41s - https://buildkite.com/llvm-project/github-pull-requests/builds/168504#019635ca-f0cc-4ab7-8723-c761a640a701 2) 3m30s - https://buildkite.com/llvm-project/github-pull-requests/builds/168559#01963642-adc3-4e7c-ac07-aaf8e589c53b --- lldb/DELETE.ME | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 lldb/DELETE.ME diff --git a/lldb/DELETE.ME b/lldb/DELETE.ME new file mode 100644 index 0..e69de29bb2d1d ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Override Should{Select, Show} in StopReasonBreakpoint (PR #135637)
https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/135637 This is necessary so that LLDB does not select (or show the stop reason for) a thread which stopped at an internal breakpoint. Other than manual testing/inspection, which I've done, this does not seem to lend itself to API testing, as we cannot set internal breakpoints through the SBAPI. >From 2252ae2496656eae6c76861d665320ba1941ec1c Mon Sep 17 00:00:00 2001 From: Felipe de Azevedo Piovezan Date: Mon, 14 Apr 2025 08:56:55 -0700 Subject: [PATCH] [lldb] Override Should{Select,Show} in StopReasonBreakpoint This is necessary so that LLDB does not select (or show the stop reason for) a thread which stopped at an internal breakpoint. Other than manual testing/inspection, which I've done, this does not seem to lend itself to API testing, as we cannot set internal breakpoints through the SBAPI. --- lldb/source/Target/StopInfo.cpp | 8 1 file changed, 8 insertions(+) diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp index f1272a723a8cb..6bdc467af6746 100644 --- a/lldb/source/Target/StopInfo.cpp +++ b/lldb/source/Target/StopInfo.cpp @@ -263,6 +263,14 @@ class StopInfoBreakpoint : public StopInfo { return bp_site_sp->GetSuggestedStackFrameIndex(); } + bool ShouldShow() const override { +return !m_was_all_internal; + } + + bool ShouldSelect() const override { +return !m_was_all_internal; + } + protected: bool ShouldStop(Event *event_ptr) override { // This just reports the work done by PerformAction or the synchronous ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland: [clang] preserve class type sugar when taking pointer to member (PR #132401)
mizvekov wrote: In one of these changes we did bump one of these bit fields down to 15 bits, starting from 16. https://github.com/llvm/llvm-project/pull/132401 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Fix Apple M4 on Linux (PR #135563)
jasonmolenda wrote: As the patch notes, Apple's M4 has the SME register & instructions, plus Streaming SVE Mode and the SVE register set, but most of the SVE instructions are not supported. And the SVE registers (z0-31, p0-15) are only available when the core is in Streaming SVE Mode I believe. I guess the main concern would be someone keying off of "this core has SVE registers" (true) and "this core can run SVE API tests" (most likely false). But as far as the patch goes, it looks good to me. While Docker might not virtualize the SME, the Darwin kernel does support this and Linux running in a VM will have access to these hardware resources on an M4 system. https://github.com/llvm/llvm-project/pull/135563 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Fix Apple M4 on Linux (PR #135563)
https://github.com/laverdet reopened https://github.com/llvm/llvm-project/pull/135563 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Imporve error reporting if a command's arguments fail to parse correctly. (PR #135684)
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/135684 >From cab7671780bde4d4e2e137f10ced6b5fe504 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Mon, 14 Apr 2025 13:22:31 -0700 Subject: [PATCH 1/2] [lldb-dap] Imporve error reporting if a command's arguments fail to parse correctly. Previously the error only contained the failed to parse JSON message, which has no additional context. This improves the error messages and improves the consistency of handling properties in protocol structures. Updating the fields to use 'ObjectMapper.map' instead of 'ObjectMapper.mapOptional' caught that adapterID was misspelled as well. --- lldb/tools/lldb-dap/Handler/RequestHandler.h | 1 + lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp | 2 +- .../lldb-dap/Protocol/ProtocolRequests.cpp| 42 --- .../lldb-dap/Protocol/ProtocolRequests.h | 4 +- .../tools/lldb-dap/Protocol/ProtocolTypes.cpp | 6 +-- 5 files changed, 33 insertions(+), 22 deletions(-) diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.h b/lldb/tools/lldb-dap/Handler/RequestHandler.h index 50795f8252de3..488628b224f53 100644 --- a/lldb/tools/lldb-dap/Handler/RequestHandler.h +++ b/lldb/tools/lldb-dap/Handler/RequestHandler.h @@ -124,6 +124,7 @@ class RequestHandler : public BaseRequestHandler { if (request.arguments && !fromJSON(request.arguments, arguments, root)) { std::string parse_failure; llvm::raw_string_ostream OS(parse_failure); + OS << "invalid arguments for request '" << request.command << "': "; root.printErrorContext(request.arguments, OS); protocol::ErrorMessage error_message; diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp b/lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp index af63cc803e545..bfd68448fb483 100644 --- a/lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp +++ b/lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp @@ -178,7 +178,7 @@ bool fromJSON(json::Value const &Params, Response &R, json::Path P) { return false; } - return O.map("success", R.success) && O.mapOptional("message", R.message) && + return O.map("success", R.success) && O.map("message", R.message) && mapRaw(Params, "body", R.body, P); } diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp index 7163399899f7e..3523f8ac87ec9 100644 --- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp +++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp @@ -20,16 +20,16 @@ namespace lldb_dap::protocol { bool fromJSON(const llvm::json::Value &Params, CancelArguments &CA, llvm::json::Path P) { llvm::json::ObjectMapper O(Params, P); - return O && O.mapOptional("requestId", CA.requestId) && - O.mapOptional("progressId", CA.progressId); + return O && O.map("requestId", CA.requestId) && + O.map("progressId", CA.progressId); } bool fromJSON(const json::Value &Params, DisconnectArguments &DA, json::Path P) { json::ObjectMapper O(Params, P); - return O && O.mapOptional("restart", DA.restart) && - O.mapOptional("terminateDebuggee", DA.terminateDebuggee) && - O.mapOptional("suspendDebuggee", DA.suspendDebuggee); + return O && O.map("restart", DA.restart) && + O.map("terminateDebuggee", DA.terminateDebuggee) && + O.map("suspendDebuggee", DA.suspendDebuggee); } bool fromJSON(const llvm::json::Value &Params, PathFormat &PF, @@ -75,23 +75,33 @@ bool fromJSON(const llvm::json::Value &Params, InitializeRequestArguments &IRA, const json::Object *O = Params.getAsObject(); - for (auto &kv : ClientFeatureByKey) -if (std::optional v = O->getBoolean(kv.first()); v && *v) + for (auto &kv : ClientFeatureByKey) { +const json::Value *value_ref = O->get(kv.first()); +if (!value_ref) + continue; + +const std::optional value = value_ref->getAsBoolean(); +if (!value) { + P.field(kv.first()).report("expected bool"); + return false; +} + +if (*value) IRA.supportedFeatures.insert(kv.second); + } - return OM.mapOptional("adatperID", IRA.adatperID) && - OM.mapOptional("clientID", IRA.clientID) && - OM.mapOptional("clientName", IRA.clientName) && - OM.mapOptional("locale", IRA.locale) && - OM.mapOptional("linesStartAt1", IRA.linesStartAt1) && - OM.mapOptional("columnsStartAt1", IRA.columnsStartAt1) && - OM.mapOptional("pathFormat", IRA.pathFormat) && - OM.mapOptional("$__lldb_sourceInitFile", IRA.lldbExtSourceInitFile); + return OM.map("adapterID", IRA.adapterID) && + OM.map("clientID", IRA.clientID) && + OM.map("clientName", IRA.clientName) && OM.map("locale", IRA.locale) && + OM.map("linesStartAt1", IRA.linesStartAt1) && + OM.map("columnsStartAt1", IRA.columnsStartAt1) && + OM.map("pathFormat", IRA.pathFormat) && + OM.map("$__lldb_sourceInitFile", IRA
[Lldb-commits] [lldb] [lldb] Override Should{Select, Show} in StopReasonBreakpoint (PR #135637)
https://github.com/jimingham approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/135637 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Override Should{Select, Show} in StopReasonBreakpoint (PR #135637)
https://github.com/felipepiovezan closed https://github.com/llvm/llvm-project/pull/135637 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits