[Lldb-commits] [lldb] [lldb] Removed gdbserver ports map from lldb-server (PR #104238)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/104238 >From 8491aa073ae240eb5e31df12ac278c70fc9515e7 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Fri, 16 Aug 2024 17:03:37 +0400 Subject: [PATCH 1/4] [lldb] Removed gdbserver ports map from lldb-server Listen to gdbserver-port, accept the connection and run `lldb-server gdbserver --fd` on all platforms. Added acceptor_gdb and gdb_thread to lldb-platform.cpp SharedSocket has been moved to ConnectionFileDescriptorPosix. Parameters --min-gdbserver-port and --max-gdbserver-port are deprecated now. This is the part 2 of #101283. Fixes #97537, fixes #101475. --- lldb/docs/man/lldb-server.rst | 11 +- lldb/docs/resources/qemu-testing.rst | 19 +- .../posix/ConnectionFileDescriptorPosix.h | 26 ++ .../posix/ConnectionFileDescriptorPosix.cpp | 110 +- .../gdb-remote/GDBRemoteCommunication.cpp | 41 ++- .../gdb-remote/GDBRemoteCommunication.h | 8 +- .../GDBRemoteCommunicationServerPlatform.cpp | 287 +--- .../GDBRemoteCommunicationServerPlatform.h| 83 + .../Process/gdb-remote/ProcessGDBRemote.cpp | 2 +- .../Shell/lldb-server/TestGdbserverPort.test | 4 - lldb/tools/lldb-server/lldb-gdbserver.cpp | 23 +- lldb/tools/lldb-server/lldb-platform.cpp | 324 -- .../Process/gdb-remote/CMakeLists.txt | 1 - .../Process/gdb-remote/PortMapTest.cpp| 115 --- .../tools/lldb-server/tests/TestClient.h | 4 + 15 files changed, 450 insertions(+), 608 deletions(-) delete mode 100644 lldb/test/Shell/lldb-server/TestGdbserverPort.test delete mode 100644 lldb/unittests/Process/gdb-remote/PortMapTest.cpp diff --git a/lldb/docs/man/lldb-server.rst b/lldb/docs/man/lldb-server.rst index a67c00b305f6d2..31f5360df5e23e 100644 --- a/lldb/docs/man/lldb-server.rst +++ b/lldb/docs/man/lldb-server.rst @@ -147,15 +147,8 @@ GDB-SERVER CONNECTIONS .. option:: --gdbserver-port - Define a port to be used for gdb-server connections. Can be specified multiple - times to allow multiple ports. Has no effect if --min-gdbserver-port - and --max-gdbserver-port are specified. - -.. option:: --min-gdbserver-port -.. option:: --max-gdbserver-port - - Specify the range of ports that can be used for gdb-server connections. Both - options need to be specified simultaneously. Overrides --gdbserver-port. + Define a port to be used for gdb-server connections. This port is used for + multiple connections. .. option:: --port-offset diff --git a/lldb/docs/resources/qemu-testing.rst b/lldb/docs/resources/qemu-testing.rst index 51a30b11717a87..e102f84a1d31f4 100644 --- a/lldb/docs/resources/qemu-testing.rst +++ b/lldb/docs/resources/qemu-testing.rst @@ -149,7 +149,6 @@ to the host (refer to QEMU's manuals for the specific options). * At least one to connect to the intial ``lldb-server``. * One more if you want to use ``lldb-server`` in ``platform mode``, and have it start a ``gdbserver`` instance for you. -* A bunch more if you want to run tests against the ``lldb-server`` platform. If you are doing either of the latter 2 you should also restrict what ports ``lldb-server tries`` to use, otherwise it will randomly pick one that is almost @@ -157,22 +156,14 @@ certainly not forwarded. An example of this is shown below. :: - $ lldb-server plaform --server --listen 0.0.0.0:54321 \ ---min-gdbserver-port 49140 --max-gdbserver-port 49150 + $ lldb-server plaform --server --listen 0.0.0.0:54321 --gdbserver-port 49140 The result of this is that: * ``lldb-server`` platform mode listens externally on port ``54321``. -* When it is asked to start a new gdbserver mode instance, it will use a port - in the range ``49140`` to ``49150``. +* When it is asked to start a new gdbserver mode instance, it will use the port + ``49140``. -Your VM configuration should have ports ``54321``, and ``49140`` to ``49150`` -forwarded for this to work. - -.. note:: - These options are used to create a "port map" within ``lldb-server``. - Unfortunately this map is not cleaned up on Windows on connection close, - and across a few uses you may run out of valid ports. To work around this, - restart the platform every so often, especially after running a set of tests. - This is tracked here: https://github.com/llvm/llvm-project/issues/90923 +Your VM configuration should have ports ``54321`` and ``49140`` forwarded for +this to work. diff --git a/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h b/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h index 35773d5907e913..08f486b92e0f07 100644 --- a/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h +++ b/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h @@ -26,6 +26,32 @@ class Status; class Socket; class SocketAddress; +#ifdef _WIN32 +typedef lldb::pipe_t shared_fd_t; +#else +typedef NativeSocket shared_fd_t; +#endif + +class Sha
[Lldb-commits] [lldb] [AIX] 1. Avoid namespace collision on other platforms (PR #104679)
https://github.com/DhruvSrivastavaX created https://github.com/llvm/llvm-project/pull/104679 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. This PR is for discussion as asked in #101657 The complete changes for porting are present in this draft PR: https://github.com/llvm/llvm-project/pull/102601 The changes on this PR are intended to avoid namespace collision for certain typedefs between lldb and other platforms: 1. tid_t --> lldb::tid_t 2. offset_t --> lldb::offset_t >From e72ceaada170354aa322b4c6a1787152ac72c65b Mon Sep 17 00:00:00 2001 From: Dhruv-Srivastava Date: Sat, 17 Aug 2024 12:16:09 -0500 Subject: [PATCH] Using lldb's internal typedefs to avoid namespace collision 1. tid_t --> lldb::tid_t 2. offset_t --> lldb::ofset_t --- lldb/source/API/SBBreakpoint.cpp | 6 +++--- lldb/source/API/SBBreakpointLocation.cpp | 6 +++--- lldb/source/API/SBBreakpointName.cpp | 4 ++-- lldb/source/Expression/DWARFExpression.cpp | 10 +- lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp | 2 +- .../Darwin-Kernel/DynamicLoaderDarwinKernel.cpp| 4 ++-- .../MacOSX-DYLD/DynamicLoaderDarwin.cpp| 2 +- .../InstrumentationRuntimeMainThreadChecker.cpp| 2 +- .../TSan/InstrumentationRuntimeTSan.cpp| 14 +++--- .../UBSan/InstrumentationRuntimeUBSan.cpp | 2 +- .../MemoryHistory/asan/MemoryHistoryASan.cpp | 2 +- .../Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | 6 +++--- .../Python/OperatingSystemPython.cpp | 2 +- .../Plugins/Process/Utility/ThreadMemory.cpp | 2 +- .../Process/gdb-remote/ProcessGDBRemote.cpp| 2 +- .../Plugins/Process/mach-core/ProcessMachCore.cpp | 8 lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp | 2 +- .../MacOSX/AppleGetThreadItemInfoHandler.cpp | 2 +- lldb/source/Symbol/DWARFCallFrameInfo.cpp | 4 ++-- 19 files changed, 41 insertions(+), 41 deletions(-) diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp index 3d908047f9455b..728fe04d14d927 100644 --- a/lldb/source/API/SBBreakpoint.cpp +++ b/lldb/source/API/SBBreakpoint.cpp @@ -342,7 +342,7 @@ uint32_t SBBreakpoint::GetIgnoreCount() const { return count; } -void SBBreakpoint::SetThreadID(tid_t tid) { +void SBBreakpoint::SetThreadID(lldb::tid_t tid) { LLDB_INSTRUMENT_VA(this, tid); BreakpointSP bkpt_sp = GetSP(); @@ -353,10 +353,10 @@ void SBBreakpoint::SetThreadID(tid_t tid) { } } -tid_t SBBreakpoint::GetThreadID() { +lldb::tid_t SBBreakpoint::GetThreadID() { LLDB_INSTRUMENT_VA(this); - tid_t tid = LLDB_INVALID_THREAD_ID; + lldb::tid_t tid = LLDB_INVALID_THREAD_ID; BreakpointSP bkpt_sp = GetSP(); if (bkpt_sp) { std::lock_guard guard( diff --git a/lldb/source/API/SBBreakpointLocation.cpp b/lldb/source/API/SBBreakpointLocation.cpp index 75b66364d4f1ae..fad9a4076a54fb 100644 --- a/lldb/source/API/SBBreakpointLocation.cpp +++ b/lldb/source/API/SBBreakpointLocation.cpp @@ -302,7 +302,7 @@ bool SBBreakpointLocation::GetCommandLineCommands(SBStringList &commands) { return has_commands; } -void SBBreakpointLocation::SetThreadID(tid_t thread_id) { +void SBBreakpointLocation::SetThreadID(lldb::tid_t thread_id) { LLDB_INSTRUMENT_VA(this, thread_id); BreakpointLocationSP loc_sp = GetSP(); @@ -313,10 +313,10 @@ void SBBreakpointLocation::SetThreadID(tid_t thread_id) { } } -tid_t SBBreakpointLocation::GetThreadID() { +lldb::tid_t SBBreakpointLocation::GetThreadID() { LLDB_INSTRUMENT_VA(this); - tid_t tid = LLDB_INVALID_THREAD_ID; + lldb::tid_t tid = LLDB_INVALID_THREAD_ID; BreakpointLocationSP loc_sp = GetSP(); if (loc_sp) { std::lock_guard guard( diff --git a/lldb/source/API/SBBreakpointName.cpp b/lldb/source/API/SBBreakpointName.cpp index 7f63aaf6fa7d5e..5c7c0a8f6504b0 100644 --- a/lldb/source/API/SBBreakpointName.cpp +++ b/lldb/source/API/SBBreakpointName.cpp @@ -347,7 +347,7 @@ bool SBBreakpointName::GetAutoContinue() { return bp_name->GetOptions().IsAutoContinue(); } -void SBBreakpointName::SetThreadID(tid_t tid) { +void SBBreakpointName::SetThreadID(lldb::tid_t tid) { LLDB_INSTRUMENT_VA(this, tid); BreakpointName *bp_name = GetBreakpointName(); @@ -361,7 +361,7 @@ void SBBreakpointName::SetThreadID(tid_t tid) { UpdateName(*bp_name); } -tid_t SBBreakpointName::GetThreadID() { +lldb::tid_t SBBreakpointName::GetThreadID() { LLDB_INSTRUMENT_VA(this); BreakpointName *bp_name = GetBreakpointName(); diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index 444e44b3928919..c1feec990f989d 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -130,7 +130,7 @@ static llvm::Error ReadRegisterValueAsScalar(RegisterContext *r
[Lldb-commits] [lldb] [AIX] 1. Avoid namespace collision on other platforms (PR #104679)
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using `@` followed by their GitHub username. If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the [LLVM GitHub User Guide](https://llvm.org/docs/GitHub.html). You can also ask questions in a comment on this PR, on the [LLVM Discord](https://discord.com/invite/xS7Z362) or on the [forums](https://discourse.llvm.org/). https://github.com/llvm/llvm-project/pull/104679 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [AIX] 1. Avoid namespace collision on other platforms (PR #104679)
https://github.com/DhruvSrivastavaX edited https://github.com/llvm/llvm-project/pull/104679 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [AIX] 1. Avoid namespace collision on other platforms (PR #104679)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Dhruv Srivastava (DhruvSrivastavaX) Changes 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. #101657 The complete changes for porting are present in this draft PR: https://github.com/llvm/llvm-project/pull/102601 The changes on this PR are intended to avoid namespace collision for certain typedefs between lldb and other platforms: 1. tid_t --> lldb::tid_t 2. offset_t --> lldb::offset_t --- Full diff: https://github.com/llvm/llvm-project/pull/104679.diff 19 Files Affected: - (modified) lldb/source/API/SBBreakpoint.cpp (+3-3) - (modified) lldb/source/API/SBBreakpointLocation.cpp (+3-3) - (modified) lldb/source/API/SBBreakpointName.cpp (+2-2) - (modified) lldb/source/Expression/DWARFExpression.cpp (+5-5) - (modified) lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp (+1-1) - (modified) lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (+2-2) - (modified) lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp (+1-1) - (modified) lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp (+1-1) - (modified) lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp (+7-7) - (modified) lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp (+1-1) - (modified) lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp (+1-1) - (modified) lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (+3-3) - (modified) lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp (+1-1) - (modified) lldb/source/Plugins/Process/Utility/ThreadMemory.cpp (+1-1) - (modified) lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (+1-1) - (modified) lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp (+4-4) - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (+1-1) - (modified) lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp (+1-1) - (modified) lldb/source/Symbol/DWARFCallFrameInfo.cpp (+2-2) ``diff diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp index 3d908047f9455b..728fe04d14d927 100644 --- a/lldb/source/API/SBBreakpoint.cpp +++ b/lldb/source/API/SBBreakpoint.cpp @@ -342,7 +342,7 @@ uint32_t SBBreakpoint::GetIgnoreCount() const { return count; } -void SBBreakpoint::SetThreadID(tid_t tid) { +void SBBreakpoint::SetThreadID(lldb::tid_t tid) { LLDB_INSTRUMENT_VA(this, tid); BreakpointSP bkpt_sp = GetSP(); @@ -353,10 +353,10 @@ void SBBreakpoint::SetThreadID(tid_t tid) { } } -tid_t SBBreakpoint::GetThreadID() { +lldb::tid_t SBBreakpoint::GetThreadID() { LLDB_INSTRUMENT_VA(this); - tid_t tid = LLDB_INVALID_THREAD_ID; + lldb::tid_t tid = LLDB_INVALID_THREAD_ID; BreakpointSP bkpt_sp = GetSP(); if (bkpt_sp) { std::lock_guard guard( diff --git a/lldb/source/API/SBBreakpointLocation.cpp b/lldb/source/API/SBBreakpointLocation.cpp index 75b66364d4f1ae..fad9a4076a54fb 100644 --- a/lldb/source/API/SBBreakpointLocation.cpp +++ b/lldb/source/API/SBBreakpointLocation.cpp @@ -302,7 +302,7 @@ bool SBBreakpointLocation::GetCommandLineCommands(SBStringList &commands) { return has_commands; } -void SBBreakpointLocation::SetThreadID(tid_t thread_id) { +void SBBreakpointLocation::SetThreadID(lldb::tid_t thread_id) { LLDB_INSTRUMENT_VA(this, thread_id); BreakpointLocationSP loc_sp = GetSP(); @@ -313,10 +313,10 @@ void SBBreakpointLocation::SetThreadID(tid_t thread_id) { } } -tid_t SBBreakpointLocation::GetThreadID() { +lldb::tid_t SBBreakpointLocation::GetThreadID() { LLDB_INSTRUMENT_VA(this); - tid_t tid = LLDB_INVALID_THREAD_ID; + lldb::tid_t tid = LLDB_INVALID_THREAD_ID; BreakpointLocationSP loc_sp = GetSP(); if (loc_sp) { std::lock_guard guard( diff --git a/lldb/source/API/SBBreakpointName.cpp b/lldb/source/API/SBBreakpointName.cpp index 7f63aaf6fa7d5e..5c7c0a8f6504b0 100644 --- a/lldb/source/API/SBBreakpointName.cpp +++ b/lldb/source/API/SBBreakpointName.cpp @@ -347,7 +347,7 @@ bool SBBreakpointName::GetAutoContinue() { return bp_name->GetOptions().IsAutoContinue(); } -void SBBreakpointName::SetThreadID(tid_t tid) { +void SBBreakpointName::SetThreadID(lldb::tid_t tid) { LLDB_INSTRUMENT_VA(this, tid); BreakpointName *bp_name = GetBreakpointName(); @@ -361,7 +361,7 @@ void SBBreakpointName::SetThreadID(tid_t tid) { UpdateName(*bp_name); } -tid_t SBBreakpointName::GetThreadID() { +lldb::tid_t SBBreakpointName::GetThreadID() { LLDB_INSTRUMENT_VA(this); BreakpointName *bp_name = GetBreakpointName(); diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index 444e44b3928919..c1feec990f989d 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lld
[Lldb-commits] [lldb] [lldb][dotest] Add an arg to add DLL search paths. (PR #104514)
https://github.com/kendalharland edited https://github.com/llvm/llvm-project/pull/104514 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Remove redundant symbol lookups in IRExecutionUnit::FindInSymbols (PR #102835)
https://github.com/DmT021 updated https://github.com/llvm/llvm-project/pull/102835 >From ffe47e8dfe71b31951913bc571cd6830eb3f2426 Mon Sep 17 00:00:00 2001 From: Dmitrii Galimzianov Date: Sun, 18 Aug 2024 04:36:19 +0200 Subject: [PATCH] Remove redundant symbol lookups in IRExecutionUnit::FindInSymbols --- lldb/include/lldb/Core/ModuleList.h| 43 ++ lldb/include/lldb/Symbol/SymbolContext.h | 2 +- lldb/source/Core/ModuleList.cpp| 68 ++ lldb/source/Expression/IRExecutionUnit.cpp | 55 + lldb/source/Symbol/Symbol.cpp | 8 +++ lldb/source/Symbol/SymbolContext.cpp | 68 ++ 6 files changed, 194 insertions(+), 50 deletions(-) diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index 43d931a8447406..171850e59baa35 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -287,6 +287,24 @@ class ModuleList { const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list) const; + /// \see Module::FindFunctions () + /// + /// \param[in] search_hint + /// If the value is NULL, then all modules will be searched in + /// order. If the value is a valid pointer and if a module is specified in + /// the symbol context, that module will be searched first followed by all + /// other modules in the list. + /// \param[in] partial_result_handler + /// A callback that will be called for each module in which at least one + /// match was found. + void FindFunctions(ConstString name, lldb::FunctionNameType name_type_mask, + const ModuleFunctionSearchOptions &options, + const SymbolContext *search_hint, + llvm::function_ref + partial_result_handler) const; + /// \see Module::FindFunctionSymbols () void FindFunctionSymbols(ConstString name, lldb::FunctionNameType name_type_mask, @@ -357,6 +375,31 @@ class ModuleList { lldb::SymbolType symbol_type, SymbolContextList &sc_list) const; + /// Find symbols by name and SymbolType. + /// + /// \param[in] name + /// A name of the symbol we are looking for. + /// + /// \param[in] symbol_type + /// A SymbolType the symbol we are looking for. + /// + /// \param[in] search_hint + /// If the value is NULL, then all modules will be searched in + /// order. If the value is a valid pointer and if a module is specified in + /// the symbol context, that module will be searched first followed by all + /// other modules in the list. + /// + /// \param[in] partial_result_handler + /// A callback that will be called for each module in which at least one + /// match was found. + void FindSymbolsWithNameAndType(ConstString name, + lldb::SymbolType symbol_type, + const SymbolContext *search_hint, + llvm::function_ref + partial_result_handler) const; + void FindSymbolsMatchingRegExAndType(const RegularExpression ®ex, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const; diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h index 0bc707070f8504..66622b5c15f7c9 100644 --- a/lldb/include/lldb/Symbol/SymbolContext.h +++ b/lldb/include/lldb/Symbol/SymbolContext.h @@ -471,7 +471,7 @@ class SymbolContextList { typedef AdaptedIterable SymbolContextIterable; - SymbolContextIterable SymbolContexts() { + SymbolContextIterable SymbolContexts() const { return SymbolContextIterable(m_symbol_contexts); } }; diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index b03490bacf9593..9b45334fb65a15 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -466,6 +466,41 @@ void ModuleList::FindFunctions(ConstString name, } } +void ModuleList::FindFunctions( +ConstString name, lldb::FunctionNameType name_type_mask, +const ModuleFunctionSearchOptions &options, +const SymbolContext *search_hint, +llvm::function_ref +partial_result_handler) const { + SymbolContextList sc_list_partial{}; + auto FindInModule = [&](const ModuleSP &module) { +module->FindFunctions(name, CompilerDeclContext(), name_type_mask, options, + sc_list_partial); +if (!sc_list_partial.IsEmpty()) { + auto iteration_action = partial_result_handler(module, sc_list_partial); + sc_list_partial.Clear(); + return iteration_action; +} +return IterationAction::Continue; + }; + + auto hinted_module = search_hint ? search_h
[Lldb-commits] [lldb] Remove redundant symbol lookups in IRExecutionUnit::FindInSymbols (PR #102835)
DmT021 wrote: I implemented the solution with a callback and used it in `IRExecutionUnit::FindInSymbols` and `SymbolContext::FindBestGlobalDataSymbol`. But it's not very suitable for `ClangExpressionDeclMap::GetSymbolAddress` :-/ Also, for some reason I'm getting `UNEXPECTED SUCCESS: test_shadowed (TestConflictingSymbol.TestConflictingSymbols.test_shadowed)`. I tried to stick to the original algorithm of `SymbolContext::FindBestGlobalDataSymbol` as close as possible. I'll check if it fails on CI as well. https://github.com/llvm/llvm-project/pull/102835 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Extend frame recognizers to hide frames from backtraces (PR #104523)
@@ -1048,6 +1048,9 @@ let Command = "thread backtrace" in { Arg<"FrameIndex">, Desc<"Frame in which to start the backtrace">; def thread_backtrace_extended : Option<"extended", "e">, Group<1>, Arg<"Boolean">, Desc<"Show the extended backtrace, if available">; + def thread_backtrace_full : Option<"filtered", "f">, Group<1>, + Arg<"Boolean">, medismailben wrote: suggestion: `-a`, `--all-frames` (like the option for `ls`) and in the help for that option we could mention that it shows all the frames including the ones hidden by a recognizer. https://github.com/llvm/llvm-project/pull/104523 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][dotest] Add an arg to add DLL search paths. (PR #104514)
https://github.com/kendalharland converted_to_draft https://github.com/llvm/llvm-project/pull/104514 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Remove redundant symbol lookups in IRExecutionUnit::FindInSymbols (PR #102835)
https://github.com/DmT021 updated https://github.com/llvm/llvm-project/pull/102835 >From c0b9be1b4ef436bbf79bd3877a58e6b598b19940 Mon Sep 17 00:00:00 2001 From: Dmitrii Galimzianov Date: Sun, 18 Aug 2024 04:36:19 +0200 Subject: [PATCH] Remove redundant symbol lookups in IRExecutionUnit::FindInSymbols --- lldb/include/lldb/Core/ModuleList.h| 43 + lldb/include/lldb/Symbol/SymbolContext.h | 2 +- lldb/source/Core/ModuleList.cpp| 68 + lldb/source/Expression/IRExecutionUnit.cpp | 55 + lldb/source/Symbol/Symbol.cpp | 8 +++ lldb/source/Symbol/SymbolContext.cpp | 71 ++ 6 files changed, 197 insertions(+), 50 deletions(-) diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index 43d931a8447406..171850e59baa35 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -287,6 +287,24 @@ class ModuleList { const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list) const; + /// \see Module::FindFunctions () + /// + /// \param[in] search_hint + /// If the value is NULL, then all modules will be searched in + /// order. If the value is a valid pointer and if a module is specified in + /// the symbol context, that module will be searched first followed by all + /// other modules in the list. + /// \param[in] partial_result_handler + /// A callback that will be called for each module in which at least one + /// match was found. + void FindFunctions(ConstString name, lldb::FunctionNameType name_type_mask, + const ModuleFunctionSearchOptions &options, + const SymbolContext *search_hint, + llvm::function_ref + partial_result_handler) const; + /// \see Module::FindFunctionSymbols () void FindFunctionSymbols(ConstString name, lldb::FunctionNameType name_type_mask, @@ -357,6 +375,31 @@ class ModuleList { lldb::SymbolType symbol_type, SymbolContextList &sc_list) const; + /// Find symbols by name and SymbolType. + /// + /// \param[in] name + /// A name of the symbol we are looking for. + /// + /// \param[in] symbol_type + /// A SymbolType the symbol we are looking for. + /// + /// \param[in] search_hint + /// If the value is NULL, then all modules will be searched in + /// order. If the value is a valid pointer and if a module is specified in + /// the symbol context, that module will be searched first followed by all + /// other modules in the list. + /// + /// \param[in] partial_result_handler + /// A callback that will be called for each module in which at least one + /// match was found. + void FindSymbolsWithNameAndType(ConstString name, + lldb::SymbolType symbol_type, + const SymbolContext *search_hint, + llvm::function_ref + partial_result_handler) const; + void FindSymbolsMatchingRegExAndType(const RegularExpression ®ex, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const; diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h index 0bc707070f8504..66622b5c15f7c9 100644 --- a/lldb/include/lldb/Symbol/SymbolContext.h +++ b/lldb/include/lldb/Symbol/SymbolContext.h @@ -471,7 +471,7 @@ class SymbolContextList { typedef AdaptedIterable SymbolContextIterable; - SymbolContextIterable SymbolContexts() { + SymbolContextIterable SymbolContexts() const { return SymbolContextIterable(m_symbol_contexts); } }; diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index b03490bacf9593..9b45334fb65a15 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -466,6 +466,41 @@ void ModuleList::FindFunctions(ConstString name, } } +void ModuleList::FindFunctions( +ConstString name, lldb::FunctionNameType name_type_mask, +const ModuleFunctionSearchOptions &options, +const SymbolContext *search_hint, +llvm::function_ref +partial_result_handler) const { + SymbolContextList sc_list_partial{}; + auto FindInModule = [&](const ModuleSP &module) { +module->FindFunctions(name, CompilerDeclContext(), name_type_mask, options, + sc_list_partial); +if (!sc_list_partial.IsEmpty()) { + auto iteration_action = partial_result_handler(module, sc_list_partial); + sc_list_partial.Clear(); + return iteration_action; +} +return IterationAction::Continue; + }; + + auto hinted_module = search_hint ? search_hin