Re: [Lldb-commits] [lldb] r318039 - Revert "[lldb] Use OrcMCJITReplacement rather than MCJIT as the underlying JIT for LLDB"
Oops -- I thought I'd reverted this ages ago. Evidently not. Thanks Pavel! -- Lang. On Mon, Nov 13, 2017 at 6:03 AM, Pavel Labath via lldb-commits < lldb-commits@lists.llvm.org> wrote: > Author: labath > Date: Mon Nov 13 06:03:17 2017 > New Revision: 318039 > > URL: http://llvm.org/viewvc/llvm-project?rev=318039&view=rev > Log: > Revert "[lldb] Use OrcMCJITReplacement rather than MCJIT as the underlying > JIT for LLDB" > > This commit really did not introduce any functional changes (for most > people) but it turns out it's not for the reason we thought it was. > > The reason wasn't that Orc is a perfect drop-in replacement for MCJIT, > but it was because we were never using Orc in the first place, as it was > not initialized. > > Orc's initialization relies on a global constructor in the LLVMOrcJIT.a. > Since this archive does not expose any symbols referenced from other > object files, it does not get linked into liblldb when linking against > llvm components statically. However, in an LLVM_LINK_LLVM_DYLIB=On > build, LLVMOrcJit.a is linked into libLLVM.so using --whole-archive, so > the global constructor does end up firing. > > The result of using Orc jit is pr34194, where lldb fails to evaluate > even very simple expressions. This bug can be reproduced in > non-LLVM_LINK_LLVM_DYLIB builds by making sure Orc jit is linked into > liblldb, for example by #including > llvm/ExecutionEngine/OrcMCJITReplacement.h in IRExecutionUnit.cpp (and > adding OrcJIT as a dependency to the relevant CMakeLists.txt file). The > bug reproduces (at least) on linux and osx. > > The root cause of the bug seems to be related to relocation processing. > It seems Orc processes relocations earlier than the system it is > replacing. This means the relocation processing happens before we have > had a chance to remap section load addresses to reflect their address in > the target process memory, so they end up pointing to locations in the > lldb's address space instead. > > I am not sure whether this is a bug in Orc jit, or in how we are using > it from lldb, but in any case it is preventing us from using Orc right > now. Reverting this fixes LLVM_LINK_LLVM_DYLIB build, and makes it clear > that we are in fact *not* using Orc, and we never really were. > > This reverts commit r279327. > > Modified: > lldb/trunk/source/Expression/IRExecutionUnit.cpp > > Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp > URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/ > Expression/IRExecutionUnit.cpp?rev=318039&r1=318038&r2=318039&view=diff > > == > --- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original) > +++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Mon Nov 13 06:03:17 > 2017 > @@ -277,8 +277,7 @@ void IRExecutionUnit::GetRunnableInfo(St >.setRelocationModel(relocModel) >.setMCJITMemoryManager( >std::unique_ptr(new MemoryManager(*this))) > - .setOptLevel(llvm::CodeGenOpt::Less) > - .setUseOrcMCJITReplacement(true); > + .setOptLevel(llvm::CodeGenOpt::Less); > >llvm::StringRef mArch; >llvm::StringRef mCPU; > > > ___ > lldb-commits mailing list > lldb-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r318039 - Revert "[lldb] Use OrcMCJITReplacement rather than MCJIT as the underlying JIT for LLDB"
For the curious: The relocation issue is one of two known incompatibilities between OrcMCJIT and MCJIT. I'm working on an ORC refactor that should eliminate both, at which point we can try this out again (with OrcMCJITReplacement properly #included this time). Cheers, Lang. On Mon, Nov 13, 2017 at 6:03 AM, Pavel Labath via lldb-commits < lldb-commits@lists.llvm.org> wrote: > Author: labath > Date: Mon Nov 13 06:03:17 2017 > New Revision: 318039 > > URL: http://llvm.org/viewvc/llvm-project?rev=318039&view=rev > Log: > Revert "[lldb] Use OrcMCJITReplacement rather than MCJIT as the underlying > JIT for LLDB" > > This commit really did not introduce any functional changes (for most > people) but it turns out it's not for the reason we thought it was. > > The reason wasn't that Orc is a perfect drop-in replacement for MCJIT, > but it was because we were never using Orc in the first place, as it was > not initialized. > > Orc's initialization relies on a global constructor in the LLVMOrcJIT.a. > Since this archive does not expose any symbols referenced from other > object files, it does not get linked into liblldb when linking against > llvm components statically. However, in an LLVM_LINK_LLVM_DYLIB=On > build, LLVMOrcJit.a is linked into libLLVM.so using --whole-archive, so > the global constructor does end up firing. > > The result of using Orc jit is pr34194, where lldb fails to evaluate > even very simple expressions. This bug can be reproduced in > non-LLVM_LINK_LLVM_DYLIB builds by making sure Orc jit is linked into > liblldb, for example by #including > llvm/ExecutionEngine/OrcMCJITReplacement.h in IRExecutionUnit.cpp (and > adding OrcJIT as a dependency to the relevant CMakeLists.txt file). The > bug reproduces (at least) on linux and osx. > > The root cause of the bug seems to be related to relocation processing. > It seems Orc processes relocations earlier than the system it is > replacing. This means the relocation processing happens before we have > had a chance to remap section load addresses to reflect their address in > the target process memory, so they end up pointing to locations in the > lldb's address space instead. > > I am not sure whether this is a bug in Orc jit, or in how we are using > it from lldb, but in any case it is preventing us from using Orc right > now. Reverting this fixes LLVM_LINK_LLVM_DYLIB build, and makes it clear > that we are in fact *not* using Orc, and we never really were. > > This reverts commit r279327. > > Modified: > lldb/trunk/source/Expression/IRExecutionUnit.cpp > > Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp > URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/ > Expression/IRExecutionUnit.cpp?rev=318039&r1=318038&r2=318039&view=diff > > == > --- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original) > +++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Mon Nov 13 06:03:17 > 2017 > @@ -277,8 +277,7 @@ void IRExecutionUnit::GetRunnableInfo(St >.setRelocationModel(relocModel) >.setMCJITMemoryManager( >std::unique_ptr(new MemoryManager(*this))) > - .setOptLevel(llvm::CodeGenOpt::Less) > - .setUseOrcMCJITReplacement(true); > + .setOptLevel(llvm::CodeGenOpt::Less); > >llvm::StringRef mArch; >llvm::StringRef mCPU; > > > ___ > lldb-commits mailing list > lldb-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r323163 - [lldb] Fix some C++ virtual method call bugs in LLDB expression evaluation by
Author: lhames Date: Mon Jan 22 15:53:56 2018 New Revision: 323163 URL: http://llvm.org/viewvc/llvm-project?rev=323163&view=rev Log: [lldb] Fix some C++ virtual method call bugs in LLDB expression evaluation by building method override tables for CXXMethodDecls in DWARFASTParserClang::CompleteTypeFromDWARF. C++ virtual method calls in LLDB expressions may fail if the override table for the method being called is not correct as IRGen will produce references to the wrong (or a missing) vtable entry. This patch does not fix calls to virtual methods with covariant return types as it mistakenly treats these as overloads, rather than overrides. This will be addressed in a future patch. Review: https://reviews.llvm.org/D41997 Partially fixes Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/ lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/Makefile lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/Makefile?rev=323163&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/Makefile Mon Jan 22 15:53:56 2018 @@ -0,0 +1,8 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules + +clean:: + rm -rf $(wildcard *.o *.d *.dSYM) Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py?rev=323163&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py Mon Jan 22 15:53:56 2018 @@ -0,0 +1,47 @@ +""" +Test calling an overriden method. + +Note: + This verifies that LLDB is correctly building the method overrides table. + If this table is not built correctly then calls to overridden methods in + derived classes may generate references to non-existant vtable entries, + as the compiler treats the overridden method as a totally new virtual + method definition. + + +""" + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + +class ExprCommandCallOverriddenMethod(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) +# Find the line number to break for main.c. +self.line = line_number('main.cpp', '// Set breakpoint here') + +def test(self): +"""Test calls to overridden methods in derived classes.""" +self.build() + +# Set breakpoint in main and run exe +self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) +lldbutil.run_break_set_by_file_and_line( +self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True) + +self.runCmd("run", RUN_SUCCEEDED) + +# Test call to method in base class (this should always work as the base +# class method is never an override). +self.expect("expr b->foo()") + +# Test call to overridden method in derived class (this will fail if the +# overrides table is not correctly set up, as Derived::foo will be assigned +# a vtable entry that does not exist in the compiled program). +self.expect("expr d.foo()") Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp?rev=323163&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp (added) +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp Mon Jan 22 15:53:56 2018 @@ -0,0 +1,16 @@ +class Base { +public: + virtual ~Base() {} + virtual void foo() {} +}; + +class Derived : public Base { +publi
[Lldb-commits] [lldb] r301441 - Use llvm::ArrayRef rather than std::vector/std::initializer lists for some
Author: lhames Date: Wed Apr 26 13:15:40 2017 New Revision: 301441 URL: http://llvm.org/viewvc/llvm-project?rev=301441&view=rev Log: Use llvm::ArrayRef rather than std::vector/std::initializer lists for some ValueObject methods. Using ArrayRef allows us to remove some overloads, work with more array-like types, and avoid some std::vector temporaries. https://reviews.llvm.org/D32518 Modified: lldb/trunk/include/lldb/Core/ValueObject.h lldb/trunk/source/Core/ValueObject.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp Modified: lldb/trunk/include/lldb/Core/ValueObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=301441&r1=301440&r2=301441&view=diff == --- lldb/trunk/include/lldb/Core/ValueObject.h (original) +++ lldb/trunk/include/lldb/Core/ValueObject.h Wed Apr 26 13:15:40 2017 @@ -27,6 +27,7 @@ #include "lldb/lldb-private-enumerations.h" // for AddressType #include "lldb/lldb-types.h"// for addr_t, offs... +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" // for StringRef @@ -37,7 +38,6 @@ #include// for recursive_mutex #include // for string #include // for pair -#include #include // for size_t #include // for uint32_t @@ -489,35 +489,19 @@ public: virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx, bool can_create); // this will always create the children if necessary - lldb::ValueObjectSP - GetChildAtIndexPath(const std::initializer_list &idxs, - size_t *index_of_error = nullptr); - - lldb::ValueObjectSP GetChildAtIndexPath(const std::vector &idxs, + lldb::ValueObjectSP GetChildAtIndexPath(llvm::ArrayRef idxs, size_t *index_of_error = nullptr); - lldb::ValueObjectSP GetChildAtIndexPath( - const std::initializer_list> &idxs, - size_t *index_of_error = nullptr); - lldb::ValueObjectSP - GetChildAtIndexPath(const std::vector> &idxs, + GetChildAtIndexPath(llvm::ArrayRef> idxs, size_t *index_of_error = nullptr); // this will always create the children if necessary - lldb::ValueObjectSP - GetChildAtNamePath(const std::initializer_list &names, - ConstString *name_of_error = nullptr); - - lldb::ValueObjectSP GetChildAtNamePath(const std::vector &names, + lldb::ValueObjectSP GetChildAtNamePath(llvm::ArrayRef names, ConstString *name_of_error = nullptr); - lldb::ValueObjectSP GetChildAtNamePath( - const std::initializer_list> &names, - ConstString *name_of_error = nullptr); - lldb::ValueObjectSP - GetChildAtNamePath(const std::vector> &names, + GetChildAtNamePath(llvm::ArrayRef> names, ConstString *name_of_error = nullptr); virtual lldb::ValueObjectSP GetChildMemberWithName(const ConstString &name, Modified: lldb/trunk/source/Core/ValueObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=301441&r1=301440&r2=301441&view=diff == --- lldb/trunk/source/Core/ValueObject.cpp (original) +++ lldb/trunk/source/Core/ValueObject.cpp Wed Apr 26 13:15:40 2017 @@ -481,21 +481,8 @@ ValueObjectSP ValueObject::GetChildAtInd return child_sp; } -ValueObjectSP -ValueObject::GetChildAtIndexPath(const std::initializer_list &idxs, - size_t *index_of_error) { - return GetChildAtIndexPath(std::vector(idxs), index_of_error); -} - -ValueObjectSP ValueObject::GetChildAtIndexPath( -const std::initializer_list> &idxs, -size_t *index_of_error) { - return GetChildAtIndexPath(std::vector>(idxs), - index_of_error); -} - lldb::ValueObjectSP -ValueObject::GetChildAtIndexPath(const std::vector &idxs, +ValueObject::GetChildAtIndexPath(llvm::ArrayRef idxs, size_t *index_of_error) { if (idxs.size() == 0) return GetSP(); @@ -512,7 +499,7 @@ ValueObject::GetChildAtIndexPath(const s } lldb::ValueObjectSP ValueObject::GetChildAtIndexPath( -const std::vector> &idxs, size_t *index_of_error) { + llvm::ArrayRef> idxs, size_t *index_of_error) { if (idxs.size() == 0) return GetSP(); ValueObjectSP root(GetSP()); @@ -528,20 +515,7 @@ lldb::ValueObjectSP ValueObject::GetChil } lldb::ValueObjectSP -ValueObject::GetChildAtNamePath(const std::initializer_list &names, -ConstString *name_of_error) { - return GetChildAtNamePath(std::vector(names), name_of_error); -} - -lldb::ValueObjectSP ValueObject::GetChildAtNamePath( -const std::initializer_list> &names, -ConstString *name_of_error) { - return GetChildAtNamePath(std::vector>(names), -name_of_er
[Lldb-commits] [lldb] r301493 - Fix libcxx formatters for changes in r300140.
Author: lhames Date: Wed Apr 26 18:29:59 2017 New Revision: 301493 URL: http://llvm.org/viewvc/llvm-project?rev=301493&view=rev Log: Fix libcxx formatters for changes in r300140. Summary: LLVM r300140 changed the layout and field names of __compressed_pair, which broke LLDB's std::vector, std::map and std::unsorted_map formatters. This patch attempts to fix these formatters by having them interogate the __compressed_pair values to determine whether they're pre- or post-r300140 variants, then access them accordingly. Reviewers: jingham, EricWF Reviewed By: jingham Differential Revision: https://reviews.llvm.org/D32554 Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp?rev=301493&r1=301492&r2=301493&view=diff == --- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp (original) +++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp Wed Apr 26 18:29:59 2017 @@ -219,6 +219,7 @@ size_t lldb_private::formatters::LibcxxS CalculateNumChildren() { static ConstString g___pair3_("__pair3_"); static ConstString g___first_("__first_"); + static ConstString g___value_("__value_"); if (m_count != UINT32_MAX) return m_count; @@ -227,7 +228,22 @@ size_t lldb_private::formatters::LibcxxS ValueObjectSP m_item(m_tree->GetChildMemberWithName(g___pair3_, true)); if (!m_item) return 0; - m_item = m_item->GetChildMemberWithName(g___first_, true); + + switch (m_item->GetCompilerType().GetNumDirectBaseClasses()) { + case 1: +// Assume a pre llvm r300140 __compressed_pair implementation: +m_item = m_item->GetChildMemberWithName(g___first_, true); +break; + case 2: { +// Assume a post llvm r300140 __compressed_pair implementation: +ValueObjectSP first_elem_parent = m_item->GetChildAtIndex(0, true); +m_item = first_elem_parent->GetChildMemberWithName(g___value_, true); +break; + } + default: +return false; + } + if (!m_item) return 0; m_count = m_item->GetValueAsUnsigned(0); Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp?rev=301493&r1=301492&r2=301493&view=diff == --- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp (original) +++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp Wed Apr 26 18:29:59 2017 @@ -94,9 +94,30 @@ lldb::ValueObjectSP lldb_private::format node_sp->GetChildMemberWithName(ConstString("__hash_"), true); if (!hash_sp || !value_sp) { if (!m_element_type) { -auto first_sp = m_backend.GetChildAtNamePath({ConstString("__table_"), - ConstString("__p1_"), - ConstString("__first_")}); +auto p1_sp = m_backend.GetChildAtNamePath({ConstString("__table_"), + ConstString("__p1_")}); +if (!p1_sp) + return nullptr; + +ValueObjectSP first_sp = nullptr; +switch (p1_sp->GetCompilerType().GetNumDirectBaseClasses()) { +case 1: + // Assume a pre llvm r300140 __compressed_pair implementation: + first_sp = p1_sp->GetChildMemberWithName(ConstString("__first_"), + true); + break; +case 2: { + // Assume a post llvm r300140 __compressed_pair implementation: + ValueObjectSP first_elem_parent_sp = +p1_sp->GetChildAtIndex(0, true); + first_sp = p1_sp->GetChildMemberWithName(ConstString("__value_"), + true); + break; +} +default: + return nullptr; +} + if (!first_sp) return nullptr; m_element_type = first_sp->GetCompilerType(); @@ -152,22 +173,39 @@ bool lldb_private::formatters::LibcxxStd m_backend.GetChildMemberWithName(ConstString("__table_"), true); if (!table_sp) return false; - ValueObjectSP num_elements_sp = table_sp->GetChildAtNamePath( - {ConstString("__p2_"), ConstString("__first_")}); + + ValueObjectSP p2_sp = table_sp->GetChildMemberWithName( +ConstString("__p2_"), true); + ValueObjectSP num_elements_sp = nullptr; + llvm::SmallVector next_path; + switch (p2_sp->GetCompilerType().GetNumDirectBaseClasses()) { + case 1: +// Assume a pre llvm r300140 __compressed_pair implemen
[Lldb-commits] [lldb] r302314 - Add DidStartExecuting/WillFinishExecuting methods to Expression.
Author: lhames Date: Fri May 5 17:42:13 2017 New Revision: 302314 URL: http://llvm.org/viewvc/llvm-project?rev=302314&view=rev Log: Add DidStartExecuting/WillFinishExecuting methods to Expression. These methods can be used by the derived expression types to perform expression specific and/or language specific actions before and after the expression runs. (ThreadPlanCallUserExpression is modified to call these methods on the expression immediately before/after execution of the expression). The immediate motivation is allowing Swift expressions to notify the swift runtime that exclusivity enforcement should be suspended while the expression runs (we want LLDB expressions to be able to access variables even when they're considered exclusively owned by someone else in the original program). Reviewed in https://reviews.llvm.org/D32889 Modified: lldb/trunk/include/lldb/Expression/Expression.h lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h lldb/trunk/include/lldb/Target/ThreadPlanCallUserExpression.h lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp Modified: lldb/trunk/include/lldb/Expression/Expression.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/Expression.h?rev=302314&r1=302313&r2=302314&view=diff == --- lldb/trunk/include/lldb/Expression/Expression.h (original) +++ lldb/trunk/include/lldb/Expression/Expression.h Fri May 5 17:42:13 2017 @@ -99,6 +99,16 @@ public: //-- lldb::addr_t StartAddress() { return m_jit_start_addr; } + //-- + /// Called to notify the expression that it is about to be executed. + //-- + virtual void WillStartExecuting() {} + + //-- + /// Called to notify the expression that its execution has finished. + //-- + virtual void DidFinishExecuting() {} + virtual ExpressionTypeSystemHelper *GetTypeSystemHelper() { return nullptr; } protected: Modified: lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h?rev=302314&r1=302313&r2=302314&view=diff == --- lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h Fri May 5 17:42:13 2017 @@ -117,7 +117,7 @@ protected: lldb::addr_t &start_load_addr, lldb::addr_t &function_load_addr); - void DoTakedown(bool success); + virtual void DoTakedown(bool success); void SetBreakpoints(); Modified: lldb/trunk/include/lldb/Target/ThreadPlanCallUserExpression.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanCallUserExpression.h?rev=302314&r1=302313&r2=302314&view=diff == --- lldb/trunk/include/lldb/Target/ThreadPlanCallUserExpression.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanCallUserExpression.h Fri May 5 17:42:13 2017 @@ -35,6 +35,8 @@ public: void GetDescription(Stream *s, lldb::DescriptionLevel level) override; + void DidPush() override; + void WillPop() override; lldb::StopInfoSP GetRealStopInfo() override; @@ -48,6 +50,7 @@ public: } protected: + void DoTakedown(bool success) override; private: lldb::UserExpressionSP m_user_expression_sp; // This is currently just used to ensure the Modified: lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp?rev=302314&r1=302313&r2=302314&view=diff == --- lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp Fri May 5 17:42:13 2017 @@ -60,6 +60,12 @@ void ThreadPlanCallUserExpression::GetDe ThreadPlanCallFunction::GetDescription(s, level); } +void ThreadPlanCallUserExpression::DidPush() { + ThreadPlanCallFunction::DidPush(); + if (m_user_expression_sp) +m_user_expression_sp->WillStartExecuting(); +} + void ThreadPlanCallUserExpression::WillPop() { ThreadPlanCallFunction::WillPop(); if (m_user_expression_sp) @@ -113,3 +119,8 @@ StopInfoSP ThreadPlanCallUserExpression: return stop_info_sp; } + +void ThreadPlanCallUserExpression::DoTakedown(bool success) { + ThreadPlanCallFunction::DoTakedown(success); + m_user_expression_sp->DidFinishExecuting(); +} _
[Lldb-commits] [lldb] r302584 - Import sys in repo.py.
Author: lhames Date: Tue May 9 15:37:01 2017 New Revision: 302584 URL: http://llvm.org/viewvc/llvm-project?rev=302584&view=rev Log: Import sys in repo.py. The find function in repo.py calls sys.exit on error. Without this import that call to exit will fail, masking the actual error message. This patch fixes that. Modified: lldb/trunk/scripts/Xcode/repo.py Modified: lldb/trunk/scripts/Xcode/repo.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/repo.py?rev=302584&r1=302583&r2=302584&view=diff == --- lldb/trunk/scripts/Xcode/repo.py (original) +++ lldb/trunk/scripts/Xcode/repo.py Tue May 9 15:37:01 2017 @@ -3,6 +3,7 @@ import os import re import shutil import subprocess +import sys def identifier(): try: ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r310984 - Fix typo in variable name.
Author: lhames Date: Tue Aug 15 18:50:32 2017 New Revision: 310984 URL: http://llvm.org/viewvc/llvm-project?rev=310984&view=rev Log: Fix typo in variable name. Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=310984&r1=310983&r2=310984&view=diff == --- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original) +++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Tue Aug 15 18:50:32 2017 @@ -185,7 +185,7 @@ endif() set(LLDB_CODESIGN_IDENTITY "lldb_codesign" CACHE STRING "Identity used for code signing. Set to empty string to skip the signing step.") set(LLDB_USE_ENTITLEMENTS_Default On) -if("${LLDB_CODESIGN_INDENTITY}" STREQUAL "lldb_codesign") +if("${LLDB_CODESIGN_IDENTITY}" STREQUAL "lldb_codesign") set(LLDB_USE_ENTITLEMENTS_Default Off) endif() option(LLDB_USE_ENTITLEMENTS "Use entitlements when codesigning (Defaults Off when using lldb_codesign identity, otherwise On)" ${LLDB_USE_ENTITLEMENTS_Default}) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r279327 - [lldb] Use OrcMCJITReplacement rather than MCJIT as the underlying JIT for LLDB
Author: lhames Date: Fri Aug 19 16:27:16 2016 New Revision: 279327 URL: http://llvm.org/viewvc/llvm-project?rev=279327&view=rev Log: [lldb] Use OrcMCJITReplacement rather than MCJIT as the underlying JIT for LLDB expression evaluation. OrcMCJITReplacement is a reimplementation of MCJIT using ORC components, and provides an easy upgrade path to ORC for existing MCJIT clients. There should be no functional changes resulting from this switch. Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=279327&r1=279326&r2=279327&view=diff == --- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original) +++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Fri Aug 19 16:27:16 2016 @@ -308,7 +308,8 @@ IRExecutionUnit::GetRunnableInfo(Error & .setRelocationModel(relocModel) .setMCJITMemoryManager(std::unique_ptr(new MemoryManager(*this))) .setCodeModel(codeModel) -.setOptLevel(llvm::CodeGenOpt::Less); +.setOptLevel(llvm::CodeGenOpt::Less) +.setUseOrcMCJITReplacement(true); llvm::StringRef mArch; llvm::StringRef mCPU; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r264449 - Fix now-ambiguous references to Error.
Author: lhames Date: Fri Mar 25 14:27:24 2016 New Revision: 264449 URL: http://llvm.org/viewvc/llvm-project?rev=264449&view=rev Log: Fix now-ambiguous references to Error. Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=264449&r1=264448&r2=264449&view=diff == --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Fri Mar 25 14:27:24 2016 @@ -793,7 +793,7 @@ static bool FindFunctionInModule (ConstS return false; } -Error +lldb_private::Error ClangExpressionParser::PrepareForExecution (lldb::addr_t &func_addr, lldb::addr_t &func_end, lldb::IRExecutionUnitSP &execution_unit_sp, @@ -805,7 +805,7 @@ ClangExpressionParser::PrepareForExecuti func_end = LLDB_INVALID_ADDRESS; Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); -Error err; +lldb_private::Error err; std::unique_ptr llvm_module_ap (m_code_generator->ReleaseModule()); @@ -872,7 +872,7 @@ ClangExpressionParser::PrepareForExecuti if (execution_policy != eExecutionPolicyAlways && execution_policy != eExecutionPolicyTopLevel) { -Error interpret_error; +lldb_private::Error interpret_error; bool interpret_function_calls = !process ? false : process->CanInterpretFunctionCalls(); can_interpret = @@ -957,11 +957,11 @@ ClangExpressionParser::PrepareForExecuti return err; } -Error +lldb_private::Error ClangExpressionParser::RunStaticInitializers (lldb::IRExecutionUnitSP &execution_unit_sp, ExecutionContext &exe_ctx) { -Error err; +lldb_private::Error err; lldbassert(execution_unit_sp.get()); lldbassert(exe_ctx.HasThreadScope()); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [clang][AST] fix ast-print of extern with >=2 declarators, fixed, fixed (PR #98795)
lhames wrote: > > Regarding the orc-rt test failures: I tried building one of the failing > > objects and I can't reproduce the failure. Perhaps, because the tests are > > run on Windows and I'm running on Linux? It would be very helpful if > > @Prabhuk could run the failing command on a debug build. > > CC @lhames This is a frontend crash, rather than a JIT one, and I don't have access to a Windows dev machine so I'm not well placed to look into this. https://github.com/llvm/llvm-project/pull/98795 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] Add a createError variant without error code (NFC) (PR #93209)
lhames wrote: Late to the party here, but some context might be of interest: `inconvertibleErrorCode` was meant to never be used, except with a documented explanation of why no error code could be supplied. The idea was to make conversion between `Error` and `std::error_code` illegal when no error code was supplied. In practice (1) nobody has adhered to the documentation rule (me included), and (2) nobody seems to be converting errors back into std::error_codes in a dangerous way*. At this point I'd be fine getting rid of `inconvertibleErrorCode` entirely and replacing it with an "unknownErrorCode" that could be used as a default instead. * There is some danger that people _have_ tried such invalid conversions and either caught the issue before submitting, or have never hit the dangerous path at runtime and don't realize it's there. If we switched to a safe "unknownErrorCode" we would lose some signal on the former (it'd be an error report rather than a crash), but would prevent the latter from happening in production. https://github.com/llvm/llvm-project/pull/93209 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] unique_ptr-ify some GetUserExpression APIs. (PR #106034)
https://github.com/lhames created https://github.com/llvm/llvm-project/pull/106034 These methods already returned a uniquely owned object, this just makes them self-documenting. >From b115f38e01488e0622f5ab1d064b873f9459efeb Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Mon, 26 Aug 2024 13:56:04 +1000 Subject: [PATCH] [lldb] unique_ptr-ify some GetUserExpression APIs. These methods already returned a uniquely owned object, this just makes them self-documenting. --- lldb/include/lldb/Symbol/TypeSystem.h | 2 +- lldb/include/lldb/Target/Target.h | 2 +- lldb/source/Breakpoint/BreakpointLocation.cpp | 4 ++-- lldb/source/Breakpoint/Watchpoint.cpp | 4 ++-- .../Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 6 +++--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h | 10 -- lldb/source/Target/Target.cpp | 6 +++--- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index 7d48f9b316138c..b1ed5df3013a2b 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -495,7 +495,7 @@ class TypeSystem : public PluginInterface, return IsPointerOrReferenceType(type, nullptr); } - virtual UserExpression *GetUserExpression( + virtual std::unique_ptr GetUserExpression( llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj) { diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index 7f4d607f5427df..95e3aaf02b19d5 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -1174,7 +1174,7 @@ class Target : public std::enable_shared_from_this, // parameters have the same meaning as for the UserExpression constructor. // Returns a new-ed object which the caller owns. - UserExpression * + std::unique_ptr GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, Expression::ResultType desired_type, diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp index 41911fad41c648..8ef6b844230505 100644 --- a/lldb/source/Breakpoint/BreakpointLocation.cpp +++ b/lldb/source/Breakpoint/BreakpointLocation.cpp @@ -251,9 +251,9 @@ bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx, if (comp_unit) language = comp_unit->GetLanguage(); -m_user_expression_sp.reset(GetTarget().GetUserExpressionForLanguage( +m_user_expression_sp = GetTarget().GetUserExpressionForLanguage( condition_text, llvm::StringRef(), language, Expression::eResultTypeAny, -EvaluateExpressionOptions(), nullptr, error)); +EvaluateExpressionOptions(), nullptr, error); if (error.Fail()) { LLDB_LOGF(log, "Error getting condition expression: %s.", error.AsCString()); diff --git a/lldb/source/Breakpoint/Watchpoint.cpp b/lldb/source/Breakpoint/Watchpoint.cpp index 715e83c76697b2..577ee81d687dcb 100644 --- a/lldb/source/Breakpoint/Watchpoint.cpp +++ b/lldb/source/Breakpoint/Watchpoint.cpp @@ -463,9 +463,9 @@ void Watchpoint::SetCondition(const char *condition) { } else { // Pass nullptr for expr_prefix (no translation-unit level definitions). Status error; -m_condition_up.reset(m_target.GetUserExpressionForLanguage( +m_condition_up = m_target.GetUserExpressionForLanguage( condition, {}, {}, UserExpression::eResultTypeAny, -EvaluateExpressionOptions(), nullptr, error)); +EvaluateExpressionOptions(), nullptr, error); if (error.Fail()) { // FIXME: Log something... m_condition_up.reset(); diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 695801da9da69a..2e2f4be6343791 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -9741,7 +9741,7 @@ void ScratchTypeSystemClang::Dump(llvm::raw_ostream &output) { } } -UserExpression *ScratchTypeSystemClang::GetUserExpression( +std::unique_ptr ScratchTypeSystemClang::GetUserExpression( llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj) { @@ -9749,8 +9749,8 @@ UserExpression *ScratchTypeSystemClang::GetUserExpression( if (!target_sp) return nullptr; - return new ClangUserExpression(*target_sp.get(), expr, prefix, language, - desired_type, options, ctx_obj); + return std::make_unique( + *target_sp.get(), expr, pre
[Lldb-commits] [lldb] [lldb] unique_ptr-ify some GetUserExpression APIs. (PR #106034)
https://github.com/lhames closed https://github.com/llvm/llvm-project/pull/106034 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] e6cbea1 - Revert "[lldb] unique_ptr-ify some GetUserExpression APIs. (#106034)"
Author: Lang Hames Date: 2024-08-28T15:49:40+10:00 New Revision: e6cbea11578f197589801297d22b9b3bc4f1bd10 URL: https://github.com/llvm/llvm-project/commit/e6cbea11578f197589801297d22b9b3bc4f1bd10 DIFF: https://github.com/llvm/llvm-project/commit/e6cbea11578f197589801297d22b9b3bc4f1bd10.diff LOG: Revert "[lldb] unique_ptr-ify some GetUserExpression APIs. (#106034)" This reverts commit 3c5ab5a75a9c8fb87dcb13cdf4207aa975fd6972 while I investigate bot failures (e.g. https://lab.llvm.org/buildbot/#/builders/163/builds/4286). Added: Modified: lldb/include/lldb/Symbol/TypeSystem.h lldb/include/lldb/Target/Target.h lldb/source/Breakpoint/BreakpointLocation.cpp lldb/source/Breakpoint/Watchpoint.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h lldb/source/Target/Target.cpp Removed: diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index b1ed5df3013a2b..7d48f9b316138c 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -495,7 +495,7 @@ class TypeSystem : public PluginInterface, return IsPointerOrReferenceType(type, nullptr); } - virtual std::unique_ptr GetUserExpression( + virtual UserExpression *GetUserExpression( llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj) { diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index 95e3aaf02b19d5..7f4d607f5427df 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -1174,7 +1174,7 @@ class Target : public std::enable_shared_from_this, // parameters have the same meaning as for the UserExpression constructor. // Returns a new-ed object which the caller owns. - std::unique_ptr + UserExpression * GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, Expression::ResultType desired_type, diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp index 91a36bf2bd9e08..8d7364052a006a 100644 --- a/lldb/source/Breakpoint/BreakpointLocation.cpp +++ b/lldb/source/Breakpoint/BreakpointLocation.cpp @@ -251,9 +251,9 @@ bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx, if (comp_unit) language = comp_unit->GetLanguage(); -m_user_expression_sp = GetTarget().GetUserExpressionForLanguage( +m_user_expression_sp.reset(GetTarget().GetUserExpressionForLanguage( condition_text, llvm::StringRef(), language, Expression::eResultTypeAny, -EvaluateExpressionOptions(), nullptr, error); +EvaluateExpressionOptions(), nullptr, error)); if (error.Fail()) { LLDB_LOGF(log, "Error getting condition expression: %s.", error.AsCString()); diff --git a/lldb/source/Breakpoint/Watchpoint.cpp b/lldb/source/Breakpoint/Watchpoint.cpp index 577ee81d687dcb..715e83c76697b2 100644 --- a/lldb/source/Breakpoint/Watchpoint.cpp +++ b/lldb/source/Breakpoint/Watchpoint.cpp @@ -463,9 +463,9 @@ void Watchpoint::SetCondition(const char *condition) { } else { // Pass nullptr for expr_prefix (no translation-unit level definitions). Status error; -m_condition_up = m_target.GetUserExpressionForLanguage( +m_condition_up.reset(m_target.GetUserExpressionForLanguage( condition, {}, {}, UserExpression::eResultTypeAny, -EvaluateExpressionOptions(), nullptr, error); +EvaluateExpressionOptions(), nullptr, error)); if (error.Fail()) { // FIXME: Log something... m_condition_up.reset(); diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 2e2f4be6343791..695801da9da69a 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -9741,7 +9741,7 @@ void ScratchTypeSystemClang::Dump(llvm::raw_ostream &output) { } } -std::unique_ptr ScratchTypeSystemClang::GetUserExpression( +UserExpression *ScratchTypeSystemClang::GetUserExpression( llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj) { @@ -9749,8 +9749,8 @@ std::unique_ptr ScratchTypeSystemClang::GetUserExpression( if (!target_sp) return nullptr; - return std::make_unique( - *target_sp.get(), expr, prefix, language, desired_type, options, ctx_obj); + return new ClangUserExpression(*target_sp.get(), expr, prefix, language, +
[Lldb-commits] [lldb] [llvm] [lldb][RISCV] function calls support in lldb expressions (PR #99336)
lhames wrote: > @lhames could you take a look, please? Hi @dlav-sc. The `RuntimeDyld` changes look ok to me. We are hoping to switch LLDB to ORC / JITLink soon (https://discourse.llvm.org/t/rfc-removing-mcjit-and-runtimedyld/80464), but JITLink's RISCV support is pretty solid already -- I don't think we'll have any trouble moving over when we're ready. If you want to test the RuntimeDyld changes you could add `llvm-rtdyld` tests (see `llvm/test/ExecutionEngine/RuntimeDyld`), but given that this is a stop-gap I'm ok with the changes going in as-is. https://github.com/llvm/llvm-project/pull/99336 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb][RISCV] function calls support in lldb expressions (PR #99336)
https://github.com/lhames approved this pull request. https://github.com/llvm/llvm-project/pull/99336 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits