[Lldb-commits] [lldb] [lldb][NFC] Add maybe_unused to err used in asserts (PR #98055)
https://github.com/keith created https://github.com/llvm/llvm-project/pull/98055 None >From 6a6fc355e3623a0d0aacc465220a562e103e6dfc Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Mon, 8 Jul 2024 10:28:22 -0700 Subject: [PATCH] [lldb][NFC] Add maybe_unused to err used in asserts --- lldb/tools/debugserver/source/PThreadMutex.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/tools/debugserver/source/PThreadMutex.h b/lldb/tools/debugserver/source/PThreadMutex.h index a4535dd79172c..17f9fdff5f2d3 100644 --- a/lldb/tools/debugserver/source/PThreadMutex.h +++ b/lldb/tools/debugserver/source/PThreadMutex.h @@ -78,13 +78,13 @@ class PThreadMutex { }; PThreadMutex() { -int err; +[[maybe_unused]] int err; err = ::pthread_mutex_init(&m_mutex, NULL); assert(err == 0); } PThreadMutex(int type) { -int err; +[[maybe_unused]] int err; ::pthread_mutexattr_t attr; err = ::pthread_mutexattr_init(&attr); assert(err == 0); @@ -97,7 +97,7 @@ class PThreadMutex { } ~PThreadMutex() { -int err; +[[maybe_unused]] int err; err = ::pthread_mutex_destroy(&m_mutex); if (err != 0) { err = Unlock(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Allow env override for LLDB_ARGDUMPER_PATH (PR #91688)
https://github.com/keith closed https://github.com/llvm/llvm-project/pull/91688 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [compiler-rt] [lldb] [llvm] [Support] Remove terminfo dependency (PR #92865)
keith wrote: looks like the .bazelrc still has mentions of this https://github.com/llvm/llvm-project/pull/92865 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][OSX] Add a fallback support exe directory (PR #103458)
https://github.com/keith approved this pull request. lgtm, but not a LLDB expert https://github.com/llvm/llvm-project/pull/103458 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][OSX] Add a fallback support exe directory (PR #103458)
keith wrote: note that this is similar to lldb-server is discovered on linux as well https://github.com/llvm/llvm-project/pull/103458 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Allow env override for LLDB_ARGDUMPER_PATH (PR #91688)
https://github.com/keith created https://github.com/llvm/llvm-project/pull/91688 This mirrors the LLDB_DEBUGSERVER_PATH environment variable and allows you to have lldb-argdumper in a non-standard location and still use it at runtime. >From 98ddf4ed99a10c46a43d9a750bd826623a8c7e6f Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Thu, 9 May 2024 18:10:36 -0700 Subject: [PATCH] [lldb] Allow env override for LLDB_ARGDUMPER_PATH This mirrors the LLDB_DEBUGSERVER_PATH environment variable and allows you to have lldb-argdumper in a non-standard location and still use it at runtime. --- lldb/source/Host/macosx/objcxx/Host.mm | 35 ++ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/lldb/source/Host/macosx/objcxx/Host.mm b/lldb/source/Host/macosx/objcxx/Host.mm index 4fba5550ba10a..e6f1c0ea3d295 100644 --- a/lldb/source/Host/macosx/objcxx/Host.mm +++ b/lldb/source/Host/macosx/objcxx/Host.mm @@ -1387,18 +1387,31 @@ static bool ShouldLaunchUsingXPC(ProcessLaunchInfo &launch_info) { Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { Status error; if (launch_info.GetFlags().Test(eLaunchFlagShellExpandArguments)) { -FileSpec expand_tool_spec = HostInfo::GetSupportExeDir(); -if (!expand_tool_spec) { - error.SetErrorString( - "could not get support executable directory for lldb-argdumper tool"); - return error; +FileSpec expand_tool_spec; +Environment host_env = Host::GetEnvironment(); +std::string env_argdumper_path = host_env.lookup("LLDB_ARGDUMPER_PATH"); +if (!env_argdumper_path.empty()) { + expand_tool_spec.SetFile(env_argdumper_path, FileSpec::Style::native); + Log *log(GetLog(LLDBLog::Host | LLDBLog::Process)); + LLDB_LOGF(log, +"lldb-argdumper exe path set from environment variable: %s", +env_argdumper_path.c_str()); } -expand_tool_spec.AppendPathComponent("lldb-argdumper"); -if (!FileSystem::Instance().Exists(expand_tool_spec)) { - error.SetErrorStringWithFormat( - "could not find the lldb-argdumper tool: %s", - expand_tool_spec.GetPath().c_str()); - return error; +bool argdumper_exists = FileSystem::Instance().Exists(env_argdumper_path); +if (!argdumper_exists) { + expand_tool_spec = HostInfo::GetSupportExeDir(); + if (!expand_tool_spec) { +error.SetErrorString("could not get support executable directory for " + "lldb-argdumper tool"); +return error; + } + expand_tool_spec.AppendPathComponent("lldb-argdumper"); + if (!FileSystem::Instance().Exists(expand_tool_spec)) { +error.SetErrorStringWithFormat( +"could not find the lldb-argdumper tool: %s", +expand_tool_spec.GetPath().c_str()); +return error; + } } StreamString expand_tool_spec_stream; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 0f3254b - [lldb] Improve help for platform put-file
Author: Keith Smiley Date: 2021-10-05T10:29:37-07:00 New Revision: 0f3254b29f375d449e815e91d63bef78d9e81354 URL: https://github.com/llvm/llvm-project/commit/0f3254b29f375d449e815e91d63bef78d9e81354 DIFF: https://github.com/llvm/llvm-project/commit/0f3254b29f375d449e815e91d63bef78d9e81354.diff LOG: [lldb] Improve help for platform put-file Previously it was not clear what arguments this required, or what it would do if you didn't pass the destination argument. Differential Revision: https://reviews.llvm.org/D110981 Added: Modified: lldb/source/Commands/CommandObjectPlatform.cpp Removed: diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index cd4d880e7..6bfb4c8a0689c 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -1067,7 +1067,18 @@ class CommandObjectPlatformPutFile : public CommandObjectParsed { CommandObjectPlatformPutFile(CommandInterpreter &interpreter) : CommandObjectParsed( interpreter, "platform put-file", -"Transfer a file from this system to the remote end.", nullptr, 0) { +"Transfer a file from this system to the remote end.", +"platform put-file []", 0) { +SetHelpLong( +R"(Examples: + +(lldb) platform put-file /source/foo.txt /destination/bar.txt + +(lldb) platform put-file /source/foo.txt + +Relative source file paths are resolved against lldb's local working directory. + +Omitting the destination places the file in the platform working directory.)"); } ~CommandObjectPlatformPutFile() override = default; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 0c4464a - [lldb] Fix formatted log statement
Author: Keith Smiley Date: 2021-11-18T15:09:38-08:00 New Revision: 0c4464a5bd35dd865f568ed68171208e44df16c7 URL: https://github.com/llvm/llvm-project/commit/0c4464a5bd35dd865f568ed68171208e44df16c7 DIFF: https://github.com/llvm/llvm-project/commit/0c4464a5bd35dd865f568ed68171208e44df16c7.diff LOG: [lldb] Fix formatted log statement Previously this would output literally without replacements Differential Revision: https://reviews.llvm.org/D114178 Added: Modified: lldb/source/Core/Module.cpp Removed: diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 283e18707dbba..bd0a667171a5a 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -1627,10 +1627,10 @@ void Module::RegisterXcodeSDK(llvm::StringRef sdk_name, llvm::StringRef sysroot) bool Module::MergeArchitecture(const ArchSpec &arch_spec) { if (!arch_spec.IsValid()) return false; - LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_MODULES), - "module has arch %s, merging/replacing with arch %s", - m_arch.GetTriple().getTriple().c_str(), - arch_spec.GetTriple().getTriple().c_str()); + LLDB_LOGF(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_MODULES), +"module has arch %s, merging/replacing with arch %s", +m_arch.GetTriple().getTriple().c_str(), +arch_spec.GetTriple().getTriple().c_str()); if (!m_arch.IsCompatibleMatch(arch_spec)) { // The new architecture is diff erent, we just need to replace it. return SetArchitecture(arch_spec); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Escape ? for zsh (PR #112107)
keith wrote: Oh yea great point. I guess another way to put that is if I copy the exact same invocation and run it directly it works, so that differing is unexpected. https://github.com/llvm/llvm-project/pull/112107 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Escape ? for zsh (PR #112107)
https://github.com/keith created https://github.com/llvm/llvm-project/pull/112107 Previously on macOS with lldb-argdumper if you ran: ``` lldb -o r -- /tmp/foo "some arg?" ``` It would fail with this error: ``` error: shell expansion failed (reason: lldb-argdumper exited with error 1). consider launching with 'process launch'. ``` stderr is silenced here but the underlying error if you print it for debugging is: ``` zsh: no matches found: ? ``` This change escapes the `?` so this argument works as expected. >From 2cd6a6726373e8b499aba4e41dafad5780f2134f Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Sat, 12 Oct 2024 11:25:16 -0700 Subject: [PATCH] [lldb] Escape ? for zsh Previously on macOS with lldb-argdumper if you ran: ``` lldb -o r -- /tmp/foo "some arg?" ``` It would fail with this error: ``` error: shell expansion failed (reason: lldb-argdumper exited with error 1). consider launching with 'process launch'. ``` stderr is silenced here but the underlying error if you print it for debugging is: ``` zsh: no matches found: ? ``` This change escapes the `?` so this argument works as expected. --- lldb/source/Utility/Args.cpp| 2 +- lldb/unittests/Utility/ArgsTest.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/source/Utility/Args.cpp b/lldb/source/Utility/Args.cpp index 8ba40bae4d67e5..92a7ef03273fbc 100644 --- a/lldb/source/Utility/Args.cpp +++ b/lldb/source/Utility/Args.cpp @@ -401,7 +401,7 @@ std::string Args::GetShellSafeArgument(const FileSpec &shell, static ShellDescriptor g_Shells[] = {{"bash", " '\"<>()&;"}, {"fish", " '\"<>()&\\|;"}, {"tcsh", " '\"<>()&;"}, - {"zsh", " '\"<>()&;\\|"}, + {"zsh", " '\"<>()&;\\|?"}, {"sh", " '\"<>()&;"}}; // safe minimal set diff --git a/lldb/unittests/Utility/ArgsTest.cpp b/lldb/unittests/Utility/ArgsTest.cpp index 8d2b625f524d67..34d6b4dd7c95a0 100644 --- a/lldb/unittests/Utility/ArgsTest.cpp +++ b/lldb/unittests/Utility/ArgsTest.cpp @@ -292,8 +292,8 @@ TEST(ArgsTest, GetShellSafeArgument) { EXPECT_EQ(Args::GetShellSafeArgument(bash, "a\"b"), "a\\\"b"); FileSpec zsh("/bin/zsh", FileSpec::Style::posix); - EXPECT_EQ(Args::GetShellSafeArgument(zsh, R"('";()<>&|\)"), -R"(\'\"\;\(\)\<\>\&\|\\)"); + EXPECT_EQ(Args::GetShellSafeArgument(zsh, R"('"?;()<>&|\)"), +R"(\'\"\?\;\(\)\<\>\&\|\\)"); // Normal characters and expressions that shouldn't be escaped. EXPECT_EQ(Args::GetShellSafeArgument(zsh, "aA$1*"), "aA$1*"); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Escape ? for zsh (PR #112107)
keith wrote: hmm good point. I wonder if the fix here should be around surfacing the error to users then, so they know they have to escape it depending on their use case https://github.com/llvm/llvm-project/pull/112107 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Silence Wunused-result warning (PR #126580)
https://github.com/keith created https://github.com/llvm/llvm-project/pull/126580 None >From bb41fdf6021c7a62bf77096bc4ce31e8e9311577 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Mon, 10 Feb 2025 19:00:31 + Subject: [PATCH] [lldb-dap] Silence Wunused-result warning --- lldb/tools/lldb-dap/OutputRedirector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/tools/lldb-dap/OutputRedirector.cpp b/lldb/tools/lldb-dap/OutputRedirector.cpp index 7935e17a653bec3..a23572ab7ae0425 100644 --- a/lldb/tools/lldb-dap/OutputRedirector.cpp +++ b/lldb/tools/lldb-dap/OutputRedirector.cpp @@ -86,7 +86,7 @@ void OutputRedirector::Stop() { // write descriptor is duplicated (to stdout/err or to another process). // Write a null byte to ensure the read call returns. char buf[] = "\0"; -::write(fd, buf, sizeof(buf)); +(void)::write(fd, buf, sizeof(buf)); ::close(fd); m_forwarder.join(); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Silence Wunused-result warning (PR #126580)
keith wrote: showed up since https://github.com/llvm/llvm-project/commit/adb9ef035552d7fc42a34560677f89f4f6421295 https://github.com/llvm/llvm-project/pull/126580 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Silence Wunused-result warning (PR #126580)
keith wrote: ``` lldb/tools/lldb-dap/OutputRedirector.cpp:89:5: error: ignoring return value of function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result] 89 | ::write(fd, buf, sizeof(buf)); | ^~~ 1 error generated. ``` https://github.com/llvm/llvm-project/pull/126580 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix ubsan violation with plugin loading (PR #126652)
https://github.com/keith created https://github.com/llvm/llvm-project/pull/126652 This typedef doesn't match the signature below, specifically the signature takes a `lldb:SBDebugger` vs this was defined as `lldb:SBDebugger&`. ``` lldb/source/API/SBDebugger.cpp:199:13: runtime error: call to function lldb::PluginInitialize(lldb::SBDebugger) through pointer to incorrect function type 'bool (*)(lldb::SBDebugger &)' .../CustomPlugin.cpp:134: note: lldb::PluginInitialize(lldb::SBDebugger) defined here ``` >From 52cdc7332d58157e4bc10ebb66ea93c17f052c5f Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Tue, 11 Feb 2025 02:06:36 + Subject: [PATCH] [lldb] Fix ubsan violation with plugin loading This typedef doesn't match the signature below, specifically the signature takes a `lldb:SBDebugger` vs this was defined as `lldb:SBDebugger&`. ``` lldb/source/API/SBDebugger.cpp:199:13: runtime error: call to function lldb::PluginInitialize(lldb::SBDebugger) through pointer to incorrect function type 'bool (*)(lldb::SBDebugger &)' .../CustomPlugin.cpp:134: note: lldb::PluginInitialize(lldb::SBDebugger) defined here ``` --- lldb/source/API/SBDebugger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index 4e6b22492a0d1c2..bdb8e538b99f861 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -185,7 +185,7 @@ lldb::SBError SBDebugger::InitializeWithErrorHandling() { llvm::sys::DynamicLibrary dynlib = llvm::sys::DynamicLibrary::getPermanentLibrary(spec.GetPath().c_str()); if (dynlib.isValid()) { - typedef bool (*LLDBCommandPluginInit)(lldb::SBDebugger & debugger); + typedef bool (*LLDBCommandPluginInit)(lldb::SBDebugger debugger); lldb::SBDebugger debugger_sb(debugger_sp); // This calls the bool lldb::PluginInitialize(lldb::SBDebugger debugger) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Silence Wunused-result warning (PR #126580)
https://github.com/keith closed https://github.com/llvm/llvm-project/pull/126580 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix ubsan violation with plugin loading (PR #126652)
https://github.com/keith closed https://github.com/llvm/llvm-project/pull/126652 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] Revert "[LLDB] Add a target.launch-working-dir setting" (PR #114973)
keith wrote: did this one reland somewhere? https://github.com/llvm/llvm-project/pull/114973 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits