[Lldb-commits] [PATCH] D95601: [lldb][AArch64] Add memory tag reading to lldb-server
omjavaid added inline comments. Comment at: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:1357 + + if (error.Fail()) +return error; DavidSpickett wrote: > omjavaid wrote: > > DavidSpickett wrote: > > > DavidSpickett wrote: > > > > DavidSpickett wrote: > > > > > omjavaid wrote: > > > > > > ptrace request is a success if number of tags requested is not > > > > > > equal to no of tags read? If not then this and following condition > > > > > > may be redundant. > > > > > Well ptracewrapper doesn't check the iovec, but I'll check the kernel > > > > > source to see if it's actually possible for it to fail that way. > > > > In `linux/arch/arm64/kernel/mte.c` `__access_remote_tags` there is a > > > > comment: > > > > ``` > > > > +/* > > > > + * Access MTE tags in another process' address space as given in mm. > > > > Update > > > > + * the number of tags copied. Return 0 if any tags copied, error > > > > otherwise. > > > > + * Inspired by __access_remote_vm(). > > > > + */ > > > > ``` > > > > > > > > *any tags* being the key words. > > > > > > > > So the scenario is: > > > > * ask to read from addr X in page 0, with length of pagesize+some so > > > > the range spills into page 1 > > > > * kernel can access page 0, reads tags until the end of the page > > > > * tries to access page 1 to read the rest, fails, returns 0 (success) > > > > since *some* tags were read > > > > * we see the ptrace call succeeded but with less tags than we expected > > > > > > > > I don't see it's worth dealing with this corner case here since lldb > > > > will look before it leaps. It would have errored much earlier here > > > > because either page 1 isn't in the tracee's memory regions or it wasn't > > > > MTE enabled. > > > > > > > > > > > Added a comment in the code too. > > This means emitting less than requested number of tags is legit. However we > > have set tags vector size equal to whatever we have requested. We set error > > string which is actually not being used anywhere and can be removed in > > favor of a log message to help with debugging if needed. > > > > Also we need to resize the vector after ptrace request so we use this size > > in gdb remote reply. > I'll log that error in in GDBRemoteCommunicationServerLLGS.cpp. > > I'll do what you suggested to support partial read on the server side. Then > lldb client can error if it doesn't get what it expected. > (testing partial reads on the lldb side is going to be very difficult anyway > since we'd need a valid smaps entry to even issue one) If we are following an approach similar to m/M gdb remote packets for tags then its ok to read partial data in case a part memory in requested address range was inaccessible. May be make appropriate adjustment for command output I dont recall what currently emit out for partial memory reads but should be something like Comment at: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:1345 + + tags.resize((range.GetByteSize() / details->manager->GetGranuleSize()) * + details->manager->GetBytesPerTag()); DavidSpickett wrote: > omjavaid wrote: > > is there a difference between Granule and GranuleSize? > Granule is used to mean the current Granule you're in. So if you were at > address 0x10 you'd be in the [0x10,0x20) granule. > GranuleSize is the size of each granule. > > If I saw `manager->GetGranule` I'd expect it to be something like > `std::pair GetGranule(addr_t addr);`. > As in, tell me which granule I'm in. > > Though I admit this is more an issue of "ExpandToGranule" not being clear > enough, rather than "GetGranuleSize" being too redunant. > AlignToGranule(s) perhaps? But then you ask "align how", hence "ExpandTo". > Anyway. Right I guess we can stay with current nomenclature. Thanks for detailed explanation. Comment at: lldb/test/API/tools/lldb-server/memory-tagging/main.c:13 + // Wait for lldb-server to stop us + while (1) { + } DavidSpickett wrote: > omjavaid wrote: > > infinite loop in test program may not be a good idea. > I'll check what the timeouts are on the expect packet sequence. I think it > would get killed eventually if we didn't see the output we're looking for. > (I could do something more CPU friendly, sleep/halt/wait on something) In past I have LLDB buildbot sometimes piling up excutables which python couldnt cleanup for whatever reason. Its better if executable can safely exit within a reasonable period. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95601/new/ https://reviews.llvm.org/D95601 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 771c4c9 - [lldb] [Process/FreeBSD] Introduce aarch64 hw break/watchpoint support
Author: Michał Górny Date: 2021-03-10T18:36:19+01:00 New Revision: 771c4c9cf6be9f0b1e6e1d9f3e5063d0c3e6086b URL: https://github.com/llvm/llvm-project/commit/771c4c9cf6be9f0b1e6e1d9f3e5063d0c3e6086b DIFF: https://github.com/llvm/llvm-project/commit/771c4c9cf6be9f0b1e6e1d9f3e5063d0c3e6086b.diff LOG: [lldb] [Process/FreeBSD] Introduce aarch64 hw break/watchpoint support Split out the common base of Linux hardware breakpoint/watchpoint support for AArch64 into a Utility class, and use it to implement the matching support on FreeBSD. Differential Revision: https://reviews.llvm.org/D96548 Added: lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.cpp lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.h Modified: lldb/packages/Python/lldbsuite/test/dotest.py lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.h lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h lldb/source/Plugins/Process/Utility/CMakeLists.txt Removed: diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index 945b3f0c20a4..6617d377929b 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -801,6 +801,10 @@ def canRunWatchpointTests(): except subprocess.CalledProcessError: pass return False, "security.models.extensions.user_set_dbregs disabled" +elif platform == "freebsd" and configuration.arch == "aarch64": +import lldb +if lldb.SBPlatform.GetHostPlatform().GetOSMajorVersion() < 13: +return False, "Watchpoint support on arm64 requires FreeBSD 13.0" return True, "watchpoint support available" def checkWatchpointSupport(): diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp index 44797cd555c9..5961ff4439db 100644 --- a/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp @@ -265,6 +265,9 @@ void NativeProcessFreeBSD::MonitorSIGTRAP(lldb::pid_t pid) { switch (info.pl_siginfo.si_code) { case TRAP_BRKPT: + LLDB_LOG(log, "SIGTRAP/TRAP_BRKPT: si_addr: {0}", + info.pl_siginfo.si_addr); + if (thread) { auto thread_info = m_threads_stepping_with_breakpoint.find(thread->GetID()); @@ -282,12 +285,15 @@ void NativeProcessFreeBSD::MonitorSIGTRAP(lldb::pid_t pid) { SetState(StateType::eStateStopped, true); return; case TRAP_TRACE: + LLDB_LOG(log, "SIGTRAP/TRAP_TRACE: si_addr: {0}", + info.pl_siginfo.si_addr); + if (thread) { auto ®ctx = static_cast( thread->GetRegisterContext()); uint32_t wp_index = LLDB_INVALID_INDEX32; -Status error = -regctx.GetWatchpointHitIndex(wp_index, LLDB_INVALID_ADDRESS); +Status error = regctx.GetWatchpointHitIndex( +wp_index, reinterpret_cast(info.pl_siginfo.si_addr)); if (error.Fail()) LLDB_LOG(log, "received error while checking for watchpoint hits, pid = " @@ -655,9 +661,8 @@ size_t NativeProcessFreeBSD::UpdateThreads() { return m_threads.size(); } Status NativeProcessFreeBSD::SetBreakpoint(lldb::addr_t addr, uint32_t size, bool hardware) { if (hardware) -return Status("NativeProcessFreeBSD does not support hardware breakpoints"); - else -return SetSoftwareBreakpoint(addr, size); +return SetHardwareBreakpoint(addr, size); + return SetSoftwareBreakpoint(addr, size); } Status NativeProcessFreeBSD::GetLoadedModuleFileSpec(const char *module_path, diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp index 2fa08bf8e3a3..e98e0a8a0caa 100644 --- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp @@ -15,6 +15,7 @@ #include "lldb/Utility/Status.h" #include "Plugins/Process/FreeBSD/NativeProcessFreeBSD.h" +#include "Plugins/Process/POSIX/ProcessPOSIXLog.h" #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h" // clang-format off @@ -36,9 +37,16 @@ NativeRegisterContextFreeBSD::CreateHostNativeRegisterContextFreeBSD( NativeRegisterContextFreeBSD_arm64::NativeRegisterContextFreeBSD_arm64( const ArchSpec &target_arch, NativeThreadProtocol &native_thread) : NativeRe
[Lldb-commits] [lldb] f47a84b - [lldb] [test] Update XFAILs for FreeBSD/aarch64
Author: Michał Górny Date: 2021-03-10T18:36:19+01:00 New Revision: f47a84bc335775273688b76df8ddc7daae7f132e URL: https://github.com/llvm/llvm-project/commit/f47a84bc335775273688b76df8ddc7daae7f132e DIFF: https://github.com/llvm/llvm-project/commit/f47a84bc335775273688b76df8ddc7daae7f132e.diff LOG: [lldb] [test] Update XFAILs for FreeBSD/aarch64 Added: Modified: lldb/test/API/commands/expression/fixits/TestFixIts.py lldb/test/API/commands/expression/multiline-completion/TestMultilineCompletion.py lldb/test/API/commands/expression/static-initializers/TestStaticInitializers.py lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteLoad.py lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py lldb/test/API/functionalities/return-value/TestReturnValue.py lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentNWatchNBreak.py lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentSignalNWatchNBreak.py lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointThreads.py lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointsOneDelaySignal.py lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointsOneSignal.py lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointsOneWatchpoint.py lldb/test/API/iohandler/completion/TestIOHandlerCompletion.py lldb/test/API/lang/cpp/trivial_abi/TestTrivialABI.py lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py Removed: diff --git a/lldb/test/API/commands/expression/fixits/TestFixIts.py b/lldb/test/API/commands/expression/fixits/TestFixIts.py index 59a1eb2d2abf..754e517a855d 100644 --- a/lldb/test/API/commands/expression/fixits/TestFixIts.py +++ b/lldb/test/API/commands/expression/fixits/TestFixIts.py @@ -83,7 +83,8 @@ def test_with_target(self): "Fix was right") # The final function call runs into SIGILL on aarch64-linux. -@expectedFailureAll(archs=["aarch64"], oslist=["linux"]) +@expectedFailureAll(archs=["aarch64"], oslist=["freebsd", "linux"], +bugnumber="llvm.org/pr49407") def test_with_multiple_retries(self): """Test calling expressions with errors that can be fixed by the FixIts.""" self.build() diff --git a/lldb/test/API/commands/expression/multiline-completion/TestMultilineCompletion.py b/lldb/test/API/commands/expression/multiline-completion/TestMultilineCompletion.py index 512b4a433984..0d6f19f7c6cb 100644 --- a/lldb/test/API/commands/expression/multiline-completion/TestMultilineCompletion.py +++ b/lldb/test/API/commands/expression/multiline-completion/TestMultilineCompletion.py @@ -30,6 +30,7 @@ def exit_expression_editor(self): # under ASAN on a loaded machine.. @skipIfAsan @skipIfEditlineSupportMissing +@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr49408') def test_basic_completion(self): """Test that we can complete a simple multiline expression""" self.build() diff --git a/lldb/test/API/commands/expression/static-initializers/TestStaticInitializers.py b/lldb/test/API/commands/expression/static-initializers/TestStaticInitializers.py index 60a005f10280..38470bb8a57d 100644 --- a/lldb/test/API/commands/expression/static-initializers/TestStaticInitializers.py +++ b/lldb/test/API/commands/expression/static-initializers/TestStaticInitializers.py @@ -7,7 +7,7 @@ class StaticInitializers(TestBase): mydir = TestBase.compute_mydir(__file__) -@expectedFailureAll(archs="aarch64", oslist="linux", +@expectedFailureAll(archs="aarch64", oslist=["freebsd", "linux"], bugnumber="https://bugs.llvm.org/show_bug.cgi?id=44053";) def test(self): """ Test a static initializer. """ diff --git a/lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py b/lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py index f26c8e58cccd..4b5926314790 100644 --- a/lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py +++ b/lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py @@ -14,7 +14,7 @@ class TestStepOverWatchpoint(TestBase): NO_DEBUG_INFO_TESTCASE = True @expectedFailureAll( -oslist=["linux"], +oslist=["freebsd", "linux"], archs=[ 'aarch64', 'arm'], diff --git a
[Lldb-commits] [PATCH] D96548: [lldb] [Process/FreeBSDRemote] Introduce aarch64 hw break/watchpoint support
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG771c4c9cf6be: [lldb] [Process/FreeBSD] Introduce aarch64 hw break/watchpoint support (authored by mgorny). Herald added a project: LLDB. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D96548/new/ https://reviews.llvm.org/D96548 Files: lldb/packages/Python/lldbsuite/test/dotest.py lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.h lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h lldb/source/Plugins/Process/Utility/CMakeLists.txt lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.cpp lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.h Index: lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.h === --- /dev/null +++ lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.h @@ -0,0 +1,79 @@ +//===-- NativeRegisterContextDBReg_arm64.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_NativeRegisterContextDBReg_arm64_h +#define lldb_NativeRegisterContextDBReg_arm64_h + +#include "Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h" + +#include + +namespace lldb_private { + +class NativeRegisterContextDBReg_arm64 +: public virtual NativeRegisterContextRegisterInfo { +public: + uint32_t NumSupportedHardwareBreakpoints() override; + + uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override; + + bool ClearHardwareBreakpoint(uint32_t hw_idx) override; + + Status ClearAllHardwareBreakpoints() override; + + Status GetHardwareBreakHitIndex(uint32_t &bp_index, + lldb::addr_t trap_addr) override; + + bool BreakpointIsEnabled(uint32_t bp_index); + + uint32_t NumSupportedHardwareWatchpoints() override; + + uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, + uint32_t watch_flags) override; + + bool ClearHardwareWatchpoint(uint32_t hw_index) override; + + Status ClearAllHardwareWatchpoints() override; + + Status GetWatchpointHitIndex(uint32_t &wp_index, + lldb::addr_t trap_addr) override; + + lldb::addr_t GetWatchpointHitAddress(uint32_t wp_index) override; + + lldb::addr_t GetWatchpointAddress(uint32_t wp_index) override; + + uint32_t GetWatchpointSize(uint32_t wp_index); + + bool WatchpointIsEnabled(uint32_t wp_index); + + // Debug register type select + enum DREGType { eDREGTypeWATCH = 0, eDREGTypeBREAK }; + +protected: + // Debug register info for hardware breakpoints and watchpoints management. + struct DREG { +lldb::addr_t address; // Breakpoint/watchpoint address value. +lldb::addr_t hit_addr; // Address at which last watchpoint trigger exception + // occurred. +lldb::addr_t real_addr; // Address value that should cause target to stop. +uint32_t control; // Breakpoint/watchpoint control value. + }; + + std::array m_hbp_regs; // hardware breakpoints + std::array m_hwp_regs; // hardware watchpoints + + uint32_t m_max_hbp_supported; + uint32_t m_max_hwp_supported; + + virtual llvm::Error ReadHardwareDebugInfo() = 0; + virtual llvm::Error WriteHardwareDebugRegs(DREGType hwbType) = 0; +}; + +} // namespace lldb_private + +#endif // #ifndef lldb_NativeRegisterContextDBReg_arm64_h Index: lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.cpp === --- /dev/null +++ lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.cpp @@ -0,0 +1,466 @@ +//===-- NativeRegisterContextDBReg_arm64.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 "NativeRegisterContextDBReg_arm64.h" + +#include "lldb/Utility/Log.h" +#include "lldb/Utility/RegisterValue.h" + +using namespace lldb_private; + +// E (bit 0), used to enable breakpoint/watchpoint +constexpr uint32_t g_enable_bit = 1; +// PAC (bits 2:1): 0b10 +constexpr uint32_t g_pac_bits = (2 << 1); + +// Returns appropriate co
[Lldb-commits] [PATCH] D96916: [lldb] Fix PushPlan to set subplan to private
kastiglione added a comment. Jim previously approved this offline. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D96916/new/ https://reviews.llvm.org/D96916 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 354d105 - [lldb] Fix PushPlan to set subplan to private
Author: Dave Lee Date: 2021-03-10T11:05:33-08:00 New Revision: 354d10530d267838a08bf0a27b1bdf69fd99086e URL: https://github.com/llvm/llvm-project/commit/354d10530d267838a08bf0a27b1bdf69fd99086e DIFF: https://github.com/llvm/llvm-project/commit/354d10530d267838a08bf0a27b1bdf69fd99086e.diff LOG: [lldb] Fix PushPlan to set subplan to private Call `SetPrivate(true)` for subplans pushed via `PushPlan()`, as described in its docstring. Differential Revision: https://reviews.llvm.org/D96916 Added: Modified: lldb/include/lldb/Target/ThreadPlan.h Removed: diff --git a/lldb/include/lldb/Target/ThreadPlan.h b/lldb/include/lldb/Target/ThreadPlan.h index 007e56d4babe..5e14a1fd6577 100644 --- a/lldb/include/lldb/Target/ThreadPlan.h +++ b/lldb/include/lldb/Target/ThreadPlan.h @@ -494,7 +494,7 @@ class ThreadPlan : public std::enable_shared_from_this, // another thread plan is never either of the above. void PushPlan(lldb::ThreadPlanSP &thread_plan_sp) { GetThread().PushPlan(thread_plan_sp); -thread_plan_sp->SetPrivate(false); +thread_plan_sp->SetPrivate(true); thread_plan_sp->SetIsMasterPlan(false); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D96916: [lldb] Fix PushPlan to set subplan to private
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG354d10530d26: [lldb] Fix PushPlan to set subplan to private (authored by kastiglione). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D96916/new/ https://reviews.llvm.org/D96916 Files: lldb/include/lldb/Target/ThreadPlan.h Index: lldb/include/lldb/Target/ThreadPlan.h === --- lldb/include/lldb/Target/ThreadPlan.h +++ lldb/include/lldb/Target/ThreadPlan.h @@ -494,7 +494,7 @@ // another thread plan is never either of the above. void PushPlan(lldb::ThreadPlanSP &thread_plan_sp) { GetThread().PushPlan(thread_plan_sp); -thread_plan_sp->SetPrivate(false); +thread_plan_sp->SetPrivate(true); thread_plan_sp->SetIsMasterPlan(false); } Index: lldb/include/lldb/Target/ThreadPlan.h === --- lldb/include/lldb/Target/ThreadPlan.h +++ lldb/include/lldb/Target/ThreadPlan.h @@ -494,7 +494,7 @@ // another thread plan is never either of the above. void PushPlan(lldb::ThreadPlanSP &thread_plan_sp) { GetThread().PushPlan(thread_plan_sp); -thread_plan_sp->SetPrivate(false); +thread_plan_sp->SetPrivate(true); thread_plan_sp->SetIsMasterPlan(false); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D98272: [lldb/Platform] Skip very slow xcrun queries for simulator platforms, NFC
vsk added inline comments. Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp:534 +if (arch && arch->IsValid() && !arch->TripleEnvironmentWasSpecified()) + return nullptr; // Avoid very slow xcrun query for non-simulator archs. llvm::StringRef sdk; JDevlieghere wrote: > Is it equivalent to return nullptr here to passing an empty string as the > `sdk`? I don't know, but I don't think so -- shouldn't that amount to dropping the -sdk argument here?: ``` auto xcrun = [](const std::string &sdk, llvm::StringRef developer_dir = "") -> std::string { std::string xcrun_cmd = "xcrun --show-sdk-path --sdk " + sdk; ``` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98272/new/ https://reviews.llvm.org/D98272 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D98272: [lldb/Platform] Skip very slow xcrun queries for simulator platforms, NFC
vsk updated this revision to Diff 329733. vsk added a comment. Use a helper function, respect the force argument. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98272/new/ https://reviews.llvm.org/D98272 Files: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp Index: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp === --- lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -505,6 +505,15 @@ return process_infos.size(); } +/// Whether to skip creating a simulator platform. +static bool shouldSkipSimulatorPlatform(bool force, const ArchSpec *arch) { + // If the arch is known not to specify a simulator environment, skip creating + // the simulator platform (we can create it later if there's a matching arch). + // This avoid very slow xcrun queries for non-simulator archs. + return !force && arch && arch->IsValid() && + !arch->TripleEnvironmentWasSpecified(); +} + static llvm::StringRef GetXcodeSDKDir(std::string preferred, std::string secondary) { llvm::StringRef sdk; @@ -530,6 +539,8 @@ } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { +if (shouldSkipSimulatorPlatform(force, arch)) + return nullptr; llvm::StringRef sdk; sdk = HostInfo::GetXcodeSDKPath(XcodeSDK("iPhoneSimulator.Internal.sdk")); if (sdk.empty()) @@ -578,6 +589,8 @@ } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { +if (shouldSkipSimulatorPlatform(force, arch)) + return nullptr; return PlatformAppleSimulator::CreateInstance( "PlatformAppleTVSimulator", g_tvos_description, ConstString(g_tvos_plugin_name), @@ -619,6 +632,8 @@ } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { +if (shouldSkipSimulatorPlatform(force, arch)) + return nullptr; return PlatformAppleSimulator::CreateInstance( "PlatformAppleWatchSimulator", g_watchos_description, ConstString(g_watchos_plugin_name), Index: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp === --- lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -505,6 +505,15 @@ return process_infos.size(); } +/// Whether to skip creating a simulator platform. +static bool shouldSkipSimulatorPlatform(bool force, const ArchSpec *arch) { + // If the arch is known not to specify a simulator environment, skip creating + // the simulator platform (we can create it later if there's a matching arch). + // This avoid very slow xcrun queries for non-simulator archs. + return !force && arch && arch->IsValid() && + !arch->TripleEnvironmentWasSpecified(); +} + static llvm::StringRef GetXcodeSDKDir(std::string preferred, std::string secondary) { llvm::StringRef sdk; @@ -530,6 +539,8 @@ } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { +if (shouldSkipSimulatorPlatform(force, arch)) + return nullptr; llvm::StringRef sdk; sdk = HostInfo::GetXcodeSDKPath(XcodeSDK("iPhoneSimulator.Internal.sdk")); if (sdk.empty()) @@ -578,6 +589,8 @@ } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { +if (shouldSkipSimulatorPlatform(force, arch)) + return nullptr; return PlatformAppleSimulator::CreateInstance( "PlatformAppleTVSimulator", g_tvos_description, ConstString(g_tvos_plugin_name), @@ -619,6 +632,8 @@ } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { +if (shouldSkipSimulatorPlatform(force, arch)) + return nullptr; return PlatformAppleSimulator::CreateInstance( "PlatformAppleWatchSimulator", g_watchos_description, ConstString(g_watchos_plugin_name), ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D98368: [lldb] Ignore linkage diagnostic for LLDBSwigPythonBreakpointCallbackFunction (NFC)
kastiglione created this revision. kastiglione added a reviewer: JDevlieghere. kastiglione requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits. Ignore `-Wreturn-type-c-linkage` diagnostics for `LLDBSwigPythonBreakpointCallbackFunction`. The function is defined in `python-wrapper.swig` which uses `extern "C" { ... }` blocks. The declaration of this function in `ScriptInterpreterPython.cpp` already uses these same pragmas to silence the warning there. This prevents `-Werror` builds from failing. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D98368 Files: lldb/bindings/python/python-wrapper.swig Index: lldb/bindings/python/python-wrapper.swig === --- lldb/bindings/python/python-wrapper.swig +++ lldb/bindings/python/python-wrapper.swig @@ -39,6 +39,17 @@ // This function is called by lldb_private::ScriptInterpreterPython::BreakpointCallbackFunction(...) // and is used when a script command is attached to a breakpoint for execution. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreturn-type-c-linkage" + +// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has +// C-linkage specified, but returns UDT 'llvm::Expected' which is +// incompatible with C +#if _MSC_VER +#pragma warning (push) +#pragma warning (disable : 4190) +#endif + SWIGEXPORT llvm::Expected LLDBSwigPythonBreakpointCallbackFunction ( @@ -85,6 +96,12 @@ return result.get().get() != Py_False; } +#if _MSC_VER +#pragma warning (pop) +#endif + +#pragma clang diagnostic pop + // This function is called by lldb_private::ScriptInterpreterPython::WatchpointCallbackFunction(...) // and is used when a script command is attached to a watchpoint for execution. Index: lldb/bindings/python/python-wrapper.swig === --- lldb/bindings/python/python-wrapper.swig +++ lldb/bindings/python/python-wrapper.swig @@ -39,6 +39,17 @@ // This function is called by lldb_private::ScriptInterpreterPython::BreakpointCallbackFunction(...) // and is used when a script command is attached to a breakpoint for execution. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreturn-type-c-linkage" + +// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has +// C-linkage specified, but returns UDT 'llvm::Expected' which is +// incompatible with C +#if _MSC_VER +#pragma warning (push) +#pragma warning (disable : 4190) +#endif + SWIGEXPORT llvm::Expected LLDBSwigPythonBreakpointCallbackFunction ( @@ -85,6 +96,12 @@ return result.get().get() != Py_False; } +#if _MSC_VER +#pragma warning (pop) +#endif + +#pragma clang diagnostic pop + // This function is called by lldb_private::ScriptInterpreterPython::WatchpointCallbackFunction(...) // and is used when a script command is attached to a watchpoint for execution. ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D98272: [lldb/Platform] Skip very slow xcrun queries for simulator platforms, NFC
JDevlieghere accepted this revision. JDevlieghere added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98272/new/ https://reviews.llvm.org/D98272 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D98370: [lldb] Fix SBValue::Persist() for constant values
werat created this revision. werat added a reviewer: teemperor. werat requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits. Right now `SBValue::Persist()` works properly only for values that refere to variables (refer to unit-tests for an example). Constant values (e.g. values created by `EvaluateExpression` or `CreateValueFromData`) can be persisted, but using them in the expressions leads to an error: >>> v = lldb.frame.EvaluateExpression("1+2") >>> vp = v.Persist() >>> vp.GetName() '$1' >>> v = lldb.frame.EvaluateExpression("$1") >>> v.GetValue() '3' >>> v = lldb.frame.EvaluateExpression("$1+1") >>> v.GetError().GetCString() "error: supposed to interpret, but failed: Interpreter couldn't read from memory\n" In this patch we mark constant values as "required materialization" and fix up the dematerialization logic to apply side-effects. Also move Windows-failing use cases to a separate test, so that other tests can be executed on Windows too. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D98370 Files: lldb/source/Core/ValueObject.cpp lldb/source/Expression/Materializer.cpp lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py lldb/test/API/python_api/sbvalue_persist/main.cpp Index: lldb/test/API/python_api/sbvalue_persist/main.cpp === --- lldb/test/API/python_api/sbvalue_persist/main.cpp +++ lldb/test/API/python_api/sbvalue_persist/main.cpp @@ -1,14 +1,21 @@ -#include #include +#include void f() {} +struct P { + int x; + float y; +} _p; + int main() { -int foo = 10; -int *bar = new int(4); -std::string baz = "85"; - -f(); // break here -f(); // break here -return 0; + int foo = 10; + int *bar = new int(4); + std::string baz = "85"; + + int mem[] = {1, 0x3fc0}; // P { x = 1, y = 1.5 } + + f(); // break here + f(); // break here + return 0; } Index: lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py === --- lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py +++ lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py @@ -1,7 +1,5 @@ """Test SBValue::Persist""" - - import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * @@ -13,9 +11,7 @@ mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True -@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24772") -def test(self): -"""Test SBValue::Persist""" +def _setup(self): self.build() self.setTearDownCleanup() self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) @@ -40,42 +36,103 @@ # Execute the cleanup function during test case tear down. self.addTearDownHook(cleanup) +@add_test_categories(['pyapi']) +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24772") +def test_std_string(self): +"""Test SBValue::Persist for a variable of type std::string""" +self._setup() + +baz = self.frame().FindVariable("baz") +self.assertTrue(baz.IsValid(), "baz is not valid") + +bazPersist = baz.Persist() +self.assertTrue(bazPersist.IsValid(), "bazPersist is not valid") +self.assertEqual(bazPersist.GetSummary(), '"85"') + +self.runCmd("continue") + +self.assertTrue(bazPersist.IsValid(), "bazPersist is not valid") +self.assertEqual(bazPersist.GetSummary(), '"85"') + +@add_test_categories(['pyapi']) +def test(self): +"""Test SBValue::Persist""" +self._setup() + foo = self.frame().FindVariable("foo") bar = self.frame().FindVariable("bar") -baz = self.frame().FindVariable("baz") self.assertTrue(foo.IsValid(), "foo is not valid") self.assertTrue(bar.IsValid(), "bar is not valid") -self.assertTrue(baz.IsValid(), "baz is not valid") fooPersist = foo.Persist() barPersist = bar.Persist() -bazPersist = baz.Persist() self.assertTrue(fooPersist.IsValid(), "fooPersist is not valid") self.assertTrue(barPersist.IsValid(), "barPersist is not valid") -self.assertTrue(bazPersist.IsValid(), "bazPersist is not valid") -self.assertEqual( -fooPersist.GetValueAsUnsigned(0), 10, -"fooPersist != 10") -self.assertEqual( -barPersist.GetPointeeData().sint32[0], 4, -"barPersist != 4") -self.assertEquals(bazPersist.GetSummary(), '"85"', "bazPersist != 85") +self.assertEqual(fooPersist.GetValueAsUnsigned(0), 10) +self.assertEqual(barPersist.GetPointeeData().sint32[0], 4) self.runCmd("continue") self.assertTrue(fooPersist.IsValid(), "fooPersist is not valid") self.assertT
[Lldb-commits] [PATCH] D98370: [lldb] Fix SBValue::Persist() for constant values
werat added a comment. Herald added a subscriber: JDevlieghere. Hi @teemperor , here's an attempt to fix `SBValue::Persist` method. I've highlighted a few moments in the patch I'm not so sure about, please let me know what you think. Thanks! Comment at: lldb/source/Expression/Materializer.cpp:301 -m_persistent_variable_sp->m_flags &= -~ExpressionVariable::EVNeedsFreezeDry; +m_persistent_variable_sp->m_frozen_sp = ValueObjectConstResult::Create( +map.GetBestExecutionContextScope(), Writing data directly to `m_persistent_variable_sp->GetValueBytes()` is not enough, because the underlying `ValueObject` also stores the data in `m_value` and I didn't find a way to update that one too. Overall there seems to be an assumption that `ValueObjectConstResult` doesn't change (which makes sense), so creating a new one here seems more in line with the design. Comment at: lldb/source/Expression/Materializer.cpp:303-304 -m_persistent_variable_sp->m_flags &= -~ExpressionVariable::EVNeedsFreezeDry; } I am not sure how to deal with this. "ConstResult" variables needs to be dematerialized every time, so they should either have `EVNeedsFreezeDry` flag, or the check should be different. Removing this flag doesn't seem to break anything though... Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98370/new/ https://reviews.llvm.org/D98370 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D98272: [lldb/Platform] Skip very slow xcrun queries for simulator platforms, NFC
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGac29c35207a5: [lldb/Platform] Skip very slow xcrun queries for simulator platforms, NFC (authored by vsk). Changed prior to commit: https://reviews.llvm.org/D98272?vs=329733&id=329767#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98272/new/ https://reviews.llvm.org/D98272 Files: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp Index: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp === --- lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -505,6 +505,16 @@ return process_infos.size(); } +/// Whether to skip creating a simulator platform. +static bool shouldSkipSimulatorPlatform(bool force, const ArchSpec *arch) { + // If the arch is known not to specify a simulator environment, skip creating + // the simulator platform (we can create it later if there's a matching arch). + // This avoids very slow xcrun queries for non-simulator archs (the slowness + // is due to xcrun not caching negative queries (rdar://74882205)). + return !force && arch && arch->IsValid() && + !arch->TripleEnvironmentWasSpecified(); +} + static llvm::StringRef GetXcodeSDKDir(std::string preferred, std::string secondary) { llvm::StringRef sdk; @@ -530,6 +540,8 @@ } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { +if (shouldSkipSimulatorPlatform(force, arch)) + return nullptr; llvm::StringRef sdk; sdk = HostInfo::GetXcodeSDKPath(XcodeSDK("iPhoneSimulator.Internal.sdk")); if (sdk.empty()) @@ -578,6 +590,8 @@ } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { +if (shouldSkipSimulatorPlatform(force, arch)) + return nullptr; return PlatformAppleSimulator::CreateInstance( "PlatformAppleTVSimulator", g_tvos_description, ConstString(g_tvos_plugin_name), @@ -619,6 +633,8 @@ } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { +if (shouldSkipSimulatorPlatform(force, arch)) + return nullptr; return PlatformAppleSimulator::CreateInstance( "PlatformAppleWatchSimulator", g_watchos_description, ConstString(g_watchos_plugin_name), Index: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp === --- lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -505,6 +505,16 @@ return process_infos.size(); } +/// Whether to skip creating a simulator platform. +static bool shouldSkipSimulatorPlatform(bool force, const ArchSpec *arch) { + // If the arch is known not to specify a simulator environment, skip creating + // the simulator platform (we can create it later if there's a matching arch). + // This avoids very slow xcrun queries for non-simulator archs (the slowness + // is due to xcrun not caching negative queries (rdar://74882205)). + return !force && arch && arch->IsValid() && + !arch->TripleEnvironmentWasSpecified(); +} + static llvm::StringRef GetXcodeSDKDir(std::string preferred, std::string secondary) { llvm::StringRef sdk; @@ -530,6 +540,8 @@ } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { +if (shouldSkipSimulatorPlatform(force, arch)) + return nullptr; llvm::StringRef sdk; sdk = HostInfo::GetXcodeSDKPath(XcodeSDK("iPhoneSimulator.Internal.sdk")); if (sdk.empty()) @@ -578,6 +590,8 @@ } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { +if (shouldSkipSimulatorPlatform(force, arch)) + return nullptr; return PlatformAppleSimulator::CreateInstance( "PlatformAppleTVSimulator", g_tvos_description, ConstString(g_tvos_plugin_name), @@ -619,6 +633,8 @@ } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { +if (shouldSkipSimulatorPlatform(force, arch)) + return nullptr; return PlatformAppleSimulator::CreateInstance( "PlatformAppleWatchSimulator", g_watchos_description, ConstString(g_watchos_plugin_name), ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] ac29c35 - [lldb/Platform] Skip very slow xcrun queries for simulator platforms, NFC
Author: Vedant Kumar Date: 2021-03-10T13:57:10-08:00 New Revision: ac29c35207a506eedaaea8a4196b83facbf978da URL: https://github.com/llvm/llvm-project/commit/ac29c35207a506eedaaea8a4196b83facbf978da DIFF: https://github.com/llvm/llvm-project/commit/ac29c35207a506eedaaea8a4196b83facbf978da.diff LOG: [lldb/Platform] Skip very slow xcrun queries for simulator platforms, NFC GetXcodeSDK() consistently takes over 1 second to complete if the queried SDK is missing, because `xcrun` doesn't cache negative lookups. Because there are multiple simulator platforms, this can add 4+ seconds to `lldb -b some_object_file.o`. To work around this, skip the call to GetXcodeSDK() when setting up simulator platforms if the specified arch doesn't have what looks like a simulator triple. Some other ways to fix this: - Fix caching in xcrun (rdar://74882205) - Test for arch compat before calling SomePlatform::CreateInstance() (much larger change) Differential Revision: https://reviews.llvm.org/D98272 Added: Modified: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp Removed: diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp index 342f7c214a76..afbffc2ef0a3 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -505,6 +505,16 @@ uint32_t PlatformAppleSimulator::FindProcesses( return process_infos.size(); } +/// Whether to skip creating a simulator platform. +static bool shouldSkipSimulatorPlatform(bool force, const ArchSpec *arch) { + // If the arch is known not to specify a simulator environment, skip creating + // the simulator platform (we can create it later if there's a matching arch). + // This avoids very slow xcrun queries for non-simulator archs (the slowness + // is due to xcrun not caching negative queries (rdar://74882205)). + return !force && arch && arch->IsValid() && + !arch->TripleEnvironmentWasSpecified(); +} + static llvm::StringRef GetXcodeSDKDir(std::string preferred, std::string secondary) { llvm::StringRef sdk; @@ -530,6 +540,8 @@ struct PlatformiOSSimulator { } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { +if (shouldSkipSimulatorPlatform(force, arch)) + return nullptr; llvm::StringRef sdk; sdk = HostInfo::GetXcodeSDKPath(XcodeSDK("iPhoneSimulator.Internal.sdk")); if (sdk.empty()) @@ -578,6 +590,8 @@ struct PlatformAppleTVSimulator { } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { +if (shouldSkipSimulatorPlatform(force, arch)) + return nullptr; return PlatformAppleSimulator::CreateInstance( "PlatformAppleTVSimulator", g_tvos_description, ConstString(g_tvos_plugin_name), @@ -619,6 +633,8 @@ struct PlatformAppleWatchSimulator { } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { +if (shouldSkipSimulatorPlatform(force, arch)) + return nullptr; return PlatformAppleSimulator::CreateInstance( "PlatformAppleWatchSimulator", g_watchos_description, ConstString(g_watchos_plugin_name), ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] daf3699 - [lldb] Ignore linkage diagnostic for LLDBSwigPythonBreakpointCallbackFunction (NFC)
Author: Dave Lee Date: 2021-03-10T14:15:54-08:00 New Revision: daf36998694fd9a0beaf7e1659ae41a6d1079107 URL: https://github.com/llvm/llvm-project/commit/daf36998694fd9a0beaf7e1659ae41a6d1079107 DIFF: https://github.com/llvm/llvm-project/commit/daf36998694fd9a0beaf7e1659ae41a6d1079107.diff LOG: [lldb] Ignore linkage diagnostic for LLDBSwigPythonBreakpointCallbackFunction (NFC) Ignore `-Wreturn-type-c-linkage` diagnostics for `LLDBSwigPythonBreakpointCallbackFunction`. The function is defined in `python-wrapper.swig` which uses `extern "C" { ... }` blocks. The declaration of this function in `ScriptInterpreterPython.cpp` already uses these same pragmas to silence the warning there. This prevents `-Werror` builds from failing. Differential Revision: https://reviews.llvm.org/D98368 Added: Modified: lldb/bindings/python/python-wrapper.swig Removed: diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig index 443ddfb8dd20..b189bfd7b9eb 100644 --- a/lldb/bindings/python/python-wrapper.swig +++ b/lldb/bindings/python/python-wrapper.swig @@ -39,6 +39,17 @@ private: // This function is called by lldb_private::ScriptInterpreterPython::BreakpointCallbackFunction(...) // and is used when a script command is attached to a breakpoint for execution. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreturn-type-c-linkage" + +// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has +// C-linkage specified, but returns UDT 'llvm::Expected' which is +// incompatible with C +#if _MSC_VER +#pragma warning (push) +#pragma warning (disable : 4190) +#endif + SWIGEXPORT llvm::Expected LLDBSwigPythonBreakpointCallbackFunction ( @@ -85,6 +96,12 @@ LLDBSwigPythonBreakpointCallbackFunction return result.get().get() != Py_False; } +#if _MSC_VER +#pragma warning (pop) +#endif + +#pragma clang diagnostic pop + // This function is called by lldb_private::ScriptInterpreterPython::WatchpointCallbackFunction(...) // and is used when a script command is attached to a watchpoint for execution. ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D98368: [lldb] Ignore linkage diagnostic for LLDBSwigPythonBreakpointCallbackFunction (NFC)
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGdaf36998694f: [lldb] Ignore linkage diagnostic for LLDBSwigPythonBreakpointCallbackFunction… (authored by kastiglione). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98368/new/ https://reviews.llvm.org/D98368 Files: lldb/bindings/python/python-wrapper.swig Index: lldb/bindings/python/python-wrapper.swig === --- lldb/bindings/python/python-wrapper.swig +++ lldb/bindings/python/python-wrapper.swig @@ -39,6 +39,17 @@ // This function is called by lldb_private::ScriptInterpreterPython::BreakpointCallbackFunction(...) // and is used when a script command is attached to a breakpoint for execution. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreturn-type-c-linkage" + +// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has +// C-linkage specified, but returns UDT 'llvm::Expected' which is +// incompatible with C +#if _MSC_VER +#pragma warning (push) +#pragma warning (disable : 4190) +#endif + SWIGEXPORT llvm::Expected LLDBSwigPythonBreakpointCallbackFunction ( @@ -85,6 +96,12 @@ return result.get().get() != Py_False; } +#if _MSC_VER +#pragma warning (pop) +#endif + +#pragma clang diagnostic pop + // This function is called by lldb_private::ScriptInterpreterPython::WatchpointCallbackFunction(...) // and is used when a script command is attached to a watchpoint for execution. Index: lldb/bindings/python/python-wrapper.swig === --- lldb/bindings/python/python-wrapper.swig +++ lldb/bindings/python/python-wrapper.swig @@ -39,6 +39,17 @@ // This function is called by lldb_private::ScriptInterpreterPython::BreakpointCallbackFunction(...) // and is used when a script command is attached to a breakpoint for execution. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreturn-type-c-linkage" + +// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has +// C-linkage specified, but returns UDT 'llvm::Expected' which is +// incompatible with C +#if _MSC_VER +#pragma warning (push) +#pragma warning (disable : 4190) +#endif + SWIGEXPORT llvm::Expected LLDBSwigPythonBreakpointCallbackFunction ( @@ -85,6 +96,12 @@ return result.get().get() != Py_False; } +#if _MSC_VER +#pragma warning (pop) +#endif + +#pragma clang diagnostic pop + // This function is called by lldb_private::ScriptInterpreterPython::WatchpointCallbackFunction(...) // and is used when a script command is attached to a watchpoint for execution. ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 08d33aa - [nfc] [lldb] Remove variable ranges_base in DWARFUnit::AddUnitDIE
Author: Jan Kratochvil Date: 2021-03-10T23:36:07+01:00 New Revision: 08d33aa6807d998ef777a4e6d56b629878d0e73b URL: https://github.com/llvm/llvm-project/commit/08d33aa6807d998ef777a4e6d56b629878d0e73b DIFF: https://github.com/llvm/llvm-project/commit/08d33aa6807d998ef777a4e6d56b629878d0e73b.diff LOG: [nfc] [lldb] Remove variable ranges_base in DWARFUnit::AddUnitDIE Added: Modified: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Removed: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index bb60ab9878c8..86b18615da7d 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -292,8 +292,7 @@ uint64_t DWARFUnit::GetDWOId() { // m_die_array_mutex must be already held as read/write. void DWARFUnit::AddUnitDIE(const DWARFDebugInfoEntry &cu_die) { - llvm::Optional addr_base, gnu_addr_base, ranges_base, - gnu_ranges_base; + llvm::Optional addr_base, gnu_addr_base, gnu_ranges_base; DWARFAttributes attributes; size_t num_attributes = cu_die.GetAttributes(this, attributes); @@ -320,8 +319,7 @@ void DWARFUnit::AddUnitDIE(const DWARFDebugInfoEntry &cu_die) { SetLoclistsBase(form_value.Unsigned()); break; case DW_AT_rnglists_base: - ranges_base = form_value.Unsigned(); - SetRangesBase(*ranges_base); + SetRangesBase(form_value.Unsigned()); break; case DW_AT_str_offsets_base: SetStrOffsetsBase(form_value.Unsigned()); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D98153: Some FormatEntity.cpp cleanup and unit testing
nealsid planned changes to this revision. nealsid added inline comments. Comment at: lldb/source/Core/FormatEntity.cpp:1560 } -return true; } Sorry, just caught this. Am uploading a new diff shortly. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98153/new/ https://reviews.llvm.org/D98153 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D98153: Some FormatEntity.cpp cleanup and unit testing
nealsid updated this revision to Diff 329834. nealsid added a comment. Fix regression introduced by removing return statement in case where we were able to format a function name. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98153/new/ https://reviews.llvm.org/D98153 Files: lldb/include/lldb/Core/FormatEntity.h lldb/source/Core/FormatEntity.cpp lldb/unittests/Core/CMakeLists.txt lldb/unittests/Core/FormatEntityTest.cpp Index: lldb/unittests/Core/FormatEntityTest.cpp === --- /dev/null +++ lldb/unittests/Core/FormatEntityTest.cpp @@ -0,0 +1,172 @@ +//===-- FormatEntityTest.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/Core/FormatEntity.h" +#include "lldb/Utility/Status.h" + +#include "llvm/ADT/StringRef.h" +#include "gtest/gtest.h" + +using namespace lldb_private; + +using Definition = FormatEntity::Entry::Definition; +using Entry = FormatEntity::Entry; + +TEST(FormatEntityTest, DefinitionConstructionAllParameters) { + Definition d("foo", "bar", FormatEntity::Entry::Type::Invalid, 0, 0, nullptr, + false); + + ASSERT_EQ(d.name, "foo"); + ASSERT_EQ(d.string, "bar"); + ASSERT_EQ(d.type, FormatEntity::Entry::Type::Invalid); + ASSERT_EQ(d.data, 0UL); + ASSERT_EQ(d.num_children, 0UL); + ASSERT_EQ(d.children, nullptr); + ASSERT_FALSE(d.keep_separator); +} + +TEST(FormatEntityTest, DefinitionConstructionNameAndType) { + Definition d("foo", FormatEntity::Entry::Type::Invalid); + + ASSERT_EQ(d.name, "foo"); + ASSERT_EQ(d.string, nullptr); + ASSERT_EQ(d.type, FormatEntity::Entry::Type::Invalid); + ASSERT_EQ(d.data, 0UL); + ASSERT_EQ(d.num_children, 0UL); + ASSERT_EQ(d.children, nullptr); + ASSERT_FALSE(d.keep_separator); +} + +TEST(FormatEntityTest, DefinitionConstructionNameAndString) { + Definition d("foo", "string"); + + ASSERT_EQ(d.name, "foo"); + ASSERT_EQ(d.string, "string"); + ASSERT_EQ(d.type, FormatEntity::Entry::Type::EscapeCode); + ASSERT_EQ(d.data, 0UL); + ASSERT_EQ(d.num_children, 0UL); + ASSERT_EQ(d.children, nullptr); + ASSERT_FALSE(d.keep_separator); +} + +TEST(FormatEntityTest, DefinitionConstructionNameTypeData) { + Definition d("foo", FormatEntity::Entry::Type::Invalid, 33); + + ASSERT_EQ(d.name, "foo"); + ASSERT_EQ(d.string, nullptr); + ASSERT_EQ(d.type, FormatEntity::Entry::Type::Invalid); + ASSERT_EQ(d.data, 33UL); + ASSERT_EQ(d.num_children, 0UL); + ASSERT_EQ(d.children, nullptr); + ASSERT_FALSE(d.keep_separator); +} + +TEST(FormatEntityTest, DefinitionConstructionNameTypeChildren) { + Definition d("foo", FormatEntity::Entry::Type::Invalid, 33); + Definition parent("parent", FormatEntity::Entry::Type::Invalid, 1, &d); + ASSERT_EQ(parent.name, "parent"); + ASSERT_EQ(parent.string, nullptr); + ASSERT_EQ(parent.type, FormatEntity::Entry::Type::Invalid); + ASSERT_EQ(parent.num_children, 1UL); + ASSERT_EQ(parent.children, &d); + ASSERT_FALSE(parent.keep_separator); + + ASSERT_EQ(parent.children[0].name, "foo"); + ASSERT_EQ(parent.children[0].string, nullptr); + ASSERT_EQ(parent.children[0].type, FormatEntity::Entry::Type::Invalid); + ASSERT_EQ(parent.children[0].data, 33UL); + ASSERT_EQ(parent.children[0].num_children, 0UL); + ASSERT_EQ(parent.children[0].children, nullptr); + ASSERT_FALSE(d.keep_separator); +} + +constexpr llvm::StringRef lookupStrings[] = { +"${addr.load}", +"${addr.file}", +"${ansi.fg.black}", +"${ansi.fg.red}", +"${ansi.fg.green}", +"${ansi.fg.yellow}", +"${ansi.fg.blue}", +"${ansi.fg.purple}", +"${ansi.fg.cyan}", +"${ansi.fg.white}", +"${ansi.bg.black}", +"${ansi.bg.red}", +"${ansi.bg.green}", +"${ansi.bg.yellow}", +"${ansi.bg.blue}", +"${ansi.bg.purple}", +"${ansi.bg.cyan}", +"${ansi.bg.white}", +"${file.basename}", +"${file.dirname}", +"${file.fullpath}", +"${frame.index}", +"${frame.pc}", +"${frame.fp}", +"${frame.sp}", +"${frame.flags}", +"${frame.no-debug}", +"${frame.reg.*}", +"${frame.is-artificial}", +"${function.id}", +"${function.name}", +"${function.name-without-args}", +"${function.name-with-args}", +"${function.mangled-name}", +"${function.addr-offset}", +"${function.concrete-only-addr-offset-no-padding}", +"${function.line-offset}", +"${function.pc-offset}", +"${function.initial-function}", +"${function.changed}", +"${function.is-optimized}", +"${line.file.basename}", +"${line.file.dirname}", +"${line.file.fullpath}", +"${line.number}", +"${line.column}", +"${line.start-addr}", +