[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland: [clang] preserve class type sugar when taking pointer to member (PR #132401)
alexfh wrote: > @alexfh should be fixed by #133613 Thank you! The crash is resolved. Do you still need a reduced test case? 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] [llvm] Modify the localCache API to require an explicit commit on CachedFile… (PR #115331)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `llvm-clang-win-x-armv7l` running on `as-builder-1` while building `lldb,llvm` at step 9 "test-check-llvm". Full details are available at: https://lab.llvm.org/buildbot/#/builders/38/builds/2638 Here is the relevant piece of the build log for the reference ``` Step 9 (test-check-llvm) failure: Test just built components: check-llvm completed (failure) TEST 'LLVM-Unit :: Support/./SupportTests.exe/51/87' FAILED Script(shard): -- GTEST_OUTPUT=json:C:\buildbot\as-builder-1\x-armv7l\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-10412-51-87.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=87 GTEST_SHARD_INDEX=51 C:\buildbot\as-builder-1\x-armv7l\build\unittests\Support\.\SupportTests.exe -- Script: -- C:\buildbot\as-builder-1\x-armv7l\build\unittests\Support\.\SupportTests.exe --gtest_filter=Caching.NoCommit -- C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\unittests\Support\Caching.cpp(142): error: Value of: AddStream Actual: false Expected: true C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\unittests\Support\Caching.cpp:142 Value of: AddStream Actual: false Expected: true ``` https://github.com/llvm/llvm-project/pull/115331 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Swapping to not use FLAG_ENUM and just defining typed enums. (PR #133622)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: John Harrison (ashgti) Changes Small tweak to the previous patch to make the enums in `lldb_dap::protocol` typed to work with types like `llvm::DenseSet` found by ubsan. --- Full diff: https://github.com/llvm/llvm-project/pull/133622.diff 4 Files Affected: - (modified) lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp (+5-3) - (modified) lldb/tools/lldb-dap/Protocol/ProtocolBase.h (+5-6) - (modified) lldb/tools/lldb-dap/Protocol/ProtocolRequests.h (+17-18) - (modified) lldb/tools/lldb-dap/Protocol/ProtocolTypes.h (+121-114) ``diff diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp b/lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp index 0d63e37d3eafb..87fd0df018b65 100644 --- a/lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp +++ b/lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp @@ -7,7 +7,6 @@ //===--===// #include "Protocol/ProtocolBase.h" -#include "lldb/lldb-enumerations.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/Support/ErrorHandling.h" @@ -32,8 +31,11 @@ static bool mapRaw(const json::Value &Params, StringLiteral Prop, namespace lldb_dap::protocol { -FLAGS_ENUM(MessageType){eMessageTypeRequest, eMessageTypeResponse, -eMessageTypeEvent}; +enum MessageType : unsigned { + eMessageTypeRequest, + eMessageTypeResponse, + eMessageTypeEvent +}; bool fromJSON(const json::Value &Params, MessageType &M, json::Path P) { auto rawType = Params.getAsString(); diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolBase.h b/lldb/tools/lldb-dap/Protocol/ProtocolBase.h index 5ac68e38cb9c4..2c647610de11c 100644 --- a/lldb/tools/lldb-dap/Protocol/ProtocolBase.h +++ b/lldb/tools/lldb-dap/Protocol/ProtocolBase.h @@ -20,7 +20,6 @@ #ifndef LLDB_TOOLS_LLDB_DAP_PROTOCOL_H #define LLDB_TOOLS_LLDB_DAP_PROTOCOL_H -#include "lldb/lldb-enumerations.h" #include "llvm/Support/JSON.h" #include #include @@ -65,11 +64,11 @@ struct Event { llvm::json::Value toJSON(const Event &); bool fromJSON(const llvm::json::Value &, Event &, llvm::json::Path); -FLAGS_ENUM(ResponseMessage){ -/// The request was cancelled -eResponseMessageCancelled, -/// The request may be retried once the adapter is in a 'stopped' state -eResponseMessageNotStopped, +enum ResponseMessage : unsigned { + /// The request was cancelled + eResponseMessageCancelled, + /// The request may be retried once the adapter is in a 'stopped' state + eResponseMessageNotStopped, }; /// Response for a request. diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h index 116cf8516c52e..927106997953a 100644 --- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h +++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h @@ -22,7 +22,6 @@ #include "Protocol/ProtocolBase.h" #include "Protocol/ProtocolTypes.h" -#include "lldb/lldb-enumerations.h" #include "llvm/ADT/DenseSet.h" #include "llvm/Support/JSON.h" #include @@ -57,26 +56,26 @@ bool fromJSON(const llvm::json::Value &, DisconnectArguments &, using DisconnectResponse = VoidResponse; /// Features supported by DAP clients. -FLAGS_ENUM(ClientFeature){ -eClientFeatureVariableType, -eClientFeatureVariablePaging, -eClientFeatureRunInTerminalRequest, -eClientFeatureMemoryReferences, -eClientFeatureProgressReporting, -eClientFeatureInvalidatedEvent, -eClientFeatureMemoryEvent, -/// Client supports the `argsCanBeInterpretedByShell` attribute on the -/// `runInTerminal` request. -eClientFeatureArgsCanBeInterpretedByShell, -eClientFeatureStartDebuggingRequest, -/// The client will interpret ANSI escape sequences in the display of -/// `OutputEvent.output` and `Variable.value` fields when -/// `Capabilities.supportsANSIStyling` is also enabled. -eClientFeatureANSIStyling, +enum ClientFeature : unsigned { + eClientFeatureVariableType, + eClientFeatureVariablePaging, + eClientFeatureRunInTerminalRequest, + eClientFeatureMemoryReferences, + eClientFeatureProgressReporting, + eClientFeatureInvalidatedEvent, + eClientFeatureMemoryEvent, + /// Client supports the `argsCanBeInterpretedByShell` attribute on the + /// `runInTerminal` request. + eClientFeatureArgsCanBeInterpretedByShell, + eClientFeatureStartDebuggingRequest, + /// The client will interpret ANSI escape sequences in the display of + /// `OutputEvent.output` and `Variable.value` fields when + /// `Capabilities.supportsANSIStyling` is also enabled. + eClientFeatureANSIStyling, }; /// Format of paths reported by the debug adapter. -FLAGS_ENUM(PathFormat){ePatFormatPath, ePathFormatURI}; +enum PathFormat : unsigned { ePatFormatPath, ePathFormatURI }; /// Arguments for `initialize` request. struct InitializeRequestArguments { diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.h b/lldb/too
[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland: [clang] preserve class type sugar when taking pointer to member (PR #132401)
mizvekov wrote: > > @alexfh should be fixed by #133613 > > > > Thank you! The crash is resolved. Do you still need a reduced test case? No worries, the tests included in PR already reproduce it. 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] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)
ashgti wrote: I may need to split this up into a smaller set of patches. Let me know what you think. 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] [SBProgress] Add swig support for `with` statement in Python (PR #133527)
aperez wrote: > @aperez Thoughts on this? I think this could be useful I think it could be useful as well. Couple things to note though: - If you allow for both sequences and iterators as arguments into `lldb.Progress.track` you might not know the total number steps in advance. - You'll need to handle the case when users exit the loop early, so that `Finalize()` is still called. https://github.com/llvm/llvm-project/pull/133527 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Implement CLI support for reverse-continue (PR #132783)
rocallahan wrote: > In addition, I guess we would eventually want to also document more generally > how to use rr with lldb (how to start the rr replay, how to connect lldb to > it, etc.) such that end users are able to discover this feature. However, I > guess before doing so, we would like to also implement reverse single- > stepping etc.? Yes, but actually I think this documentation can be in rr. Reverse-continue is 80% of what people do in practice so just advertising "lldb supports reverse-continue with rr now" would be OK. > reverse-continue on a non-reverse-capable process gives a decent error message Added. > process continue --forward also work for non-reverse-capable processes Added. > We might want to add a test case for this error condition? Added. https://github.com/llvm/llvm-project/pull/132783 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Combine disassembler gtest binaries for efficiency (PR #133539)
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 16 "test-check-lldb-unit". Full details are available at: https://lab.llvm.org/buildbot/#/builders/197/builds/3361 Here is the relevant piece of the build log for the reference ``` Step 16 (test-check-lldb-unit) failure: Test just built components: check-lldb-unit completed (failure) ... 0.772 [57/130/106]Building CXX object tools\lldb\unittests\TestingSupport\Symbol\CMakeFiles\lldbSymbolHelpers.dir\YAMLModuleTester.cpp.obj 0.779 [56/130/107]Building CXX object tools\lldb\unittests\Expression\CMakeFiles\ExpressionTests.dir\ClangExpressionDeclMapTest.cpp.obj 0.781 [55/130/108]Building RC object tools\lldb\unittests\tools\lldb-server\CMakeFiles\environment_check.dir\C_\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\resources\windows_version_resource.rc.res 0.783 [54/130/109]Building RC object tools\lldb\unittests\UnwindAssembly\ARM64\CMakeFiles\Arm64InstEmulationTests.dir\C_\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\resources\windows_version_resource.rc.res 0.788 [53/130/110]Building CXX object tools\lldb\unittests\Interpreter\CMakeFiles\InterpreterTests.dir\TestCommandPaths.cpp.obj 0.793 [52/130/111]Building CXX object tools\lldb\unittests\Interpreter\CMakeFiles\InterpreterTests.dir\TestCompletion.cpp.obj 0.797 [51/130/112]Building CXX object tools\lldb\unitteninja: no work to do. sts\Core\CMakeFiles\LLDBCoreTests.dir\CommunicationTest.cpp.obj 0.797 [50/130/112]Performing build step for 'builtins-aarch64-unknown-linux-gnu' 0.821 [49/121/123]Linking CXX executable tools\lldb\unittests\Disassembler\DisassemblerTests.exe FAILED: tools/lldb/unittests/Disassembler/DisassemblerTests.exe cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=tools\lldb\unittests\Disassembler\CMakeFiles\DisassemblerTests.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests -- C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\DisassemblerTests.rsp /out:tools\lldb\unittests\Disassembler\DisassemblerTests.exe /implib:tools\lldb\unittests\Disassembler\DisassemblerTests.lib /pdb:tools\lldb\unittests\Disassembler\DisassemblerTests.pdb /version:0.0 /machine:x64 /STACK:1000 /INCREMENTAL:NO /subsystem:console && cmd.exe /C "cd /D C:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\unittests\Disassembler && "C:\Program Files\CMake\bin\cmake.exe" -E make_directory C:/buildbot/as-builder-10/lldb-x-aarch64/build/tools/lldb/unittests/Disassembler/./Inputs"" LINK: command "C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\DisassemblerTests.rsp /out:tools\lldb\unittests\Disassembler\DisassemblerTests.exe /implib:tools\lldb\unittests\Disassembler\DisassemblerTests.lib /pdb:tools\lldb\unittests\Disassembler\DisassemblerTests.pdb /version:0.0 /machine:x64 /STACK:1000 /INCREMENTAL:NO /subsystem:console /MANIFEST /MANIFESTFILE:tools\lldb\unittests\Disassembler\DisassemblerTests.exe.manifest" failed (exit code 1120) with the following output: LINK : warning LNK4199: /DELAYLOAD:shell32.dll ignored; no imports found from shell32.dll LINK : warning LNK4199: /DELAYLOAD:ole32.dll ignored; no imports found from ole32.dll LINK : error LNK2001: unresolved external symbol mainCRTStartup tools\lldb\unittests\Disassembler\DisassemblerTests.exe : fatal error LNK1120: 1 unresolved externals 1.187 [49/75/169]Building CXX object tools\lldb\unittests\Symbol\CMakeFiles\SymbolTests.dir\TestClangASTImporter.cpp.obj 1.188 [49/73/171]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\StatusTest.cpp.obj 1.190 [49/72/172]Building CXX object tools\lldb\unittests\Target\CMakeFiles\TargetTests.dir\LocateModuleCallbackTest.cpp.obj 1.192 [49/71/173]Building CXX object tools\lldb\unittests\Symbol\CMakeFiles\SymbolTests.dir\SymtabTest.cpp.obj 1.193 [49/70/174]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\EventTest.cpp.obj 1.196 [49/69/175]Building CXX object tools\lldb\unittests\Symbol\CMakeFiles\SymbolTests.dir\TestLineEntry.cpp.obj 1.197 [49/68/176]Building CXX object tools\lldb\unittests\Symbol\CMakeFiles\SymbolTests.dir\TestDWARFCallFrameInfo.cpp.obj 1.198 [49/67/177]Building CXX object tools\lldb\unittests\Target\CMakeFiles\TargetTests.dir\MemoryTest.cpp.obj 1.199 [49/66/178]Building CXX object tools\lldb\unittests\Target\CMakeFiles\TargetTests.dir\RemoteAwarePlatformTest.cpp.obj 1.200 [49/65/179]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\RealpathPrefixesTest.cpp.obj 1.201 [49/64/180]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\FileSpecListTest.cpp.obj 1.203 [49/63/181]Building CXX object tools\lldb\unittests
[Lldb-commits] [lldb] [lldb] Implement CLI support for reverse-continue (PR #132783)
https://github.com/rocallahan ready_for_review https://github.com/llvm/llvm-project/pull/132783 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Combine disassembler gtest binaries for efficiency (PR #133539)
@@ -1,11 +1,32 @@ +set(disas_srcs "") + if("ARM" IN_LIST LLVM_TARGETS_TO_BUILD) - add_subdirectory(ARM) + set(disas_srcs ${disas_srcs} rnk wrote: Good idea, done. https://github.com/llvm/llvm-project/pull/133539 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 2796e41 - [lldb] Remove unused Version.h include in Telemetry.cpp (NFC)
Author: Jonas Devlieghere Date: 2025-03-30T15:56:14-07:00 New Revision: 2796e41ade306c3bf0f2e21311dff406bcf65652 URL: https://github.com/llvm/llvm-project/commit/2796e41ade306c3bf0f2e21311dff406bcf65652 DIFF: https://github.com/llvm/llvm-project/commit/2796e41ade306c3bf0f2e21311dff406bcf65652.diff LOG: [lldb] Remove unused Version.h include in Telemetry.cpp (NFC) Added: Modified: lldb/source/Core/Telemetry.cpp Removed: diff --git a/lldb/source/Core/Telemetry.cpp b/lldb/source/Core/Telemetry.cpp index 62ebdfc027d81..c7789d43c7899 100644 --- a/lldb/source/Core/Telemetry.cpp +++ b/lldb/source/Core/Telemetry.cpp @@ -10,7 +10,6 @@ #include "lldb/Core/Telemetry.h" #include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/UUID.h" -#include "lldb/Version/Version.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-forward.h" #include "llvm/ADT/StringRef.h" ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 848faf4 - [lldb] Combine disassembler gtest binaries for efficiency (#133539)
Author: Reid Kleckner Date: 2025-03-30T15:08:40-07:00 New Revision: 848faf49f793968ae6dee1577f507d4cc68b157e URL: https://github.com/llvm/llvm-project/commit/848faf49f793968ae6dee1577f507d4cc68b157e DIFF: https://github.com/llvm/llvm-project/commit/848faf49f793968ae6dee1577f507d4cc68b157e.diff LOG: [lldb] Combine disassembler gtest binaries for efficiency (#133539) Each of these executables is 642MB for me locally with split DWARF, and we don't need 3 statically linked gtest binaries when one will do. Added: Modified: lldb/unittests/Disassembler/CMakeLists.txt Removed: lldb/unittests/Disassembler/ARM/CMakeLists.txt lldb/unittests/Disassembler/RISCV/CMakeLists.txt lldb/unittests/Disassembler/x86/CMakeLists.txt diff --git a/lldb/unittests/Disassembler/ARM/CMakeLists.txt b/lldb/unittests/Disassembler/ARM/CMakeLists.txt deleted file mode 100644 index 91af06fa19d6f..0 --- a/lldb/unittests/Disassembler/ARM/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -add_lldb_unittest(DisassemblerTests - TestArm64Disassembly.cpp - TestArmv7Disassembly.cpp - LINK_LIBS -lldbCore -lldbSymbol -lldbTarget -lldbPluginDisassemblerLLVMC -lldbPluginProcessUtility - LINK_COMPONENTS -Support -${LLVM_TARGETS_TO_BUILD}) diff --git a/lldb/unittests/Disassembler/CMakeLists.txt b/lldb/unittests/Disassembler/CMakeLists.txt index 208f1807427f4..81aff5902db74 100644 --- a/lldb/unittests/Disassembler/CMakeLists.txt +++ b/lldb/unittests/Disassembler/CMakeLists.txt @@ -1,11 +1,32 @@ +set(disas_srcs "") + if("ARM" IN_LIST LLVM_TARGETS_TO_BUILD) - add_subdirectory(ARM) + list(APPEND +ARM/TestArm64Disassembly.cpp +ARM/TestArmv7Disassembly.cpp + ) endif() if("X86" IN_LIST LLVM_TARGETS_TO_BUILD) - add_subdirectory(x86) + list(APPEND disas_srcs +x86/TestGetControlFlowKindx86.cpp + ) endif() if("RISCV" IN_LIST LLVM_TARGETS_TO_BUILD) - add_subdirectory(RISCV) + list(APPEND disas_srcs +RISCV/TestMCDisasmInstanceRISCV.cpp + ) endif() + +add_lldb_unittest(DisassemblerTests + ${disas_srcs} + LINK_LIBS +lldbCore +lldbSymbol +lldbTarget +lldbPluginDisassemblerLLVMC +lldbPluginProcessUtility + LINK_COMPONENTS +Support +${LLVM_TARGETS_TO_BUILD}) diff --git a/lldb/unittests/Disassembler/RISCV/CMakeLists.txt b/lldb/unittests/Disassembler/RISCV/CMakeLists.txt deleted file mode 100644 index 5bcc3e948335c..0 --- a/lldb/unittests/Disassembler/RISCV/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -add_lldb_unittest(MCDisasmInstanceRISCVTests - TestMCDisasmInstanceRISCV.cpp -LINK_LIBS - lldbCore - lldbSymbol - lldbTarget - lldbPluginDisassemblerLLVMC - lldbPluginProcessUtility -LINK_COMPONENTS - Support - ${LLVM_TARGETS_TO_BUILD} - ) diff --git a/lldb/unittests/Disassembler/x86/CMakeLists.txt b/lldb/unittests/Disassembler/x86/CMakeLists.txt deleted file mode 100644 index 31d84cf5d8365..0 --- a/lldb/unittests/Disassembler/x86/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -add_lldb_unittest(GetControlFlowKindx86Tests -TestGetControlFlowKindx86.cpp -LINK_LIBS - lldbCore - lldbSymbol - lldbTarget - lldbPluginDisassemblerLLVMC - lldbPluginProcessUtility -LINK_COMPONENTS - Support - ${LLVM_TARGETS_TO_BUILD} - ) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Hoist UUID generation into the UUID class (PR #133662)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) Changes Hoist UUID generation into the UUID class and add a trivial unit test. This also changes the telemetry code to drop the double underscore if we failed to generate a UUID and subsequently logs to the Host instead of Object log channel. --- Full diff: https://github.com/llvm/llvm-project/pull/133662.diff 4 Files Affected: - (modified) lldb/include/lldb/Utility/UUID.h (+9-6) - (modified) lldb/source/Core/Telemetry.cpp (+11-10) - (modified) lldb/source/Utility/UUID.cpp (+8) - (modified) lldb/unittests/Utility/UUIDTest.cpp (+6-2) ``diff diff --git a/lldb/include/lldb/Utility/UUID.h b/lldb/include/lldb/Utility/UUID.h index bc4b4acd5a7d8..42c8844148776 100644 --- a/lldb/include/lldb/Utility/UUID.h +++ b/lldb/include/lldb/Utility/UUID.h @@ -12,6 +12,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Endian.h" +#include "llvm/Support/Error.h" #include #include #include @@ -26,7 +27,7 @@ class UUID { // will return false for IsValid. public: UUID() = default; - + /// Creates a uuid from the data pointed to by the bytes argument. UUID(llvm::ArrayRef bytes) : m_bytes(bytes) { if (llvm::all_of(m_bytes, [](uint8_t b) { return b == 0; })) { @@ -50,13 +51,12 @@ class UUID { /// Create a UUID from CvRecordPdb70. UUID(CvRecordPdb70 debug_info); - /// Creates a UUID from the data pointed to by the bytes argument. + /// Creates a UUID from the data pointed to by the bytes argument. UUID(const void *bytes, uint32_t num_bytes) { if (!bytes) return; -*this -= UUID(llvm::ArrayRef(reinterpret_cast(bytes), - num_bytes)); +*this = UUID(llvm::ArrayRef( +reinterpret_cast(bytes), num_bytes)); } void Clear() { m_bytes.clear(); } @@ -67,7 +67,7 @@ class UUID { explicit operator bool() const { return IsValid(); } bool IsValid() const { return !m_bytes.empty(); } - + std::string GetAsString(llvm::StringRef separator = "-") const; bool SetFromStringRef(llvm::StringRef str); @@ -88,6 +88,9 @@ class UUID { DecodeUUIDBytesFromString(llvm::StringRef str, llvm::SmallVectorImpl &uuid_bytes); + /// Generate a random UUID. + static llvm::Expected Generate(); + private: // GNU ld generates 20-byte build-ids. Size chosen to avoid heap allocations // for this case. diff --git a/lldb/source/Core/Telemetry.cpp b/lldb/source/Core/Telemetry.cpp index c7789d43c7899..e9ba7d1845bb4 100644 --- a/lldb/source/Core/Telemetry.cpp +++ b/lldb/source/Core/Telemetry.cpp @@ -9,15 +9,18 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/Telemetry.h" #include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" #include "lldb/Utility/UUID.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-forward.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Error.h" +#include "llvm/Support/Format.h" #include "llvm/Support/RandomNumberGenerator.h" #include "llvm/Telemetry/Telemetry.h" #include #include +#include #include #include #include @@ -37,18 +40,16 @@ static uint64_t ToNanosec(const SteadyTimePoint Point) { // This reduces the chances of getting the same UUID, even when the same // user runs the two copies of binary at the same time. static std::string MakeUUID() { - uint8_t random_bytes[16]; - std::string randomString = "_"; - if (auto ec = llvm::getRandomBytes(random_bytes, 16)) { -LLDB_LOG(GetLog(LLDBLog::Object), - "Failed to generate random bytes for UUID: {0}", ec.message()); - } else { -randomString = UUID(random_bytes).GetAsString(); + auto timestmap = std::chrono::steady_clock::now().time_since_epoch().count(); + + llvm::Expected maybe_uuid = UUID::Generate(); + if (!maybe_uuid) { +LLDB_LOG_ERROR(GetLog(LLDBLog::Host), maybe_uuid.takeError(), + "Failed to generate random bytes for UUID: {0}"); +return llvm::formatv("{0}", timestmap); } - return llvm::formatv( - "{0}_{1}", randomString, - std::chrono::steady_clock::now().time_since_epoch().count()); + return llvm::formatv("{0}_{1}", maybe_uuid->GetAsString(), timestmap); } void LLDBBaseTelemetryInfo::serialize(Serializer &serializer) const { diff --git a/lldb/source/Utility/UUID.cpp b/lldb/source/Utility/UUID.cpp index 370b8b6848c7e..80c829e40b2c9 100644 --- a/lldb/source/Utility/UUID.cpp +++ b/lldb/source/Utility/UUID.cpp @@ -11,6 +11,7 @@ #include "lldb/Utility/Stream.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Format.h" +#include "llvm/Support/RandomNumberGenerator.h" #include #include @@ -110,3 +111,10 @@ bool UUID::SetFromStringRef(llvm::StringRef str) { *this = UUID(bytes); return true; } + +llvm::Expected UUID::Generate() { + uint8_t random_bytes[16]; + if (auto ec = llvm::getRandomBytes(random_bytes, 16)) +return llvm::errorCodeToError(ec)
[Lldb-commits] [lldb] [lldb] Implement CLI support for reverse-continue (PR #132783)
vogelsgesang wrote: > Yes, but actually I think this documentation can be in rr. Agree, we should probably have the bulk of the documentation in the rr repo. Not sure if we want to put it online right away, or if we wait to wait for lldb-21 to go out the door first. (Not sure how accustomed rr users are to building lldb from source) Inside the LLVM project, we probably want to add a release note for this change, in the lldb section in `llvm/docs/ReleaseNotes.md`. Would be great I'd you could add a short bullet point there as part of this PR https://github.com/llvm/llvm-project/pull/132783 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Hoist UUID generation into the UUID class (PR #133662)
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/133662 Hoist UUID generation into the UUID class and add a trivial unit test. This also changes the telemetry code to drop the double underscore if we failed to generate a UUID and subsequently logs to the Host instead of Object log channel. >From 15e07ce18961e63c22510fa34c7baa5b5985dfe7 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Sun, 30 Mar 2025 16:10:05 -0700 Subject: [PATCH] [lldb] Hoist UUID generation into the UUID class Hoist UUID generation into the UUID class and add a trivial unit test. This also changes the telemetry code to drop the double underscore if we failed to generate a UUID and subsequently logs to the Host instead of Object log channel. --- lldb/include/lldb/Utility/UUID.h| 15 +-- lldb/source/Core/Telemetry.cpp | 21 +++-- lldb/source/Utility/UUID.cpp| 8 lldb/unittests/Utility/UUIDTest.cpp | 8 ++-- 4 files changed, 34 insertions(+), 18 deletions(-) diff --git a/lldb/include/lldb/Utility/UUID.h b/lldb/include/lldb/Utility/UUID.h index bc4b4acd5a7d8..42c8844148776 100644 --- a/lldb/include/lldb/Utility/UUID.h +++ b/lldb/include/lldb/Utility/UUID.h @@ -12,6 +12,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Endian.h" +#include "llvm/Support/Error.h" #include #include #include @@ -26,7 +27,7 @@ class UUID { // will return false for IsValid. public: UUID() = default; - + /// Creates a uuid from the data pointed to by the bytes argument. UUID(llvm::ArrayRef bytes) : m_bytes(bytes) { if (llvm::all_of(m_bytes, [](uint8_t b) { return b == 0; })) { @@ -50,13 +51,12 @@ class UUID { /// Create a UUID from CvRecordPdb70. UUID(CvRecordPdb70 debug_info); - /// Creates a UUID from the data pointed to by the bytes argument. + /// Creates a UUID from the data pointed to by the bytes argument. UUID(const void *bytes, uint32_t num_bytes) { if (!bytes) return; -*this -= UUID(llvm::ArrayRef(reinterpret_cast(bytes), - num_bytes)); +*this = UUID(llvm::ArrayRef( +reinterpret_cast(bytes), num_bytes)); } void Clear() { m_bytes.clear(); } @@ -67,7 +67,7 @@ class UUID { explicit operator bool() const { return IsValid(); } bool IsValid() const { return !m_bytes.empty(); } - + std::string GetAsString(llvm::StringRef separator = "-") const; bool SetFromStringRef(llvm::StringRef str); @@ -88,6 +88,9 @@ class UUID { DecodeUUIDBytesFromString(llvm::StringRef str, llvm::SmallVectorImpl &uuid_bytes); + /// Generate a random UUID. + static llvm::Expected Generate(); + private: // GNU ld generates 20-byte build-ids. Size chosen to avoid heap allocations // for this case. diff --git a/lldb/source/Core/Telemetry.cpp b/lldb/source/Core/Telemetry.cpp index c7789d43c7899..e9ba7d1845bb4 100644 --- a/lldb/source/Core/Telemetry.cpp +++ b/lldb/source/Core/Telemetry.cpp @@ -9,15 +9,18 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/Telemetry.h" #include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" #include "lldb/Utility/UUID.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-forward.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Error.h" +#include "llvm/Support/Format.h" #include "llvm/Support/RandomNumberGenerator.h" #include "llvm/Telemetry/Telemetry.h" #include #include +#include #include #include #include @@ -37,18 +40,16 @@ static uint64_t ToNanosec(const SteadyTimePoint Point) { // This reduces the chances of getting the same UUID, even when the same // user runs the two copies of binary at the same time. static std::string MakeUUID() { - uint8_t random_bytes[16]; - std::string randomString = "_"; - if (auto ec = llvm::getRandomBytes(random_bytes, 16)) { -LLDB_LOG(GetLog(LLDBLog::Object), - "Failed to generate random bytes for UUID: {0}", ec.message()); - } else { -randomString = UUID(random_bytes).GetAsString(); + auto timestmap = std::chrono::steady_clock::now().time_since_epoch().count(); + + llvm::Expected maybe_uuid = UUID::Generate(); + if (!maybe_uuid) { +LLDB_LOG_ERROR(GetLog(LLDBLog::Host), maybe_uuid.takeError(), + "Failed to generate random bytes for UUID: {0}"); +return llvm::formatv("{0}", timestmap); } - return llvm::formatv( - "{0}_{1}", randomString, - std::chrono::steady_clock::now().time_since_epoch().count()); + return llvm::formatv("{0}_{1}", maybe_uuid->GetAsString(), timestmap); } void LLDBBaseTelemetryInfo::serialize(Serializer &serializer) const { diff --git a/lldb/source/Utility/UUID.cpp b/lldb/source/Utility/UUID.cpp index 370b8b6848c7e..80c829e40b2c9 100644 --- a/lldb/source/Utility/UUID.cpp +++ b/lldb/source/Utility/UUID.cpp @@ -11,6 +11,7 @@ #include "lldb/Utility/Stream.h" #include "llvm/ADT/Strin
[Lldb-commits] [lldb] [llvm] [lldb] Implement CLI support for reverse-continue (PR #132783)
https://github.com/rocallahan updated https://github.com/llvm/llvm-project/pull/132783 >From 9bf6c80782adc8b76e50880ea0a2eea897274c25 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Fri, 19 Jul 2024 22:48:14 +1200 Subject: [PATCH] [lldb] Implement CLI support for reverse-continue This introduces the options "-F/--forward" and "-R/--reverse" to `process continue`. These only work if you're running with a gdbserver backend that supports reverse execution, such as rr. For testing we rely on the fake reverse- execution functionality in `lldbreverse.py`. --- lldb/source/Commands/CommandObjectProcess.cpp | 23 ++- lldb/source/Commands/Options.td | 4 ++ .../process/reverse-continue/Makefile | 3 + .../reverse-continue/TestReverseContinue.py | 66 +++ .../TestReverseContinueNotSupported.py| 51 ++ .../commands/process/reverse-continue/main.c | 12 llvm/docs/ReleaseNotes.md | 2 + 7 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 lldb/test/API/commands/process/reverse-continue/Makefile create mode 100644 lldb/test/API/commands/process/reverse-continue/TestReverseContinue.py create mode 100644 lldb/test/API/commands/process/reverse-continue/TestReverseContinueNotSupported.py create mode 100644 lldb/test/API/commands/process/reverse-continue/main.c diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 654dfa83ea444..463f4698a985f 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -468,7 +468,23 @@ class CommandObjectProcessContinue : public CommandObjectParsed { case 'b': m_run_to_bkpt_args.AppendArgument(option_arg); m_any_bkpts_specified = true; - break; +break; + case 'F': +if (m_base_direction == lldb::RunDirection::eRunReverse) { + error = Status::FromErrorString( + "cannot specify both 'forward' and 'reverse'"); + break; +} +m_base_direction = lldb::RunDirection::eRunForward; +break; + case 'R': +if (m_base_direction == lldb::RunDirection::eRunForward) { + error = Status::FromErrorString( + "cannot specify both 'forward' and 'reverse'"); + break; +} +m_base_direction = lldb::RunDirection::eRunReverse; +break; default: llvm_unreachable("Unimplemented option"); } @@ -479,6 +495,7 @@ class CommandObjectProcessContinue : public CommandObjectParsed { m_ignore = 0; m_run_to_bkpt_args.Clear(); m_any_bkpts_specified = false; + m_base_direction = std::nullopt; } llvm::ArrayRef GetDefinitions() override { @@ -488,6 +505,7 @@ class CommandObjectProcessContinue : public CommandObjectParsed { uint32_t m_ignore = 0; Args m_run_to_bkpt_args; bool m_any_bkpts_specified = false; +std::optional m_base_direction; }; void DoExecute(Args &command, CommandReturnObject &result) override { @@ -654,6 +672,9 @@ class CommandObjectProcessContinue : public CommandObjectParsed { } } + if (m_options.m_base_direction.has_value()) +process->SetBaseDirection(*m_options.m_base_direction); + const uint32_t iohandler_id = process->GetIOHandlerID(); StreamString stream; diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td index cc579d767eb06..e8c340b85aa92 100644 --- a/lldb/source/Commands/Options.td +++ b/lldb/source/Commands/Options.td @@ -744,6 +744,10 @@ let Command = "process continue" in { Arg<"BreakpointIDRange">, Desc<"Specify a breakpoint to continue to, temporarily " "ignoring other breakpoints. Can be specified more than once. " "The continue action will be done synchronously if this option is specified.">; + def thread_continue_forward : Option<"forward", "F">, Group<3>, +Desc<"Execute in forward direction">; + def thread_continue_reverse : Option<"reverse", "R">, Group<3>, +Desc<"Execute in reverse direction">; } let Command = "process detach" in { diff --git a/lldb/test/API/commands/process/reverse-continue/Makefile b/lldb/test/API/commands/process/reverse-continue/Makefile new file mode 100644 index 0..10495940055b6 --- /dev/null +++ b/lldb/test/API/commands/process/reverse-continue/Makefile @@ -0,0 +1,3 @@ +C_SOURCES := main.c + +include Makefile.rules diff --git a/lldb/test/API/commands/process/reverse-continue/TestReverseContinue.py b/lldb/test/API/commands/process/reverse-continue/TestReverseContinue.py new file mode 100644 index 0..c04d2b9d4b5a5 --- /dev/null +++ b/lldb/test/API/commands/process/reverse-continue/TestReverseContinue.py @@ -0,0 +1,66 @@ +""" +Test the "process continue --reverse" and "--forward" options. +""" + + +import lldb +from lldbsuite.test.lldbtest import * +from
[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/133624 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. >From 3240fe49515e5f59c5b9ff9c02423b77504d8a43 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Fri, 28 Mar 2025 14:02:53 -0700 Subject: [PATCH] [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
[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland: [clang] preserve class type sugar when taking pointer to member (PR #132401)
alexfh wrote: I've found a new crash that's not fixed by https://github.com/llvm/llvm-project/pull/133343. Reducing... 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] Combine disassembler gtest binaries for efficiency (PR #133539)
https://github.com/rnk updated https://github.com/llvm/llvm-project/pull/133539 >From 1c16745d1779d91bcc0b34e1a82cc98e70def316 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Fri, 28 Mar 2025 15:37:49 -0700 Subject: [PATCH 1/2] [lldb] Combine disassembler gtest binaries for efficiency Each of these executables is 642MB for me locally with split DWARF, and we don't need 3 statically linked gtest binaries when one will do. --- .../unittests/Disassembler/ARM/CMakeLists.txt | 12 - lldb/unittests/Disassembler/CMakeLists.txt| 27 --- .../Disassembler/RISCV/CMakeLists.txt | 12 - .../unittests/Disassembler/x86/CMakeLists.txt | 12 - 4 files changed, 24 insertions(+), 39 deletions(-) delete mode 100644 lldb/unittests/Disassembler/ARM/CMakeLists.txt delete mode 100644 lldb/unittests/Disassembler/RISCV/CMakeLists.txt delete mode 100644 lldb/unittests/Disassembler/x86/CMakeLists.txt diff --git a/lldb/unittests/Disassembler/ARM/CMakeLists.txt b/lldb/unittests/Disassembler/ARM/CMakeLists.txt deleted file mode 100644 index 91af06fa19d6f..0 --- a/lldb/unittests/Disassembler/ARM/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -add_lldb_unittest(DisassemblerTests - TestArm64Disassembly.cpp - TestArmv7Disassembly.cpp - LINK_LIBS -lldbCore -lldbSymbol -lldbTarget -lldbPluginDisassemblerLLVMC -lldbPluginProcessUtility - LINK_COMPONENTS -Support -${LLVM_TARGETS_TO_BUILD}) diff --git a/lldb/unittests/Disassembler/CMakeLists.txt b/lldb/unittests/Disassembler/CMakeLists.txt index 208f1807427f4..4d443b69f29b1 100644 --- a/lldb/unittests/Disassembler/CMakeLists.txt +++ b/lldb/unittests/Disassembler/CMakeLists.txt @@ -1,11 +1,32 @@ +set(disas_srcs "") + if("ARM" IN_LIST LLVM_TARGETS_TO_BUILD) - add_subdirectory(ARM) + set(disas_srcs ${disas_srcs} +ARM/TestArm64Disassembly.cpp +ARM/TestArmv7Disassembly.cpp + ) endif() if("X86" IN_LIST LLVM_TARGETS_TO_BUILD) - add_subdirectory(x86) + set(disas_srcs ${disas_srcs} +x86/TestGetControlFlowKindx86.cpp + ) endif() if("RISCV" IN_LIST LLVM_TARGETS_TO_BUILD) - add_subdirectory(RISCV) + set(disas_srcs ${disas_srcs} +RISCV/TestMCDisasmInstanceRISCV.cpp + ) endif() + +add_lldb_unittest(DisassemblerTests + ${disas_srcs} + LINK_LIBS +lldbCore +lldbSymbol +lldbTarget +lldbPluginDisassemblerLLVMC +lldbPluginProcessUtility + LINK_COMPONENTS +Support +${LLVM_TARGETS_TO_BUILD}) diff --git a/lldb/unittests/Disassembler/RISCV/CMakeLists.txt b/lldb/unittests/Disassembler/RISCV/CMakeLists.txt deleted file mode 100644 index 5bcc3e948335c..0 --- a/lldb/unittests/Disassembler/RISCV/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -add_lldb_unittest(MCDisasmInstanceRISCVTests - TestMCDisasmInstanceRISCV.cpp -LINK_LIBS - lldbCore - lldbSymbol - lldbTarget - lldbPluginDisassemblerLLVMC - lldbPluginProcessUtility -LINK_COMPONENTS - Support - ${LLVM_TARGETS_TO_BUILD} - ) diff --git a/lldb/unittests/Disassembler/x86/CMakeLists.txt b/lldb/unittests/Disassembler/x86/CMakeLists.txt deleted file mode 100644 index 31d84cf5d8365..0 --- a/lldb/unittests/Disassembler/x86/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -add_lldb_unittest(GetControlFlowKindx86Tests -TestGetControlFlowKindx86.cpp -LINK_LIBS - lldbCore - lldbSymbol - lldbTarget - lldbPluginDisassemblerLLVMC - lldbPluginProcessUtility -LINK_COMPONENTS - Support - ${LLVM_TARGETS_TO_BUILD} - ) >From ea81332c53b326b5d70844692b9a55845b09c23c Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Sun, 30 Mar 2025 14:49:38 -0700 Subject: [PATCH 2/2] use list(APPEND) --- lldb/unittests/Disassembler/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/unittests/Disassembler/CMakeLists.txt b/lldb/unittests/Disassembler/CMakeLists.txt index 4d443b69f29b1..81aff5902db74 100644 --- a/lldb/unittests/Disassembler/CMakeLists.txt +++ b/lldb/unittests/Disassembler/CMakeLists.txt @@ -1,20 +1,20 @@ set(disas_srcs "") if("ARM" IN_LIST LLVM_TARGETS_TO_BUILD) - set(disas_srcs ${disas_srcs} + list(APPEND ARM/TestArm64Disassembly.cpp ARM/TestArmv7Disassembly.cpp ) endif() if("X86" IN_LIST LLVM_TARGETS_TO_BUILD) - set(disas_srcs ${disas_srcs} + list(APPEND disas_srcs x86/TestGetControlFlowKindx86.cpp ) endif() if("RISCV" IN_LIST LLVM_TARGETS_TO_BUILD) - set(disas_srcs ${disas_srcs} + list(APPEND disas_srcs RISCV/TestMCDisasmInstanceRISCV.cpp ) endif() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Hoist UUID generation into the UUID class (PR #133662)
@@ -88,6 +88,9 @@ class UUID { DecodeUUIDBytesFromString(llvm::StringRef str, llvm::SmallVectorImpl &uuid_bytes); + /// Generate a random UUID. oontvoo wrote: s/Generate/Generates ? (to be consistent with the other comments) https://github.com/llvm/llvm-project/pull/133662 ___ 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 #132234)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Matheus Izvekov (mizvekov) Changes Original PR: #130537 Reland after updating lldb too. This changes the MemberPointerType representation to use a NestedNameSpecifier instead of a Type to represent the base class. Since the qualifiers are always parsed as nested names, there was an impedance mismatch when converting these back and forth into types, and this led to issues in preserving sugar. The nested names are indeed a better match for these, as the differences which a QualType can represent cannot be expressed syntatically, and they represent the use case more exactly, being either dependent or referring to a CXXRecord, unqualified. This patch also makes the MemberPointerType able to represent sugar for a {up/downcast}cast conversion of the base class, although for now the underlying type is canonical, as preserving the sugar up to that point requires further work. As usual, includes a few drive-by fixes in order to make use of the improvements. --- Patch is 143.32 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/132234.diff 71 Files Affected: - (modified) clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp (+1-2) - (modified) clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp (+3-1) - (modified) clang-tools-extra/clangd/unittests/FindTargetTests.cpp (+1-1) - (modified) clang/docs/ReleaseNotes.rst (+1) - (modified) clang/include/clang/AST/ASTContext.h (+3-4) - (modified) clang/include/clang/AST/ASTNodeTraverser.h (+5-2) - (modified) clang/include/clang/AST/CanonicalType.h (+1-1) - (modified) clang/include/clang/AST/RecursiveASTVisitor.h (+5-4) - (modified) clang/include/clang/AST/Type.h (+15-13) - (modified) clang/include/clang/AST/TypeLoc.h (+19-14) - (modified) clang/include/clang/AST/TypeProperties.td (+6-3) - (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+2-4) - (modified) clang/include/clang/Sema/Sema.h (+9-2) - (modified) clang/lib/AST/ASTContext.cpp (+47-21) - (modified) clang/lib/AST/ASTImporter.cpp (+9-5) - (modified) clang/lib/AST/ASTStructuralEquivalence.cpp (+6-2) - (modified) clang/lib/AST/ItaniumMangle.cpp (+10-1) - (modified) clang/lib/AST/NestedNameSpecifier.cpp (+1) - (modified) clang/lib/AST/ODRHash.cpp (+1-1) - (modified) clang/lib/AST/QualTypeNames.cpp (+4-3) - (modified) clang/lib/AST/Type.cpp (+30-4) - (modified) clang/lib/AST/TypePrinter.cpp (+2-2) - (modified) clang/lib/CodeGen/CGCXXABI.cpp (+1-1) - (modified) clang/lib/CodeGen/CGPointerAuth.cpp (+2-2) - (modified) clang/lib/CodeGen/CGVTables.cpp (+2-3) - (modified) clang/lib/CodeGen/CodeGenModule.cpp (+1-1) - (modified) clang/lib/CodeGen/ItaniumCXXABI.cpp (+5-5) - (modified) clang/lib/CodeGen/MicrosoftCXXABI.cpp (+4-3) - (modified) clang/lib/Sema/SemaAccess.cpp (+18-8) - (modified) clang/lib/Sema/SemaCast.cpp (+2-2) - (modified) clang/lib/Sema/SemaExpr.cpp (+4-6) - (modified) clang/lib/Sema/SemaExprCXX.cpp (+3-1) - (modified) clang/lib/Sema/SemaOpenMP.cpp (+2-3) - (modified) clang/lib/Sema/SemaOverload.cpp (+60-27) - (modified) clang/lib/Sema/SemaTemplate.cpp (+6-2) - (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (+16-5) - (modified) clang/lib/Sema/SemaType.cpp (+22-100) - (modified) clang/lib/Sema/TreeTransform.h (+29-30) - (modified) clang/lib/Serialization/ASTReader.cpp (+1-1) - (modified) clang/lib/Serialization/ASTWriter.cpp (+1-1) - (modified) clang/lib/Serialization/TemplateArgumentHasher.cpp (+3-1) - (modified) clang/test/AST/ast-dump-template-json-win32-mangler-crash.cpp (+3-1) - (modified) clang/test/AST/ast-dump-templates.cpp (+238) - (modified) clang/test/AST/ast-dump-types-json.cpp (+338-44) - (modified) clang/test/AST/attr-print-emit.cpp (+1-1) - (modified) clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp (+5-5) - (modified) clang/test/CXX/class.access/p6.cpp (+2-2) - (modified) clang/test/CXX/drs/cwg0xx.cpp (+6-6) - (modified) clang/test/CXX/drs/cwg13xx.cpp (+2-2) - (modified) clang/test/CXX/drs/cwg26xx.cpp (+3-3) - (modified) clang/test/CXX/drs/cwg2xx.cpp (+2-2) - (modified) clang/test/CXX/drs/cwg4xx.cpp (+1-1) - (modified) clang/test/CXX/drs/cwg7xx.cpp (+1-2) - (modified) clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp (+1-1) - (modified) clang/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp (+3-3) - (modified) clang/test/Index/print-type.cpp (+1-1) - (modified) clang/test/SemaCXX/addr-of-overloaded-function.cpp (+13-13) - (modified) clang/test/SemaCXX/builtin-ptrtomember-ambig.cpp (+2-2) - (modified) clang/test/SemaCXX/calling-conv-compat.cpp (+21-21) - (modified) clang/test/SemaCXX/err_init_conversion_failed.cpp (+1-1) - (modified) clang/test/SemaCXX/member-pointer.cpp (+13-4) - (modified) clang/test/SemaOpenACC/combined-construct-if-ast.cpp (+2-2) - (modified) clang/test/SemaOpenACC/combined-construct-num_workers-ast.cpp (+2-2) - (modified) clang/test/SemaOpenACC/compute-construct-
[Lldb-commits] [lldb] [LLDB][MIPS] Fix signal number of SIGBUS on mips (PR #132688)
https://github.com/yingopq edited https://github.com/llvm/llvm-project/pull/132688 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][MIPS] Fix signal SIGBUS number mismatch error on mips target (PR #132688)
https://github.com/yingopq updated https://github.com/llvm/llvm-project/pull/132688 >From 6b950401848296565f9aa988b6edceb5a1bbc2e1 Mon Sep 17 00:00:00 2001 From: Ying Huang Date: Mon, 24 Mar 2025 03:44:41 -0400 Subject: [PATCH] [LLDB][MIPS] Fix signal SIGBUS number mismatch error on mips target Now, because we do not support mips debugging, if we compile LLVM on mips target, would report error `static assertion failed:Value mismatch for signal number SIGBUS`, so add this condition to avoid error. --- lldb/source/Plugins/Process/Utility/LinuxSignals.cpp | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp index eaecc84df15d4..65184c9ee373a 100644 --- a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp +++ b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp @@ -8,7 +8,10 @@ #include "LinuxSignals.h" -#ifdef __linux__ +// Now, because we do not support mips debugging, if we compile LLVM on mips +// target, would report error `static assertion failed:Value mismatch for signal +// number SIGBUS`, so add this condition to avoid error. +#if defined(__linux__) && !defined(__mips__) #include #ifndef SEGV_BNDERR ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][MIPS] Fix signal SIGBUS number mismatch error on mips target (PR #132688)
https://github.com/yingopq edited https://github.com/llvm/llvm-project/pull/132688 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][MIPS] Fix signal number of SIGBUS on mips (PR #132688)
https://github.com/yingopq updated https://github.com/llvm/llvm-project/pull/132688 >From 1b1285a8a2e9e9d0218054183276556af890c96a Mon Sep 17 00:00:00 2001 From: Ying Huang Date: Mon, 24 Mar 2025 03:44:41 -0400 Subject: [PATCH] [LLDB][MIPS] Fix signal SIGBUS number mismatch error on mips target Now, because we do not support mips debugging, if we compile LLVM on mips target, would report error `static assertion failed:Value mismatch for signal number SIGBUS`, so add this condition to avoid error. --- lldb/source/Plugins/Process/Utility/LinuxSignals.cpp | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp index eaecc84df15d4..d254ab3fb3472 100644 --- a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp +++ b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp @@ -8,7 +8,10 @@ #include "LinuxSignals.h" -#ifdef __linux__ +// Now, because we do not support mips debugging, if we compile LLVM on mips target, +// would report error `static assertion failed:Value mismatch for signal number +// SIGBUS`, so add this condition to avoid error. +#if defined(__linux__) && !defined(__mips__) #include #ifndef SEGV_BNDERR ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Implement CLI support for reverse-continue (PR #132783)
@@ -654,6 +672,10 @@ class CommandObjectProcessContinue : public CommandObjectParsed { } } + if (m_options.m_base_direction.has_value()) { +process->SetBaseDirection(*m_options.m_base_direction); + } JDevlieghere wrote: ```suggestion if (m_options.m_base_direction.has_value()) process->SetBaseDirection(*m_options.m_base_direction); ``` https://github.com/llvm/llvm-project/pull/132783 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb] Implement CLI support for reverse-continue (PR #132783)
@@ -744,6 +744,10 @@ let Command = "process continue" in { Arg<"BreakpointIDRange">, Desc<"Specify a breakpoint to continue to, temporarily " "ignoring other breakpoints. Can be specified more than once. " "The continue action will be done synchronously if this option is specified.">; + def thread_continue_forward : Option<"forward", "F">, Group<3>, rocallahan wrote: Processes have a persistent base direction. `--forward` forces forward, `--reverse` forces reverse, and neither means continue in the current dirction. https://github.com/llvm/llvm-project/pull/132783 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Implement CLI support for reverse-continue (PR #132783)
https://github.com/rocallahan updated https://github.com/llvm/llvm-project/pull/132783 >From 0d8334833e62c2e89df13bb26d2ce723878d6638 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Fri, 19 Jul 2024 22:48:14 +1200 Subject: [PATCH] [lldb] Implement CLI support for reverse-continue This introduces the options "-F/--forward" and "-R/--reverse" to `process continue`. These only work if you're running with a gdbserver backend that supports reverse execution, such as rr. For testing we rely on the fake reverse- execution functionality in `lldbreverse.py`. --- lldb/source/Commands/CommandObjectProcess.cpp | 24 ++- lldb/source/Commands/Options.td | 4 ++ .../process/reverse-continue/Makefile | 3 + .../reverse-continue/TestReverseContinue.py | 66 +++ .../TestReverseContinueNotSupported.py| 51 ++ .../commands/process/reverse-continue/main.c | 12 6 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 lldb/test/API/commands/process/reverse-continue/Makefile create mode 100644 lldb/test/API/commands/process/reverse-continue/TestReverseContinue.py create mode 100644 lldb/test/API/commands/process/reverse-continue/TestReverseContinueNotSupported.py create mode 100644 lldb/test/API/commands/process/reverse-continue/main.c diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 654dfa83ea444..bed81ef0fa7cd 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -468,7 +468,23 @@ class CommandObjectProcessContinue : public CommandObjectParsed { case 'b': m_run_to_bkpt_args.AppendArgument(option_arg); m_any_bkpts_specified = true; - break; +break; + case 'F': +if (m_base_direction == lldb::RunDirection::eRunReverse) { + error = Status::FromErrorString( + "cannot specify both 'forward' and 'reverse'"); + break; +} +m_base_direction = lldb::RunDirection::eRunForward; +break; + case 'R': +if (m_base_direction == lldb::RunDirection::eRunForward) { + error = Status::FromErrorString( + "cannot specify both 'forward' and 'reverse'"); + break; +} +m_base_direction = lldb::RunDirection::eRunReverse; +break; default: llvm_unreachable("Unimplemented option"); } @@ -479,6 +495,7 @@ class CommandObjectProcessContinue : public CommandObjectParsed { m_ignore = 0; m_run_to_bkpt_args.Clear(); m_any_bkpts_specified = false; + m_base_direction = std::nullopt; } llvm::ArrayRef GetDefinitions() override { @@ -488,6 +505,7 @@ class CommandObjectProcessContinue : public CommandObjectParsed { uint32_t m_ignore = 0; Args m_run_to_bkpt_args; bool m_any_bkpts_specified = false; +std::optional m_base_direction; }; void DoExecute(Args &command, CommandReturnObject &result) override { @@ -654,6 +672,10 @@ class CommandObjectProcessContinue : public CommandObjectParsed { } } + if (m_options.m_base_direction.has_value()) { +process->SetBaseDirection(*m_options.m_base_direction); + } + const uint32_t iohandler_id = process->GetIOHandlerID(); StreamString stream; diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td index cc579d767eb06..e8c340b85aa92 100644 --- a/lldb/source/Commands/Options.td +++ b/lldb/source/Commands/Options.td @@ -744,6 +744,10 @@ let Command = "process continue" in { Arg<"BreakpointIDRange">, Desc<"Specify a breakpoint to continue to, temporarily " "ignoring other breakpoints. Can be specified more than once. " "The continue action will be done synchronously if this option is specified.">; + def thread_continue_forward : Option<"forward", "F">, Group<3>, +Desc<"Execute in forward direction">; + def thread_continue_reverse : Option<"reverse", "R">, Group<3>, +Desc<"Execute in reverse direction">; } let Command = "process detach" in { diff --git a/lldb/test/API/commands/process/reverse-continue/Makefile b/lldb/test/API/commands/process/reverse-continue/Makefile new file mode 100644 index 0..10495940055b6 --- /dev/null +++ b/lldb/test/API/commands/process/reverse-continue/Makefile @@ -0,0 +1,3 @@ +C_SOURCES := main.c + +include Makefile.rules diff --git a/lldb/test/API/commands/process/reverse-continue/TestReverseContinue.py b/lldb/test/API/commands/process/reverse-continue/TestReverseContinue.py new file mode 100644 index 0..c04d2b9d4b5a5 --- /dev/null +++ b/lldb/test/API/commands/process/reverse-continue/TestReverseContinue.py @@ -0,0 +1,66 @@ +""" +Test the "process continue --reverse" and "--forward" options. +""" + + +import lldb +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * +from
[Lldb-commits] [lldb] [lldb] Combine disassembler gtest binaries for efficiency (PR #133539)
rnk wrote: Thanks! https://github.com/llvm/llvm-project/pull/133539 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Combine disassembler gtest binaries for efficiency (PR #133539)
https://github.com/rnk closed https://github.com/llvm/llvm-project/pull/133539 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Combine disassembler gtest binaries for efficiency (PR #133539)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `lldb-remote-linux-ubuntu` running on `as-builder-9` while building `lldb` at step 6 "cmake-configure". Full details are available at: https://lab.llvm.org/buildbot/#/builders/195/builds/6919 Here is the relevant piece of the build log for the reference ``` Step 6 (cmake-configure) failure: cmake (failure) ... -- Enable editline support in LLDB: FALSE -- Enable curses support in LLDB: FALSE -- Enable LZMA compression support in LLDB: FALSE -- Could NOT find Lua (missing: LUA_LIBRARIES LUA_INCLUDE_DIR) (Required is at least version "5.3") -- Could NOT find LuaAndSwig (missing: LUA_LIBRARIES LUA_INCLUDE_DIR LUA_VERSION_MINOR LUA_VERSION_MAJOR) -- Enable Lua scripting support in LLDB: FALSE -- Found Python3: /usr/bin/python3.12 (found version "3.12.3") found components: Interpreter Development Development.Module Development.Embed -- Found PythonAndSwig: /usr/lib/x86_64-linux-gnu/libpython3.12.so -- Enable Python scripting support in LLDB: TRUE -- Enable Libxml 2 support in LLDB: FALSE -- Enable libfbsdvmcore support in LLDB: 0 -- Performing Test CXX_SUPPORTS_STRINGOP_TRUNCATION -- Performing Test CXX_SUPPORTS_STRINGOP_TRUNCATION - Success -- LLDB version: 21.0.0git -- Looking for ppoll -- Looking for ppoll - found -- Looking for ptsname_r -- Looking for ptsname_r - found -- Looking for accept4 -- Looking for accept4 - found -- Looking for termios.h -- Looking for termios.h - found -- Looking for include files sys/types.h, sys/event.h -- Looking for include files sys/types.h, sys/event.h - not found -- Looking for process_vm_readv -- Looking for process_vm_readv - found -- Looking for __NR_process_vm_readv -- Looking for __NR_process_vm_readv - found -- Looking for compression_encode_buffer in compression -- Looking for compression_encode_buffer in compression - not found -- Skipping FreeBSDKernel plugin due to missing libfbsdvmcore -- Symbols (liblldb): exporting all symbols from the lldb namespace -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- Found make: /usr/bin/gmake -- Performing Test CXX_SUPPORTS_DOCUMENTATION -- Performing Test CXX_SUPPORTS_DOCUMENTATION - Failed -- Looking for gettid -- Looking for gettid - found -- Registering ExampleIRTransforms as a pass plugin (static build: OFF) -- Registering Bye as a pass plugin (static build: OFF) -- Configuring done (16.9s) CMake Error at cmake/modules/AddLLVM.cmake:1068 (add_executable): No SOURCES given to target: DisassemblerTests Call Stack (most recent call first): cmake/modules/AddLLVM.cmake:1768 (add_llvm_executable) /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/unittests/CMakeLists.txt:26 (add_unittest) /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/unittests/Disassembler/CMakeLists.txt:22 (add_lldb_unittest) CMake Generate step failed. Build files cannot be regenerated correctly. ``` https://github.com/llvm/llvm-project/pull/133539 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 92e5916 - [lldb] Fix cmake logic when no targets are configured
Author: Reid Kleckner Date: 2025-03-30T15:14:48-07:00 New Revision: 92e591684576e7244d53722b04e840f28c3f03c3 URL: https://github.com/llvm/llvm-project/commit/92e591684576e7244d53722b04e840f28c3f03c3 DIFF: https://github.com/llvm/llvm-project/commit/92e591684576e7244d53722b04e840f28c3f03c3.diff LOG: [lldb] Fix cmake logic when no targets are configured Should fix reported lldb-remote-linux-ubuntu bot post-submit failure Added: Modified: lldb/unittests/Disassembler/CMakeLists.txt Removed: diff --git a/lldb/unittests/Disassembler/CMakeLists.txt b/lldb/unittests/Disassembler/CMakeLists.txt index 81aff5902db74..2a76158bf90fd 100644 --- a/lldb/unittests/Disassembler/CMakeLists.txt +++ b/lldb/unittests/Disassembler/CMakeLists.txt @@ -19,14 +19,16 @@ if("RISCV" IN_LIST LLVM_TARGETS_TO_BUILD) ) endif() -add_lldb_unittest(DisassemblerTests - ${disas_srcs} - LINK_LIBS -lldbCore -lldbSymbol -lldbTarget -lldbPluginDisassemblerLLVMC -lldbPluginProcessUtility - LINK_COMPONENTS -Support -${LLVM_TARGETS_TO_BUILD}) +if (disas_srcs) + add_lldb_unittest(DisassemblerTests +${disas_srcs} +LINK_LIBS + lldbCore + lldbSymbol + lldbTarget + lldbPluginDisassemblerLLVMC + lldbPluginProcessUtility +LINK_COMPONENTS + Support + ${LLVM_TARGETS_TO_BUILD}) +endif() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 5b6386d - [lldb-dap] Swapping to not use FLAG_ENUM and just defining typed enums. (#133622)
Author: John Harrison Date: 2025-03-30T16:42:49-07:00 New Revision: 5b6386dcbd68d3f7c1ce98dd7acdd4477d5724ad URL: https://github.com/llvm/llvm-project/commit/5b6386dcbd68d3f7c1ce98dd7acdd4477d5724ad DIFF: https://github.com/llvm/llvm-project/commit/5b6386dcbd68d3f7c1ce98dd7acdd4477d5724ad.diff LOG: [lldb-dap] Swapping to not use FLAG_ENUM and just defining typed enums. (#133622) Small tweak to the previous patch to make the enums in `lldb_dap::protocol` typed to work with types like `llvm::DenseSet` found by ubsan. Added: Modified: lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp lldb/tools/lldb-dap/Protocol/ProtocolBase.h lldb/tools/lldb-dap/Protocol/ProtocolRequests.h lldb/tools/lldb-dap/Protocol/ProtocolTypes.h Removed: diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp b/lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp index 0d63e37d3eafb..87fd0df018b65 100644 --- a/lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp +++ b/lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp @@ -7,7 +7,6 @@ //===--===// #include "Protocol/ProtocolBase.h" -#include "lldb/lldb-enumerations.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/Support/ErrorHandling.h" @@ -32,8 +31,11 @@ static bool mapRaw(const json::Value &Params, StringLiteral Prop, namespace lldb_dap::protocol { -FLAGS_ENUM(MessageType){eMessageTypeRequest, eMessageTypeResponse, -eMessageTypeEvent}; +enum MessageType : unsigned { + eMessageTypeRequest, + eMessageTypeResponse, + eMessageTypeEvent +}; bool fromJSON(const json::Value &Params, MessageType &M, json::Path P) { auto rawType = Params.getAsString(); diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolBase.h b/lldb/tools/lldb-dap/Protocol/ProtocolBase.h index 5ac68e38cb9c4..2c647610de11c 100644 --- a/lldb/tools/lldb-dap/Protocol/ProtocolBase.h +++ b/lldb/tools/lldb-dap/Protocol/ProtocolBase.h @@ -20,7 +20,6 @@ #ifndef LLDB_TOOLS_LLDB_DAP_PROTOCOL_H #define LLDB_TOOLS_LLDB_DAP_PROTOCOL_H -#include "lldb/lldb-enumerations.h" #include "llvm/Support/JSON.h" #include #include @@ -65,11 +64,11 @@ struct Event { llvm::json::Value toJSON(const Event &); bool fromJSON(const llvm::json::Value &, Event &, llvm::json::Path); -FLAGS_ENUM(ResponseMessage){ -/// The request was cancelled -eResponseMessageCancelled, -/// The request may be retried once the adapter is in a 'stopped' state -eResponseMessageNotStopped, +enum ResponseMessage : unsigned { + /// The request was cancelled + eResponseMessageCancelled, + /// The request may be retried once the adapter is in a 'stopped' state + eResponseMessageNotStopped, }; /// Response for a request. diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h index 116cf8516c52e..927106997953a 100644 --- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h +++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h @@ -22,7 +22,6 @@ #include "Protocol/ProtocolBase.h" #include "Protocol/ProtocolTypes.h" -#include "lldb/lldb-enumerations.h" #include "llvm/ADT/DenseSet.h" #include "llvm/Support/JSON.h" #include @@ -57,26 +56,26 @@ bool fromJSON(const llvm::json::Value &, DisconnectArguments &, using DisconnectResponse = VoidResponse; /// Features supported by DAP clients. -FLAGS_ENUM(ClientFeature){ -eClientFeatureVariableType, -eClientFeatureVariablePaging, -eClientFeatureRunInTerminalRequest, -eClientFeatureMemoryReferences, -eClientFeatureProgressReporting, -eClientFeatureInvalidatedEvent, -eClientFeatureMemoryEvent, -/// Client supports the `argsCanBeInterpretedByShell` attribute on the -/// `runInTerminal` request. -eClientFeatureArgsCanBeInterpretedByShell, -eClientFeatureStartDebuggingRequest, -/// The client will interpret ANSI escape sequences in the display of -/// `OutputEvent.output` and `Variable.value` fields when -/// `Capabilities.supportsANSIStyling` is also enabled. -eClientFeatureANSIStyling, +enum ClientFeature : unsigned { + eClientFeatureVariableType, + eClientFeatureVariablePaging, + eClientFeatureRunInTerminalRequest, + eClientFeatureMemoryReferences, + eClientFeatureProgressReporting, + eClientFeatureInvalidatedEvent, + eClientFeatureMemoryEvent, + /// Client supports the `argsCanBeInterpretedByShell` attribute on the + /// `runInTerminal` request. + eClientFeatureArgsCanBeInterpretedByShell, + eClientFeatureStartDebuggingRequest, + /// The client will interpret ANSI escape sequences in the display of + /// `OutputEvent.output` and `Variable.value` fields when + /// `Capabilities.supportsANSIStyling` is also enabled. + eClientFeatureANSIStyling, }; /// Format of paths reported by the debug adapter. -FLAGS_ENUM(PathFormat)
[Lldb-commits] [lldb] [lldb] Hoist UUID generation into the UUID class (PR #133662)
https://github.com/oontvoo approved this pull request. https://github.com/llvm/llvm-project/pull/133662 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb] Implement CLI support for reverse-continue (PR #132783)
rocallahan wrote: > or if we wait to wait for lldb-21 to go out the door first I'll definitely wait for the next lldb release before updating the rr docs. > Would be great I'd you could add a short bullet point there Done. https://github.com/llvm/llvm-project/pull/132783 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Hoist UUID generation into the UUID class (PR #133662)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/133662 >From 15e07ce18961e63c22510fa34c7baa5b5985dfe7 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Sun, 30 Mar 2025 16:10:05 -0700 Subject: [PATCH 1/3] [lldb] Hoist UUID generation into the UUID class Hoist UUID generation into the UUID class and add a trivial unit test. This also changes the telemetry code to drop the double underscore if we failed to generate a UUID and subsequently logs to the Host instead of Object log channel. --- lldb/include/lldb/Utility/UUID.h| 15 +-- lldb/source/Core/Telemetry.cpp | 21 +++-- lldb/source/Utility/UUID.cpp| 8 lldb/unittests/Utility/UUIDTest.cpp | 8 ++-- 4 files changed, 34 insertions(+), 18 deletions(-) diff --git a/lldb/include/lldb/Utility/UUID.h b/lldb/include/lldb/Utility/UUID.h index bc4b4acd5a7d8..42c8844148776 100644 --- a/lldb/include/lldb/Utility/UUID.h +++ b/lldb/include/lldb/Utility/UUID.h @@ -12,6 +12,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Endian.h" +#include "llvm/Support/Error.h" #include #include #include @@ -26,7 +27,7 @@ class UUID { // will return false for IsValid. public: UUID() = default; - + /// Creates a uuid from the data pointed to by the bytes argument. UUID(llvm::ArrayRef bytes) : m_bytes(bytes) { if (llvm::all_of(m_bytes, [](uint8_t b) { return b == 0; })) { @@ -50,13 +51,12 @@ class UUID { /// Create a UUID from CvRecordPdb70. UUID(CvRecordPdb70 debug_info); - /// Creates a UUID from the data pointed to by the bytes argument. + /// Creates a UUID from the data pointed to by the bytes argument. UUID(const void *bytes, uint32_t num_bytes) { if (!bytes) return; -*this -= UUID(llvm::ArrayRef(reinterpret_cast(bytes), - num_bytes)); +*this = UUID(llvm::ArrayRef( +reinterpret_cast(bytes), num_bytes)); } void Clear() { m_bytes.clear(); } @@ -67,7 +67,7 @@ class UUID { explicit operator bool() const { return IsValid(); } bool IsValid() const { return !m_bytes.empty(); } - + std::string GetAsString(llvm::StringRef separator = "-") const; bool SetFromStringRef(llvm::StringRef str); @@ -88,6 +88,9 @@ class UUID { DecodeUUIDBytesFromString(llvm::StringRef str, llvm::SmallVectorImpl &uuid_bytes); + /// Generate a random UUID. + static llvm::Expected Generate(); + private: // GNU ld generates 20-byte build-ids. Size chosen to avoid heap allocations // for this case. diff --git a/lldb/source/Core/Telemetry.cpp b/lldb/source/Core/Telemetry.cpp index c7789d43c7899..e9ba7d1845bb4 100644 --- a/lldb/source/Core/Telemetry.cpp +++ b/lldb/source/Core/Telemetry.cpp @@ -9,15 +9,18 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/Telemetry.h" #include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" #include "lldb/Utility/UUID.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-forward.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Error.h" +#include "llvm/Support/Format.h" #include "llvm/Support/RandomNumberGenerator.h" #include "llvm/Telemetry/Telemetry.h" #include #include +#include #include #include #include @@ -37,18 +40,16 @@ static uint64_t ToNanosec(const SteadyTimePoint Point) { // This reduces the chances of getting the same UUID, even when the same // user runs the two copies of binary at the same time. static std::string MakeUUID() { - uint8_t random_bytes[16]; - std::string randomString = "_"; - if (auto ec = llvm::getRandomBytes(random_bytes, 16)) { -LLDB_LOG(GetLog(LLDBLog::Object), - "Failed to generate random bytes for UUID: {0}", ec.message()); - } else { -randomString = UUID(random_bytes).GetAsString(); + auto timestmap = std::chrono::steady_clock::now().time_since_epoch().count(); + + llvm::Expected maybe_uuid = UUID::Generate(); + if (!maybe_uuid) { +LLDB_LOG_ERROR(GetLog(LLDBLog::Host), maybe_uuid.takeError(), + "Failed to generate random bytes for UUID: {0}"); +return llvm::formatv("{0}", timestmap); } - return llvm::formatv( - "{0}_{1}", randomString, - std::chrono::steady_clock::now().time_since_epoch().count()); + return llvm::formatv("{0}_{1}", maybe_uuid->GetAsString(), timestmap); } void LLDBBaseTelemetryInfo::serialize(Serializer &serializer) const { diff --git a/lldb/source/Utility/UUID.cpp b/lldb/source/Utility/UUID.cpp index 370b8b6848c7e..80c829e40b2c9 100644 --- a/lldb/source/Utility/UUID.cpp +++ b/lldb/source/Utility/UUID.cpp @@ -11,6 +11,7 @@ #include "lldb/Utility/Stream.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Format.h" +#include "llvm/Support/RandomNumberGenerator.h" #include #include @@ -110,3 +111,10 @@ bool UUID::SetFromStringRef(llvm::StringRef str) { *this = UUID(bytes); return true; } + +l
[Lldb-commits] [lldb] [lldb] Hoist UUID generation into the UUID class (PR #133662)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/133662 >From 15e07ce18961e63c22510fa34c7baa5b5985dfe7 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Sun, 30 Mar 2025 16:10:05 -0700 Subject: [PATCH 1/2] [lldb] Hoist UUID generation into the UUID class Hoist UUID generation into the UUID class and add a trivial unit test. This also changes the telemetry code to drop the double underscore if we failed to generate a UUID and subsequently logs to the Host instead of Object log channel. --- lldb/include/lldb/Utility/UUID.h| 15 +-- lldb/source/Core/Telemetry.cpp | 21 +++-- lldb/source/Utility/UUID.cpp| 8 lldb/unittests/Utility/UUIDTest.cpp | 8 ++-- 4 files changed, 34 insertions(+), 18 deletions(-) diff --git a/lldb/include/lldb/Utility/UUID.h b/lldb/include/lldb/Utility/UUID.h index bc4b4acd5a7d8..42c8844148776 100644 --- a/lldb/include/lldb/Utility/UUID.h +++ b/lldb/include/lldb/Utility/UUID.h @@ -12,6 +12,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Endian.h" +#include "llvm/Support/Error.h" #include #include #include @@ -26,7 +27,7 @@ class UUID { // will return false for IsValid. public: UUID() = default; - + /// Creates a uuid from the data pointed to by the bytes argument. UUID(llvm::ArrayRef bytes) : m_bytes(bytes) { if (llvm::all_of(m_bytes, [](uint8_t b) { return b == 0; })) { @@ -50,13 +51,12 @@ class UUID { /// Create a UUID from CvRecordPdb70. UUID(CvRecordPdb70 debug_info); - /// Creates a UUID from the data pointed to by the bytes argument. + /// Creates a UUID from the data pointed to by the bytes argument. UUID(const void *bytes, uint32_t num_bytes) { if (!bytes) return; -*this -= UUID(llvm::ArrayRef(reinterpret_cast(bytes), - num_bytes)); +*this = UUID(llvm::ArrayRef( +reinterpret_cast(bytes), num_bytes)); } void Clear() { m_bytes.clear(); } @@ -67,7 +67,7 @@ class UUID { explicit operator bool() const { return IsValid(); } bool IsValid() const { return !m_bytes.empty(); } - + std::string GetAsString(llvm::StringRef separator = "-") const; bool SetFromStringRef(llvm::StringRef str); @@ -88,6 +88,9 @@ class UUID { DecodeUUIDBytesFromString(llvm::StringRef str, llvm::SmallVectorImpl &uuid_bytes); + /// Generate a random UUID. + static llvm::Expected Generate(); + private: // GNU ld generates 20-byte build-ids. Size chosen to avoid heap allocations // for this case. diff --git a/lldb/source/Core/Telemetry.cpp b/lldb/source/Core/Telemetry.cpp index c7789d43c7899..e9ba7d1845bb4 100644 --- a/lldb/source/Core/Telemetry.cpp +++ b/lldb/source/Core/Telemetry.cpp @@ -9,15 +9,18 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/Telemetry.h" #include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" #include "lldb/Utility/UUID.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-forward.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Error.h" +#include "llvm/Support/Format.h" #include "llvm/Support/RandomNumberGenerator.h" #include "llvm/Telemetry/Telemetry.h" #include #include +#include #include #include #include @@ -37,18 +40,16 @@ static uint64_t ToNanosec(const SteadyTimePoint Point) { // This reduces the chances of getting the same UUID, even when the same // user runs the two copies of binary at the same time. static std::string MakeUUID() { - uint8_t random_bytes[16]; - std::string randomString = "_"; - if (auto ec = llvm::getRandomBytes(random_bytes, 16)) { -LLDB_LOG(GetLog(LLDBLog::Object), - "Failed to generate random bytes for UUID: {0}", ec.message()); - } else { -randomString = UUID(random_bytes).GetAsString(); + auto timestmap = std::chrono::steady_clock::now().time_since_epoch().count(); + + llvm::Expected maybe_uuid = UUID::Generate(); + if (!maybe_uuid) { +LLDB_LOG_ERROR(GetLog(LLDBLog::Host), maybe_uuid.takeError(), + "Failed to generate random bytes for UUID: {0}"); +return llvm::formatv("{0}", timestmap); } - return llvm::formatv( - "{0}_{1}", randomString, - std::chrono::steady_clock::now().time_since_epoch().count()); + return llvm::formatv("{0}_{1}", maybe_uuid->GetAsString(), timestmap); } void LLDBBaseTelemetryInfo::serialize(Serializer &serializer) const { diff --git a/lldb/source/Utility/UUID.cpp b/lldb/source/Utility/UUID.cpp index 370b8b6848c7e..80c829e40b2c9 100644 --- a/lldb/source/Utility/UUID.cpp +++ b/lldb/source/Utility/UUID.cpp @@ -11,6 +11,7 @@ #include "lldb/Utility/Stream.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Format.h" +#include "llvm/Support/RandomNumberGenerator.h" #include #include @@ -110,3 +111,10 @@ bool UUID::SetFromStringRef(llvm::StringRef str) { *this = UUID(bytes); return true; } + +l
[Lldb-commits] [lldb] [lldb] Hoist UUID generation into the UUID class (PR #133662)
@@ -88,6 +88,9 @@ class UUID { DecodeUUIDBytesFromString(llvm::StringRef str, llvm::SmallVectorImpl &uuid_bytes); + /// Generate a random UUID. JDevlieghere wrote: I updated the existing comments to be imperative and updated this one to say "Create" to match the comment for the constructors. https://github.com/llvm/llvm-project/pull/133662 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb] Implement CLI support for reverse-continue (PR #132783)
@@ -744,6 +744,10 @@ let Command = "process continue" in { Arg<"BreakpointIDRange">, Desc<"Specify a breakpoint to continue to, temporarily " "ignoring other breakpoints. Can be specified more than once. " "The continue action will be done synchronously if this option is specified.">; + def thread_continue_forward : Option<"forward", "F">, Group<3>, medismailben wrote: I don't think it's necessary to have 2 options for this, I'd just keep the reverse option and make it default to false. That would simplify the logic in the CommandObject as well. https://github.com/llvm/llvm-project/pull/132783 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Hoist UUID generation into the UUID class (PR #133662)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/133662 >From f0a4b9bc2f20a812f7f37e5f5a2417dbbb4d45e0 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Sun, 30 Mar 2025 16:10:05 -0700 Subject: [PATCH] [lldb] Hoist UUID generation into the UUID class Hoist UUID generation into the UUID class and add a trivial unit test. This also changes the telemetry code to drop the double underscore if we failed to generate a UUID and subsequently logs to the Host instead of Object log channel. --- lldb/include/lldb/Utility/UUID.h| 28 lldb/source/Core/Telemetry.cpp | 21 +++-- lldb/source/Utility/UUID.cpp| 9 + lldb/unittests/Utility/UUIDTest.cpp | 14 -- 4 files changed, 48 insertions(+), 24 deletions(-) diff --git a/lldb/include/lldb/Utility/UUID.h b/lldb/include/lldb/Utility/UUID.h index bc4b4acd5a7d8..05731ea4dc090 100644 --- a/lldb/include/lldb/Utility/UUID.h +++ b/lldb/include/lldb/Utility/UUID.h @@ -12,26 +12,28 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Endian.h" +#include "llvm/Support/Error.h" #include #include #include +#include namespace lldb_private { - class Stream; +class Stream; +/// Represents UUID's of various sizes. In all cases, a uuid of all zeros is +/// treated as an "Invalid UUID" marker, and the UUID created from such data +/// will return false for IsValid. class UUID { - // Represents UUID's of various sizes. In all cases, a uuid of all zeros is - // treated as an "Invalid UUID" marker, and the UUID created from such data - // will return false for IsValid. public: UUID() = default; - - /// Creates a uuid from the data pointed to by the bytes argument. + + /// Create a uuid from the data pointed to by the bytes argument. UUID(llvm::ArrayRef bytes) : m_bytes(bytes) { if (llvm::all_of(m_bytes, [](uint8_t b) { return b == 0; })) { Clear(); - } +} } // Reference: @@ -50,13 +52,12 @@ class UUID { /// Create a UUID from CvRecordPdb70. UUID(CvRecordPdb70 debug_info); - /// Creates a UUID from the data pointed to by the bytes argument. + /// Create a UUID from the data pointed to by the bytes argument. UUID(const void *bytes, uint32_t num_bytes) { if (!bytes) return; -*this -= UUID(llvm::ArrayRef(reinterpret_cast(bytes), - num_bytes)); +*this = UUID(llvm::ArrayRef( +reinterpret_cast(bytes), num_bytes)); } void Clear() { m_bytes.clear(); } @@ -67,7 +68,7 @@ class UUID { explicit operator bool() const { return IsValid(); } bool IsValid() const { return !m_bytes.empty(); } - + std::string GetAsString(llvm::StringRef separator = "-") const; bool SetFromStringRef(llvm::StringRef str); @@ -88,6 +89,9 @@ class UUID { DecodeUUIDBytesFromString(llvm::StringRef str, llvm::SmallVectorImpl &uuid_bytes); + /// Create a random UUID. + static llvm::Expected Generate(uint32_t num_bytes = 16); + private: // GNU ld generates 20-byte build-ids. Size chosen to avoid heap allocations // for this case. diff --git a/lldb/source/Core/Telemetry.cpp b/lldb/source/Core/Telemetry.cpp index c7789d43c7899..e9ba7d1845bb4 100644 --- a/lldb/source/Core/Telemetry.cpp +++ b/lldb/source/Core/Telemetry.cpp @@ -9,15 +9,18 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/Telemetry.h" #include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" #include "lldb/Utility/UUID.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-forward.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Error.h" +#include "llvm/Support/Format.h" #include "llvm/Support/RandomNumberGenerator.h" #include "llvm/Telemetry/Telemetry.h" #include #include +#include #include #include #include @@ -37,18 +40,16 @@ static uint64_t ToNanosec(const SteadyTimePoint Point) { // This reduces the chances of getting the same UUID, even when the same // user runs the two copies of binary at the same time. static std::string MakeUUID() { - uint8_t random_bytes[16]; - std::string randomString = "_"; - if (auto ec = llvm::getRandomBytes(random_bytes, 16)) { -LLDB_LOG(GetLog(LLDBLog::Object), - "Failed to generate random bytes for UUID: {0}", ec.message()); - } else { -randomString = UUID(random_bytes).GetAsString(); + auto timestmap = std::chrono::steady_clock::now().time_since_epoch().count(); + + llvm::Expected maybe_uuid = UUID::Generate(); + if (!maybe_uuid) { +LLDB_LOG_ERROR(GetLog(LLDBLog::Host), maybe_uuid.takeError(), + "Failed to generate random bytes for UUID: {0}"); +return llvm::formatv("{0}", timestmap); } - return llvm::formatv( - "{0}_{1}", randomString, - std::chrono::steady_clock::now().time_since_epoch().count()); + return llvm::formatv("{0}_{1}", maybe_uuid->GetAsString(), timestmap); }