[Lldb-commits] [lldb] [lldb][OpenBSD] Make use of Environment class (PR #122040)
https://github.com/labath approved this pull request. If you feel up to it, you could also put into the common code (under `#if !APPLE && !WINDOWS`) and delete the implementations in other OSes as well. https://github.com/llvm/llvm-project/pull/122040 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Some base #if _AIX changes of a minimal lldb build (PR #120979)
https://github.com/DhruvSrivastavaX updated https://github.com/llvm/llvm-project/pull/120979 >From c8887adb58fc0042c99a66fbc436bc95361e9086 Mon Sep 17 00:00:00 2001 From: Dhruv-Srivastava Date: Mon, 23 Dec 2024 10:22:40 -0600 Subject: [PATCH 1/5] Some base #if _AIX changes --- .../Host/posix/ConnectionFileDescriptorPosix.cpp | 7 +++ lldb/source/Host/posix/DomainSocket.cpp | 6 +- lldb/source/Host/posix/FileSystemPosix.cpp| 2 ++ lldb/source/Plugins/Language/ObjC/Cocoa.cpp | 15 +++ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp index 6bdc33f8923281..e3d1300cf76eda 100644 --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -119,8 +119,7 @@ bool ConnectionFileDescriptor::IsConnected() const { ConnectionStatus ConnectionFileDescriptor::Connect(llvm::StringRef path, Status *error_ptr) { - return Connect( - path, [](llvm::StringRef) {}, error_ptr); + return Connect(path, [](llvm::StringRef) {}, error_ptr); } ConnectionStatus @@ -716,7 +715,7 @@ ConnectionFileDescriptor::ConnectFD(llvm::StringRef s, ConnectionStatus ConnectionFileDescriptor::ConnectFile( llvm::StringRef s, socket_id_callback_type socket_id_callback, Status *error_ptr) { -#if LLDB_ENABLE_POSIX +#if LLDB_ENABLE_POSIX && !defined(_AIX) std::string addr_str = s.str(); // file:///PATH int fd = FileSystem::Instance().Open(addr_str.c_str(), O_RDWR); @@ -747,7 +746,7 @@ ConnectionStatus ConnectionFileDescriptor::ConnectFile( m_io_sp = std::make_shared(fd, File::eOpenOptionReadWrite, true); return eConnectionStatusSuccess; -#endif // LLDB_ENABLE_POSIX +#endif // LLDB_ENABLE_POSIX && !defined(_AIX) llvm_unreachable("this function should be only called w/ LLDB_ENABLE_POSIX"); } diff --git a/lldb/source/Host/posix/DomainSocket.cpp b/lldb/source/Host/posix/DomainSocket.cpp index 9a0b385d998bfc..9f4f12bb481bd0 100644 --- a/lldb/source/Host/posix/DomainSocket.cpp +++ b/lldb/source/Host/posix/DomainSocket.cpp @@ -16,6 +16,9 @@ #include #include #include +#ifdef _AIX +#include +#endif using namespace lldb; using namespace lldb_private; @@ -86,7 +89,8 @@ Status DomainSocket::Connect(llvm::StringRef name) { if (error.Fail()) return error; if (llvm::sys::RetryAfterSignal(-1, ::connect, GetNativeSocket(), -(struct sockaddr *)&saddr_un, saddr_un_len) < 0) + (struct sockaddr *)&saddr_un, + saddr_un_len) < 0) SetLastError(error); return error; diff --git a/lldb/source/Host/posix/FileSystemPosix.cpp b/lldb/source/Host/posix/FileSystemPosix.cpp index 945e2affc83715..1a84f550662d75 100644 --- a/lldb/source/Host/posix/FileSystemPosix.cpp +++ b/lldb/source/Host/posix/FileSystemPosix.cpp @@ -11,7 +11,9 @@ // C includes #include #include +#ifndef _AIX #include +#endif #include #include #include diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp index bbe5d4c611f870..1d79edbede5d67 100644 --- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp +++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp @@ -31,7 +31,6 @@ #include "llvm/ADT/APInt.h" #include "llvm/ADT/bit.h" - using namespace lldb; using namespace lldb_private; using namespace lldb_private::formatters; @@ -267,21 +266,21 @@ bool lldb_private::formatters::NSIndexSetSummaryProvider( if (class_name == "NSIndexSet" || class_name == "NSMutableIndexSet") { // Foundation version 2000 added a bitmask if the index set fit in 64 bits // and a Tagged Pointer version if the bitmask is small enough to fit in - // the tagged pointer payload. + // the tagged pointer payload. // It also changed the layout (but not the size) of the set descriptor. // First check whether this is a tagged pointer. The bitmask will be in // the payload of the tagged pointer. uint64_t payload; - if (runtime->GetFoundationVersion() >= 2000 - && descriptor->GetTaggedPointerInfo(nullptr, nullptr, &payload)) { + if (runtime->GetFoundationVersion() >= 2000 && + descriptor->GetTaggedPointerInfo(nullptr, nullptr, &payload)) { count = llvm::popcount(payload); break; } // The first 32 bits describe the index set in all cases: Status error; uint32_t mode = process_sp->ReadUnsignedIntegerFromMemory( -valobj_addr + ptr_size, 4, 0, error); + valobj_addr + ptr_size, 4, 0, error); if (error.Fail()) return false; // Now check if the index is held in a bitmask in the object: @@ -292,7 +291,7 @@ bool lldb_private::formatters::NSIndexSetSummaryProvider( if (
[Lldb-commits] [lldb] [lldb][AIX] Some base #if _AIX changes of a minimal lldb build (PR #120979)
https://github.com/DavidSpickett approved this pull request. LGTM, @labath ? https://github.com/llvm/llvm-project/pull/120979 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [WIP][RFC][lldb] faster indexing (PR #122128)
https://github.com/labath created https://github.com/llvm/llvm-project/pull/122128 None >From b534596aa6d7c2c38610d8b32a06ca7a8c6857f5 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Wed, 8 Jan 2025 15:27:30 + Subject: [PATCH] faster indexing --- .../Plugins/SymbolFile/DWARF/DWARFUnit.h | 1 - .../SymbolFile/DWARF/ManualDWARFIndex.cpp | 282 ++--- .../SymbolFile/DWARF/ManualDWARFIndex.h | 24 +- .../Plugins/SymbolFile/DWARF/NameToDIE.cpp| 135 +++- .../Plugins/SymbolFile/DWARF/NameToDIE.h | 81 - .../unittests/SymbolFile/DWARF/CMakeLists.txt | 1 - .../DWARF/DWARFIndexCachingTest.cpp | 292 -- 7 files changed, 222 insertions(+), 594 deletions(-) delete mode 100644 lldb/unittests/SymbolFile/DWARF/DWARFIndexCachingTest.cpp diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h index ba142ae86fe0e5..da419169e25395 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h @@ -24,7 +24,6 @@ namespace lldb_private::plugin { namespace dwarf { class DWARFUnit; class DWARFCompileUnit; -class NameToDIE; class SymbolFileDWARF; class SymbolFileDWARFDwo; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp index 6f2c45e74132c1..1e180e3d296e2b 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp @@ -21,10 +21,11 @@ #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/Timer.h" -#include "llvm/Support/FormatVariadic.h" +#include "Plugins/SymbolFile/DWARF/NameToDIE.h" #include "llvm/Support/ThreadPool.h" #include #include +#include using namespace lldb_private; using namespace lldb; @@ -37,7 +38,6 @@ void ManualDWARFIndex::Index() { m_indexed = true; ElapsedTime elapsed(m_index_time); - LLDB_SCOPED_TIMERF("%p", static_cast(m_dwarf)); if (LoadFromCache()) { m_dwarf->SetDebugInfoIndexWasLoadedFromCache(); return; @@ -91,16 +91,15 @@ void ManualDWARFIndex::Index() { // Run a function for each compile unit in parallel using as many threads as // are available. This is significantly faster than submiting a new task for // each unit. - auto for_each_unit = [&](auto &&fn) { + auto for_each_unit = [&](auto &&fn, auto &&reduce) { std::atomic next_cu_idx = 0; -auto wrapper = [&fn, &next_cu_idx, &units_to_index, -&progress](size_t worker_id) { +auto wrapper = [&fn, &next_cu_idx, &units_to_index, &reduce](size_t worker_id) { size_t cu_idx; while ((cu_idx = next_cu_idx.fetch_add(1, std::memory_order_relaxed)) < units_to_index.size()) { fn(worker_id, cu_idx, units_to_index[cu_idx]); -progress.Increment(); } + reduce(worker_id); }; for (size_t i = 0; i < num_threads; ++i) @@ -109,6 +108,10 @@ void ManualDWARFIndex::Index() { task_group.wait(); }; +#define TTT(x) \ + static ::lldb_private::Timer::Category _cat(x); \ + ::lldb_private::Timer _scoped_timer(_cat, "") + // Extract dies for all DWARFs unit in parallel. Figure out which units // didn't have their DIEs already parsed and remember this. If no DIEs were // parsed prior to this index function call, we are going to want to clear the @@ -117,42 +120,92 @@ void ManualDWARFIndex::Index() { // in one unit refers to another and the indexes accesses those DIEs. std::vector> clear_cu_dies( units_to_index.size()); - for_each_unit([&clear_cu_dies](size_t, size_t idx, DWARFUnit *unit) { -clear_cu_dies[idx] = unit->ExtractDIEsScoped(); - }); + { +TTT("INDEX - EXTRACT"); +for_each_unit( +[&clear_cu_dies](size_t, size_t idx, DWARFUnit *unit) { + clear_cu_dies[idx] = unit->ExtractDIEsScoped(); +}, +[](size_t) {}); + } // Now index all DWARF unit in parallel. - std::vector sets(num_threads); - for_each_unit( - [this, dwp_dwarf, &sets](size_t worker_id, size_t, DWARFUnit *unit) { -IndexUnit(*unit, dwp_dwarf, sets[worker_id]); - }); - - // Merge partial indexes into a single index. Process each index in a set in - // parallel. - auto finalize_fn = [this, &sets, &progress](NameToDIE(IndexSet::*index)) { -NameToDIE &result = m_set.*index; -for (auto &set : sets) - result.Append(set.*index); -result.Finalize(); -progress.Increment(); - }; + std::vector> sets(num_threads); + { +TTT("INDEX - INDEX"); + +for_each_unit( +[this, dwp_dwarf, &sets](size_t worker_id, size_t, DWARFUnit *unit) { + IndexUnit(*unit, dwp_dwarf, sets[worker_id]); +}, +[&sets](size_t worker_id) { +
[Lldb-commits] [lldb] [lldb][AIX] Some base #if _AIX changes of a minimal lldb build (PR #120979)
@@ -14,6 +14,7 @@ #include #include +#include labath wrote: If bzero is out, then the header should go out as well (unless it used for other things, but I don't see anything like that). If anyone wants to reintroduce bzero, they can/should re-add the header as well. https://github.com/llvm/llvm-project/pull/120979 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Some base #if _AIX changes of a minimal lldb build (PR #120979)
https://github.com/labath approved this pull request. https://github.com/llvm/llvm-project/pull/120979 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 81898ac - Revert "[lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (#120457)"
Author: Benjamin Kramer Date: 2025-01-08T15:49:46+01:00 New Revision: 81898ac00e04ed3f352534a810829bdf4e6e14b7 URL: https://github.com/llvm/llvm-project/commit/81898ac00e04ed3f352534a810829bdf4e6e14b7 DIFF: https://github.com/llvm/llvm-project/commit/81898ac00e04ed3f352534a810829bdf4e6e14b7.diff LOG: Revert "[lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (#120457)" This reverts commit 0d9cf2671e06c9124a0b5fc753330c39c8b4a791. Breaks the lldb-aarch64-windows buildbot. Added: Modified: lldb/tools/lldb-dap/CMakeLists.txt lldb/tools/lldb-dap/DAP.cpp lldb/tools/lldb-dap/DAP.h lldb/tools/lldb-dap/IOStream.h lldb/tools/lldb-dap/OutputRedirector.cpp lldb/tools/lldb-dap/OutputRedirector.h lldb/tools/lldb-dap/lldb-dap.cpp Removed: diff --git a/lldb/tools/lldb-dap/CMakeLists.txt b/lldb/tools/lldb-dap/CMakeLists.txt index 43fc18873feb33..d68098bf7b3266 100644 --- a/lldb/tools/lldb-dap/CMakeLists.txt +++ b/lldb/tools/lldb-dap/CMakeLists.txt @@ -1,3 +1,7 @@ +if ( CMAKE_SYSTEM_NAME MATCHES "Windows" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD" ) + list(APPEND extra_libs lldbHost) +endif () + if (HAVE_LIBPTHREAD) list(APPEND extra_libs pthread) endif () @@ -22,11 +26,9 @@ add_lldb_tool(lldb-dap lldb-dap.cpp Breakpoint.cpp BreakpointBase.cpp - DAP.cpp ExceptionBreakpoint.cpp FifoFiles.cpp FunctionBreakpoint.cpp - InstructionBreakpoint.cpp IOStream.cpp JSONUtils.cpp LLDBUtils.cpp @@ -34,11 +36,12 @@ add_lldb_tool(lldb-dap ProgressEvent.cpp RunInTerminal.cpp SourceBreakpoint.cpp + DAP.cpp Watchpoint.cpp + InstructionBreakpoint.cpp LINK_LIBS liblldb -lldbHost ${extra_libs} LINK_COMPONENTS diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp index a67abe582abd40..35250d9eef608a 100644 --- a/lldb/tools/lldb-dap/DAP.cpp +++ b/lldb/tools/lldb-dap/DAP.cpp @@ -6,62 +6,34 @@ // //===--===// +#include +#include +#include +#include + #include "DAP.h" #include "JSONUtils.h" #include "LLDBUtils.h" -#include "OutputRedirector.h" -#include "lldb/API/SBBreakpoint.h" #include "lldb/API/SBCommandInterpreter.h" -#include "lldb/API/SBCommandReturnObject.h" #include "lldb/API/SBLanguageRuntime.h" #include "lldb/API/SBListener.h" -#include "lldb/API/SBProcess.h" #include "lldb/API/SBStream.h" -#include "lldb/Host/FileSystem.h" -#include "lldb/Utility/Status.h" -#include "lldb/lldb-defines.h" -#include "lldb/lldb-enumerations.h" -#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringExtras.h" -#include "llvm/ADT/Twine.h" -#include "llvm/Support/Error.h" -#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormatVariadic.h" -#include "llvm/Support/raw_ostream.h" -#include -#include -#include -#include -#include -#include -#include -#include #if defined(_WIN32) #define NOMINMAX #include #include #include -#else -#include #endif using namespace lldb_dap; -namespace { -#ifdef _WIN32 -const char DEV_NULL[] = "nul"; -#else -const char DEV_NULL[] = "/dev/null"; -#endif -} // namespace - namespace lldb_dap { -DAP::DAP(llvm::StringRef path, std::ofstream *log, ReplMode repl_mode, - StreamDescriptor input, StreamDescriptor output) -: debug_adaptor_path(path), log(log), input(std::move(input)), - output(std::move(output)), broadcaster("lldb-dap"), +DAP::DAP(llvm::StringRef path, ReplMode repl_mode) +: debug_adaptor_path(path), broadcaster("lldb-dap"), exception_breakpoints(), focus_tid(LLDB_INVALID_THREAD_ID), stop_at_entry(false), is_attach(false), enable_auto_variable_summaries(false), @@ -71,7 +43,21 @@ DAP::DAP(llvm::StringRef path, std::ofstream *log, ReplMode repl_mode, configuration_done_sent(false), waiting_for_run_in_terminal(false), progress_event_reporter( [&](const ProgressEvent &event) { SendJSON(event.ToJSON()); }), - reverse_request_seq(0), repl_mode(repl_mode) {} + reverse_request_seq(0), repl_mode(repl_mode) { + const char *log_file_path = getenv("LLDBDAP_LOG"); +#if defined(_WIN32) + // Windows opens stdout and stdin in text mode which converts \n to 13,10 + // while the value is just 10 on Darwin/Linux. Setting the file mode to binary + // fixes this. + int result = _setmode(fileno(stdout), _O_BINARY); + assert(result); + result = _setmode(fileno(stdin), _O_BINARY); + UNUSED_IF_ASSERT_DISABLED(result); + assert(result); +#endif + if (log_file_path) +log.reset(new std::ofstream(log_file_path)); +} DAP::~DAP() = default; @@ -187,45 +173,6 @@ ExceptionBreakpoint *DAP::GetExceptionBreakpoint(const lldb::break_id_t bp_id) { return nullptr; } -llvm::Error DAP::ConfigureIO(std::FILE *overrideOut, std::FILE *overrideErr) { - in = lldb::SBFile(std::fopen(DEV_NULL
[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)
d0k wrote: Reverted this in 81898ac00e04ed3f352534a810829bdf4e6e14b7. Apart from breaking windows, I'm also seeing some weirdness when debugging iOS apps with this change, don't know what's going on. https://github.com/llvm/llvm-project/pull/120457 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Some base #if _AIX changes of a minimal lldb build (PR #120979)
https://github.com/DhruvSrivastavaX updated https://github.com/llvm/llvm-project/pull/120979 >From c8887adb58fc0042c99a66fbc436bc95361e9086 Mon Sep 17 00:00:00 2001 From: Dhruv-Srivastava Date: Mon, 23 Dec 2024 10:22:40 -0600 Subject: [PATCH 1/6] Some base #if _AIX changes --- .../Host/posix/ConnectionFileDescriptorPosix.cpp | 7 +++ lldb/source/Host/posix/DomainSocket.cpp | 6 +- lldb/source/Host/posix/FileSystemPosix.cpp| 2 ++ lldb/source/Plugins/Language/ObjC/Cocoa.cpp | 15 +++ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp index 6bdc33f8923281..e3d1300cf76eda 100644 --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -119,8 +119,7 @@ bool ConnectionFileDescriptor::IsConnected() const { ConnectionStatus ConnectionFileDescriptor::Connect(llvm::StringRef path, Status *error_ptr) { - return Connect( - path, [](llvm::StringRef) {}, error_ptr); + return Connect(path, [](llvm::StringRef) {}, error_ptr); } ConnectionStatus @@ -716,7 +715,7 @@ ConnectionFileDescriptor::ConnectFD(llvm::StringRef s, ConnectionStatus ConnectionFileDescriptor::ConnectFile( llvm::StringRef s, socket_id_callback_type socket_id_callback, Status *error_ptr) { -#if LLDB_ENABLE_POSIX +#if LLDB_ENABLE_POSIX && !defined(_AIX) std::string addr_str = s.str(); // file:///PATH int fd = FileSystem::Instance().Open(addr_str.c_str(), O_RDWR); @@ -747,7 +746,7 @@ ConnectionStatus ConnectionFileDescriptor::ConnectFile( m_io_sp = std::make_shared(fd, File::eOpenOptionReadWrite, true); return eConnectionStatusSuccess; -#endif // LLDB_ENABLE_POSIX +#endif // LLDB_ENABLE_POSIX && !defined(_AIX) llvm_unreachable("this function should be only called w/ LLDB_ENABLE_POSIX"); } diff --git a/lldb/source/Host/posix/DomainSocket.cpp b/lldb/source/Host/posix/DomainSocket.cpp index 9a0b385d998bfc..9f4f12bb481bd0 100644 --- a/lldb/source/Host/posix/DomainSocket.cpp +++ b/lldb/source/Host/posix/DomainSocket.cpp @@ -16,6 +16,9 @@ #include #include #include +#ifdef _AIX +#include +#endif using namespace lldb; using namespace lldb_private; @@ -86,7 +89,8 @@ Status DomainSocket::Connect(llvm::StringRef name) { if (error.Fail()) return error; if (llvm::sys::RetryAfterSignal(-1, ::connect, GetNativeSocket(), -(struct sockaddr *)&saddr_un, saddr_un_len) < 0) + (struct sockaddr *)&saddr_un, + saddr_un_len) < 0) SetLastError(error); return error; diff --git a/lldb/source/Host/posix/FileSystemPosix.cpp b/lldb/source/Host/posix/FileSystemPosix.cpp index 945e2affc83715..1a84f550662d75 100644 --- a/lldb/source/Host/posix/FileSystemPosix.cpp +++ b/lldb/source/Host/posix/FileSystemPosix.cpp @@ -11,7 +11,9 @@ // C includes #include #include +#ifndef _AIX #include +#endif #include #include #include diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp index bbe5d4c611f870..1d79edbede5d67 100644 --- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp +++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp @@ -31,7 +31,6 @@ #include "llvm/ADT/APInt.h" #include "llvm/ADT/bit.h" - using namespace lldb; using namespace lldb_private; using namespace lldb_private::formatters; @@ -267,21 +266,21 @@ bool lldb_private::formatters::NSIndexSetSummaryProvider( if (class_name == "NSIndexSet" || class_name == "NSMutableIndexSet") { // Foundation version 2000 added a bitmask if the index set fit in 64 bits // and a Tagged Pointer version if the bitmask is small enough to fit in - // the tagged pointer payload. + // the tagged pointer payload. // It also changed the layout (but not the size) of the set descriptor. // First check whether this is a tagged pointer. The bitmask will be in // the payload of the tagged pointer. uint64_t payload; - if (runtime->GetFoundationVersion() >= 2000 - && descriptor->GetTaggedPointerInfo(nullptr, nullptr, &payload)) { + if (runtime->GetFoundationVersion() >= 2000 && + descriptor->GetTaggedPointerInfo(nullptr, nullptr, &payload)) { count = llvm::popcount(payload); break; } // The first 32 bits describe the index set in all cases: Status error; uint32_t mode = process_sp->ReadUnsignedIntegerFromMemory( -valobj_addr + ptr_size, 4, 0, error); + valobj_addr + ptr_size, 4, 0, error); if (error.Fail()) return false; // Now check if the index is held in a bitmask in the object: @@ -292,7 +291,7 @@ bool lldb_private::formatters::NSIndexSetSummaryProvider( if (
[Lldb-commits] [lldb] [LLDB] Add SBProgress so Python scripts can also report progress (PR #119052)
https://github.com/Jlalond updated https://github.com/llvm/llvm-project/pull/119052 >From d28dedabaeb6bdc763e8226e7d669ff4eba66d50 Mon Sep 17 00:00:00 2001 From: Jacob Lalonde Date: Fri, 6 Dec 2024 18:17:44 -0800 Subject: [PATCH 1/3] Add SBPRogress class to enable commands to async report to lldb-dap their progress --- lldb/bindings/headers.swig| 1 + .../bindings/interface/SBProgressDocstrings.i | 14 + lldb/bindings/interfaces.swig | 2 + lldb/include/lldb/API/SBDebugger.h| 3 +- lldb/include/lldb/API/SBProgress.h| 56 +++ lldb/include/lldb/lldb-forward.h | 1 + lldb/source/API/CMakeLists.txt| 1 + lldb/source/API/SBProgress.cpp| 34 +++ 8 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 lldb/bindings/interface/SBProgressDocstrings.i create mode 100644 lldb/include/lldb/API/SBProgress.h create mode 100644 lldb/source/API/SBProgress.cpp diff --git a/lldb/bindings/headers.swig b/lldb/bindings/headers.swig index c0dde905f986bd..5e7c54d1eb8393 100644 --- a/lldb/bindings/headers.swig +++ b/lldb/bindings/headers.swig @@ -52,6 +52,7 @@ #include "lldb/API/SBProcess.h" #include "lldb/API/SBProcessInfo.h" #include "lldb/API/SBProcessInfoList.h" +#include "lldb/API/SBProgress.h" #include "lldb/API/SBQueue.h" #include "lldb/API/SBQueueItem.h" #include "lldb/API/SBReproducer.h" diff --git a/lldb/bindings/interface/SBProgressDocstrings.i b/lldb/bindings/interface/SBProgressDocstrings.i new file mode 100644 index 00..016c02432c4117 --- /dev/null +++ b/lldb/bindings/interface/SBProgressDocstrings.i @@ -0,0 +1,14 @@ +%feature("docstring", +"A Progress indicator helper class. + +Any potentially long running sections of code in LLDB should report +progress so that clients are aware of delays that might appear during +debugging. Delays commonly include indexing debug information, parsing +symbol tables for object files, downloading symbols from remote +repositories, and many more things. + +The Progress class helps make sure that progress is correctly reported +and will always send an initial progress update, updates when +Progress::Increment() is called, and also will make sure that a progress +completed update is reported even if the user doesn't explicitly cause one +to be sent.") lldb::SBProgress diff --git a/lldb/bindings/interfaces.swig b/lldb/bindings/interfaces.swig index 8a6fed95f0b729..08df9a1a8d5392 100644 --- a/lldb/bindings/interfaces.swig +++ b/lldb/bindings/interfaces.swig @@ -54,6 +54,7 @@ %include "./interface/SBPlatformDocstrings.i" %include "./interface/SBProcessDocstrings.i" %include "./interface/SBProcessInfoDocstrings.i" +%include "./interface/SBProgressDocstrings.i" %include "./interface/SBQueueDocstrings.i" %include "./interface/SBQueueItemDocstrings.i" %include "./interface/SBReproducerDocstrings.i" @@ -133,6 +134,7 @@ %include "lldb/API/SBProcess.h" %include "lldb/API/SBProcessInfo.h" %include "lldb/API/SBProcessInfoList.h" +%include "lldb/API/SBProgress.h" %include "lldb/API/SBQueue.h" %include "lldb/API/SBQueueItem.h" %include "lldb/API/SBReproducer.h" diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index 787bd040dd15bb..eb371e33c4951c 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -203,7 +203,7 @@ class LLDB_API SBDebugger { lldb::SBCommandInterpreter GetCommandInterpreter(); void HandleCommand(const char *command); - + void RequestInterrupt(); void CancelInterruptRequest(); bool InterruptRequested(); @@ -517,6 +517,7 @@ class LLDB_API SBDebugger { friend class SBPlatform; friend class SBTarget; friend class SBTrace; + friend class SBProgress; lldb::SBTarget FindTargetWithLLDBProcess(const lldb::ProcessSP &processSP); diff --git a/lldb/include/lldb/API/SBProgress.h b/lldb/include/lldb/API/SBProgress.h new file mode 100644 index 00..38f4b4a81f42b7 --- /dev/null +++ b/lldb/include/lldb/API/SBProgress.h @@ -0,0 +1,56 @@ +//===-- SBProgress.h *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef LLDB_API_SBPROGRESS_H +#define LLDB_API_SBPROGRESS_H + +#include "lldb/API/SBDebugger.h" +#include "lldb/API/SBDefines.h" + +namespace lldb { + +/// A SB API Wrapper around lldb_private::Progress +class LLDB_API SBProgress { +public: + /// Construct a progress object with a title, details and a given debugger. + /// \param title + /// The title of the progress object. + /// \param details + /// The details of the progress object. + /// \param debugger + /// The deb
[Lldb-commits] [lldb] [LLDB] Add SBProgress so Python scripts can also report progress (PR #119052)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r 29ed6000d21edd1a88b2daad242e1f356cafbaca...26424c0ad0b85106ce20b8d93f40bc583805abd0 lldb/test/API/python_api/sbprogress/TestSBProgress.py `` View the diff from darker here. ``diff --- TestSBProgress.py 2025-01-08 18:53:14.00 + +++ TestSBProgress.py 2025-01-08 19:29:48.028593 + @@ -3,11 +3,10 @@ import lldb from lldbsuite.test.lldbtest import * class SBProgressTestCase(TestBase): - def test_with_external_bit_set(self): """Test SBProgress events are listened to when the external bit is set.""" progress = lldb.SBProgress("Test SBProgress", "Test progress", self.dbg) listener = lldb.SBListener("Test listener") `` https://github.com/llvm/llvm-project/pull/119052 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add SBProgress so Python scripts can also report progress (PR #119052)
https://github.com/Jlalond updated https://github.com/llvm/llvm-project/pull/119052 >From d28dedabaeb6bdc763e8226e7d669ff4eba66d50 Mon Sep 17 00:00:00 2001 From: Jacob Lalonde Date: Fri, 6 Dec 2024 18:17:44 -0800 Subject: [PATCH 1/4] Add SBPRogress class to enable commands to async report to lldb-dap their progress --- lldb/bindings/headers.swig| 1 + .../bindings/interface/SBProgressDocstrings.i | 14 + lldb/bindings/interfaces.swig | 2 + lldb/include/lldb/API/SBDebugger.h| 3 +- lldb/include/lldb/API/SBProgress.h| 56 +++ lldb/include/lldb/lldb-forward.h | 1 + lldb/source/API/CMakeLists.txt| 1 + lldb/source/API/SBProgress.cpp| 34 +++ 8 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 lldb/bindings/interface/SBProgressDocstrings.i create mode 100644 lldb/include/lldb/API/SBProgress.h create mode 100644 lldb/source/API/SBProgress.cpp diff --git a/lldb/bindings/headers.swig b/lldb/bindings/headers.swig index c0dde905f986bd..5e7c54d1eb8393 100644 --- a/lldb/bindings/headers.swig +++ b/lldb/bindings/headers.swig @@ -52,6 +52,7 @@ #include "lldb/API/SBProcess.h" #include "lldb/API/SBProcessInfo.h" #include "lldb/API/SBProcessInfoList.h" +#include "lldb/API/SBProgress.h" #include "lldb/API/SBQueue.h" #include "lldb/API/SBQueueItem.h" #include "lldb/API/SBReproducer.h" diff --git a/lldb/bindings/interface/SBProgressDocstrings.i b/lldb/bindings/interface/SBProgressDocstrings.i new file mode 100644 index 00..016c02432c4117 --- /dev/null +++ b/lldb/bindings/interface/SBProgressDocstrings.i @@ -0,0 +1,14 @@ +%feature("docstring", +"A Progress indicator helper class. + +Any potentially long running sections of code in LLDB should report +progress so that clients are aware of delays that might appear during +debugging. Delays commonly include indexing debug information, parsing +symbol tables for object files, downloading symbols from remote +repositories, and many more things. + +The Progress class helps make sure that progress is correctly reported +and will always send an initial progress update, updates when +Progress::Increment() is called, and also will make sure that a progress +completed update is reported even if the user doesn't explicitly cause one +to be sent.") lldb::SBProgress diff --git a/lldb/bindings/interfaces.swig b/lldb/bindings/interfaces.swig index 8a6fed95f0b729..08df9a1a8d5392 100644 --- a/lldb/bindings/interfaces.swig +++ b/lldb/bindings/interfaces.swig @@ -54,6 +54,7 @@ %include "./interface/SBPlatformDocstrings.i" %include "./interface/SBProcessDocstrings.i" %include "./interface/SBProcessInfoDocstrings.i" +%include "./interface/SBProgressDocstrings.i" %include "./interface/SBQueueDocstrings.i" %include "./interface/SBQueueItemDocstrings.i" %include "./interface/SBReproducerDocstrings.i" @@ -133,6 +134,7 @@ %include "lldb/API/SBProcess.h" %include "lldb/API/SBProcessInfo.h" %include "lldb/API/SBProcessInfoList.h" +%include "lldb/API/SBProgress.h" %include "lldb/API/SBQueue.h" %include "lldb/API/SBQueueItem.h" %include "lldb/API/SBReproducer.h" diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index 787bd040dd15bb..eb371e33c4951c 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -203,7 +203,7 @@ class LLDB_API SBDebugger { lldb::SBCommandInterpreter GetCommandInterpreter(); void HandleCommand(const char *command); - + void RequestInterrupt(); void CancelInterruptRequest(); bool InterruptRequested(); @@ -517,6 +517,7 @@ class LLDB_API SBDebugger { friend class SBPlatform; friend class SBTarget; friend class SBTrace; + friend class SBProgress; lldb::SBTarget FindTargetWithLLDBProcess(const lldb::ProcessSP &processSP); diff --git a/lldb/include/lldb/API/SBProgress.h b/lldb/include/lldb/API/SBProgress.h new file mode 100644 index 00..38f4b4a81f42b7 --- /dev/null +++ b/lldb/include/lldb/API/SBProgress.h @@ -0,0 +1,56 @@ +//===-- SBProgress.h *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef LLDB_API_SBPROGRESS_H +#define LLDB_API_SBPROGRESS_H + +#include "lldb/API/SBDebugger.h" +#include "lldb/API/SBDefines.h" + +namespace lldb { + +/// A SB API Wrapper around lldb_private::Progress +class LLDB_API SBProgress { +public: + /// Construct a progress object with a title, details and a given debugger. + /// \param title + /// The title of the progress object. + /// \param details + /// The details of the progress object. + /// \param debugger + /// The deb
[Lldb-commits] [lldb] [LLDB] Add SBProgress so Python scripts can also report progress (PR #119052)
Jlalond wrote: @JDevlieghere Do we want to add new tests having the external bit by default? I added unit tests in the [external category bit](https://github.com/llvm/llvm-project/pull/120171/files#diff-a1f24599f1588366a91518f71afd1a54b6f8172a1f0891747e6972d126be4159) PR. Any additional test recommendations? I didn't find any 'default' broadcast bit test cases. https://github.com/llvm/llvm-project/pull/119052 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Move GetEnvironment function into common code (PR #122173)
https://github.com/labath approved this pull request. Thanks. https://github.com/llvm/llvm-project/pull/122173 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Move GetEnvironment function into common code (PR #122173)
https://github.com/labath edited https://github.com/llvm/llvm-project/pull/122173 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Move GetEnvironment function into common code (PR #122173)
@@ -114,6 +114,12 @@ void LogChannelSystem::Initialize() { void LogChannelSystem::Terminate() { g_system_log.Disable(); } #if !defined(__APPLE__) && !defined(_WIN32) +extern "C" { +extern char **environ; +} labath wrote: ```suggestion extern "C" char **environ; ``` https://github.com/llvm/llvm-project/pull/122173 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 18de1db - [lldb][AIX] Some base #if _AIX changes of a minimal lldb build (#120979)
Author: Dhruv Srivastava Date: 2025-01-09T09:38:25+05:30 New Revision: 18de1db0cfbfbbf12d16338923b43077a87dce18 URL: https://github.com/llvm/llvm-project/commit/18de1db0cfbfbbf12d16338923b43077a87dce18 DIFF: https://github.com/llvm/llvm-project/commit/18de1db0cfbfbbf12d16338923b43077a87dce18.diff LOG: [lldb][AIX] Some base #if _AIX changes of a minimal lldb build (#120979) This PR is in reference to porting LLDB on AIX. Link to discussions on llvm discourse and github: 1. https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640 2. https://github.com/llvm/llvm-project/issues/101657 The complete changes for porting are present in this draft PR: https://github.com/llvm/llvm-project/pull/102601 Added some base #if _AIX changes for minimal lldb build. Added a PR for clang-format changes separately, to rebase this on later: - https://github.com/llvm/llvm-project/pull/120978 Review Request: @labath @DavidSpickett Added: Modified: lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp lldb/source/Plugins/Language/ObjC/Cocoa.cpp lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp Removed: diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp index ab4ddbfe1fb203..0ed2016667162a 100644 --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -730,9 +730,19 @@ ConnectionStatus ConnectionFileDescriptor::ConnectFile( struct termios options; ::tcgetattr(fd, &options); -// Set port speed to maximum +// Set port speed to the available maximum +#ifdef B115200 ::cfsetospeed(&options, B115200); ::cfsetispeed(&options, B115200); +#elif B57600 +::cfsetospeed(&options, B57600); +::cfsetispeed(&options, B57600); +#elif B38400 +::cfsetospeed(&options, B38400); +::cfsetispeed(&options, B38400); +#else +#error "Maximum Baud rate is Unknown" +#endif // Raw input, disable echo and signals options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp index b35e27ad8123f6..1d79edbede5d67 100644 --- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp +++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp @@ -1226,7 +1226,7 @@ bool lldb_private::formatters::ObjCSELSummaryProvider( time_t lldb_private::formatters::GetOSXEpoch() { static time_t epoch = 0; if (!epoch) { -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(_AIX) tzset(); tm tm_epoch; tm_epoch.tm_sec = 0; diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp index 3835f2b08a05f4..b202898ff438a6 100644 --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -8,7 +8,7 @@ #include "ObjectContainerBSDArchive.h" -#if defined(_WIN32) || defined(__ANDROID__) +#if defined(_WIN32) || defined(__ANDROID__) || defined(_AIX) // Defines from ar, missing on Windows #define SARMAG 8 #define ARFMAG "`\n" ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Some base #if _AIX changes of a minimal lldb build (PR #120979)
https://github.com/DhruvSrivastavaX closed https://github.com/llvm/llvm-project/pull/120979 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Docs] Add Guarded Control Stack to AArch64 Linux page (PR #117860)
@@ -229,3 +229,64 @@ bytes. `zt0`'s value and whether it is active or not will be saved prior to expression evaluation and restored afterwards. + +## Guarded Control Stack Extension (GCS) + +GCS support includes the following new registers: + +* `gcs_features_enabled` +* `gcs_features_locked` +* `gcspr_el0` + +These map to the registers ptrace provides. The first two have had a `gcs_` +prefix added as their names are too generic without it. + +When the GCS is enabled the kernel allocates a memory region for it. This region +has a special attribute that LLDB will detect and presents like this: +``` + (lldb) memory region --all + <...> + [0xf7a0-0xf7e0) rw- + shadow stack: yes + [0xf7e0-0xf7e1) --- +``` + +`shadow stack` is a generic term used in the kernel for secure stack +extensions like GCS. + +### Expression Evaluation + +To execute an expression when GCS is enabled, LLDB must push the return +address of the expression wrapper (usually the entry point of the program) +to the Guarded Control Stack. It does this by decrementing `gcspr_el0` and +writing to the location now pointed to by `gcspr_el0` (instead of using the +GCS push instructions). + +After an expression finishes, LLDB will restore the contents of all 3 +GCS registers, apart from the enable bit of `gcs_features_enabled`. This is +because there are limits on how often and from where you can set this +bit. + +We cannot enable GCS from ptrace at all and it is expected that a process +that has enabled GCS then disabled it, will not enable it again. The simplest +choice was to not restore the enable bit at all. It is up to the user or +program to manage that bit. + +The return address that LLDB pushed onto the Guarded Control Stack will be left +in place. As will any values that were pushed to the stack by functions run +during the expresison. omjavaid wrote: typo s/expresison/expression https://github.com/llvm/llvm-project/pull/117860 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Docs] Add Guarded Control Stack to AArch64 Linux page (PR #117860)
@@ -229,3 +229,64 @@ bytes. `zt0`'s value and whether it is active or not will be saved prior to expression evaluation and restored afterwards. + +## Guarded Control Stack Extension (GCS) + +GCS support includes the following new registers: + +* `gcs_features_enabled` +* `gcs_features_locked` +* `gcspr_el0` + +These map to the registers ptrace provides. The first two have had a `gcs_` omjavaid wrote: "Have had" sounds unnecessary. Replace with "The first two have a gcs_ prefix added." https://github.com/llvm/llvm-project/pull/117860 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Docs] Add Guarded Control Stack to AArch64 Linux page (PR #117860)
@@ -229,3 +229,64 @@ bytes. `zt0`'s value and whether it is active or not will be saved prior to expression evaluation and restored afterwards. + +## Guarded Control Stack Extension (GCS) + +GCS support includes the following new registers: + +* `gcs_features_enabled` +* `gcs_features_locked` +* `gcspr_el0` + +These map to the registers ptrace provides. The first two have had a `gcs_` +prefix added as their names are too generic without it. + +When the GCS is enabled the kernel allocates a memory region for it. This region +has a special attribute that LLDB will detect and presents like this: +``` + (lldb) memory region --all + <...> + [0xf7a0-0xf7e0) rw- + shadow stack: yes + [0xf7e0-0xf7e1) --- +``` + +`shadow stack` is a generic term used in the kernel for secure stack +extensions like GCS. + +### Expression Evaluation + +To execute an expression when GCS is enabled, LLDB must push the return +address of the expression wrapper (usually the entry point of the program) +to the Guarded Control Stack. It does this by decrementing `gcspr_el0` and +writing to the location now pointed to by `gcspr_el0` (instead of using the +GCS push instructions). + +After an expression finishes, LLDB will restore the contents of all 3 +GCS registers, apart from the enable bit of `gcs_features_enabled`. This is +because there are limits on how often and from where you can set this +bit. + +We cannot enable GCS from ptrace at all and it is expected that a process omjavaid wrote: This sentence could sound more clear, may be something like: "GCS cannot be enabled from ptrace and it is expected that a process which has enabled and then disabled GCS, will not enable it again." https://github.com/llvm/llvm-project/pull/117860 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Docs] Add Guarded Control Stack to AArch64 Linux page (PR #117860)
omjavaid wrote: I read the documentation again and find some minor points. Feel free to ignore them if you want. https://github.com/llvm/llvm-project/pull/117860 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)
luporl 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 6 > "test". > > Full details are available at: > https://lab.llvm.org/buildbot/#/builders/141/builds/5258 > Here is the relevant piece of the build log for the reference Hi. `lldb-aarch64-windows` has been broken for some time. Are there any plans to fix or revert this PR? https://github.com/llvm/llvm-project/pull/120457 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Linux] Mark memory regions used for shadow stacks (PR #117861)
omjavaid wrote: @DavidSpickett have you posted rest of the patches for GCS other than this one? https://github.com/llvm/llvm-project/pull/117861 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)
ashgti wrote: I'll take a look https://github.com/llvm/llvm-project/pull/120457 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [WIP][RFC][lldb] faster indexing (PR #122128)
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 fdd7cafb9078e146634a3fbb72a8949108dca425 b534596aa6d7c2c38610d8b32a06ca7a8c6857f5 --extensions cpp,h -- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.h `` View the diff from clang-format here. ``diff diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp index 1e180e3d29..1c5ce46d92 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp @@ -11,6 +11,7 @@ #include "Plugins/SymbolFile/DWARF/DWARFDebugInfo.h" #include "Plugins/SymbolFile/DWARF/DWARFDeclContext.h" #include "Plugins/SymbolFile/DWARF/LogChannelDWARF.h" +#include "Plugins/SymbolFile/DWARF/NameToDIE.h" #include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h" #include "lldb/Core/DataFileCache.h" #include "lldb/Core/Debugger.h" @@ -21,7 +22,6 @@ #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/Timer.h" -#include "Plugins/SymbolFile/DWARF/NameToDIE.h" #include "llvm/Support/ThreadPool.h" #include #include @@ -93,7 +93,8 @@ void ManualDWARFIndex::Index() { // each unit. auto for_each_unit = [&](auto &&fn, auto &&reduce) { std::atomic next_cu_idx = 0; -auto wrapper = [&fn, &next_cu_idx, &units_to_index, &reduce](size_t worker_id) { +auto wrapper = [&fn, &next_cu_idx, &units_to_index, +&reduce](size_t worker_id) { size_t cu_idx; while ((cu_idx = next_cu_idx.fetch_add(1, std::memory_order_relaxed)) < units_to_index.size()) { @@ -603,15 +604,14 @@ enum DataID { // index name tables. See DIERef class for details. constexpr uint32_t CURRENT_CACHE_VERSION = 2; -template +template bool ManualDWARFIndex::IndexSet::Decode(const DataExtractor &data, -lldb::offset_t *offset_ptr) { + lldb::offset_t *offset_ptr) { return true; } -template -void ManualDWARFIndex::IndexSet::Encode(DataEncoder &encoder) const { -} +template +void ManualDWARFIndex::IndexSet::Encode(DataEncoder &encoder) const {} bool ManualDWARFIndex::Decode(const DataExtractor &data, lldb::offset_t *offset_ptr, diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h index 281ec869a9..8774691f9e 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h @@ -59,8 +59,7 @@ public: void Dump(Stream &s) override; // Make IndexSet public so we can unit test the encoding and decoding logic. - template - struct IndexSet { + template struct IndexSet { T function_basenames; T function_fullnames; T function_methods; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp index 6e8a6b9f9c..bc32447eb7 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp @@ -64,8 +64,7 @@ void NameToDIE::FindAllEntriesForUnit( } } -void NameToDIE::Dump(Stream *s) { -} +void NameToDIE::Dump(Stream *s) {} void NameToDIE::ForEach( llvm::function_ref @@ -92,8 +91,7 @@ bool NameToDIE::Decode(const DataExtractor &data, lldb::offset_t *offset_ptr, return true; } -void NameToDIE::Encode(DataEncoder &encoder, ConstStringTable &strtab) const { -} +void NameToDIE::Encode(DataEncoder &encoder, ConstStringTable &strtab) const {} bool NameToDIE::operator==(const NameToDIE &rhs) const { return m_map == rhs.m_map; `` https://github.com/llvm/llvm-project/pull/122128 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Linux] Mark memory regions used for shadow stacks (PR #117861)
@@ -1629,10 +1630,10 @@ Status GDBRemoteCommunicationClient::GetMemoryRegionInfo( std::tie(flag, flags) = flags.split(' '); omjavaid wrote: instead of tokenizing and checking cant we just use `if (value.contains("mt")) region_info.SetMemoryTagged(MemoryRegionInfo::eYes); if (value.contains("ss")) region_info.SetIsShadowStack(MemoryRegionInfo::eYes);` https://github.com/llvm/llvm-project/pull/117861 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Linux] Mark memory regions used for shadow stacks (PR #117861)
@@ -164,12 +164,17 @@ void lldb_private::ParseLinuxSMapRegions(llvm::StringRef linux_smap, if (!name.contains(' ')) { if (region) { if (name == "VmFlags") { - if (value.contains("mt")) -region->SetMemoryTagged(MemoryRegionInfo::eYes); - else -region->SetMemoryTagged(MemoryRegionInfo::eNo); + region->SetMemoryTagged(MemoryRegionInfo::eNo); + region->SetIsShadowStack(MemoryRegionInfo::eNo); + + llvm::SmallVector flags; + value.split(flags, ' ', /*MaxSplit=*/-1, /*KeepEmpty=*/false); + for (llvm::StringRef flag : flags) omjavaid wrote: instead of tokenizing and checking cant we just use `if (value.contains("mt")) region_info.SetMemoryTagged(MemoryRegionInfo::eYes); if (value.contains("ss")) region_info.SetIsShadowStack(MemoryRegionInfo::eYes);` https://github.com/llvm/llvm-project/pull/117861 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Linux] Mark memory regions used for shadow stacks (PR #117861)
@@ -101,12 +105,13 @@ class MemoryRegionInfo { bool operator==(const MemoryRegionInfo &rhs) const { return m_range == rhs.m_range && m_read == rhs.m_read && m_write == rhs.m_write && m_execute == rhs.m_execute && - m_shared == rhs.m_shared && - m_mapped == rhs.m_mapped && m_name == rhs.m_name && - m_flash == rhs.m_flash && m_blocksize == rhs.m_blocksize && + m_shared == rhs.m_shared && m_mapped == rhs.m_mapped && omjavaid wrote: No real change happening here. https://github.com/llvm/llvm-project/pull/117861 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Linux] Mark memory regions used for shadow stacks (PR #117861)
@@ -2796,11 +2796,17 @@ GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfo( // Flags MemoryRegionInfo::OptionalBool memory_tagged = region_info.GetMemoryTagged(); -if (memory_tagged != MemoryRegionInfo::eDontKnow) { +MemoryRegionInfo::OptionalBool is_shadow_stack = +region_info.IsShadowStack(); + +if (memory_tagged != MemoryRegionInfo::eDontKnow || +is_shadow_stack != MemoryRegionInfo::eDontKnow) { response.PutCString("flags:"); - if (memory_tagged == MemoryRegionInfo::eYes) { + if (memory_tagged == MemoryRegionInfo::eYes) response.PutCString("mt"); - } + if (is_shadow_stack == MemoryRegionInfo::eYes) omjavaid wrote: Shouldnt there be a delimiter character between mt and ss? https://github.com/llvm/llvm-project/pull/117861 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Move GetEnvironment function into common code (PR #122173)
https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/122173 None >From 43784f2bb5f4755f9cf1e63738ad4c566c7d3044 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Wed, 8 Jan 2025 16:23:11 -0500 Subject: [PATCH] [lldb] Move GetEnvironment function into common code --- lldb/source/Host/common/Host.cpp | 6 ++ lldb/source/Host/freebsd/Host.cpp | 6 -- lldb/source/Host/linux/Host.cpp| 2 -- lldb/source/Host/netbsd/HostNetBSD.cpp | 6 -- lldb/source/Host/openbsd/Host.cpp | 6 -- 5 files changed, 6 insertions(+), 20 deletions(-) diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 03ea2f242d3c78..01749f4919de56 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -114,6 +114,12 @@ void LogChannelSystem::Initialize() { void LogChannelSystem::Terminate() { g_system_log.Disable(); } #if !defined(__APPLE__) && !defined(_WIN32) +extern "C" { +extern char **environ; +} + +Environment Host::GetEnvironment() { return Environment(environ); } + static thread_result_t MonitorChildProcessThreadFunction(::pid_t pid, Host::MonitorChildProcessCallback callback); diff --git a/lldb/source/Host/freebsd/Host.cpp b/lldb/source/Host/freebsd/Host.cpp index 89ebe714f095f8..14c0e9f2209d24 100644 --- a/lldb/source/Host/freebsd/Host.cpp +++ b/lldb/source/Host/freebsd/Host.cpp @@ -33,10 +33,6 @@ #include "llvm/TargetParser/Host.h" -extern "C" { -extern char **environ; -} - namespace lldb_private { class ProcessLaunchInfo; } @@ -241,8 +237,6 @@ bool Host::GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info) { return false; } -Environment Host::GetEnvironment() { return Environment(environ); } - Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { return Status::FromErrorString("unimplemented"); } diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp index f5ec2e187af196..25bef9b0e7151b 100644 --- a/lldb/source/Host/linux/Host.cpp +++ b/lldb/source/Host/linux/Host.cpp @@ -411,8 +411,6 @@ bool Host::GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info) { return GetProcessAndStatInfo(pid, process_info, State, tracerpid); } -Environment Host::GetEnvironment() { return Environment(environ); } - Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { return Status::FromErrorString("unimplemented"); } diff --git a/lldb/source/Host/netbsd/HostNetBSD.cpp b/lldb/source/Host/netbsd/HostNetBSD.cpp index 49ff342fe152f6..8904df5eba03eb 100644 --- a/lldb/source/Host/netbsd/HostNetBSD.cpp +++ b/lldb/source/Host/netbsd/HostNetBSD.cpp @@ -35,10 +35,6 @@ #include "llvm/Object/ELF.h" #include "llvm/TargetParser/Host.h" -extern "C" { -extern char **environ; -} - using namespace lldb; using namespace lldb_private; @@ -46,8 +42,6 @@ namespace lldb_private { class ProcessLaunchInfo; } -Environment Host::GetEnvironment() { return Environment(environ); } - static bool GetNetBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr, ProcessInstanceInfo &process_info) { if (!process_info.ProcessIDIsValid()) diff --git a/lldb/source/Host/openbsd/Host.cpp b/lldb/source/Host/openbsd/Host.cpp index 24650ff97075ea..2b66a3c8696b10 100644 --- a/lldb/source/Host/openbsd/Host.cpp +++ b/lldb/source/Host/openbsd/Host.cpp @@ -30,10 +30,6 @@ #include "llvm/TargetParser/Host.h" -extern "C" { -extern char **environ; -} - using namespace lldb; using namespace lldb_private; @@ -41,8 +37,6 @@ namespace lldb_private { class ProcessLaunchInfo; } -Environment Host::GetEnvironment() { return Environment(environ); } - static bool GetOpenBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr, ProcessInstanceInfo &process_info) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Move GetEnvironment function into common code (PR #122173)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Brad Smith (brad0) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/122173.diff 5 Files Affected: - (modified) lldb/source/Host/common/Host.cpp (+6) - (modified) lldb/source/Host/freebsd/Host.cpp (-6) - (modified) lldb/source/Host/linux/Host.cpp (-2) - (modified) lldb/source/Host/netbsd/HostNetBSD.cpp (-6) - (modified) lldb/source/Host/openbsd/Host.cpp (-6) ``diff diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 03ea2f242d3c78..01749f4919de56 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -114,6 +114,12 @@ void LogChannelSystem::Initialize() { void LogChannelSystem::Terminate() { g_system_log.Disable(); } #if !defined(__APPLE__) && !defined(_WIN32) +extern "C" { +extern char **environ; +} + +Environment Host::GetEnvironment() { return Environment(environ); } + static thread_result_t MonitorChildProcessThreadFunction(::pid_t pid, Host::MonitorChildProcessCallback callback); diff --git a/lldb/source/Host/freebsd/Host.cpp b/lldb/source/Host/freebsd/Host.cpp index 89ebe714f095f8..14c0e9f2209d24 100644 --- a/lldb/source/Host/freebsd/Host.cpp +++ b/lldb/source/Host/freebsd/Host.cpp @@ -33,10 +33,6 @@ #include "llvm/TargetParser/Host.h" -extern "C" { -extern char **environ; -} - namespace lldb_private { class ProcessLaunchInfo; } @@ -241,8 +237,6 @@ bool Host::GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info) { return false; } -Environment Host::GetEnvironment() { return Environment(environ); } - Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { return Status::FromErrorString("unimplemented"); } diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp index f5ec2e187af196..25bef9b0e7151b 100644 --- a/lldb/source/Host/linux/Host.cpp +++ b/lldb/source/Host/linux/Host.cpp @@ -411,8 +411,6 @@ bool Host::GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info) { return GetProcessAndStatInfo(pid, process_info, State, tracerpid); } -Environment Host::GetEnvironment() { return Environment(environ); } - Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { return Status::FromErrorString("unimplemented"); } diff --git a/lldb/source/Host/netbsd/HostNetBSD.cpp b/lldb/source/Host/netbsd/HostNetBSD.cpp index 49ff342fe152f6..8904df5eba03eb 100644 --- a/lldb/source/Host/netbsd/HostNetBSD.cpp +++ b/lldb/source/Host/netbsd/HostNetBSD.cpp @@ -35,10 +35,6 @@ #include "llvm/Object/ELF.h" #include "llvm/TargetParser/Host.h" -extern "C" { -extern char **environ; -} - using namespace lldb; using namespace lldb_private; @@ -46,8 +42,6 @@ namespace lldb_private { class ProcessLaunchInfo; } -Environment Host::GetEnvironment() { return Environment(environ); } - static bool GetNetBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr, ProcessInstanceInfo &process_info) { if (!process_info.ProcessIDIsValid()) diff --git a/lldb/source/Host/openbsd/Host.cpp b/lldb/source/Host/openbsd/Host.cpp index 24650ff97075ea..2b66a3c8696b10 100644 --- a/lldb/source/Host/openbsd/Host.cpp +++ b/lldb/source/Host/openbsd/Host.cpp @@ -30,10 +30,6 @@ #include "llvm/TargetParser/Host.h" -extern "C" { -extern char **environ; -} - using namespace lldb; using namespace lldb_private; @@ -41,8 +37,6 @@ namespace lldb_private { class ProcessLaunchInfo; } -Environment Host::GetEnvironment() { return Environment(environ); } - static bool GetOpenBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr, ProcessInstanceInfo &process_info) { `` https://github.com/llvm/llvm-project/pull/122173 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add DIL code for handling plain variable names. (PR #120971)
@@ -0,0 +1,117 @@ +//===-- DILEval.cpp ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "lldb/ValueObject/DILEval.h" + +#include + +#include "lldb/ValueObject/DILAST.h" +#include "lldb/ValueObject/ValueObject.h" +#include "llvm/Support/FormatAdapters.h" + +namespace lldb_private { + +namespace dil { + +DILInterpreter::DILInterpreter(lldb::TargetSP target, + std::shared_ptr sm) +: m_target(std::move(target)), m_sm(std::move(sm)) { + m_default_dynamic = lldb::eNoDynamicValues; +} + +DILInterpreter::DILInterpreter(lldb::TargetSP target, + std::shared_ptr sm, + lldb::DynamicValueType use_dynamic) +: m_target(std::move(target)), m_sm(std::move(sm)), + m_default_dynamic(use_dynamic) {} + +DILInterpreter::DILInterpreter(lldb::TargetSP target, + std::shared_ptr sm, + lldb::ValueObjectSP scope) +: m_target(std::move(target)), m_sm(std::move(sm)), + m_scope(std::move(scope)) { + m_default_dynamic = lldb::eNoDynamicValues; + // If `m_scope` is a reference, dereference it. All operations on a reference + // should be operations on the referent. + if (m_scope->GetCompilerType().IsValid() && + m_scope->GetCompilerType().IsReferenceType()) { +Status error; +m_scope = m_scope->Dereference(error); cmtice wrote: Could m_scope->GetCompilerType().IsReferenceType() (the test on the line above) return 'true' if the dereferencing could fail? https://github.com/llvm/llvm-project/pull/120971 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add DIL code for handling plain variable names. (PR #120971)
@@ -0,0 +1,117 @@ +//===-- DILEval.cpp ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "lldb/ValueObject/DILEval.h" + +#include + +#include "lldb/ValueObject/DILAST.h" +#include "lldb/ValueObject/ValueObject.h" +#include "llvm/Support/FormatAdapters.h" + +namespace lldb_private { + +namespace dil { + +DILInterpreter::DILInterpreter(lldb::TargetSP target, + std::shared_ptr sm) +: m_target(std::move(target)), m_sm(std::move(sm)) { + m_default_dynamic = lldb::eNoDynamicValues; +} + +DILInterpreter::DILInterpreter(lldb::TargetSP target, + std::shared_ptr sm, + lldb::DynamicValueType use_dynamic) +: m_target(std::move(target)), m_sm(std::move(sm)), + m_default_dynamic(use_dynamic) {} + +DILInterpreter::DILInterpreter(lldb::TargetSP target, + std::shared_ptr sm, + lldb::ValueObjectSP scope) +: m_target(std::move(target)), m_sm(std::move(sm)), + m_scope(std::move(scope)) { + m_default_dynamic = lldb::eNoDynamicValues; + // If `m_scope` is a reference, dereference it. All operations on a reference + // should be operations on the referent. + if (m_scope->GetCompilerType().IsValid() && + m_scope->GetCompilerType().IsReferenceType()) { +Status error; +m_scope = m_scope->Dereference(error); + } +} + +lldb::ValueObjectSP DILInterpreter::DILEval(const DILASTNode *tree, +lldb::TargetSP target_sp, +Status &error) { + m_error.Clear(); + // Evaluate an AST. + DILEvalNode(tree); + // Set the error. + error = std::move(m_error); + // Return the computed result. If there was an error, it will be invalid. + return m_result; +} + +lldb::ValueObjectSP DILInterpreter::DILEvalNode(const DILASTNode *node) { + + // Traverse an AST pointed by the `node`. + node->Accept(this); + + // Return the computed value for convenience. The caller is responsible for + // checking if an error occured during the evaluation. + return m_result; +} cmtice wrote: As we add functionality, some of the "Visit" functions call DILEvalNode to evaluate subtrees within the AST. SO..this function isn't really needed immediately (in this version), but it will definitely be needed later. Do you want me to remove it in this version? https://github.com/llvm/llvm-project/pull/120971 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add SBProgress so Python scripts can also report progress (PR #119052)
https://github.com/Jlalond updated https://github.com/llvm/llvm-project/pull/119052 >From d28dedabaeb6bdc763e8226e7d669ff4eba66d50 Mon Sep 17 00:00:00 2001 From: Jacob Lalonde Date: Fri, 6 Dec 2024 18:17:44 -0800 Subject: [PATCH 1/4] Add SBPRogress class to enable commands to async report to lldb-dap their progress --- lldb/bindings/headers.swig| 1 + .../bindings/interface/SBProgressDocstrings.i | 14 + lldb/bindings/interfaces.swig | 2 + lldb/include/lldb/API/SBDebugger.h| 3 +- lldb/include/lldb/API/SBProgress.h| 56 +++ lldb/include/lldb/lldb-forward.h | 1 + lldb/source/API/CMakeLists.txt| 1 + lldb/source/API/SBProgress.cpp| 34 +++ 8 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 lldb/bindings/interface/SBProgressDocstrings.i create mode 100644 lldb/include/lldb/API/SBProgress.h create mode 100644 lldb/source/API/SBProgress.cpp diff --git a/lldb/bindings/headers.swig b/lldb/bindings/headers.swig index c0dde905f986bd..5e7c54d1eb8393 100644 --- a/lldb/bindings/headers.swig +++ b/lldb/bindings/headers.swig @@ -52,6 +52,7 @@ #include "lldb/API/SBProcess.h" #include "lldb/API/SBProcessInfo.h" #include "lldb/API/SBProcessInfoList.h" +#include "lldb/API/SBProgress.h" #include "lldb/API/SBQueue.h" #include "lldb/API/SBQueueItem.h" #include "lldb/API/SBReproducer.h" diff --git a/lldb/bindings/interface/SBProgressDocstrings.i b/lldb/bindings/interface/SBProgressDocstrings.i new file mode 100644 index 00..016c02432c4117 --- /dev/null +++ b/lldb/bindings/interface/SBProgressDocstrings.i @@ -0,0 +1,14 @@ +%feature("docstring", +"A Progress indicator helper class. + +Any potentially long running sections of code in LLDB should report +progress so that clients are aware of delays that might appear during +debugging. Delays commonly include indexing debug information, parsing +symbol tables for object files, downloading symbols from remote +repositories, and many more things. + +The Progress class helps make sure that progress is correctly reported +and will always send an initial progress update, updates when +Progress::Increment() is called, and also will make sure that a progress +completed update is reported even if the user doesn't explicitly cause one +to be sent.") lldb::SBProgress diff --git a/lldb/bindings/interfaces.swig b/lldb/bindings/interfaces.swig index 8a6fed95f0b729..08df9a1a8d5392 100644 --- a/lldb/bindings/interfaces.swig +++ b/lldb/bindings/interfaces.swig @@ -54,6 +54,7 @@ %include "./interface/SBPlatformDocstrings.i" %include "./interface/SBProcessDocstrings.i" %include "./interface/SBProcessInfoDocstrings.i" +%include "./interface/SBProgressDocstrings.i" %include "./interface/SBQueueDocstrings.i" %include "./interface/SBQueueItemDocstrings.i" %include "./interface/SBReproducerDocstrings.i" @@ -133,6 +134,7 @@ %include "lldb/API/SBProcess.h" %include "lldb/API/SBProcessInfo.h" %include "lldb/API/SBProcessInfoList.h" +%include "lldb/API/SBProgress.h" %include "lldb/API/SBQueue.h" %include "lldb/API/SBQueueItem.h" %include "lldb/API/SBReproducer.h" diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index 787bd040dd15bb..eb371e33c4951c 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -203,7 +203,7 @@ class LLDB_API SBDebugger { lldb::SBCommandInterpreter GetCommandInterpreter(); void HandleCommand(const char *command); - + void RequestInterrupt(); void CancelInterruptRequest(); bool InterruptRequested(); @@ -517,6 +517,7 @@ class LLDB_API SBDebugger { friend class SBPlatform; friend class SBTarget; friend class SBTrace; + friend class SBProgress; lldb::SBTarget FindTargetWithLLDBProcess(const lldb::ProcessSP &processSP); diff --git a/lldb/include/lldb/API/SBProgress.h b/lldb/include/lldb/API/SBProgress.h new file mode 100644 index 00..38f4b4a81f42b7 --- /dev/null +++ b/lldb/include/lldb/API/SBProgress.h @@ -0,0 +1,56 @@ +//===-- SBProgress.h *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef LLDB_API_SBPROGRESS_H +#define LLDB_API_SBPROGRESS_H + +#include "lldb/API/SBDebugger.h" +#include "lldb/API/SBDefines.h" + +namespace lldb { + +/// A SB API Wrapper around lldb_private::Progress +class LLDB_API SBProgress { +public: + /// Construct a progress object with a title, details and a given debugger. + /// \param title + /// The title of the progress object. + /// \param details + /// The details of the progress object. + /// \param debugger + /// The deb
[Lldb-commits] [lldb] [LLDB] Add DIL code for handling plain variable names. (PR #120971)
@@ -0,0 +1,356 @@ +//===-- DILParser.cpp -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// This implements the recursive descent parser for the Data Inspection +// Language (DIL), and its helper functions, which will eventually underlie the +// 'frame variable' command. The language that this parser recognizes is +// described in lldb/docs/dil-expr-lang.ebnf +// +//===--===// + +#include "lldb/ValueObject/DILParser.h" + +#include +#include + +#include +#include +#include + +#include "lldb/Target/ExecutionContextScope.h" +#include "lldb/ValueObject/DILAST.h" +#include "lldb/ValueObject/DILEval.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/FormatAdapters.h" + +namespace lldb_private { + +namespace dil { + +inline void TokenKindsJoinImpl(std::ostringstream &os, dil::TokenKind k) { + os << "'" << DILToken::getTokenName(k) << "'"; +} + +template +inline void TokenKindsJoinImpl(std::ostringstream &os, dil::TokenKind k, + Ts... ks) { + TokenKindsJoinImpl(os, k); + os << ", "; + TokenKindsJoinImpl(os, ks...); +} + +template +inline std::string TokenKindsJoin(dil::TokenKind k, Ts... ks) { + std::ostringstream os; + TokenKindsJoinImpl(os, k, ks...); + + return os.str(); +} + +std::string FormatDiagnostics(std::shared_ptr input_expr, + const std::string &message, uint32_t loc) { + // Get the source buffer and the location of the current token. + llvm::StringRef text(*input_expr); + size_t loc_offset = (size_t)loc; + + // Look for the start of the line. + size_t line_start = text.rfind('\n', loc_offset); + line_start = line_start == llvm::StringRef::npos ? 0 : line_start + 1; + + // Look for the end of the line. + size_t line_end = text.find('\n', loc_offset); + line_end = line_end == llvm::StringRef::npos ? text.size() : line_end; + + // Get a view of the current line in the source code and the position of the + // diagnostics pointer. + llvm::StringRef line = text.slice(line_start, line_end); + int32_t arrow = loc + 1; // Column offset starts at 1, not 0. + + // Calculate the padding in case we point outside of the expression (this can + // happen if the parser expected something, but got EOF).˚ + size_t expr_rpad = std::max(0, arrow - static_cast(line.size())); + size_t arrow_rpad = std::max(0, static_cast(line.size()) - arrow); + + return llvm::formatv(": {1}\n{2}\n{3}", loc, message, + llvm::fmt_pad(line, 0, expr_rpad), + llvm::fmt_pad("^", arrow - 1, arrow_rpad)); +} + +DILParser::DILParser(std::shared_ptr dil_input_expr, + std::shared_ptr exe_ctx_scope, + lldb::DynamicValueType use_dynamic, bool use_synthetic, + bool fragile_ivar, bool check_ptr_vs_member) +: m_ctx_scope(exe_ctx_scope), m_input_expr(dil_input_expr), + m_use_dynamic(use_dynamic), m_use_synthetic(use_synthetic), + m_fragile_ivar(fragile_ivar), m_check_ptr_vs_member(check_ptr_vs_member), + m_dil_lexer(DILLexer(dil_input_expr)) { + // Initialize the token. + m_dil_token.setKind(dil::TokenKind::unknown); +} + +DILASTNodeUP DILParser::Run(Status &error) { + ConsumeToken(); + + DILASTNodeUP expr; + + expr = ParseExpression(); + + Expect(dil::TokenKind::eof); + + error = std::move(m_error); + m_error.Clear(); + + // Explicitly return ErrorNode if there was an error during the parsing. + // Some routines raise an error, but don't change the return value (e.g. + // Expect). + if (error.Fail()) { +CompilerType bad_type; +return std::make_unique(bad_type); + } + return expr; +} + +// Parse an expression. +// +// expression: +//primary_expression +// +DILASTNodeUP DILParser::ParseExpression() { return ParsePrimaryExpression(); } + +// Parse a primary_expression. +// +// primary_expression: +//id_expression +//"this" +//"(" expression ")" +// +DILASTNodeUP DILParser::ParsePrimaryExpression() { + CompilerType bad_type; + if (m_dil_token.isOneOf(dil::TokenKind::coloncolon, + dil::TokenKind::identifier)) { +// Save the source location for the diagnostics message. +uint32_t loc = m_dil_token.getLocation(); +auto identifier = ParseIdExpression(); + +return std::make_unique(loc, identifier, m_use_dynamic, +m_ctx_scope); + } else if (m_dil_token.is(dil::TokenKind::kw_this)) { +// Save the source location for the diagnostics message. +uint32_t loc = m_dil_token.getLocation(); +ConsumeToken(); + +// Special case for "this" pointer. As per C++ standard, it's a prvalue. +return std::make_uniqu
[Lldb-commits] [lldb] [LLDB] Add DIL code for handling plain variable names. (PR #120971)
@@ -0,0 +1,191 @@ +//===-- DILLexer.cpp --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// This implements the recursive descent parser for the Data Inspection +// Language (DIL), and its helper functions, which will eventually underlie the +// 'frame variable' command. The language that this parser recognizes is +// described in lldb/docs/dil-expr-lang.ebnf +// +//===--===// + +#include "lldb/ValueObject/DILLexer.h" + +namespace lldb_private { + +namespace dil { + +const std::string DILToken::getTokenName(dil::TokenKind kind) { + std::string retval; + switch (kind) { + case dil::TokenKind::coloncolon: +retval = "coloncolon"; +break; + case dil::TokenKind::eof: +retval = "eof"; +break; + case dil::TokenKind::identifier: +retval = "identifier"; +break; + case dil::TokenKind::kw_namespace: +retval = "namespace"; +break; + case dil::TokenKind::kw_this: +retval = "this"; +break; + case dil::TokenKind::l_paren: +retval = "l_paren"; +break; + case dil::TokenKind::r_paren: +retval = "r_paren"; +break; + case dil::TokenKind::unknown: +retval = "unknown"; +break; + default: +retval = "token_name"; +break; + } + return retval; +} + +static bool Is_Letter(char c) { + if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) +return true; + return false; +} + +static bool Is_Digit(char c) { return ('0' <= c && c <= '9'); } + +bool DILLexer::Is_Word(std::string::iterator start, uint32_t &length) { + bool done = false; + for (; m_cur_pos != m_expr.end() && !done; ++m_cur_pos) { +char c = *m_cur_pos; +if (!Is_Letter(c) && !Is_Digit(c) && c != '_') { + done = true; + break; +} else + length++; + } + if (length > 0) +return true; + else +m_cur_pos = start; + return false; +} + +void DILLexer::UpdateLexedTokens(DILToken &result, dil::TokenKind tok_kind, + std::string tok_str, uint32_t tok_pos, + uint32_t tok_len) { + DILToken new_token; + result.setValues(tok_kind, tok_str, tok_pos, tok_len); + new_token = result; + m_lexed_tokens.push_back(std::move(new_token)); +} + +bool DILLexer::Lex(DILToken &result, bool look_ahead) { + bool retval = true; + + if (!look_ahead) { +// We're being asked for the 'next' token, and not a part of a LookAhead. +// Check to see if we've already lexed it and pushed it onto our tokens +// vector; if so, return the next token from the vector, rather than doing +// more lexing. +if ((m_tokens_idx != UINT_MAX) && +(m_tokens_idx < m_lexed_tokens.size() - 1)) { + result = m_lexed_tokens[m_tokens_idx + 1]; + return retval; +} + } + + // Skip over whitespace (spaces). + while (m_cur_pos != m_expr.end() && *m_cur_pos == ' ') +m_cur_pos++; + + // Check to see if we've reached the end of our input string. + if (m_cur_pos == m_expr.end()) { +UpdateLexedTokens(result, dil::TokenKind::eof, "", m_expr.length(), 0); +return retval; + } + + uint32_t position = m_cur_pos - m_expr.begin(); + ; + std::string::iterator start = m_cur_pos; + uint32_t length = 0; + if (Is_Word(start, length)) { +dil::TokenKind kind; +std::string word = m_expr.substr(position, length); +if (word == "this") cmtice wrote: We could...the main reason for handling it specially, is to make sure we treat it as an r-value, not an l-value. Would an acceptable alternative here be to ALSO look for "self" and treat it the same way? https://github.com/llvm/llvm-project/pull/120971 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add DIL code for handling plain variable names. (PR #120971)
@@ -0,0 +1,356 @@ +//===-- DILParser.cpp -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// This implements the recursive descent parser for the Data Inspection +// Language (DIL), and its helper functions, which will eventually underlie the +// 'frame variable' command. The language that this parser recognizes is +// described in lldb/docs/dil-expr-lang.ebnf +// +//===--===// + +#include "lldb/ValueObject/DILParser.h" + +#include +#include + +#include +#include +#include + +#include "lldb/Target/ExecutionContextScope.h" +#include "lldb/ValueObject/DILAST.h" +#include "lldb/ValueObject/DILEval.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/FormatAdapters.h" + +namespace lldb_private { + +namespace dil { + +inline void TokenKindsJoinImpl(std::ostringstream &os, dil::TokenKind k) { + os << "'" << DILToken::getTokenName(k) << "'"; +} + +template +inline void TokenKindsJoinImpl(std::ostringstream &os, dil::TokenKind k, + Ts... ks) { + TokenKindsJoinImpl(os, k); + os << ", "; + TokenKindsJoinImpl(os, ks...); +} + +template +inline std::string TokenKindsJoin(dil::TokenKind k, Ts... ks) { + std::ostringstream os; + TokenKindsJoinImpl(os, k, ks...); + + return os.str(); +} + +std::string FormatDiagnostics(std::shared_ptr input_expr, + const std::string &message, uint32_t loc) { + // Get the source buffer and the location of the current token. + llvm::StringRef text(*input_expr); + size_t loc_offset = (size_t)loc; + + // Look for the start of the line. + size_t line_start = text.rfind('\n', loc_offset); + line_start = line_start == llvm::StringRef::npos ? 0 : line_start + 1; + + // Look for the end of the line. + size_t line_end = text.find('\n', loc_offset); + line_end = line_end == llvm::StringRef::npos ? text.size() : line_end; + + // Get a view of the current line in the source code and the position of the + // diagnostics pointer. + llvm::StringRef line = text.slice(line_start, line_end); + int32_t arrow = loc + 1; // Column offset starts at 1, not 0. + + // Calculate the padding in case we point outside of the expression (this can + // happen if the parser expected something, but got EOF).˚ + size_t expr_rpad = std::max(0, arrow - static_cast(line.size())); + size_t arrow_rpad = std::max(0, static_cast(line.size()) - arrow); + + return llvm::formatv(": {1}\n{2}\n{3}", loc, message, + llvm::fmt_pad(line, 0, expr_rpad), + llvm::fmt_pad("^", arrow - 1, arrow_rpad)); +} + +DILParser::DILParser(std::shared_ptr dil_input_expr, + std::shared_ptr exe_ctx_scope, + lldb::DynamicValueType use_dynamic, bool use_synthetic, + bool fragile_ivar, bool check_ptr_vs_member) +: m_ctx_scope(exe_ctx_scope), m_input_expr(dil_input_expr), + m_use_dynamic(use_dynamic), m_use_synthetic(use_synthetic), + m_fragile_ivar(fragile_ivar), m_check_ptr_vs_member(check_ptr_vs_member), + m_dil_lexer(DILLexer(dil_input_expr)) { + // Initialize the token. + m_dil_token.setKind(dil::TokenKind::unknown); +} + +DILASTNodeUP DILParser::Run(Status &error) { + ConsumeToken(); + + DILASTNodeUP expr; + + expr = ParseExpression(); + + Expect(dil::TokenKind::eof); + + error = std::move(m_error); + m_error.Clear(); + + // Explicitly return ErrorNode if there was an error during the parsing. + // Some routines raise an error, but don't change the return value (e.g. + // Expect). + if (error.Fail()) { +CompilerType bad_type; +return std::make_unique(bad_type); + } + return expr; +} + +// Parse an expression. +// +// expression: +//primary_expression +// +DILASTNodeUP DILParser::ParseExpression() { return ParsePrimaryExpression(); } + +// Parse a primary_expression. +// +// primary_expression: +//id_expression +//"this" +//"(" expression ")" +// +DILASTNodeUP DILParser::ParsePrimaryExpression() { + CompilerType bad_type; + if (m_dil_token.isOneOf(dil::TokenKind::coloncolon, + dil::TokenKind::identifier)) { +// Save the source location for the diagnostics message. +uint32_t loc = m_dil_token.getLocation(); +auto identifier = ParseIdExpression(); + +return std::make_unique(loc, identifier, m_use_dynamic, +m_ctx_scope); + } else if (m_dil_token.is(dil::TokenKind::kw_this)) { +// Save the source location for the diagnostics message. +uint32_t loc = m_dil_token.getLocation(); +ConsumeToken(); + +// Special case for "this" pointer. As per C++ standard, it's a prvalue. +return std::make_uniqu
[Lldb-commits] [lldb] [lldb][AIX] Some base #if _AIX changes of a minimal lldb build (PR #120979)
DhruvSrivastavaX wrote: Updated the branch @labath @DavidSpickett https://github.com/llvm/llvm-project/pull/120979 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][OpenBSD][NFC] Replace tab with spaces (PR #122041)
https://github.com/labath approved this pull request. https://github.com/llvm/llvm-project/pull/122041 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Some base #if _AIX changes of a minimal lldb build (PR #120979)
@@ -730,9 +730,21 @@ ConnectionStatus ConnectionFileDescriptor::ConnectFile( struct termios options; ::tcgetattr(fd, &options); -// Set port speed to maximum +// Set port speed to the available maximum +#ifdef B115200 ::cfsetospeed(&options, B115200); ::cfsetispeed(&options, B115200); +#elif B57600 +::cfsetospeed(&options, B57600); +::cfsetispeed(&options, B57600); +#elif B38400 +::cfsetospeed(&options, B38400); +::cfsetispeed(&options, B38400); +#else +if (error_ptr) + *error_ptr = Status::FromErrorString("Maximum Baud rate is Unknown"); +return eConnectionStatusError; DavidSpickett wrote: I should have been clearer, I think this else should be a compiler error: ``` #error Maximum baud rate unknown. ``` This brings the issue to the developer's attention as early as possible. https://github.com/llvm/llvm-project/pull/120979 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Some base #if _AIX changes of a minimal lldb build (PR #120979)
@@ -14,6 +14,7 @@ #include #include +#include DavidSpickett wrote: this can go now, right? Now that bzero is not being used. https://github.com/llvm/llvm-project/pull/120979 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][OpenBSD][NFC] Replace tab with spaces (PR #122041)
https://github.com/DavidSpickett closed https://github.com/llvm/llvm-project/pull/122041 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 30b7da7 - [lldb][OpenBSD][NFC] Replace tab with spaces (#122041)
Author: Brad Smith Date: 2025-01-08T10:19:21Z New Revision: 30b7da72f2abef7cad4d1b38e141e7d2ef170d88 URL: https://github.com/llvm/llvm-project/commit/30b7da72f2abef7cad4d1b38e141e7d2ef170d88 DIFF: https://github.com/llvm/llvm-project/commit/30b7da72f2abef7cad4d1b38e141e7d2ef170d88.diff LOG: [lldb][OpenBSD][NFC] Replace tab with spaces (#122041) Added: Modified: lldb/source/Host/openbsd/Host.cpp Removed: diff --git a/lldb/source/Host/openbsd/Host.cpp b/lldb/source/Host/openbsd/Host.cpp index a4dc3918acfd08..76d8c4faa3863c 100644 --- a/lldb/source/Host/openbsd/Host.cpp +++ b/lldb/source/Host/openbsd/Host.cpp @@ -127,7 +127,7 @@ static bool GetOpenBSDProcessUserAndGroup(ProcessInstanceInfo &process_info) { process_info.SetUserID(proc_kinfo.p_ruid); process_info.SetGroupID(proc_kinfo.p_rgid); process_info.SetEffectiveUserID(proc_kinfo.p_uid); - process_info.SetEffectiveGroupID(proc_kinfo.p_gid); +process_info.SetEffectiveGroupID(proc_kinfo.p_gid); return true; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][OpenBSD][NFC] Replace tab with spaces (PR #122041)
https://github.com/DavidSpickett approved this pull request. https://github.com/llvm/llvm-project/pull/122041 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Some base #if _AIX changes of a minimal lldb build (PR #120979)
@@ -730,9 +730,21 @@ ConnectionStatus ConnectionFileDescriptor::ConnectFile( struct termios options; ::tcgetattr(fd, &options); -// Set port speed to maximum +// Set port speed to the available maximum +#ifdef B115200 ::cfsetospeed(&options, B115200); ::cfsetispeed(&options, B115200); +#elif B57600 +::cfsetospeed(&options, B57600); +::cfsetispeed(&options, B57600); +#elif B38400 +::cfsetospeed(&options, B38400); +::cfsetispeed(&options, B38400); +#else +if (error_ptr) + *error_ptr = Status::FromErrorString("Maximum Baud rate is Unknown"); +return eConnectionStatusError; DhruvSrivastavaX wrote: Okay got it. Updating https://github.com/llvm/llvm-project/pull/120979 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Some base #if _AIX changes of a minimal lldb build (PR #120979)
@@ -14,6 +14,7 @@ #include #include +#include DhruvSrivastavaX wrote: Yes, it does not have any immediate need, but just keeping it in reference to @labath's comment: https://github.com/llvm/llvm-project/pull/120979#discussion_r1905127075 Possibly for future? https://github.com/llvm/llvm-project/pull/120979 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Some base #if _AIX changes of a minimal lldb build (PR #120979)
@@ -14,6 +14,7 @@ #include #include +#include DavidSpickett wrote: Understood, leave it in then. https://github.com/llvm/llvm-project/pull/120979 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][OpenBSD] Make use of Environment class (PR #122040)
https://github.com/brad0 closed https://github.com/llvm/llvm-project/pull/122040 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 647e8d8 - [lldb][OpenBSD] Make use of Environment class (#122040)
Author: Brad Smith Date: 2025-01-08T16:18:11-05:00 New Revision: 647e8d8dee8c2b68f0b9da7956e4af272b52149b URL: https://github.com/llvm/llvm-project/commit/647e8d8dee8c2b68f0b9da7956e4af272b52149b DIFF: https://github.com/llvm/llvm-project/commit/647e8d8dee8c2b68f0b9da7956e4af272b52149b.diff LOG: [lldb][OpenBSD] Make use of Environment class (#122040) Added: Modified: lldb/source/Host/openbsd/Host.cpp Removed: diff --git a/lldb/source/Host/openbsd/Host.cpp b/lldb/source/Host/openbsd/Host.cpp index 76d8c4faa3863c..24650ff97075ea 100644 --- a/lldb/source/Host/openbsd/Host.cpp +++ b/lldb/source/Host/openbsd/Host.cpp @@ -41,18 +41,7 @@ namespace lldb_private { class ProcessLaunchInfo; } -Environment Host::GetEnvironment() { - Environment env; - char *v; - char **var = environ; - for (; var != NULL && *var != NULL; ++var) { -v = strchr(*var, (int)'-'); -if (v == NULL) - continue; -env.insert(v); - } - return env; -} +Environment Host::GetEnvironment() { return Environment(environ); } static bool GetOpenBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr, ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits