[Lldb-commits] [lldb] [lldb] Use correct path for debugserver (PR #131609)
@@ -58,3 +59,45 @@ def test_platform_process_launch_gdb_server(self): self.runCmd("target create {}".format(self.getBuildArtifact("a.out"))) self.expect("run", substrs=["unable to launch a GDB server on"], error=True) + +@skipIfRemote +@skipUnlessPlatform(["linux"]) +@add_test_categories(["lldb-server"]) +def test_lldb_server_weird_symlinks(self): +self.build() + +hostname = socket.getaddrinfo("localhost", 0, proto=socket.IPPROTO_TCP)[0][4][0] +listen_url = "[%s]:0" % hostname + +port_file = self.getBuildArtifact("port") +commandline_args = [ +"platform", +"--listen", +listen_url, +"--socket-file", +port_file, +] + +# Run lldb-server from a symlink without any binary called "lldb-server" in the directory. +llgs_hiding_directory = self.getBuildArtifact("hiding-directory") +new_lldb_server_link = self.getBuildArtifact( +"lldb-server-with-an-unconventional-name" +) +new_lldb_server = os.path.join(llgs_hiding_directory, "lldb-server") +os.makedirs(llgs_hiding_directory) +shutil.copy(lldbgdbserverutils.get_lldb_server_exe(), new_lldb_server) +os.symlink(new_lldb_server, new_lldb_server_link) + +proc = self.spawnSubprocess(new_lldb_server_link, commandline_args) +socket_id = lldbutil.wait_for_file_on_target(self, port_file) + +new_platform = lldb.SBPlatform("remote-" + self.getPlatform()) +self.dbg.SetSelectedPlatform(new_platform) + +connect_url = "connect://[%s]:%s" % (hostname, socket_id) +self.runCmd("platform connect %s" % connect_url) +self.runCmd("target create {}".format(self.getBuildArtifact("a.out"))) +self.runCmd("run") + +# So that lldb-server doesn't crash over SIGHUP +os.kill(proc.pid, signal.SIGTERM) yuvald-sweet-security wrote: The test still passes, but you get a weird error about lldb-server crashing on SIGHUP (another bug? see below). This also happens in the other test in that file, but I didn't bother with it, I fixed it for the new test because it threw me off when debugging it. ``` SIGHUP received, exiting lldb-server... PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump: 0. Program arguments: /home/user/random/llvm-project/build/lldb-test-build.noindex/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.test_platform_process_launch_gdb_server/lldb-server platform --listen [127.0.0.1]:0 --socket-file /home/user/random/llvm-project/build/lldb-test-build.noindex/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.test_platform_process_launch_gdb_server/port -- /home/user/random/llvm-project/build/lldb-test-build.noindex/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.test_platform_process_launch_gdb_server/a.out foo #0 0x62736b6aea2d (+0x3f3ca2d) #1 0x62736b6aeeeb (+0x3f3ceeb) #2 0x62736b6ad08f (+0x3f3b08f) #3 0x62736b6af5c9 (+0x3f3d5c9) #4 0x781b8f245330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330) #5 0x781b8f29eb2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c) #6 0x781b8f24527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e) #7 0x781b8f2288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff) #8 0x62736b56ca9e (+0x3dfaa9e) #9 0x781b8f245330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330) #10 0x781b8f31ba00 ppoll (/lib/x86_64-linux-gnu/libc.so.6+0x11ba00) #11 0x62736b717281 (+0x3fa5281) #12 0x62736b717193 (+0x3fa5193) #13 0x62736b717fe8 (+0x3fa5fe8) #14 0x62736b56c984 (+0x3dfa984) #15 0x62736b5774fb (+0x3e054fb) #16 0x781b8f22a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca) #17 0x781b8f22a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b) #18 0x62736b55b6e5 (+0x3de96e5) ``` https://github.com/llvm/llvm-project/pull/131609 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use correct path for debugserver (PR #131609)
@@ -58,3 +59,45 @@ def test_platform_process_launch_gdb_server(self): self.runCmd("target create {}".format(self.getBuildArtifact("a.out"))) self.expect("run", substrs=["unable to launch a GDB server on"], error=True) + +@skipIfRemote +@skipUnlessPlatform(["linux"]) +@add_test_categories(["lldb-server"]) +def test_lldb_server_weird_symlinks(self): +self.build() + +hostname = socket.getaddrinfo("localhost", 0, proto=socket.IPPROTO_TCP)[0][4][0] +listen_url = "[%s]:0" % hostname + +port_file = self.getBuildArtifact("port") +commandline_args = [ +"platform", +"--listen", +listen_url, +"--socket-file", +port_file, +] + +# Run lldb-server from a symlink without any binary called "lldb-server" in the directory. +llgs_hiding_directory = self.getBuildArtifact("hiding-directory") +new_lldb_server_link = self.getBuildArtifact( +"lldb-server-with-an-unconventional-name" +) +new_lldb_server = os.path.join(llgs_hiding_directory, "lldb-server") +os.makedirs(llgs_hiding_directory) +shutil.copy(lldbgdbserverutils.get_lldb_server_exe(), new_lldb_server) yuvald-sweet-security wrote: that's an excellent question https://github.com/llvm/llvm-project/pull/131609 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use correct path for debugserver (PR #131609)
https://github.com/yuvald-sweet-security updated https://github.com/llvm/llvm-project/pull/131609 >From 6f2d070facaced221295a5b0c48ccb3a41a5048d Mon Sep 17 00:00:00 2001 From: Yuval Deutscher Date: Mon, 17 Mar 2025 14:37:26 +0200 Subject: [PATCH 1/2] [lldb] Use correct path for debugserver --- lldb/tools/lldb-server/SystemInitializerLLGS.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lldb/tools/lldb-server/SystemInitializerLLGS.h b/lldb/tools/lldb-server/SystemInitializerLLGS.h index 4469a8ba5f60a..c6020b0dd37da 100644 --- a/lldb/tools/lldb-server/SystemInitializerLLGS.h +++ b/lldb/tools/lldb-server/SystemInitializerLLGS.h @@ -11,10 +11,17 @@ #include "lldb/Initialization/SystemInitializer.h" #include "lldb/Initialization/SystemInitializerCommon.h" +#include "lldb/Utility/FileSpec.h" class SystemInitializerLLGS : public lldb_private::SystemInitializerCommon { public: - SystemInitializerLLGS() : SystemInitializerCommon(nullptr) {} + SystemInitializerLLGS() + : SystemInitializerCommon( +// Finding the shared libraries directory on lldb-server is broken +// since lldb-server isn't dynamically linked with liblldb.so. +// Clearing the filespec here causes GetShlibDir to fail and +// GetSupportExeDir to fall-back to using the binary path instead. +[](lldb_private::FileSpec &file) { file.Clear(); }) {} llvm::Error Initialize() override; void Terminate() override; >From 1efdb937f37a05139db0994c6b354e64b7d75f9f Mon Sep 17 00:00:00 2001 From: Yuval Deutscher Date: Thu, 3 Apr 2025 14:52:43 +0300 Subject: [PATCH 2/2] [lldb] Test running lldb-server through symlink --- .../TestPlatformLaunchGDBServer.py| 43 +++ 1 file changed, 43 insertions(+) diff --git a/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py b/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py index c365bc993e338..7c393430c725c 100644 --- a/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py +++ b/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py @@ -4,6 +4,7 @@ """ import os +import signal import socket import shutil import lldbgdbserverutils @@ -58,3 +59,45 @@ def test_platform_process_launch_gdb_server(self): self.runCmd("target create {}".format(self.getBuildArtifact("a.out"))) self.expect("run", substrs=["unable to launch a GDB server on"], error=True) + +@skipIfRemote +@skipUnlessPlatform(["linux"]) +@add_test_categories(["lldb-server"]) +def test_lldb_server_weird_symlinks(self): +self.build() + +hostname = socket.getaddrinfo("localhost", 0, proto=socket.IPPROTO_TCP)[0][4][0] +listen_url = "[%s]:0" % hostname + +port_file = self.getBuildArtifact("port") +commandline_args = [ +"platform", +"--listen", +listen_url, +"--socket-file", +port_file, +] + +# Run lldb-server from a symlink without any binary called "lldb-server" in the directory. +new_lldb_server = self.getBuildArtifact( +"lldb-server-with-an-unconventional-name" +) +os.symlink(lldbgdbserverutils.get_lldb_server_exe(), new_lldb_server) + +proc = self.spawnSubprocess(new_lldb_server, commandline_args) +socket_id = lldbutil.wait_for_file_on_target(self, port_file) + +new_platform = lldb.SBPlatform("remote-" + self.getPlatform()) +self.dbg.SetSelectedPlatform(new_platform) + +connect_url = "connect://[%s]:%s" % (hostname, socket_id) +self.runCmd("platform connect %s" % connect_url) +self.runCmd("target create {}".format(self.getBuildArtifact("a.out"))) +self.runCmd("run") +self.expect( +"process status", +patterns=["Process .* exited with status = 0"], +) + +# So that lldb-server doesn't crash over SIGHUP +os.kill(proc.pid, signal.SIGTERM) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use correct path for debugserver (PR #131609)
@@ -58,3 +59,45 @@ def test_platform_process_launch_gdb_server(self): self.runCmd("target create {}".format(self.getBuildArtifact("a.out"))) self.expect("run", substrs=["unable to launch a GDB server on"], error=True) + +@skipIfRemote +@skipUnlessPlatform(["linux"]) +@add_test_categories(["lldb-server"]) +def test_lldb_server_weird_symlinks(self): +self.build() + +hostname = socket.getaddrinfo("localhost", 0, proto=socket.IPPROTO_TCP)[0][4][0] +listen_url = "[%s]:0" % hostname + +port_file = self.getBuildArtifact("port") +commandline_args = [ +"platform", +"--listen", +listen_url, +"--socket-file", +port_file, +] + +# Run lldb-server from a symlink without any binary called "lldb-server" in the directory. +llgs_hiding_directory = self.getBuildArtifact("hiding-directory") +new_lldb_server_link = self.getBuildArtifact( +"lldb-server-with-an-unconventional-name" +) +new_lldb_server = os.path.join(llgs_hiding_directory, "lldb-server") +os.makedirs(llgs_hiding_directory) +shutil.copy(lldbgdbserverutils.get_lldb_server_exe(), new_lldb_server) +os.symlink(new_lldb_server, new_lldb_server_link) + +proc = self.spawnSubprocess(new_lldb_server_link, commandline_args) +socket_id = lldbutil.wait_for_file_on_target(self, port_file) + +new_platform = lldb.SBPlatform("remote-" + self.getPlatform()) +self.dbg.SetSelectedPlatform(new_platform) + +connect_url = "connect://[%s]:%s" % (hostname, socket_id) +self.runCmd("platform connect %s" % connect_url) +self.runCmd("target create {}".format(self.getBuildArtifact("a.out"))) +self.runCmd("run") + +# So that lldb-server doesn't crash over SIGHUP +os.kill(proc.pid, signal.SIGTERM) yuvald-sweet-security wrote: Yea, this seems to happen also on the lldb-server-20 I got from apt, outside of the test... ``` $ lldb-server-20 platform --server --listen '*:1338' --log-channels "lldb all" & [1] 225430 Listen to [*]:1338 Listen to [*]:0 $ kill -HUP `pidof lldb-server-20` SIGHUP received, exiting lldb-server... PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump: 0. Program arguments: % lldb-server-20 platform --server --listen *:1338 --log-channels "lldb all" Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it): 0 libLLVM.so.20.1 0x74b07842bc7f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 63 1 libLLVM.so.20.1 0x74b078429989 llvm::sys::RunSignalHandlers() + 89 2 libLLVM.so.20.1 0x74b07842c390 3 libc.so.6 0x74b076c45330 4 libc.so.6 0x74b076c9eb2c pthread_kill + 284 5 libc.so.6 0x74b076c4527e gsignal + 30 6 libc.so.6 0x74b076c288ff abort + 223 7 lldb-server-20 0x5d1b74ca3b57 8 libc.so.6 0x74b076c45330 9 libc.so.6 0x74b076d1b9ad ppoll + 77 10 lldb-server-20 0x5d1b74cc2eea 11 lldb-server-20 0x5d1b74cc3dff 12 lldb-server-20 0x5d1b74ca39a1 13 lldb-server-20 0x5d1b74ca6225 14 libc.so.6 0x74b076c2a1ca 15 libc.so.6 0x74b076c2a28b __libc_start_main + 139 16 lldb-server-20 0x5d1b74c9e055 [1] + 225430 IOT instruction (core dumped) lldb-server-20 platform --server --listen '*:1338' --log-channels "lldb all" ``` whats the intended behavior here, do we expect lldb-server to handle SIGHUP without crashing or is the issue in the test sending that signal? https://github.com/llvm/llvm-project/pull/131609 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Implement `runInTerminal` for Windows (PR #121269)
https://github.com/SuibianP updated https://github.com/llvm/llvm-project/pull/121269 >From d13e94bfb5a54ed597d34a6a5ad3f2be25533884 Mon Sep 17 00:00:00 2001 From: Jialun Hu Date: Mon, 24 Feb 2025 22:10:17 +0800 Subject: [PATCH] [lldb-dap] Implement runInTerminal for Windows Currently, the named pipe is passed by name and a transient ofstream is constructed at each I/O request. This assumes, - Blocking semantics: FIFO I/O waits for the other side to connect. - Buffered semantics: Closing one side does not discard existing data. The former can be replaced by WaitNamedPipe/ConnectNamedPipe on Win32, but the second cannot be easily worked around. It is also impossible to have another "keep-alive" pipe server instance, as server-client pairs are fixed on connection on Win32 and the client may get connected to it instead of the real one. Refactor FifoFile[IO] to use an open file handles rather than file name. --- Win32 provides no way to replace the process image. Under the hood exec* actually creates a new process with a new PID. DebugActiveProcess also cannot get notified of process creations. Create the new process in a suspended state and resume it after attach. --- lldb/packages/Python/lldbsuite/test/dotest.py | 2 +- .../API/tools/lldb-dap/runInTerminal/Makefile | 2 +- .../runInTerminal/TestDAP_runInTerminal.py| 5 +- .../API/tools/lldb-dap/runInTerminal/main.c | 11 -- .../API/tools/lldb-dap/runInTerminal/main.cpp | 13 ++ lldb/tools/lldb-dap/FifoFiles.cpp | 131 +++--- lldb/tools/lldb-dap/FifoFiles.h | 35 +++-- .../tools/lldb-dap/Handler/RequestHandler.cpp | 8 +- lldb/tools/lldb-dap/RunInTerminal.cpp | 45 +++--- lldb/tools/lldb-dap/RunInTerminal.h | 11 +- lldb/tools/lldb-dap/lldb-dap.cpp | 63 +++-- 11 files changed, 243 insertions(+), 83 deletions(-) delete mode 100644 lldb/test/API/tools/lldb-dap/runInTerminal/main.c create mode 100644 lldb/test/API/tools/lldb-dap/runInTerminal/main.cpp diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index 7cc8f2985043e..01b161733d62e 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -547,7 +547,7 @@ def setupSysPath(): lldbDir = os.path.dirname(lldbtest_config.lldbExec) -lldbDAPExec = os.path.join(lldbDir, "lldb-dap") +lldbDAPExec = os.path.join(lldbDir, "lldb-dap.exe" if os.name == "nt" else "lldb-dap") if is_exe(lldbDAPExec): os.environ["LLDBDAP_EXEC"] = lldbDAPExec diff --git a/lldb/test/API/tools/lldb-dap/runInTerminal/Makefile b/lldb/test/API/tools/lldb-dap/runInTerminal/Makefile index 10495940055b6..8b20bcb05 100644 --- a/lldb/test/API/tools/lldb-dap/runInTerminal/Makefile +++ b/lldb/test/API/tools/lldb-dap/runInTerminal/Makefile @@ -1,3 +1,3 @@ -C_SOURCES := main.c +CXX_SOURCES := main.cpp include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/runInTerminal/TestDAP_runInTerminal.py b/lldb/test/API/tools/lldb-dap/runInTerminal/TestDAP_runInTerminal.py index 9aab7ca3293db..3a47202c5e0b6 100644 --- a/lldb/test/API/tools/lldb-dap/runInTerminal/TestDAP_runInTerminal.py +++ b/lldb/test/API/tools/lldb-dap/runInTerminal/TestDAP_runInTerminal.py @@ -43,7 +43,6 @@ def isTestSupported(self): except: return False -@skipIfWindows @skipIf(oslist=["linux"], archs=no_match(["x86_64"])) def test_runInTerminal(self): if not self.isTestSupported(): @@ -53,7 +52,7 @@ def test_runInTerminal(self): launch the inferior with the correct environment variables and arguments. """ program = self.getBuildArtifact("a.out") -source = "main.c" +source = "main.cpp" self.build_and_launch( program, runInTerminal=True, args=["foobar"], env=["FOO=bar"] ) @@ -113,7 +112,6 @@ def test_runInTerminalWithObjectEnv(self): self.assertIn("FOO", request_envs) self.assertEqual("BAR", request_envs["FOO"]) -@skipIfWindows @skipIf(oslist=["linux"], archs=no_match(["x86_64"])) def test_runInTerminalInvalidTarget(self): if not self.isTestSupported(): @@ -132,7 +130,6 @@ def test_runInTerminalInvalidTarget(self): response["message"], ) -@skipIfWindows @skipIf(oslist=["linux"], archs=no_match(["x86_64"])) def test_missingArgInRunInTerminalLauncher(self): if not self.isTestSupported(): diff --git a/lldb/test/API/tools/lldb-dap/runInTerminal/main.c b/lldb/test/API/tools/lldb-dap/runInTerminal/main.c deleted file mode 100644 index 676bd830e657b..0 --- a/lldb/test/API/tools/lldb-dap/runInTerminal/main.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include - -int main(int argc, char *argv[]) { - const char *foo = getenv("FOO"); - for (int counter = 1;; counter++) { -sleep(1); // breakpoint
[Lldb-commits] [lldb] [lldb][lldb-dap] explicitly set the expr as an alias for expression. (PR #134562)
https://github.com/da-viper created https://github.com/llvm/llvm-project/pull/134562 dap console does not recognise `expr` as a command because it is not explicitly set. It works fine in normal lldb because it is gotten from approximate match which is not available in the SBAPI >From be69e129667cac2ab75597bb3ed02f7d6da39bce Mon Sep 17 00:00:00 2001 From: Ebuka Ezike Date: Sun, 6 Apr 2025 01:36:12 +0100 Subject: [PATCH] [lldb][lldb-dap] explicitly set the expr as an alias for expression. dap console does not recognise `expr` as a command because it is not explicitly set. It works fine in normal lldb because it is gotten from approximate match which is not available in the SBAPI --- lldb/source/Interpreter/CommandInterpreter.cpp | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 112d2f20fda41..a4071f5f0a602 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -444,6 +444,7 @@ void CommandInterpreter::Initialize() { if (cmd_obj_sp) { // Ensure `e` runs `expression`. AddAlias("e", cmd_obj_sp); +AddAlias("expr", cmd_obj_sp); AddAlias("call", cmd_obj_sp, "--")->SetHelpLong(""); CommandAlias *parray_alias = AddAlias("parray", cmd_obj_sp, "--element-count %1 --"); @@ -1376,7 +1377,9 @@ bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd, } bool CommandInterpreter::AliasExists(llvm::StringRef cmd) const { - return m_alias_dict.find(cmd) != m_alias_dict.end(); + std::string alias_name; + return GetAliasFullName(cmd, alias_name); + // return m_alias_dict.find(cmd) != m_alias_dict.end(); } bool CommandInterpreter::UserCommandExists(llvm::StringRef cmd) const { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][lldb-dap] explicitly set the expr as an alias for expression. (PR #134562)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Ebuka Ezike (da-viper) Changes dap console does not recognise `expr` as a command because it is not explicitly set. It works fine in normal lldb because it is gotten from approximate match which is not available in the SBAPI --- Full diff: https://github.com/llvm/llvm-project/pull/134562.diff 1 Files Affected: - (modified) lldb/source/Interpreter/CommandInterpreter.cpp (+4-1) ``diff diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 112d2f20fda41..a4071f5f0a602 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -444,6 +444,7 @@ void CommandInterpreter::Initialize() { if (cmd_obj_sp) { // Ensure `e` runs `expression`. AddAlias("e", cmd_obj_sp); +AddAlias("expr", cmd_obj_sp); AddAlias("call", cmd_obj_sp, "--")->SetHelpLong(""); CommandAlias *parray_alias = AddAlias("parray", cmd_obj_sp, "--element-count %1 --"); @@ -1376,7 +1377,9 @@ bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd, } bool CommandInterpreter::AliasExists(llvm::StringRef cmd) const { - return m_alias_dict.find(cmd) != m_alias_dict.end(); + std::string alias_name; + return GetAliasFullName(cmd, alias_name); + // return m_alias_dict.find(cmd) != m_alias_dict.end(); } bool CommandInterpreter::UserCommandExists(llvm::StringRef cmd) const { `` https://github.com/llvm/llvm-project/pull/134562 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][lldb-dap] explicitly set the expr as an alias for expression. (PR #134562)
https://github.com/da-viper updated https://github.com/llvm/llvm-project/pull/134562 >From be69e129667cac2ab75597bb3ed02f7d6da39bce Mon Sep 17 00:00:00 2001 From: Ebuka Ezike Date: Sun, 6 Apr 2025 01:36:12 +0100 Subject: [PATCH 1/2] [lldb][lldb-dap] explicitly set the expr as an alias for expression. dap console does not recognise `expr` as a command because it is not explicitly set. It works fine in normal lldb because it is gotten from approximate match which is not available in the SBAPI --- lldb/source/Interpreter/CommandInterpreter.cpp | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 112d2f20fda41..a4071f5f0a602 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -444,6 +444,7 @@ void CommandInterpreter::Initialize() { if (cmd_obj_sp) { // Ensure `e` runs `expression`. AddAlias("e", cmd_obj_sp); +AddAlias("expr", cmd_obj_sp); AddAlias("call", cmd_obj_sp, "--")->SetHelpLong(""); CommandAlias *parray_alias = AddAlias("parray", cmd_obj_sp, "--element-count %1 --"); @@ -1376,7 +1377,9 @@ bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd, } bool CommandInterpreter::AliasExists(llvm::StringRef cmd) const { - return m_alias_dict.find(cmd) != m_alias_dict.end(); + std::string alias_name; + return GetAliasFullName(cmd, alias_name); + // return m_alias_dict.find(cmd) != m_alias_dict.end(); } bool CommandInterpreter::UserCommandExists(llvm::StringRef cmd) const { >From 7deb08ff1cf11e854f45f6dfaad30a640eb6b3c3 Mon Sep 17 00:00:00 2001 From: Ebuka Ezike Date: Sun, 6 Apr 2025 23:02:04 +0100 Subject: [PATCH 2/2] [lldb][lldb-dap] explicitly set the expr as an alias for expression. dap console does not recognise `expr` as a command because it is not explicitly set. It works fine in normal lldb because it is gotten from approximate match which is not available in the SBAPI --- lldb/source/Interpreter/CommandInterpreter.cpp | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index a4071f5f0a602..2e4c40ca53176 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1377,9 +1377,14 @@ bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd, } bool CommandInterpreter::AliasExists(llvm::StringRef cmd) const { - std::string alias_name; - return GetAliasFullName(cmd, alias_name); - // return m_alias_dict.find(cmd) != m_alias_dict.end(); + const bool exact_match = (m_alias_dict.find(cmd) != m_alias_dict.end()); + if (exact_match) +return true; + + StringList matches; + const int num_cmd_matches = + AddNamesMatchingPartialString(m_command_dict, cmd, matches); + return num_cmd_matches > 0; } bool CommandInterpreter::UserCommandExists(llvm::StringRef cmd) const { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add download time for each module in statistics (PR #134563)
https://github.com/GeorgeHuyubo created https://github.com/llvm/llvm-project/pull/134563 This PR try to store the download time statistic with a FileSpec, which can be later used when we report statistic to report the time we used to download the file. For now, only debuginfod symbol locator is using it, can be easily extend to other plugins to track download time for each downloaded file. Sample statistic dump output after this change: ``` Command: statistics dump ===Output=== { "commands": { "command container add": 1, "command script add": 51, "command script import": 59, "statistics dump": 1, "target create": 1, "type summary add": 36, "type synthetic add": 21 }, "memory": { "strings": { "bytesTotal": 3145728, "bytesUnused": 1554746, "bytesUsed": 1590982 } }, "modules": [ { "debugInfoByteSize": 244905, "debugInfoEnabled": true, "debugInfoHadIncompleteTypes": false, "debugInfoHadVariableErrors": false, "debugInfoIndexLoadedFromCache": false, "debugInfoIndexSavedToCache": false, "debugInfoIndexTime": 1.02778499, "debugInfoParseTime": 0.00036002, "identifier": 94819923889600, "path": "/home/hyubo/.cache/llvm-debuginfod/client/llvmcache-e9243b31f158441000d1e6310bd82104bdbe362b-c4crasher", "symbolDownloadTime": 2.15734097, "symbolTableIndexTime": 0.0034009, "symbolTableLoadedFromCache": false, "symbolTableParseTime": 0.0055457, "symbolTableSavedToCache": false, "symbolTableStripped": false, "triple": "x86_64--linux", "uuid": "E9243B31-F158-4410-00D1-E6310BD82104-BDBE362B" }, { "debugInfoByteSize": 0, "debugInfoEnabled": false, "debugInfoHadIncompleteTypes": false, "debugInfoHadVariableErrors": false, "debugInfoIndexLoadedFromCache": false, "debugInfoIndexSavedToCache": false, "debugInfoIndexTime": 0, "debugInfoParseTime": 0, "identifier": 94819937577008, "path": "[vdso](0x7ffdca346000)", "symbolDownloadTime": 0, "symbolTableIndexTime": 2.6999e-05, "symbolTableLoadedFromCache": false, "symbolTableParseTime": 0.00044298, "symbolTableSavedToCache": false, "symbolTableStripped": false, "triple": "x86_64--linux", "uuid": "4D1F38BD-BD34-DFB3-C9A5-B49A2A912219-AC713763" }, { "debugInfoByteSize": 0, "debugInfoEnabled": false, "debugInfoHadIncompleteTypes": false, "debugInfoHadVariableErrors": false, "debugInfoIndexLoadedFromCache": false, "debugInfoIndexSavedToCache": false, "debugInfoIndexTime": 0, "debugInfoParseTime": 0, "identifier": 94819924328256, "path": "/usr/local/fbcode/platform010/lib/libc.so.6", "symbolDownloadTime": 0, "symbolTableIndexTime": 0.0091171, "symbolTableLoadedFromCache": false, "symbolTableParseTime": 0.0867119997, "symbolTableSavedToCache": false, "symbolTableStripped": false, "triple": "x86_64--linux", "uuid": "ACE9DF01-8872-3A35-6D14-3C92527EF739-4BE32C75" }, { "debugInfoByteSize": 0, "debugInfoEnabled": false, "debugInfoHadIncompleteTypes": false, "debugInfoHadVariableErrors": false, "debugInfoIndexLoadedFromCache": false, "debugInfoIndexSavedToCache": false, "debugInfoIndexTime": 0, "debugInfoParseTime": 0, "identifier": 94819937844080, "path": "/usr/local/fbcode/platform010/lib/libm.so.6", "symbolDownloadTime": 0, "symbolTableIndexTime": 0.0026341, "symbolTableLoadedFromCache": false, "symbolTableParseTime": 0.022778, "symbolTableSavedToCache": false, "symbolTableStripped": false, "triple": "x86_64--linux", "uuid": "85932B54-0DE7-4FC1-23B0-FB09AD1A5A61-8E1098B7" }, { "debugInfoByteSize": 0, "debugInfoEnabled": false, "debugInfoHadIncompleteTypes": false, "debugInfoHadVariableErrors": false, "debugInfoIndexLoadedFromCache": false, "debugInfoIndexSavedToCache": false, "debugInfoIndexTime": 0, "debugInfoParseTime": 0, "identifier": 94819939787376, "path": "/usr/local/fbcode/platform010/lib/libmvec.so.1", "symbolDownloadTime": 0, "symbolTableIndexTime": 0.00055505, "symbolTableLoadedFromCache": false, "symbolTableParseTime": 0.0034258, "symbolTableSavedToCache": false, "symbolTableStripped": false, "triple": "x86_64--linux", "uuid": "4537CA22-8E6E-495B-7A03-FC2CEDCAD71C-8A7B2067" }, { "debugInfoByteSize": 71978, "debugInfoEnabled": true, "debugInfoHadIncompleteTypes": false, "debugInfoHadVariableErrors": false, "debugInfoIndexLoadedFromCache": false, "d
[Lldb-commits] [lldb] Add download time for each module in statistics (PR #134563)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: None (GeorgeHuyubo) Changes This PR try to store the download time statistic with a FileSpec, which can be later used when we report statistic to report the time we used to download the file. For now, only debuginfod symbol locator is using it, can be easily extend to other plugins to track download time for each downloaded file. Sample statistic dump output after this change: ``` Command: statistics dump ===Output=== { "commands": { "command container add": 1, "command script add": 51, "command script import": 59, "statistics dump": 1, "target create": 1, "type summary add": 36, "type synthetic add": 21 }, "memory": { "strings": { "bytesTotal": 3145728, "bytesUnused": 1554746, "bytesUsed": 1590982 } }, "modules": [ { "debugInfoByteSize": 244905, "debugInfoEnabled": true, "debugInfoHadIncompleteTypes": false, "debugInfoHadVariableErrors": false, "debugInfoIndexLoadedFromCache": false, "debugInfoIndexSavedToCache": false, "debugInfoIndexTime": 1.02778499, "debugInfoParseTime": 0.00036002, "identifier": 94819923889600, "path": "/home/hyubo/.cache/llvm-debuginfod/client/llvmcache-e9243b31f158441000d1e6310bd82104bdbe362b-c4crasher", "symbolDownloadTime": 2.15734097, "symbolTableIndexTime": 0.0034009, "symbolTableLoadedFromCache": false, "symbolTableParseTime": 0.0055457, "symbolTableSavedToCache": false, "symbolTableStripped": false, "triple": "x86_64--linux", "uuid": "E9243B31-F158-4410-00D1-E6310BD82104-BDBE362B" }, { "debugInfoByteSize": 0, "debugInfoEnabled": false, "debugInfoHadIncompleteTypes": false, "debugInfoHadVariableErrors": false, "debugInfoIndexLoadedFromCache": false, "debugInfoIndexSavedToCache": false, "debugInfoIndexTime": 0, "debugInfoParseTime": 0, "identifier": 94819937577008, "path": "[vdso](0x7ffdca346000)", "symbolDownloadTime": 0, "symbolTableIndexTime": 2.6999e-05, "symbolTableLoadedFromCache": false, "symbolTableParseTime": 0.00044298, "symbolTableSavedToCache": false, "symbolTableStripped": false, "triple": "x86_64--linux", "uuid": "4D1F38BD-BD34-DFB3-C9A5-B49A2A912219-AC713763" }, { "debugInfoByteSize": 0, "debugInfoEnabled": false, "debugInfoHadIncompleteTypes": false, "debugInfoHadVariableErrors": false, "debugInfoIndexLoadedFromCache": false, "debugInfoIndexSavedToCache": false, "debugInfoIndexTime": 0, "debugInfoParseTime": 0, "identifier": 94819924328256, "path": "/usr/local/fbcode/platform010/lib/libc.so.6", "symbolDownloadTime": 0, "symbolTableIndexTime": 0.0091171, "symbolTableLoadedFromCache": false, "symbolTableParseTime": 0.0867119997, "symbolTableSavedToCache": false, "symbolTableStripped": false, "triple": "x86_64--linux", "uuid": "ACE9DF01-8872-3A35-6D14-3C92527EF739-4BE32C75" }, { "debugInfoByteSize": 0, "debugInfoEnabled": false, "debugInfoHadIncompleteTypes": false, "debugInfoHadVariableErrors": false, "debugInfoIndexLoadedFromCache": false, "debugInfoIndexSavedToCache": false, "debugInfoIndexTime": 0, "debugInfoParseTime": 0, "identifier": 94819937844080, "path": "/usr/local/fbcode/platform010/lib/libm.so.6", "symbolDownloadTime": 0, "symbolTableIndexTime": 0.0026341, "symbolTableLoadedFromCache": false, "symbolTableParseTime": 0.022778, "symbolTableSavedToCache": false, "symbolTableStripped": false, "triple": "x86_64--linux", "uuid": "85932B54-0DE7-4FC1-23B0-FB09AD1A5A61-8E1098B7" }, { "debugInfoByteSize": 0, "debugInfoEnabled": false, "debugInfoHadIncompleteTypes": false, "debugInfoHadVariableErrors": false, "debugInfoIndexLoadedFromCache": false, "debugInfoIndexSavedToCache": false, "debugInfoIndexTime": 0, "debugInfoParseTime": 0, "identifier": 94819939787376, "path": "/usr/local/fbcode/platform010/lib/libmvec.so.1", "symbolDownloadTime": 0, "symbolTableIndexTime": 0.00055505, "symbolTableLoadedFromCache": false, "symbolTableParseTime": 0.0034258, "symbolTableSavedToCache": false, "symbolTableStripped": false, "triple": "x86_64--linux", "uuid": "4537CA22-8E6E-495B-7A03-FC2CEDCAD71C-8A7B2067" }, { "debugInfoByteSize": 71978, "debugInfoEnabled": true, "debugInfoHadIncompleteTypes": false, "debugInfoHadVariableErrors": false, "debugInfoIndexLoadedFromCache": false, "debugIn
[Lldb-commits] [lldb] [llvm] [lldb] Implement CLI support for reverse-continue (PR #132783)
rocallahan wrote: Thanks for the feedback, folks... if you're happy with it, don't forget to give it the thumbs-up :-) https://github.com/llvm/llvm-project/pull/132783 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits