[Lldb-commits] [lldb] r328062 - [Testsuite] Modernize this test to be run out-of-tree.

2018-03-20 Thread Davide Italiano via lldb-commits
Author: davide
Date: Tue Mar 20 16:47:47 2018
New Revision: 328062

URL: http://llvm.org/viewvc/llvm-project?rev=328062&view=rev
Log:
[Testsuite] Modernize this test to be run out-of-tree.

New tests should run the make syntax voodoo $@ and $<
instead of hardcoding the names. We should also document
how to write one, it's on my list.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile?rev=328062&r1=328061&r2=328062&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile 
Tue Mar 20 16:47:47 2018
@@ -7,14 +7,12 @@ CXXFLAGS_DEBUGINFO = -c -g
 all: main
 
 main: a.o b.o
-   $(CXX) a.o b.o -o main $(LDFLAGS)
+   $(CXX) $^ -o $@ $(LDFLAGS)
 
 a.o: a.cpp
-   $(CXX) $(SRCDIR)/a.cpp $(CXXFLAGS_NO_DEBUGINFO) -o a.o
+   $(CXX) $< $(CXXFLAGS_NO_DEBUGINFO) -o $@
 
 b.o: b.cpp
-   $(CXX) $(SRCDIR)/b.cpp $(CXXFLAGS_DEBUGINFO) -o b.o
-
-clean: OBJECTS += a.o b.o main
+   $(CXX) $< $(CXXFLAGS_DEBUGINFO) -o $@
 
 include $(LEVEL)/Makefile.rules


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44321: Support demangling for D symbols via dlopen

2018-03-20 Thread Johan Engelen via Phabricator via lldb-commits
johanengelen added a comment.

In https://reviews.llvm.org/D44321#1038241, @timotheecour wrote:

> > When druntime is initialized, a number of resources are allocated (e.g. 
> > memory and mutex). Yes you initialize druntime once, I can see that. You 
> > don't deinitialize druntime at all: that's the resource leak.
>
> Where would you want me to deinit? inside ` DLanguage::Terminate` ?


I don't know enough of LLDB to know where to put the deinitialization. Sorry, 
can't help you there, except for making it easy and doing the deinitialization 
using a dtor in the library...


https://reviews.llvm.org/D44321



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r328025 - [ExpressionParser] Re-implement r327356 in a less disruptive way.

2018-03-20 Thread Davide Italiano via lldb-commits
This apparently uncovered a crash in the linux build, looking now.
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake

Thanks,

--
Davide

On Tue, Mar 20, 2018 at 12:46 PM, Davide Italiano via lldb-commits
 wrote:
> Author: davide
> Date: Tue Mar 20 12:46:32 2018
> New Revision: 328025
>
> URL: http://llvm.org/viewvc/llvm-project?rev=328025&view=rev
> Log:
> [ExpressionParser] Re-implement r327356 in a less disruptive way.
>
> Instead of applying the sledgehammer of refusing to insert any
> C++ symbol in the ASTContext, try to validate the decl if what
> we have is an operator. There was other code in lldb which was
> responsible for this, just not really exposed (or used) in this
> codepath. Also, add a better/more comprehensive test.
>
> 
>
> Added:
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/
> 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile
> 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/a.cpp
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/b.cpp
> Removed:
> lldb/trunk/lit/Expr/Inputs/basic.cpp
> lldb/trunk/lit/Expr/TestCallCppSym.test
> Modified:
> lldb/trunk/include/lldb/Symbol/ClangASTContext.h
> lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
> 
> lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
> lldb/trunk/source/Symbol/ClangASTContext.cpp
>
> Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=328025&r1=328024&r2=328025&view=diff
> ==
> --- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
> +++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Tue Mar 20 12:46:32 2018
> @@ -253,6 +253,9 @@ public:
>&type_fields,
>bool packed = false);
>
> +  static bool IsOperator(const char *name,
> + clang::OverloadedOperatorKind &op_kind);
> +
>//--
>// Structure, Unions, Classes
>//--
>
> Removed: lldb/trunk/lit/Expr/Inputs/basic.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Expr/Inputs/basic.cpp?rev=328024&view=auto
> ==
> --- lldb/trunk/lit/Expr/Inputs/basic.cpp (original)
> +++ lldb/trunk/lit/Expr/Inputs/basic.cpp (removed)
> @@ -1,12 +0,0 @@
> -class Patatino {
> -private:
> -  long tinky;
> -
> -public:
> -  Patatino(long tinky) { this->tinky = tinky; }
> -};
> -
> -int main(void) {
> -  Patatino *a = new Patatino(26);
> -  return 0;
> -}
>
> Removed: lldb/trunk/lit/Expr/TestCallCppSym.test
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Expr/TestCallCppSym.test?rev=328024&view=auto
> ==
> --- lldb/trunk/lit/Expr/TestCallCppSym.test (original)
> +++ lldb/trunk/lit/Expr/TestCallCppSym.test (removed)
> @@ -1,6 +0,0 @@
> -# RUN: %cxx %p/Inputs/basic.cpp -g -o %t && %lldb -b -s %s -- %t 2>&1 | 
> FileCheck %s
> -
> -breakpoint set --file basic.cpp --line 12
> -run
> -call (int)_Znwm(23)
> -# CHECK: error: use of undeclared identifier '_Znwm'
>
> Added: 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile?rev=328025&view=auto
> ==
> --- 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile 
> (added)
> +++ 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile 
> Tue Mar 20 12:46:32 2018
> @@ -0,0 +1,20 @@
> +LEVEL = ../../../make
> +
> +CXX_SOURCES = a.cpp b.cpp
> +CXXFLAGS_NO_DEBUGINFO = -c
> +CXXFLAGS_DEBUGINFO = -c -g
> +
> +all: main
> +
> +main: a.o b.o
> +   $(CXX) a.o b.o -o main $(LDFLAGS)
> +
> +a.o: a.cpp
> +   $(CXX) $(SRCDIR)/a.cpp $(CXXFLAGS_NO_DEBUGINFO) -o a.o
> +
> +b.o: b.cpp
> +   $(CXX) $(SRCDIR)/b.cpp $(CXXFLAGS_DEBUGINFO) -o b.o
> +
> +clean: OBJECTS += a.o b.o main
> +
> +include $(LEVEL)/Makefile.rules
>
> Added: 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py?rev=328025&view=auto
> ==
> --- 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py

Re: [Lldb-commits] [lldb] r327356 - [ExpressionParser] Fix crash when evaluating invalid expresssions.

2018-03-20 Thread Greg Clayton via lldb-commits
Thanks for fixing this is the right way and taking the time!

Greg


> On Mar 20, 2018, at 12:49 PM, Davide Italiano via lldb-commits 
>  wrote:
> 
> Fixed in a nicer/cleaner way (that doesn't regress the current
> behavior), thank you everybody for your excellent feedback!
> 
> davide@Davidinos-Mac-Pro ~/w/l/llvm-project-20170507> git llvm push
> Pushing 1 commit:
>  8875fcce772 [ExpressionParser] Re-implement r327356 in a less disruptive way.
> Sendinglldb/trunk/include/lldb/Symbol/ClangASTContext.h
> Deleting   lldb/trunk/lit/Expr/Inputs/basic.cpp
> Deleting   lldb/trunk/lit/Expr/TestCallCppSym.test
> Adding 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload
> Adding 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile
> Adding 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py
> Adding 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/a.cpp
> Adding 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/b.cpp
> Sending
> lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
> Sending
> lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
> Sendinglldb/trunk/source/Symbol/ClangASTContext.cpp
> Transmitting file data done
> Committing transaction...
> Committed revision 328025.
> Committed 8875fcce772 to svn.
> 
> Thanks,
> 
> --
> Davide
> 
> On Thu, Mar 15, 2018 at 8:36 AM, Davide Italiano  
> wrote:
>> On Wed, Mar 14, 2018 at 1:52 AM, Pavel Labath  wrote:
>>> I'm not familiar with all of the magic we do when we synthesize clang Decls,
>>> but I feel I should point out that we can't get out of business of
>>> sanity-checking the declarations we inject into clang. The reason for that
>>> is, even if we had debug info for operator==, the debug info itself could
>>> describe it's prototype as operator==(...) (due to a compiler bug, corrupt
>>> file, or whatever). So we still need to make sure that the declarations we
>>> synthesize from debug info don't violate clang's invariants (and that's what
>>> we try to do at present, cf.
>>> ClangASTContext::CheckOverloadedOperatorParameterCount).
>>> 
>>> So maybe the solution here is not to refuse injecting any declarations
>>> without debug info, but instead to make sure that whatever declarations we
>>> inject that way satisfy the same validity criteria as the ones we synthesize
>>> from the debug info?
>>> 
>> 
>> I'll think about this more. On a more practical note, I was a able to
>> reproduce this with a fairly self contained C++ program :)
>> 
>> dcci@Davides-MacBook-Pro ~/w/l/b/bin> cat patatino.cpp
>> class Patatino {
>> public:
>>  double _blah;
>>  Patatino(int blah) : _blah(blah) {}
>> };
>> 
>> bool operator==(const Patatino& a, const Patatino& b) {
>>  return a._blah < b._blah;
>> }
>> 
>> 
>> dcci@Davides-MacBook-Pro ~/w/l/b/bin> cat patatuccio.cpp
>> class Baciotto {
>> public:
>>  int _meh;
>>  Baciotto(int meh) : _meh(meh) {}
>> };
>> 
>> int main(void) {
>>  Baciotto x(12);
>>  return 0;
>> }
>> 
>> 
>> $ ./clang++ patatuccio.cpp -o patatuccio.o -c -g
>> $ ./clang++ patatino.cpp -o patatino.o -c
>> $ ./clang++ patatino.o patatuccio.o -o patatuccio
>> 
>> $ nm ./patatuccio
>> 00010f70 t __ZN8BaciottoC1Ei
>> 00010fa0 t __ZN8BaciottoC2Ei.
>> 00010f10 T __ZeqRK8PatatinoS1_.  <--- this is the wrong symbol 
>> picked up
>> 0001 T __mh_execute_header
>> 00010f40 T _main
>> U dyld_stub_binder
>> 
>> $ echo '__ZeqRK8PatatinoS1_' | c++filt
>> operator==(Patatino const&, Patatino const&)
>> 
>> And in lldb:
>> 
>> (lldb) n
>> Process 35027 stopped
>> * thread #1, queue = 'com.apple.main-thread', stop reason = step over
>>frame #0: 0x00010f5f patatuccio`main at patatuccio.cpp:9
>>   6
>>   7   int main(void) {
>>   8Baciotto x(12);
>> -> 9return 0;
>>   10   }
>> (lldb) expr x == nil
>> Assertion failed: (i < getNumParams() && "Illegal param #"), function
>> getParamDecl, file
>> /Users/dcci/work/llvm/llvm/tools/clang/include/clang/AST/Decl.h, line
>> 2232.
>> fish: './lldb' terminated by signal SIGABRT (Abort)
>> 
>> 
>> I'll try debugging this more.
>> 
>> Thanks!
>> 
>> --
>> Davide
> ___
> 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] r327356 - [ExpressionParser] Fix crash when evaluating invalid expresssions.

2018-03-20 Thread Davide Italiano via lldb-commits
Fixed in a nicer/cleaner way (that doesn't regress the current
behavior), thank you everybody for your excellent feedback!

davide@Davidinos-Mac-Pro ~/w/l/llvm-project-20170507> git llvm push
Pushing 1 commit:
  8875fcce772 [ExpressionParser] Re-implement r327356 in a less disruptive way.
Sendinglldb/trunk/include/lldb/Symbol/ClangASTContext.h
Deleting   lldb/trunk/lit/Expr/Inputs/basic.cpp
Deleting   lldb/trunk/lit/Expr/TestCallCppSym.test
Adding 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload
Adding 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile
Adding 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py
Adding 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/a.cpp
Adding 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/b.cpp
Sending
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
Sending
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
Sendinglldb/trunk/source/Symbol/ClangASTContext.cpp
Transmitting file data done
Committing transaction...
Committed revision 328025.
Committed 8875fcce772 to svn.

Thanks,

--
Davide

On Thu, Mar 15, 2018 at 8:36 AM, Davide Italiano  wrote:
> On Wed, Mar 14, 2018 at 1:52 AM, Pavel Labath  wrote:
>> I'm not familiar with all of the magic we do when we synthesize clang Decls,
>> but I feel I should point out that we can't get out of business of
>> sanity-checking the declarations we inject into clang. The reason for that
>> is, even if we had debug info for operator==, the debug info itself could
>> describe it's prototype as operator==(...) (due to a compiler bug, corrupt
>> file, or whatever). So we still need to make sure that the declarations we
>> synthesize from debug info don't violate clang's invariants (and that's what
>> we try to do at present, cf.
>> ClangASTContext::CheckOverloadedOperatorParameterCount).
>>
>> So maybe the solution here is not to refuse injecting any declarations
>> without debug info, but instead to make sure that whatever declarations we
>> inject that way satisfy the same validity criteria as the ones we synthesize
>> from the debug info?
>>
>
> I'll think about this more. On a more practical note, I was a able to
> reproduce this with a fairly self contained C++ program :)
>
> dcci@Davides-MacBook-Pro ~/w/l/b/bin> cat patatino.cpp
> class Patatino {
> public:
>   double _blah;
>   Patatino(int blah) : _blah(blah) {}
> };
>
> bool operator==(const Patatino& a, const Patatino& b) {
>   return a._blah < b._blah;
> }
>
>
> dcci@Davides-MacBook-Pro ~/w/l/b/bin> cat patatuccio.cpp
> class Baciotto {
> public:
>   int _meh;
>   Baciotto(int meh) : _meh(meh) {}
> };
>
> int main(void) {
>   Baciotto x(12);
>   return 0;
> }
>
>
> $ ./clang++ patatuccio.cpp -o patatuccio.o -c -g
> $ ./clang++ patatino.cpp -o patatino.o -c
> $ ./clang++ patatino.o patatuccio.o -o patatuccio
>
> $ nm ./patatuccio
> 00010f70 t __ZN8BaciottoC1Ei
> 00010fa0 t __ZN8BaciottoC2Ei.
> 00010f10 T __ZeqRK8PatatinoS1_.  <--- this is the wrong symbol picked 
> up
> 0001 T __mh_execute_header
> 00010f40 T _main
>  U dyld_stub_binder
>
> $ echo '__ZeqRK8PatatinoS1_' | c++filt
> operator==(Patatino const&, Patatino const&)
>
> And in lldb:
>
> (lldb) n
> Process 35027 stopped
> * thread #1, queue = 'com.apple.main-thread', stop reason = step over
> frame #0: 0x00010f5f patatuccio`main at patatuccio.cpp:9
>6
>7   int main(void) {
>8Baciotto x(12);
> -> 9return 0;
>10   }
> (lldb) expr x == nil
> Assertion failed: (i < getNumParams() && "Illegal param #"), function
> getParamDecl, file
> /Users/dcci/work/llvm/llvm/tools/clang/include/clang/AST/Decl.h, line
> 2232.
> fish: './lldb' terminated by signal SIGABRT (Abort)
>
>
> I'll try debugging this more.
>
> Thanks!
>
> --
> Davide
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r328025 - [ExpressionParser] Re-implement r327356 in a less disruptive way.

2018-03-20 Thread Davide Italiano via lldb-commits
Author: davide
Date: Tue Mar 20 12:46:32 2018
New Revision: 328025

URL: http://llvm.org/viewvc/llvm-project?rev=328025&view=rev
Log:
[ExpressionParser] Re-implement r327356 in a less disruptive way.

Instead of applying the sledgehammer of refusing to insert any
C++ symbol in the ASTContext, try to validate the decl if what
we have is an operator. There was other code in lldb which was
responsible for this, just not really exposed (or used) in this
codepath. Also, add a better/more comprehensive test.



Added:
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/a.cpp
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/b.cpp
Removed:
lldb/trunk/lit/Expr/Inputs/basic.cpp
lldb/trunk/lit/Expr/TestCallCppSym.test
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=328025&r1=328024&r2=328025&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Tue Mar 20 12:46:32 2018
@@ -253,6 +253,9 @@ public:
   &type_fields,
   bool packed = false);
 
+  static bool IsOperator(const char *name,
+ clang::OverloadedOperatorKind &op_kind);
+
   //--
   // Structure, Unions, Classes
   //--

Removed: lldb/trunk/lit/Expr/Inputs/basic.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Expr/Inputs/basic.cpp?rev=328024&view=auto
==
--- lldb/trunk/lit/Expr/Inputs/basic.cpp (original)
+++ lldb/trunk/lit/Expr/Inputs/basic.cpp (removed)
@@ -1,12 +0,0 @@
-class Patatino {
-private:
-  long tinky;
-
-public:
-  Patatino(long tinky) { this->tinky = tinky; }
-};
-
-int main(void) {
-  Patatino *a = new Patatino(26);
-  return 0;
-}

Removed: lldb/trunk/lit/Expr/TestCallCppSym.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Expr/TestCallCppSym.test?rev=328024&view=auto
==
--- lldb/trunk/lit/Expr/TestCallCppSym.test (original)
+++ lldb/trunk/lit/Expr/TestCallCppSym.test (removed)
@@ -1,6 +0,0 @@
-# RUN: %cxx %p/Inputs/basic.cpp -g -o %t && %lldb -b -s %s -- %t 2>&1 | 
FileCheck %s
-
-breakpoint set --file basic.cpp --line 12
-run
-call (int)_Znwm(23)
-# CHECK: error: use of undeclared identifier '_Znwm'

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile?rev=328025&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile 
(added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile 
Tue Mar 20 12:46:32 2018
@@ -0,0 +1,20 @@
+LEVEL = ../../../make
+
+CXX_SOURCES = a.cpp b.cpp
+CXXFLAGS_NO_DEBUGINFO = -c
+CXXFLAGS_DEBUGINFO = -c -g
+
+all: main
+
+main: a.o b.o
+   $(CXX) a.o b.o -o main $(LDFLAGS)
+
+a.o: a.cpp
+   $(CXX) $(SRCDIR)/a.cpp $(CXXFLAGS_NO_DEBUGINFO) -o a.o
+
+b.o: b.cpp
+   $(CXX) $(SRCDIR)/b.cpp $(CXXFLAGS_DEBUGINFO) -o b.o
+
+clean: OBJECTS += a.o b.o main
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py?rev=328025&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py
 Tue Mar 20 12:46:32 2018
@@ -0,0 +1,22 @@
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestOperatorOverload(TestBase):
+  mydir = TestBase.compute_mydir(__file__)
+
+  def test_overload(self):
+self.build()
+(target, process, thread,
+  main_breakpoint) = 

[Lldb-commits] [lldb] r328020 - [lldb-dotest] Wrap arguments in single quotes

2018-03-20 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Mar 20 12:18:11 2018
New Revision: 328020

URL: http://llvm.org/viewvc/llvm-project?rev=328020&view=rev
Log:
[lldb-dotest] Wrap arguments in single quotes

If we don't wrap arguments to the wrapper in single quotes, combined
arguments, for example for -E, don't reach dotest.py as a unit but as
separate arguments, causing the latter to fail.

Modified:
lldb/trunk/test/lldb-dotest.in

Modified: lldb/trunk/test/lldb-dotest.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldb-dotest.in?rev=328020&r1=328019&r2=328020&view=diff
==
--- lldb/trunk/test/lldb-dotest.in (original)
+++ lldb/trunk/test/lldb-dotest.in Tue Mar 20 12:18:11 2018
@@ -6,9 +6,13 @@ dotest_path = '@LLDB_SOURCE_DIR@/test/do
 dotest_args = '@LLDB_DOTEST_ARGS_STR@'
 
 if __name__ == '__main__':
+# Wrap arguments in single quotes. This is necessary because we want to
+# forward the arguments and otherwise we might split up arguments that were
+# originally wrapped in single quotes.
+wrapper_args = list("'" + i + "'" for i in sys.argv[1:])
 # FIXME: It would be nice if we can mimic the approach taken by llvm-lit
 # and pass a python configuration straight to dotest, rather than going
 # through the operating system.
-command = '{} -q {} {}'.format(dotest_path, dotest_args, ' '.join(
-sys.argv[1:]))
+command = '{} -q {} {}'.format(dotest_path, dotest_args,
+   ' '.join(wrapper_args))
 os.system(command)


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44472: Add and fix some tests for PPC64

2018-03-20 Thread Leonardo Bianconi via Phabricator via lldb-commits
lbianc added a comment.

Yes, I'm running Linux and this test was not working for me, so as discussion 
above, it was separated to be executed on non Linux and Windows, but the 
variable number got wrong. Sorry for that.


https://reviews.llvm.org/D44472



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r328013 - [TestExpr] Fix a typo in a test, unbreaking the lldb Mac OS X bot.

2018-03-20 Thread Davide Italiano via lldb-commits
Author: davide
Date: Tue Mar 20 11:32:47 2018
New Revision: 328013

URL: http://llvm.org/viewvc/llvm-project?rev=328013&view=rev
Log:
[TestExpr] Fix a typo in a test, unbreaking the lldb Mac OS X bot.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs2.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs2.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs2.py?rev=328013&r1=328012&r2=328013&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs2.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs2.py 
Tue Mar 20 11:32:47 2018
@@ -76,5 +76,5 @@ class ExprCommands2TestCase(TestBase):
 
 # Do anonymous symbols work?
 self.expect("expression ((char**)environ)[0]",
-startstr="(char *) $1 = 0x")
+startstr="(char *) $0 = 0x")
 # (char *) $1 = 0x7fff5fbff298 
"Apple_PubSub_Socket_Render=/tmp/launch-7AEsUD/Render"


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44472: Add and fix some tests for PPC64

2018-03-20 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

I think I understand why this is failing:

AssertionError: False is not True : 'expression ((char**)environ)[0]'
returns expected result, got '(char *) $0 = 0x7ffeefbff753
"COMMAND_MODE=unix2003"'
Config=x86_64-/Users/davide/work/llvm-monorepo/build-release/bin/clang-7.0

but the test shows $1. How did this work for you? Are you running on
Linux by any chance?

Thanks,

-

Davide


https://reviews.llvm.org/D44472



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D44472: Add and fix some tests for PPC64

2018-03-20 Thread Davide Italiano via lldb-commits
I think I understand why this is failing:

AssertionError: False is not True : 'expression ((char**)environ)[0]'
returns expected result, got '(char *) $0 = 0x7ffeefbff753
"COMMAND_MODE=unix2003"'
Config=x86_64-/Users/davide/work/llvm-monorepo/build-release/bin/clang-7.0

but the test shows $1. How did this work for you? Are you running on
Linux by any chance?

Thanks,

--
Davide

On Tue, Mar 20, 2018 at 11:23 AM, Davide Italiano via Phabricator
 wrote:
> davide added a comment.
>
> In https://reviews.llvm.org/D44472#1043510, @davide wrote:
>
>> In https://reviews.llvm.org/D44472#1043464, @lbianc wrote:
>>
>> > @davide Are you sure this is the correct patch? This one was not merged 
>> > yet.
>> >  Could you give more details about the issue? Is it related with one of 
>> > our changes?
>>
>>
>> Apologies, this is the right one
>>
>> commit 983ecd497e223b35e46fd3306bd7ac300da94793 (HEAD -> master)
>>  Author: Davide Italiano 
>>  Date:   Tue Mar 20 11:12:19 2018 -0700
>>
>>   Revert "Fix some tests for PPC64le architecture"
>>
>>   It broke the lldb Mac OSX greendragon bot.
>
>
> here are the bot logs (for your convenience)
> http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/5869/console
>
>
> https://reviews.llvm.org/D44472
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44472: Add and fix some tests for PPC64

2018-03-20 Thread Leonardo Bianconi via Phabricator via lldb-commits
lbianc added a comment.

@davide Let me know if you need that I change it on my diff or any other help.


https://reviews.llvm.org/D44472



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44472: Add and fix some tests for PPC64

2018-03-20 Thread Leonardo Bianconi via Phabricator via lldb-commits
lbianc added a comment.

@davide, I think the error is the variable number, as this is the only command 
in the test case, could you just change from

  # Do anonymous symbols work?
  self.expect("expression ((char**)environ)[0]",
  startstr="(char *) $1 = 0x")

to

  # Do anonymous symbols work?
  self.expect("expression ((char**)environ)[0]",
  startstr="(char *) $0 = 0x")

and check if it works?


https://reviews.llvm.org/D44472



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44472: Add and fix some tests for PPC64

2018-03-20 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

In https://reviews.llvm.org/D44472#1043464, @lbianc wrote:

> @davide Are you sure this is the correct patch? This one was not merged yet.
>  Could you give more details about the issue? Is it related with one of our 
> changes?


Apologies, this is the right one

commit 983ecd497e223b35e46fd3306bd7ac300da94793 (HEAD -> master)
Author: Davide Italiano 
Date:   Tue Mar 20 11:12:19 2018 -0700

  Revert "Fix some tests for PPC64le architecture"
  
  It broke the lldb Mac OSX greendragon bot.


https://reviews.llvm.org/D44472



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44472: Add and fix some tests for PPC64

2018-03-20 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

In https://reviews.llvm.org/D44472#1043510, @davide wrote:

> In https://reviews.llvm.org/D44472#1043464, @lbianc wrote:
>
> > @davide Are you sure this is the correct patch? This one was not merged yet.
> >  Could you give more details about the issue? Is it related with one of our 
> > changes?
>
>
> Apologies, this is the right one
>
> commit 983ecd497e223b35e46fd3306bd7ac300da94793 (HEAD -> master)
>  Author: Davide Italiano 
>  Date:   Tue Mar 20 11:12:19 2018 -0700
>
>   Revert "Fix some tests for PPC64le architecture"
>   
>   It broke the lldb Mac OSX greendragon bot.


here are the bot logs (for your convenience)
http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/5869/console


https://reviews.llvm.org/D44472



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44472: Add and fix some tests for PPC64

2018-03-20 Thread Leonardo Bianconi via Phabricator via lldb-commits
lbianc added a comment.

@davide Are you sure this is the correct patch? This one was not merged yet.
Could you give more details about the issue? Is it related with one of our 
changes?


https://reviews.llvm.org/D44472



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44472: Add and fix some tests for PPC64

2018-03-20 Thread Davide Italiano via Phabricator via lldb-commits
davide added subscribers: alexandreyy, labath, davide.
davide added a comment.

Leonardo, this breaks the Mac OS X bot.
I'm going to revert this to get the bots green again, unless you have
a super quick fix (please let me know :)


https://reviews.llvm.org/D44472



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D44472: Add and fix some tests for PPC64

2018-03-20 Thread Davide Italiano via lldb-commits
Leonardo, this breaks the Mac OS X bot.
I'm going to revert this to get the bots green again, unless you have
a super quick fix (please let me know :)



On Tue, Mar 20, 2018 at 5:28 AM, Alexandre Yukio Yamashita via
Phabricator via lldb-commits  wrote:
> alexandreyy added a comment.
>
> In https://reviews.llvm.org/D44472#1039812, @labath wrote:
>
>> I like what you did with the test. Originally, I wanted to just compare the 
>> raw memory contents, but this keeps it more inline with the spirit of the 
>> original test. I have just one question about the list zipping, but 
>> otherwise lgtm.
>
>
> Hi @labath .
> Could you merge this patch?
>
>
> https://reviews.llvm.org/D44472
>
>
>
> ___
> 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] [PATCH] D44526: [dotest] Clean up test folder clean-up

2018-03-20 Thread Jim Ingham via lldb-commits


> On Mar 20, 2018, at 4:55 AM, Pavel Labath via lldb-commits 
>  wrote:
> 
> Deleting the test build dir is fairly easy. I can whip up a patch for that, 
> but I'm not sure if that's the part that is bothering you the most here. 
> Dealing with the log files is a bot more complicated and there doesn't seem 
> to be a clear consensus on what to do with them.  The last discussion about 
> the (Jan 17: Questions about the LLDB testsuite and improving its 
> reliability) ended without a clear conclusion. I personally, think it would 
> be nice to put the log files into the build dir, but I don't feel strongly 
> enough about it to go around and try to get people to change their habits.
> 
> 

I like that if I do a bunch of test runs, I can go back and get an earlier 
failing log to see why some change I made didn't do what I expected.  So I like 
the date-stamped log directories, though I may be in the minority here.  But 
that aim could be solved equally well by putting the numbered directories in 
the build tree as in the source tree (just emit the full path at the end of the 
run and you just have to cut & paste a little more to go to the log 
directories.   You'd have to avoid deleting them when you clean the build, but 
that shouldn't be too hard.  And not littering the source tree is a worthy goal.

My .02.

Jim

> On Mon, 19 Mar 2018 at 17:17, Greg Clayton via Phabricator via lldb-commits 
>  wrote:
> clayborg added subscribers: labath, clayborg.
> clayborg added a comment.
> 
> I would be nice to have the option to nuke each test build directory if the 
> test passed. Can be an option that we specify. That way, the only folders 
> left over could be the tests that are failing. The options doesn't need to 
> default to true, but if anyone is in that code and would know how to do that, 
> that would be a great option to have. This option could also clean up the log 
> directory and remove any logs for tests that succeeded or were skipped. I 
> alway have to go and nuke these files manually.
> 
> Greg
> 
> 
> Repository:
>   rL LLVM
> 
> https://reviews.llvm.org/D44526
> 
> 
> 
> ___
> 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 mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r327996 - Move StringExtractorGDBRemote.h to the include folder

2018-03-20 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Mar 20 09:14:00 2018
New Revision: 327996

URL: http://llvm.org/viewvc/llvm-project?rev=327996&view=rev
Log:
Move StringExtractorGDBRemote.h to the include folder

While trying to use this header I noticed that it is not in the include
folder. Move it to there and update all #includes to reference that file
correctly.

Added:
lldb/trunk/include/lldb/Utility/StringExtractorGDBRemote.h
  - copied, changed from r327981, 
lldb/trunk/source/Utility/StringExtractorGDBRemote.h
Removed:
lldb/trunk/source/Utility/StringExtractorGDBRemote.h
Modified:

lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp

Copied: lldb/trunk/include/lldb/Utility/StringExtractorGDBRemote.h (from 
r327981, lldb/trunk/source/Utility/StringExtractorGDBRemote.h)
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/StringExtractorGDBRemote.h?p2=lldb/trunk/include/lldb/Utility/StringExtractorGDBRemote.h&p1=lldb/trunk/source/Utility/StringExtractorGDBRemote.h&r1=327981&r2=327996&rev=327996&view=diff
==
--- lldb/trunk/source/Utility/StringExtractorGDBRemote.h (original)
+++ lldb/trunk/include/lldb/Utility/StringExtractorGDBRemote.h Tue Mar 20 
09:14:00 2018
@@ -7,8 +7,8 @@
 //
 
//===--===//
 
-#ifndef utility_StringExtractorGDBRemote_h_
-#define utility_StringExtractorGDBRemote_h_
+#ifndef LLDB_UTILITY_STRINGEXTRACTORGDBREMOTE_H
+#define LLDB_UTILITY_STRINGEXTRACTORGDBREMOTE_H
 
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/StringExtractor.h"
@@ -201,4 +201,4 @@ protected:
   void *m_validator_baton;
 };
 
-#endif // utility_StringExtractorGDBRemote_h_
+#endif // LLDB_UTILITY_STRINGEXTRACTORGDBREMOTE_H

Modified: 
lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp?rev=327996&r1=327995&r2=327996&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
 Tue Mar 20 09:14:00 2018
@@ -19,7 +19,7 @@
 #include "lldb/Utility/DataExtractor.h"
 #include "lldb/Utility/StreamString.h"
 // Project includes
-#include "Utility/StringExtractorGDBRemote.h"
+#include "lldb/Utility/StringExtractorGDBRemote.h"
 
 using namespace lldb;
 using namespace lldb_private;

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h?rev=327996&r1=327995&r2=327996&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Tue 
Mar 20 09:14:00 2018
@@ -27,7 +27,7 @@
 #include "lldb/Interpreter/Args.h"
 #include "lldb/lldb-public.h"
 
-#include "Utility/StringExtractorGDBRemote.h"
+#include "lldb/Utility/StringExtractorGDBRemote.h"
 
 namespace lldb_private {
 namespace process_gdb_remote {

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=327996&r1=327995&r2=327996&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Tue Mar 20 09:14:00 2018
@@ -36,8 +36,8 @@
 // Project includes
 #include "ProcessGDBRemote.h"
 #include "ProcessGDBRemoteLog.h"
-#include "Utility/StringExtractorGDBRemote.h"
 #include "lldb/Host/Config.h"
+#include "lldb/Utility/StringExtractorGDBRemote.h"
 
 #include "llvm/ADT/StringSwitch.h"

[Lldb-commits] [lldb] r327981 - [LLDB] Fix TestTargetXMLArch's expected arch

2018-03-20 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Mar 20 06:46:05 2018
New Revision: 327981

URL: http://llvm.org/viewvc/llvm-project?rev=327981&view=rev
Log:
[LLDB] Fix TestTargetXMLArch's expected arch

Summary:
When running on an architecture other than x86_64, the
target.ConnectRemote() part of the test may add platform information to
the target triple.

It was observed that this happens at Process::CompleteAttach() method,
after the platform_sp->IsCompatibleArchitecture() check fails.
This method then calls platform_sp->GetPlatformForArchitecture(), that
on a Linux machine ends up returning a generic Linux platform, that then
ends up getting added to the original target architecture.

Reviewers: clayborg, labath, jasonmolenda

Reviewed By: labath

Subscribers: alexandreyy, lbianc

Differential Revision: https://reviews.llvm.org/D44022
Patch by Leandro Lupori .

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py?rev=327981&r1=327980&r2=327981&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
 Tue Mar 20 06:46:05 2018
@@ -121,4 +121,4 @@ class TestTargetXMLArch(GDBRemoteTestBas
 if self.TraceOn():
 interp.HandleCommand("target list", result)
 print(result.GetOutput())
-self.assertEqual('x86_64--', target.GetTriple())
+self.assertTrue(target.GetTriple().startswith('x86_64--'))


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r327977 - Fix some tests for PPC64le architecture

2018-03-20 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Mar 20 05:46:33 2018
New Revision: 327977

URL: http://llvm.org/viewvc/llvm-project?rev=327977&view=rev
Log:
Fix some tests for PPC64le architecture

Summary:
- Fix test jump for powerpc64le
  Jumping directly to the return line on power architecture dos not means
  returning the value that is seen on the code. The last test fails, because
  it needs the execution of some assembly in the beginning of the function.
  Avoiding this test for this architecture.

- Avoid evaluate environ variable name on Linux
  On Linux the Symbol environ conflicts with another variable, then in
  order to avoid it, this test was moved into a specific test, which is not
  supported if the OS is Linux.

- Added PPC64le as MIPS behavior
  Checking the disassembler output, on PPC64le machines behaves as MPIS.
  Added method to identify PPC64le architecture and checking it when
  disassembling instructions in the test case.

Reviewers: labath

Reviewed By: labath

Subscribers: clayborg, labath, luporl, alexandreyy, sdardis, ki.stfu, 
arichardson

Differential Revision: https://reviews.llvm.org/D44101
Patch by Leonardo Bianconi .

Modified:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs2.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs2.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs2.py?rev=327977&r1=327976&r2=327977&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs2.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs2.py 
Tue Mar 20 05:46:33 2018
@@ -43,23 +43,38 @@ class ExprCommands2TestCase(TestBase):
 startstr="(int *) $0 = 0x")
 # (int *) $0 = 0x7fff5fbff258
 
-# Do anonymous symbols work?
-self.expect("expression ((char**)environ)[0]",
-startstr="(char *) $1 = 0x")
-# (char *) $1 = 0x7fff5fbff298 
"Apple_PubSub_Socket_Render=/tmp/launch-7AEsUD/Render"
-
 # Do return values containing the contents of expression locals work?
 self.expect("expression int i = 5; i",
-startstr="(int) $2 = 5")
+startstr="(int) $1 = 5")
 # (int) $2 = 5
-self.expect("expression $2 + 1",
-startstr="(int) $3 = 6")
+self.expect("expression $1 + 1",
+startstr="(int) $2 = 6")
 # (int) $3 = 6
 
 # Do return values containing the results of static expressions work?
 self.expect("expression 20 + 3",
-startstr="(int) $4 = 23")
+startstr="(int) $3 = 23")
 # (int) $4 = 5
-self.expect("expression $4 + 1",
-startstr="(int) $5 = 24")
+self.expect("expression $3 + 1",
+startstr="(int) $4 = 24")
 # (int) $5 = 6
+
+@skipIfLinux
+@expectedFailureAll(
+oslist=["windows"],
+bugnumber="llvm.org/pr24489: Name lookup not working correctly on 
Windows")
+def test_expr_symbols(self):
+"""Test symbols."""
+self.build()
+
+self.runCmd("file " + self.getBuildArtifact("a.out"), 
CURRENT_EXECUTABLE_SET)
+
+lldbutil.run_break_set_by_file_and_line(
+self, "main.cpp", self.line, num_expected_locations=1, 
loc_exact=False)
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+# Do anonymous symbols work?
+self.expect("expression ((char**)environ)[0]",
+startstr="(char *) $1 = 0x")
+# (char *) $1 = 0x7fff5fbff298 
"Apple_PubSub_Socket_Render=/tmp/launch-7AEsUD/Render"

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py?rev=327977&r1=327976&r2=327977&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
 Tue Mar 20 05:46:33 2018
@@ -50,8 +50,10 @@ class ThreadJumpTestCase(TestBase):
 self.do_min_test(self.mark3, self.mark2, "i", "5")
 # Try the double path, force it to return 'a'
 self.do_min_test(self.mark4, self.mark1, "j", "7")
-# Try the double path, force it to return 'b'
-self.do_min_test(self.mark4, self.mark2, "j", "8")
+  

[Lldb-commits] [PATCH] D44472: Add and fix some tests for PPC64

2018-03-20 Thread Alexandre Yukio Yamashita via Phabricator via lldb-commits
alexandreyy added a comment.

In https://reviews.llvm.org/D44472#1039812, @labath wrote:

> I like what you did with the test. Originally, I wanted to just compare the 
> raw memory contents, but this keeps it more inline with the spirit of the 
> original test. I have just one question about the list zipping, but otherwise 
> lgtm.


Hi @labath .
Could you merge this patch?


https://reviews.llvm.org/D44472



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44680: [dotest] Remove test build directories for passing tests

2018-03-20 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: aprantl, clayborg.

This logic is hooked into the same mechanism as the deletion of log
files, which makes it possible to use the --log-success argument to have
dotest keep the files around (for comparative analysis or whatever).

This makes the --log-successs option slightly misnamed. However one
could argue that the contents of the build folder represents a "log" of
the test's execution, so I chose to to rename it.


https://reviews.llvm.org/D44680

Files:
  packages/Python/lldbsuite/test/lldbtest.py


Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -705,11 +705,13 @@
 def makeBuildDir(self):
 """Create the test-specific working directory, deleting any previous
 contents."""
-# See also dotest.py which sets up ${LLDB_BUILD}.
+self.cleanBuildDir()
+lldbutil.mkdir_p(self.getBuildDir())
+
+def cleanBuildDir(self):
 bdir = self.getBuildDir()
 if os.path.isdir(bdir):
 shutil.rmtree(bdir)
-lldbutil.mkdir_p(bdir)
  
 def getBuildArtifact(self, name="a.out"):
 """Return absolute path to an artifact in the test's build 
directory."""
@@ -1206,7 +1208,7 @@
 log_files_for_this_test = glob.glob(self.log_basename + "*")
 
 if prefix != 'Success' or lldbtest_config.log_success:
-# keep all log files, rename them to include prefix
+# keep all test artifacts, rename log files to include prefix
 dst_log_basename = self.getLogBasenameForCurrentTest(prefix)
 for src in log_files_for_this_test:
 if os.path.isfile(src):
@@ -1220,7 +1222,9 @@
 
 os.rename(src, dst)
 else:
-# success!  (and we don't want log files) delete log files
+# success!  (and we don't want any artifacts): delete log files and
+# nuke the build dir.
+self.cleanBuildDir()
 for log_file in log_files_for_this_test:
 remove_file(log_file)
 


Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -705,11 +705,13 @@
 def makeBuildDir(self):
 """Create the test-specific working directory, deleting any previous
 contents."""
-# See also dotest.py which sets up ${LLDB_BUILD}.
+self.cleanBuildDir()
+lldbutil.mkdir_p(self.getBuildDir())
+
+def cleanBuildDir(self):
 bdir = self.getBuildDir()
 if os.path.isdir(bdir):
 shutil.rmtree(bdir)
-lldbutil.mkdir_p(bdir)
  
 def getBuildArtifact(self, name="a.out"):
 """Return absolute path to an artifact in the test's build directory."""
@@ -1206,7 +1208,7 @@
 log_files_for_this_test = glob.glob(self.log_basename + "*")
 
 if prefix != 'Success' or lldbtest_config.log_success:
-# keep all log files, rename them to include prefix
+# keep all test artifacts, rename log files to include prefix
 dst_log_basename = self.getLogBasenameForCurrentTest(prefix)
 for src in log_files_for_this_test:
 if os.path.isfile(src):
@@ -1220,7 +1222,9 @@
 
 os.rename(src, dst)
 else:
-# success!  (and we don't want log files) delete log files
+# success!  (and we don't want any artifacts): delete log files and
+# nuke the build dir.
+self.cleanBuildDir()
 for log_file in log_files_for_this_test:
 remove_file(log_file)
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D42145: [lldb] Use vFlash commands when writing to target's flash memory regions

2018-03-20 Thread Pavel Labath via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL327970: Re-land: [lldb] Use vFlash commands when writing to 
target's flash memory… (authored by labath, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D42145?vs=137827&id=139106#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42145

Files:
  lldb/trunk/include/lldb/Core/Module.h
  lldb/trunk/include/lldb/Host/XML.h
  lldb/trunk/include/lldb/Symbol/ObjectFile.h
  lldb/trunk/include/lldb/Target/MemoryRegionInfo.h
  lldb/trunk/include/lldb/Target/Process.h
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
  lldb/trunk/source/Commands/CommandObjectTarget.cpp
  lldb/trunk/source/Core/Module.cpp
  lldb/trunk/source/Host/common/XML.cpp
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  lldb/trunk/source/Symbol/ObjectFile.cpp
  lldb/trunk/source/Target/Process.cpp

Index: lldb/trunk/source/Host/common/XML.cpp
===
--- lldb/trunk/source/Host/common/XML.cpp
+++ lldb/trunk/source/Host/common/XML.cpp
@@ -151,6 +151,18 @@
 return llvm::StringRef();
 }
 
+bool XMLNode::GetAttributeValueAsUnsigned(const char *name, uint64_t &value,
+  uint64_t fail_value, int base) const {
+#if defined(LIBXML2_DEFINED)
+  llvm::StringRef str_value = GetAttributeValue(name, "");
+#else
+  llvm::StringRef str_value;
+#endif
+  bool success = false;
+  value = StringConvert::ToUInt64(str_value.data(), fail_value, base, &success);
+  return success;
+}
+
 void XMLNode::ForEachChildNode(NodeCallback const &callback) const {
 #if defined(LIBXML2_DEFINED)
   if (IsValid())
Index: lldb/trunk/source/Core/Module.cpp
===
--- lldb/trunk/source/Core/Module.cpp
+++ lldb/trunk/source/Core/Module.cpp
@@ -1685,7 +1685,3 @@
 
   return false;
 }
-
-Status Module::LoadInMemory(Target &target, bool set_pc) {
-  return m_objfile_sp->LoadInMemory(target, set_pc);
-}
Index: lldb/trunk/source/Target/Process.cpp
===
--- lldb/trunk/source/Target/Process.cpp
+++ lldb/trunk/source/Target/Process.cpp
@@ -2533,6 +2533,17 @@
   return 0;
 }
 
+Status Process::WriteObjectFile(std::vector entries) {
+  Status error;
+  for (const auto &Entry : entries) {
+WriteMemory(Entry.Dest, Entry.Contents.data(), Entry.Contents.size(),
+error);
+if (!error.Success())
+  break;
+  }
+  return error;
+}
+
 #define USE_ALLOCATE_MEMORY_CACHE 1
 addr_t Process::AllocateMemory(size_t size, uint32_t permissions,
Status &error) {
Index: lldb/trunk/source/Symbol/ObjectFile.cpp
===
--- lldb/trunk/source/Symbol/ObjectFile.cpp
+++ lldb/trunk/source/Symbol/ObjectFile.cpp
@@ -16,7 +16,6 @@
 #include "lldb/Symbol/ObjectContainer.h"
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Target/Process.h"
-#include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/DataBuffer.h"
@@ -648,41 +647,31 @@
   return ConstString(ss.GetString());
 }
 
-Status ObjectFile::LoadInMemory(Target &target, bool set_pc) {
-  Status error;
-  ProcessSP process = target.CalculateProcess();
-  if (!process)
-return Status("No Process");
-  if (set_pc && !GetEntryPointAddress().IsValid())
-return Status("No entry address in object file");
-
+std::vector
+ObjectFile::GetLoadableData(Target &target) {
+  std::vector loadables;
   SectionList *section_list = GetSectionList();
   if (!section_list)
-return Status("No section in object file");
+return loadables;
+  // Create a list of loadable data from loadable sections
   size_t section_count = section_list->GetNumSections(0);
   for (size_t i = 0; i < section_count; ++i) {
+LoadableData loadable;
 SectionSP section_sp = section_list->GetSectionAtIndex(i);
-addr_t addr = target.GetSectionLoadList().GetSectionLoadAddress(section_sp);
-if (addr != LLDB_INVALID_ADDRESS) {
-  DataExtractor section_data;
-  // We can skip sections like bss
-  if (section_sp->GetFileSize() == 0)
-continue;
-  section_sp->GetSectionData(section_data);
-  lldb::offset_t written = process->WriteMemory(
-

[Lldb-commits] [lldb] r327970 - Re-land: [lldb] Use vFlash commands when writing to target's flash memory regions

2018-03-20 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Mar 20 04:56:24 2018
New Revision: 327970

URL: http://llvm.org/viewvc/llvm-project?rev=327970&view=rev
Log:
Re-land: [lldb] Use vFlash commands when writing to target's flash memory 
regions

The difference between this and the previous patch is that now we use
ELF physical addresses only for loading objects into the target (and the
rest of the module load address logic still uses virtual addresses).

Summary:
When writing an object file over gdb-remote, use the vFlashErase, vFlashWrite, 
and vFlashDone commands if the write address is in a flash memory region.  A 
bare metal target may have this kind of setup.

- Update ObjectFileELF to set load addresses using physical addresses.  A 
typical case may be a data section with a physical address in ROM and a virtual 
address in RAM, which should be loaded to the ROM address.
- Add support for querying the target's qXfer:memory-map, which contains 
information about flash memory regions, leveraging MemoryRegionInfo data 
structures with minor modifications
- Update ProcessGDBRemote to use vFlash commands in DoWriteMemory when the 
target address is in a flash region

Original discussion at 
http://lists.llvm.org/pipermail/lldb-dev/2018-January/013093.html

Reviewers: clayborg, labath

Reviewed By: labath

Subscribers: llvm-commits, arichardson, emaste, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D42145
Patch by Owen Shaw .

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
Modified:
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/include/lldb/Host/XML.h
lldb/trunk/include/lldb/Symbol/ObjectFile.h
lldb/trunk/include/lldb/Target/MemoryRegionInfo.h
lldb/trunk/include/lldb/Target/Process.h

lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Host/common/XML.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/trunk/source/Symbol/ObjectFile.cpp
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=327970&r1=327969&r2=327970&view=diff
==
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Tue Mar 20 04:56:24 2018
@@ -1021,20 +1021,6 @@ public:
   bool RemapSourceFile(llvm::StringRef path, std::string &new_path) const;
   bool RemapSourceFile(const char *, std::string &) const = delete;
 
-  //--
-  /// Loads this module to memory.
-  ///
-  /// Loads the bits needed to create an executable image to the memory.
-  /// It is useful with bare-metal targets where target does not have the
-  /// ability to start a process itself.
-  ///
-  /// @param[in] target
-  /// Target where to load the module.
-  ///
-  /// @return
-  //--
-  Status LoadInMemory(Target &target, bool set_pc);
-
   //--
   /// @class LookupInfo Module.h "lldb/Core/Module.h"
   /// @brief A class that encapsulates name lookup information.

Modified: lldb/trunk/include/lldb/Host/XML.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/XML.h?rev=327970&r1=327969&r2=327970&view=diff
==
--- lldb/trunk/include/lldb/Host/XML.h (original)
+++ lldb/trunk/include/lldb/Host/XML.h Tue Mar 20 04:56:24 2018
@@ -82,6 +82,9 @@ public:
   llvm::StringRef GetAttributeValue(const char *name,
 const char *fail_value = nullptr) const;
 
+  bool GetAttributeValueAsUnsigned(const char *name, uint64_t &value,
+   uint64_t fail_value = 0, int base = 0) 
const;
+
   XMLNode FindFirstChildElementWithName(const char *name) const;
 
   XMLNode GetElementForPath(const NamePath &path);

Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=327970&r1=327969&r2=327970&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Tue Mar 20 04:56:24 2018
@

[Lldb-commits] [PATCH] D44526: [dotest] Clean up test folder clean-up

2018-03-20 Thread Pavel Labath via Phabricator via lldb-commits
labath added a subscriber: aprantl.
labath added a comment.

Deleting the test build dir is fairly easy. I can whip up a patch for that,
but I'm not sure if that's the part that is bothering you the most here.
Dealing with the log files is a bot more complicated and there doesn't seem
to be a clear consensus on what to do with them.  The last discussion about
the (Jan 17: Questions about the LLDB testsuite and improving its
reliability) ended without a clear conclusion. I personally, think it would
be nice to put the log files into the build dir, but I don't feel strongly
enough about it to go around and try to get people to change their habits.


Repository:
  rL LLVM

https://reviews.llvm.org/D44526



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D44526: [dotest] Clean up test folder clean-up

2018-03-20 Thread Pavel Labath via lldb-commits
Deleting the test build dir is fairly easy. I can whip up a patch for that,
but I'm not sure if that's the part that is bothering you the most here.
Dealing with the log files is a bot more complicated and there doesn't seem
to be a clear consensus on what to do with them.  The last discussion about
the (Jan 17: Questions about the LLDB testsuite and improving its
reliability) ended without a clear conclusion. I personally, think it would
be nice to put the log files into the build dir, but I don't feel strongly
enough about it to go around and try to get people to change their habits.


On Mon, 19 Mar 2018 at 17:17, Greg Clayton via Phabricator via lldb-commits
 wrote:

> clayborg added subscribers: labath, clayborg.
> clayborg added a comment.
>
> I would be nice to have the option to nuke each test build directory if
> the test passed. Can be an option that we specify. That way, the only
> folders left over could be the tests that are failing. The options doesn't
> need to default to true, but if anyone is in that code and would know how
> to do that, that would be a great option to have. This option could also
> clean up the log directory and remove any logs for tests that succeeded or
> were skipped. I alway have to go and nuke these files manually.
>
> Greg
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D44526
>
>
>
> ___
> 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