[Lldb-commits] [lldb] [lldb] Fix incorrect logical operator in 'if' condition check (NFC) (PR #94779)
https://github.com/xgupta updated https://github.com/llvm/llvm-project/pull/94779 >From b8a387d82ed90c98f6bc9c0c7f9bc9da0d8e4d18 Mon Sep 17 00:00:00 2001 From: Shivam Gupta Date: Fri, 7 Jun 2024 23:21:15 +0530 Subject: [PATCH 1/3] [LLDB][NFC] Fix a cppcheck warning in Python/Interfaces/ScriptedPythonInterface.h Fix #89195 --- .../Python/Interfaces/ScriptedPythonInterface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h index 163659234466d..30811639c9a95 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h @@ -85,7 +85,7 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { bool has_class_name = !class_name.empty(); bool has_interpreter_dict = !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty()); -if (!has_class_name && !has_interpreter_dict && !script_obj) { +if (!has_class_name || !has_interpreter_dict || !script_obj) { if (!has_class_name) return create_error("Missing script class name."); else if (!has_interpreter_dict) >From 7a53eeb7c42c79f7637a8900a02e782f385d494f Mon Sep 17 00:00:00 2001 From: Shivam Gupta Date: Wed, 19 Jun 2024 13:46:57 +0530 Subject: [PATCH 2/3] simplify condition --- .../Interfaces/ScriptedPythonInterface.h | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h index 30811639c9a95..3d7c640a686ae 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h @@ -85,13 +85,17 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { bool has_class_name = !class_name.empty(); bool has_interpreter_dict = !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty()); -if (!has_class_name || !has_interpreter_dict || !script_obj) { - if (!has_class_name) -return create_error("Missing script class name."); - else if (!has_interpreter_dict) -return create_error("Invalid script interpreter dictionary."); - else -return create_error("Missing scripting object."); + +if (!has_class_name) { + return create_error("Missing script class name."); +} + +if (!has_interpreter_dict) { + return create_error("Invalid script interpreter dictionary."); +} + +if (!script_obj) { + return create_error("Missing scripting object."); } Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN, >From 93a6edb2e5cfeca2eccbc6b70ad8a06476c99210 Mon Sep 17 00:00:00 2001 From: Shivam Gupta Date: Sat, 6 Jul 2024 09:21:30 +0200 Subject: [PATCH 3/3] address review comment --- .../Python/Interfaces/ScriptedPythonInterface.h | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h index 3d7c640a686ae..9e859ec4b3653 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h @@ -86,17 +86,14 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { bool has_interpreter_dict = !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty()); -if (!has_class_name) { +if (!has_class_name) return create_error("Missing script class name."); -} -if (!has_interpreter_dict) { +if (!has_interpreter_dict) return create_error("Invalid script interpreter dictionary."); -} -if (!script_obj) { +if (!script_obj) return create_error("Missing scripting object."); -} Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN, Locker::FreeLock); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix incorrect logical operator in 'if' condition check (NFC) (PR #94779)
@@ -85,13 +85,17 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { bool has_class_name = !class_name.empty(); bool has_interpreter_dict = !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty()); -if (!has_class_name && !has_interpreter_dict && !script_obj) { - if (!has_class_name) -return create_error("Missing script class name."); - else if (!has_interpreter_dict) -return create_error("Invalid script interpreter dictionary."); - else -return create_error("Missing scripting object."); + +if (!has_class_name) { + return create_error("Missing script class name."); +} xgupta wrote: Sure, thanks. https://github.com/llvm/llvm-project/pull/94779 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Change lldb's breakpoint handling behavior (PR #96260)
@@ -377,24 +377,17 @@ void ProcessWindows::RefreshStateAfterStop() { if (!stop_thread) return; - switch (active_exception->GetExceptionCode()) { - case EXCEPTION_SINGLE_STEP: { -RegisterContextSP register_context = stop_thread->GetRegisterContext(); + // If we're at a BreakpointSite, mark this as an Unexecuted Breakpoint. + // We'll clear that state if we've actually executed the breakpoint. + if (RegisterContextSP register_context = stop_thread->GetRegisterContext()) { AlexK0 wrote: Moving `pc` into a scope causes a compilation error at the line with the logging Here: https://github.com/llvm/llvm-project/pull/96260/files#diff-3f6125dd89c50f3b1751b5a7d3270cdd93ad55eae76aef83deee563834c45888R399 https://github.com/llvm/llvm-project/pull/96260 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Change lldb's breakpoint handling behavior (PR #96260)
https://github.com/AlexK0 edited https://github.com/llvm/llvm-project/pull/96260 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Change lldb's breakpoint handling behavior (PR #96260)
AlexK0 wrote: @jasonmolenda, I checked the tests with the latest fix. There is a minor compilation error: https://github.com/llvm/llvm-project/pull/96260#pullrequestreview-2161497469 If fix it (I just drop `pc` from the logging), all breakpoint tests work, and I don’t see any new failures compared to the main branch. https://github.com/llvm/llvm-project/pull/96260 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Correct format specifier for sscanf to prevent buffer overflow (NFC) (PR #94783)
https://github.com/xgupta updated https://github.com/llvm/llvm-project/pull/94783 >From 17d39d89ee723881063ecbea19caaa6806e4e095 Mon Sep 17 00:00:00 2001 From: Shivam Gupta Date: Sat, 15 Jun 2024 23:57:03 +0530 Subject: [PATCH 1/2] Resolved merge conflict --- lldb/source/Host/linux/Host.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp index 5545f9ef4d70e6..8a38947d4b665f 100644 --- a/lldb/source/Host/linux/Host.cpp +++ b/lldb/source/Host/linux/Host.cpp @@ -100,7 +100,7 @@ static bool GetStatusInfo(::pid_t Pid, ProcessInstanceInfo &ProcessInfo, StatFields stat_fields; if (sscanf( Rest.data(), - "%d %s %c %d %d %d %d %d %u %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld", + "%d %15s %c %d %d %d %d %d %u %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld", &stat_fields.pid, stat_fields.comm, &stat_fields.state, &stat_fields.ppid, &stat_fields.pgrp, &stat_fields.session, &stat_fields.tty_nr, &stat_fields.tpgid, &stat_fields.flags, >From d84106a138040dc4e680ec82306969f8ff7ec01d Mon Sep 17 00:00:00 2001 From: Shivam Gupta Date: Sat, 6 Jul 2024 10:57:08 +0200 Subject: [PATCH 2/2] run clang-format --- lldb/source/Host/linux/Host.cpp | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp index 8a38947d4b665f..b5fa266da1d3bf 100644 --- a/lldb/source/Host/linux/Host.cpp +++ b/lldb/source/Host/linux/Host.cpp @@ -98,16 +98,16 @@ static bool GetStatusInfo(::pid_t Pid, ProcessInstanceInfo &ProcessInfo, if (Rest.empty()) return false; StatFields stat_fields; - if (sscanf( - Rest.data(), - "%d %15s %c %d %d %d %d %d %u %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld", - &stat_fields.pid, stat_fields.comm, &stat_fields.state, - &stat_fields.ppid, &stat_fields.pgrp, &stat_fields.session, - &stat_fields.tty_nr, &stat_fields.tpgid, &stat_fields.flags, - &stat_fields.minflt, &stat_fields.cminflt, &stat_fields.majflt, - &stat_fields.cmajflt, &stat_fields.utime, &stat_fields.stime, - &stat_fields.cutime, &stat_fields.cstime, - &stat_fields.realtime_priority, &stat_fields.priority) < 0) { + if (sscanf(Rest.data(), + "%d %15s %c %d %d %d %d %d %u %lu %lu %lu %lu %lu %lu %ld %ld %ld " + "%ld", + &stat_fields.pid, stat_fields.comm, &stat_fields.state, + &stat_fields.ppid, &stat_fields.pgrp, &stat_fields.session, + &stat_fields.tty_nr, &stat_fields.tpgid, &stat_fields.flags, + &stat_fields.minflt, &stat_fields.cminflt, &stat_fields.majflt, + &stat_fields.cmajflt, &stat_fields.utime, &stat_fields.stime, + &stat_fields.cutime, &stat_fields.cstime, + &stat_fields.realtime_priority, &stat_fields.priority) < 0) { return false; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix string truncation method when substring is the prefix of string (NFC) (PR #94785)
https://github.com/xgupta updated https://github.com/llvm/llvm-project/pull/94785 >From 6ec5b1a005b7551f2857b30e2461d297e7febfa3 Mon Sep 17 00:00:00 2001 From: Shivam Gupta Date: Fri, 7 Jun 2024 23:44:49 +0530 Subject: [PATCH 1/2] [LLDB][NFC] Fix a cppcheck warning in Platform/Android/PlatformAndroid.cpp Fix #91211 --- lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp index e177c134fea20e..6367763dd8b4ac 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -287,7 +287,7 @@ Status PlatformAndroid::DownloadModuleSlice(const FileSpec &src_file_spec, static constexpr llvm::StringLiteral k_zip_separator("!/"); size_t pos = source_file.find(k_zip_separator); if (pos != std::string::npos) -source_file = source_file.substr(0, pos); +source_file = source_file.resize(0, pos); Status error; AdbClientUP adb(GetAdbClient(error)); >From c05f1a9812b8ef6cfc4f1f4c2d7525371d65a95b Mon Sep 17 00:00:00 2001 From: Shivam Gupta Date: Sat, 6 Jul 2024 11:00:16 +0200 Subject: [PATCH 2/2] address review comment --- lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp index 6367763dd8b4ac..ff63af68aec9db 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -287,7 +287,7 @@ Status PlatformAndroid::DownloadModuleSlice(const FileSpec &src_file_spec, static constexpr llvm::StringLiteral k_zip_separator("!/"); size_t pos = source_file.find(k_zip_separator); if (pos != std::string::npos) -source_file = source_file.resize(0, pos); +source_file = source_file.resize(pos); Status error; AdbClientUP adb(GetAdbClient(error)); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 048815c - Revert "[lldb] Silence function cast warning when building with Clang ToT targetting Windows"
Author: Alexandre Ganea Date: 2024-07-06T12:00:13-04:00 New Revision: 048815c22ae779b1f2a0289b7b28ed8cf54af676 URL: https://github.com/llvm/llvm-project/commit/048815c22ae779b1f2a0289b7b28ed8cf54af676 DIFF: https://github.com/llvm/llvm-project/commit/048815c22ae779b1f2a0289b7b28ed8cf54af676.diff LOG: Revert "[lldb] Silence function cast warning when building with Clang ToT targetting Windows" This reverts commit cf1ded3ac248ad4feeed7b4dd20c60b7e3c40339. Added: Modified: lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp Removed: diff --git a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp index dc7697f71d6a6f..a69c10081ff190 100644 --- a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp @@ -175,11 +175,6 @@ Status TargetThreadWindows::DoResume() { return Status(); } -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wcast-function-type-mismatch" -#endif - const char *TargetThreadWindows::GetName() { Log *log = GetLog(LLDBLog::Thread); static GetThreadDescriptionFunctionPtr GetThreadDescription = []() { @@ -205,7 +200,3 @@ const char *TargetThreadWindows::GetName() { return m_name.c_str(); } - -#if defined(__clang__) -#pragma clang diagnostic pop -#endif ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits