[Lldb-commits] [lldb] r328083 - Fix TestOperatorOverload for 32-bit builds

2018-03-21 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Mar 21 02:43:50 2018
New Revision: 328083

URL: http://llvm.org/viewvc/llvm-project?rev=328083&view=rev
Log:
Fix TestOperatorOverload for 32-bit builds

- use more goodies from Makefile.rules to correctly build a 32-bit
binary.
- avoid hardcoding typeof(nil) in the test.

This should partially fix the linux bot. There is still one assertion
failure remaining, which I'll have to investigate separately, as I am
not experiencing it locally.

Modified:

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

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py

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=328083&r1=328082&r2=328083&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 
Wed Mar 21 02:43:50 2018
@@ -1,18 +1,8 @@
 LEVEL = ../../../make
 
 CXX_SOURCES = a.cpp b.cpp
-CXXFLAGS_NO_DEBUGINFO = -c
-CXXFLAGS_DEBUGINFO = -c -g
 
-all: main
-
-main: a.o b.o
-   $(CXX) $^ -o $@ $(LDFLAGS)
+include $(LEVEL)/Makefile.rules
 
 a.o: a.cpp
-   $(CXX) $< $(CXXFLAGS_NO_DEBUGINFO) -o $@
-
-b.o: b.cpp
-   $(CXX) $< $(CXXFLAGS_DEBUGINFO) -o $@
-
-include $(LEVEL)/Makefile.rules
+   $(CC) $(CFLAGS_NO_DEBUG) -c $< -o $@

Modified: 
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=328083&r1=328082&r2=328083&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py
 Wed Mar 21 02:43:50 2018
@@ -10,13 +10,13 @@ class TestOperatorOverload(TestBase):
 self.build()
 (target, process, thread,
   main_breakpoint) = lldbutil.run_to_source_breakpoint(self,
-"break here", lldb.SBFileSpec("b.cpp"), exe_name = "main")
+"break here", lldb.SBFileSpec("b.cpp"))
 frame = thread.GetSelectedFrame()
 value = frame.EvaluateExpression("x == nil")
 self.assertTrue(str(value.GetError())
   .find("comparison between NULL and non-pointer ('Tinky' and NULL)")
 != -1)
 self.assertTrue(str(value.GetError())
-  .find("invalid operands to binary expression ('Tinky' and 'long')")
+  .find("invalid operands to binary expression ('Tinky' and")
 != -1)
 self.assertFalse(value.GetError().Success())


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


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

2018-03-21 Thread Pavel Labath via lldb-commits
Instead of trying to guess how the shell will interpret your command line,
it would be better to just use a primitive which bypasses the shell
altogether. For example you can use subprocess.call(), and just forward it
the list of arguments verbatim.

You'd need to do some special processing on the args you got from cmake, as
these are already a string, but this could be handled by forwarding them as
a list (separated by semicolon) and then just breaking it up around
semicolons. This will still not be perfect forwarding, but it will already
be a big improvement over how it's handled right now.


On Tue, 20 Mar 2018 at 19:20, Jonas Devlieghere via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> 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 mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2018-03-21 Thread Jonas Devlieghere via lldb-commits
You are absolutely right.

https://reviews.llvm.org/D44728

On Wed, Mar 21, 2018 at 10:01 AM, Pavel Labath  wrote:

> Instead of trying to guess how the shell will interpret your command line,
> it would be better to just use a primitive which bypasses the shell
> altogether. For example you can use subprocess.call(), and just forward it
> the list of arguments verbatim.
>
> You'd need to do some special processing on the args you got from cmake,
> as these are already a string, but this could be handled by forwarding them
> as a list (separated by semicolon) and then just breaking it up around
> semicolons. This will still not be perfect forwarding, but it will already
> be a big improvement over how it's handled right now.
>
>
> On Tue, 20 Mar 2018 at 19:20, Jonas Devlieghere via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
>> 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 mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44728: [dotest] Use subprocess.call to forward arguments in wrapper

2018-03-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 139270.
JDevlieghere added a comment.

Re-add accidentally removed comment.


https://reviews.llvm.org/D44728

Files:
  test/CMakeLists.txt
  test/lldb-dotest.in


Index: test/lldb-dotest.in
===
--- test/lldb-dotest.in
+++ test/lldb-dotest.in
@@ -1,18 +1,16 @@
 #!/usr/bin/env python
+import subprocess
 import sys
-import os
 
 dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args = '@LLDB_DOTEST_ARGS_STR@'
+dotest_args_str = '@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(wrapper_args))
-os.system(command)
+wrapper_args = sys.argv[1:]
+dotest_args = dotest_args_str.split(';')[:-1]
+# Build dotest.py command.
+cmd = [dotest_path, '-q']
+cmd.extend(dotest_args)
+cmd.extend(wrapper_args)
+# Invoke dotest.py
+subprocess.call(cmd)
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -136,8 +136,7 @@
   )
 
 # Generate a wrapper for dotest.py in the bin directory.
-string (REPLACE ";" " " LLDB_DOTEST_ARGS_STR  "${LLDB_DOTEST_ARGS}")
-# We need this to substitute variables.
+# We need configure_file to substitute variables.
 configure_file(
   lldb-dotest.in
   ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured


Index: test/lldb-dotest.in
===
--- test/lldb-dotest.in
+++ test/lldb-dotest.in
@@ -1,18 +1,16 @@
 #!/usr/bin/env python
+import subprocess
 import sys
-import os
 
 dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args = '@LLDB_DOTEST_ARGS_STR@'
+dotest_args_str = '@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(wrapper_args))
-os.system(command)
+wrapper_args = sys.argv[1:]
+dotest_args = dotest_args_str.split(';')[:-1]
+# Build dotest.py command.
+cmd = [dotest_path, '-q']
+cmd.extend(dotest_args)
+cmd.extend(wrapper_args)
+# Invoke dotest.py
+subprocess.call(cmd)
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -136,8 +136,7 @@
   )
 
 # Generate a wrapper for dotest.py in the bin directory.
-string (REPLACE ";" " " LLDB_DOTEST_ARGS_STR  "${LLDB_DOTEST_ARGS}")
-# We need this to substitute variables.
+# We need configure_file to substitute variables.
 configure_file(
   lldb-dotest.in
   ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44728: [dotest] Use subprocess.call to forward arguments in wrapper

2018-03-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: labath, vsk.
Herald added subscribers: llvm-commits, mgorny.

As suggested by Pavel on lldb-commits. Originally I picked os.system because it 
was so much more simple than the subprocess module, but that no longer holds 
true after yesterday's hack in r328020. This is what it should've been in the 
first place.


Repository:
  rL LLVM

https://reviews.llvm.org/D44728

Files:
  test/CMakeLists.txt
  test/lldb-dotest.in


Index: test/lldb-dotest.in
===
--- test/lldb-dotest.in
+++ test/lldb-dotest.in
@@ -1,18 +1,16 @@
 #!/usr/bin/env python
 import sys
-import os
+import subprocess
 
 dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args = '@LLDB_DOTEST_ARGS_STR@'
+dotest_args_str = '@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(wrapper_args))
-os.system(command)
+wrapper_args = sys.argv[1:]
+dotest_args = dotest_args_str.split(';')[:-1]
+# Build dotest.py command.
+cmd = [dotest_path, '-q']
+cmd.extend(dotest_args)
+cmd.extend(wrapper_args)
+# Invoke dotest.py
+subprocess.call(cmd)
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -135,8 +135,6 @@
   "Testing LLDB (parallel execution, with a separate subprocess per test)"
   )
 
-# Generate a wrapper for dotest.py in the bin directory.
-string (REPLACE ";" " " LLDB_DOTEST_ARGS_STR  "${LLDB_DOTEST_ARGS}")
 # We need this to substitute variables.
 configure_file(
   lldb-dotest.in


Index: test/lldb-dotest.in
===
--- test/lldb-dotest.in
+++ test/lldb-dotest.in
@@ -1,18 +1,16 @@
 #!/usr/bin/env python
 import sys
-import os
+import subprocess
 
 dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args = '@LLDB_DOTEST_ARGS_STR@'
+dotest_args_str = '@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(wrapper_args))
-os.system(command)
+wrapper_args = sys.argv[1:]
+dotest_args = dotest_args_str.split(';')[:-1]
+# Build dotest.py command.
+cmd = [dotest_path, '-q']
+cmd.extend(dotest_args)
+cmd.extend(wrapper_args)
+# Invoke dotest.py
+subprocess.call(cmd)
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -135,8 +135,6 @@
   "Testing LLDB (parallel execution, with a separate subprocess per test)"
   )
 
-# Generate a wrapper for dotest.py in the bin directory.
-string (REPLACE ";" " " LLDB_DOTEST_ARGS_STR  "${LLDB_DOTEST_ARGS}")
 # We need this to substitute variables.
 configure_file(
   lldb-dotest.in
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44728: [dotest] Use subprocess.call to forward arguments in wrapper

2018-03-21 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Thank you.  This looks good, assuming that the LLDB_DOTEST_ARGS_STR thingy is 
working as intended.




Comment at: test/lldb-dotest.in:6
 dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args = '@LLDB_DOTEST_ARGS_STR@'
+dotest_args_str = '@LLDB_DOTEST_ARGS_STR@'
 

I'm confused. Shouldn't this be `@LLDB_DOTEST_ARGS@`, now that you've removed 
the _STR version?


https://reviews.llvm.org/D44728



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


[Lldb-commits] [PATCH] D44728: [dotest] Use subprocess.call to forward arguments in wrapper

2018-03-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere marked an inline comment as done.
JDevlieghere added a comment.

In https://reviews.llvm.org/D44728#1044255, @labath wrote:

> Thank you.  This looks good, assuming that the LLDB_DOTEST_ARGS_STR thingy is 
> working as intended.


Good catch, the variable was still available from the cache. I'll commit this 
with the fix.


https://reviews.llvm.org/D44728



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


[Lldb-commits] [lldb] r328088 - Fix crash exposed by r328025

2018-03-21 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Mar 21 04:10:57 2018
New Revision: 328088

URL: http://llvm.org/viewvc/llvm-project?rev=328088&view=rev
Log:
Fix crash exposed by r328025

The issue was that the ASTDumper was being passed a null pointer
(because we did not create any declaration for the operator==).  The
crash was in logging code, so it only manifested it self if you ran the
tests with logging enabled (like our bots do).

Given that this is logging code and the rest of the debugger is fine
with the declaration being null, I just make sure the logging code can
handle it as well. Right now I just do the null check in
ClangExpressionDeclMap, but if the ASTDumper class is meant to be a
debugging/logging aid, then it might be a good idea move the check
inside the class itself.

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp?rev=328088&r1=328087&r2=328088&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
Wed Mar 21 04:10:57 2018
@@ -2116,7 +2116,8 @@ void ClangExpressionDeclMap::AddOneFunct
   parser_vars->m_llvm_value = NULL;
 
   if (log) {
-ASTDumper ast_dumper(function_decl);
+std::string function_str =
+function_decl ? ASTDumper(function_decl).GetCString() : "nullptr";
 
 StreamString ss;
 
@@ -2127,7 +2128,7 @@ void ClangExpressionDeclMap::AddOneFunct
 log->Printf(
 "  CEDM::FEVD[%u] Found %s function %s (description %s), returned %s",
 current_id, (function ? "specific" : "generic"), decl_name.c_str(),
-ss.GetData(), ast_dumper.GetCString());
+ss.GetData(), function_str.c_str());
   }
 }
 


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


[Lldb-commits] [lldb] r328089 - [dotest] Use subprocess.call to forward arguments in wrapper

2018-03-21 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed Mar 21 04:13:56 2018
New Revision: 328089

URL: http://llvm.org/viewvc/llvm-project?rev=328089&view=rev
Log:
[dotest] Use subprocess.call to forward arguments in wrapper

As suggested by Pavel on lldb-commits. Originally I picked os.system
because it was so much more simple than the subprocess module, but that
no longer holds true after yesterday's hack in r328020. This is what it
should've been in the first place.

Differential revision: https://reviews.llvm.org/D44728

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

Modified: lldb/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=328089&r1=328088&r2=328089&view=diff
==
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Wed Mar 21 04:13:56 2018
@@ -136,8 +136,7 @@ add_python_test_target(check-lldb
   )
 
 # Generate a wrapper for dotest.py in the bin directory.
-string (REPLACE ";" " " LLDB_DOTEST_ARGS_STR  "${LLDB_DOTEST_ARGS}")
-# We need this to substitute variables.
+# We need configure_file to substitute variables.
 configure_file(
   lldb-dotest.in
   ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured

Modified: lldb/trunk/test/lldb-dotest.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldb-dotest.in?rev=328089&r1=328088&r2=328089&view=diff
==
--- lldb/trunk/test/lldb-dotest.in (original)
+++ lldb/trunk/test/lldb-dotest.in Wed Mar 21 04:13:56 2018
@@ -1,18 +1,16 @@
 #!/usr/bin/env python
+import subprocess
 import sys
-import os
 
 dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args = '@LLDB_DOTEST_ARGS_STR@'
+dotest_args_str = '@LLDB_DOTEST_ARGS@'
 
 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(wrapper_args))
-os.system(command)
+wrapper_args = sys.argv[1:]
+dotest_args = dotest_args_str.split(';')
+# Build dotest.py command.
+cmd = [dotest_path, '-q']
+cmd.extend(dotest_args)
+cmd.extend(wrapper_args)
+# Invoke dotest.py
+subprocess.call(cmd)


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


[Lldb-commits] [PATCH] D44728: [dotest] Use subprocess.call to forward arguments in wrapper

2018-03-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL328089: [dotest] Use subprocess.call to forward arguments in 
wrapper (authored by JDevlieghere, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D44728?vs=139270&id=139274#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D44728

Files:
  lldb/trunk/test/CMakeLists.txt
  lldb/trunk/test/lldb-dotest.in


Index: lldb/trunk/test/CMakeLists.txt
===
--- lldb/trunk/test/CMakeLists.txt
+++ lldb/trunk/test/CMakeLists.txt
@@ -136,8 +136,7 @@
   )
 
 # Generate a wrapper for dotest.py in the bin directory.
-string (REPLACE ";" " " LLDB_DOTEST_ARGS_STR  "${LLDB_DOTEST_ARGS}")
-# We need this to substitute variables.
+# We need configure_file to substitute variables.
 configure_file(
   lldb-dotest.in
   ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
Index: lldb/trunk/test/lldb-dotest.in
===
--- lldb/trunk/test/lldb-dotest.in
+++ lldb/trunk/test/lldb-dotest.in
@@ -1,18 +1,16 @@
 #!/usr/bin/env python
+import subprocess
 import sys
-import os
 
 dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args = '@LLDB_DOTEST_ARGS_STR@'
+dotest_args_str = '@LLDB_DOTEST_ARGS@'
 
 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(wrapper_args))
-os.system(command)
+wrapper_args = sys.argv[1:]
+dotest_args = dotest_args_str.split(';')
+# Build dotest.py command.
+cmd = [dotest_path, '-q']
+cmd.extend(dotest_args)
+cmd.extend(wrapper_args)
+# Invoke dotest.py
+subprocess.call(cmd)


Index: lldb/trunk/test/CMakeLists.txt
===
--- lldb/trunk/test/CMakeLists.txt
+++ lldb/trunk/test/CMakeLists.txt
@@ -136,8 +136,7 @@
   )
 
 # Generate a wrapper for dotest.py in the bin directory.
-string (REPLACE ";" " " LLDB_DOTEST_ARGS_STR  "${LLDB_DOTEST_ARGS}")
-# We need this to substitute variables.
+# We need configure_file to substitute variables.
 configure_file(
   lldb-dotest.in
   ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
Index: lldb/trunk/test/lldb-dotest.in
===
--- lldb/trunk/test/lldb-dotest.in
+++ lldb/trunk/test/lldb-dotest.in
@@ -1,18 +1,16 @@
 #!/usr/bin/env python
+import subprocess
 import sys
-import os
 
 dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args = '@LLDB_DOTEST_ARGS_STR@'
+dotest_args_str = '@LLDB_DOTEST_ARGS@'
 
 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(wrapper_args))
-os.system(command)
+wrapper_args = sys.argv[1:]
+dotest_args = dotest_args_str.split(';')
+# Build dotest.py command.
+cmd = [dotest_path, '-q']
+cmd.extend(dotest_args)
+cmd.extend(wrapper_args)
+# Invoke dotest.py
+subprocess.call(cmd)
___
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-21 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

The Terminate function is a good place to do this kind of cleanup.




Comment at: source/Plugins/Language/D/DLanguage.cpp:34-36
+// D Plugin will define these symbols. They're declared to use with decltype.
+extern "C" {
+// called once, to initialize druntime. Return true on success

Instead of using decltype everywhere, you could just define the type of these 
functions  with typedef and use that.


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-21 Thread Pavel Labath via lldb-commits
It wasn't actually a linux issue, but a logging issue. The reason you
couldn't reproduce this locally is because we don't have logging on by
default (but our bot does, to help figuring out what's wrong when things
break). I haven't tried, but I'm pretty sure the test would break on mac as
well if you ran it with logging enabled (dotest.py --channel "lldb expr").
Right now, I've put a stop-gap fix, but maybe that should be resolved in a
more principled way.

The other issue I fixed was the test's Makefile not working for 32-bit
builds. Generally, when you start writing compiler invocations in the
Makefile by hand, you'll probably get break the test in some configuration.
Most of the effects can be achieved by just setting the appropriate
variables before invoking Makefile.rules. Compiling one part of the binary
without debug info is also possible that way, but historically we haven't
done that for some reason (I should probably go and fix that).



On Tue, 20 Mar 2018 at 22:24, Davide Italiano via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> 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

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

2018-03-21 Thread Pavel Labath via lldb-commits
BTW, during the "great lldb reformat" it was decided that our python files
should follow the official python formatting rules (4 space indent) and not
the llvm style guide (2 space).


On Wed, 21 Mar 2018 at 11:35, Pavel Labath  wrote:

> It wasn't actually a linux issue, but a logging issue. The reason you
> couldn't reproduce this locally is because we don't have logging on by
> default (but our bot does, to help figuring out what's wrong when things
> break). I haven't tried, but I'm pretty sure the test would break on mac as
> well if you ran it with logging enabled (dotest.py --channel "lldb expr").
> Right now, I've put a stop-gap fix, but maybe that should be resolved in a
> more principled way.
>
> The other issue I fixed was the test's Makefile not working for 32-bit
> builds. Generally, when you start writing compiler invocations in the
> Makefile by hand, you'll probably get break the test in some configuration.
> Most of the effects can be achieved by just setting the appropriate
> variables before invoking Makefile.rules. Compiling one part of the binary
> without debug info is also possible that way, but historically we haven't
> done that for some reason (I should probably go and fix that).
>
>
>
> On Tue, 20 Mar 2018 at 22:24, Davide Italiano via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
>> 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>&

[Lldb-commits] [PATCH] D44738: Add a test for setting the load address of a module with differing physical/virtual addresses

2018-03-21 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added a reviewer: owenpshaw.

First attempt at landing https://reviews.llvm.org/D42145 was reverted because 
it caused test
failures on some android devices. It turned out this was because these
devices had vdso modules with differing physical and virtual addresses.
This was not caught earlier because all of the modules in our tests
either lack physical addresses or have them identical to virtual ones.

In the discussion on the patch, we came to the conclusion that in the
scenario where we are merely setting a load address of a module (for
example from a dynamic loader plugin), we should always use virtual
addresses (i.e., preserve status quo). This patch adds a test to make
sure we don't regress in that direction.


https://reviews.llvm.org/D44738

Files:
  
packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py


Index: 
packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
===
--- 
packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
+++ 
packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
@@ -6,6 +6,25 @@
 
 class TestGDBRemoteLoad(GDBRemoteTestBase):
 
+def setUp(self):
+super(TestGDBRemoteLoad, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(TestGDBRemoteLoad, self).tearDown()
+
+def test_module_load_address(self):
+"""Test that setting the load address of a module uses virtual 
addresses"""
+target = self.createTarget("a.yaml")
+process = self.connect(target)
+module = target.GetModuleAtIndex(0)
+self.assertTrue(module.IsValid())
+self.assertTrue(target.SetModuleLoadAddress(module, 0).Success())
+address = target.ResolveLoadAddress(0x2001)
+self.assertTrue(address.IsValid())
+self.assertEqual(".data", address.GetSection().GetName())
+
 def test_ram_load(self):
 """Test loading an object file to a target's ram"""
 target = self.createTarget("a.yaml")


Index: packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
===
--- packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
+++ packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
@@ -6,6 +6,25 @@
 
 class TestGDBRemoteLoad(GDBRemoteTestBase):
 
+def setUp(self):
+super(TestGDBRemoteLoad, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(TestGDBRemoteLoad, self).tearDown()
+
+def test_module_load_address(self):
+"""Test that setting the load address of a module uses virtual addresses"""
+target = self.createTarget("a.yaml")
+process = self.connect(target)
+module = target.GetModuleAtIndex(0)
+self.assertTrue(module.IsValid())
+self.assertTrue(target.SetModuleLoadAddress(module, 0).Success())
+address = target.ResolveLoadAddress(0x2001)
+self.assertTrue(address.IsValid())
+self.assertEqual(".data", address.GetSection().GetName())
+
 def test_ram_load(self):
 """Test loading an object file to a target's ram"""
 target = self.createTarget("a.yaml")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44739: [SymbolFileDWARF] Replace FixedFormSizes with llvm::dwarf::getFixedFormByteSize

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

The llvm function is practically a drop-in replacement. There may be
slight differences in performance as the llvm version uses a switch
whereas our version used a lookup table, but I can't say which way that
will go. (In practice, the compiler will also turn the switch into a jump
table.)

The thing we definitely gain by this is support for new forms that
haven't been added to our tables (e.g. DW_FORM_data16) and the ability
to represent forms of size 0 like DW_FORM_implicit_const (which we
couldn't represent because we used 0 to mean "size unknown"). The thing
we definitely lose is 150 lines of code.


https://reviews.llvm.org/D44739

Files:
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3804,36 +3804,32 @@
 block_length);
   } else if (DWARFFormValue::IsDataForm(form_value.Form())) {
 // Retrieve the value as a data expression.
-DWARFFormValue::FixedFormSizes fixed_form_sizes =
-DWARFFormValue::GetFixedFormSizesForAddressSize(
-attributes.CompileUnitAtIndex(i)->GetAddressByteSize(),
-attributes.CompileUnitAtIndex(i)->IsDWARF64());
+llvm::dwarf::FormParams form_params =
+attributes.CompileUnitAtIndex(i)->GetFormParams();
 uint32_t data_offset = attributes.DIEOffsetAtIndex(i);
-uint32_t data_length =
-fixed_form_sizes.GetSize(form_value.Form());
-if (data_length == 0) {
+if (llvm::Optional data_length =
+llvm::dwarf::getFixedFormByteSize(
+llvm::dwarf::Form(form_value.Form()), form_params))
+  location.CopyOpcodeData(module, debug_info_data, data_offset,
+  *data_length);
+else {
   const uint8_t *data_pointer = form_value.BlockData();
   if (data_pointer) {
 form_value.Unsigned();
   } else if (DWARFFormValue::IsDataForm(form_value.Form())) {
 // we need to get the byte size of the type later after we
 // create the variable
 const_value = form_value;
   }
-} else
-  location.CopyOpcodeData(module, debug_info_data, data_offset,
-  data_length);
+}
   } else {
 // Retrieve the value as a string expression.
 if (form_value.Form() == DW_FORM_strp) {
-  DWARFFormValue::FixedFormSizes fixed_form_sizes =
-  DWARFFormValue::GetFixedFormSizesForAddressSize(
-  attributes.CompileUnitAtIndex(i)
-  ->GetAddressByteSize(),
-  attributes.CompileUnitAtIndex(i)->IsDWARF64());
+  llvm::dwarf::FormParams form_params =
+  attributes.CompileUnitAtIndex(i)->GetFormParams();
   uint32_t data_offset = attributes.DIEOffsetAtIndex(i);
-  uint32_t data_length =
-  fixed_form_sizes.GetSize(form_value.Form());
+  uint32_t data_length = *llvm::dwarf::getFixedFormByteSize(
+  DW_FORM_strp, form_params);
   location.CopyOpcodeData(module, debug_info_data, data_offset,
   data_length);
 } else {
Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -74,7 +74,7 @@
 
   lldb_private::TypeSystem *GetTypeSystem();
 
-  DWARFFormValue::FixedFormSizes GetFixedFormSizes();
+  llvm::dwarf::FormParams GetFormParams() const;
 
   void SetBaseAddress(dw_addr_t base_addr);
 
@@ -139,13 +139,14 @@
 
   DWARFUnit();
 
-  static void
-  IndexPrivate(DWARFUnit *dwarf_cu, const lldb::LanguageType cu_language,
-   const DWARFFormValue::FixedFormSizes &fixed_form_sizes,
-   cons

[Lldb-commits] [lldb] r328106 - Last batch of test-tree cleaning changes

2018-03-21 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Mar 21 08:29:32 2018
New Revision: 328106

URL: http://llvm.org/viewvc/llvm-project?rev=328106&view=rev
Log:
Last batch of test-tree cleaning changes

- postmortem tests: make sure the core files are created in the build
  folder
- TestSourceManager: copy the .c file into the build dir before
  modifying it
- TestLogging: create log files in the build folder

After these changes I get a clean test run (on linux) even if I set the
source tree to be read only. It's possible some of the skipped/xfailed
tests are still creating files in the source tree, but at the moment, I
don't have plans to go hunting for those.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
lldb/trunk/packages/Python/lldbsuite/test/logging/TestLogging.py
lldb/trunk/packages/Python/lldbsuite/test/source-manager/Makefile

lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py?rev=328106&r1=328105&r2=328106&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 Wed Mar 21 08:29:32 2018
@@ -87,30 +87,28 @@ class LinuxCoreTestCase(TestBase):
 def test_same_pid_running(self):
 """Test that we read the information from the core correctly even if 
we have a running
 process with the same PID around"""
-try:
-shutil.copyfile("linux-x86_64.out", "linux-x86_64-pid.out")
-shutil.copyfile("linux-x86_64.core", "linux-x86_64-pid.core")
-with open("linux-x86_64-pid.core", "r+b") as f:
-# These are offsets into the NT_PRSTATUS and NT_PRPSINFO 
structures in the note
-# segment of the core file. If you update the file, these 
offsets may need updating
-# as well. (Notes can be viewed with readelf --notes.)
-for pid_offset in [0x1c4, 0x320]:
-f.seek(pid_offset)
-self.assertEqual(
-struct.unpack(
-"http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py?rev=328106&r1=328105&r2=328106&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
 Wed Mar 21 08:29:32 2018
@@ -162,32 +162,25 @@ class MiniDumpNewTestCase(TestBase):
 def test_deeper_stack_in_minidump_with_same_pid_running(self):
 """Test that we read the information from the core correctly even if we
 have a running process with the same PID"""
-try:
-self.do_change_pid_in_minidump("linux-x86_64_not_crashed.dmp",
-   "linux-x86_64_not_crashed-pid.dmp",
-   
self._linux_x86_64_not_crashed_pid_offset,
-   
str(self._linux_x86_64_not_crashed_pid),
-   str(os.getpid()))
-self.do_test_deeper_stack("linux-x86_64_not_crashed",
-  "linux-x86_64_not_crashed-pid.dmp",
-  os.getpid())
-finally:
-self.RemoveTempFile("linux-x86_64_not_crashed-pid.dmp")
+new_core = self.getBuildArtifact("linux-x86_64_not_crashed-pid.dmp")
+self.do_change_pid_in_minidump("linux-x86_64_not_crashed.dmp",
+   new_core,
+   
self._linux_x86_64_not_crashed_pid_offset,
+   str(self._linux_x86_64_not_crashed_pid),
+   str(os.getpid()))
+self.do_test_deeper_stack("linux-x86_64_not_crashed", new_core, 
os.getpid())
 
 def test_two_cores_same_pid(self):
 """Test that we handle the situation if we have two core files with 
the same PID """
-try:
-self.do_change_pid_in_minidump("linux-x86_64_not_crashed.dmp",
-   "linux-x86_64_not_crashed-pid.dmp",
-   
self._linux_x86_64_not_crashed_pid_offset,
-   

Re: [Lldb-commits] [lldb] r328083 - Fix TestOperatorOverload for 32-bit builds

2018-03-21 Thread Davide Italiano via lldb-commits
On Wed, Mar 21, 2018 at 2:43 AM, Pavel Labath via lldb-commits
 wrote:
> Author: labath
> Date: Wed Mar 21 02:43:50 2018
> New Revision: 328083
>
> URL: http://llvm.org/viewvc/llvm-project?rev=328083&view=rev
> Log:
> Fix TestOperatorOverload for 32-bit builds
>
> - use more goodies from Makefile.rules to correctly build a 32-bit
> binary.
> - avoid hardcoding typeof(nil) in the test.
>
> This should partially fix the linux bot. There is still one assertion
> failure remaining, which I'll have to investigate separately, as I am
> not experiencing it locally.
>
> Modified:
> 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile
> 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py
>
> 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=328083&r1=328082&r2=328083&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 
> Wed Mar 21 02:43:50 2018
> @@ -1,18 +1,8 @@
>  LEVEL = ../../../make
>
>  CXX_SOURCES = a.cpp b.cpp
> -CXXFLAGS_NO_DEBUGINFO = -c
> -CXXFLAGS_DEBUGINFO = -c -g
>
> -all: main
> -
> -main: a.o b.o
> -   $(CXX) $^ -o $@ $(LDFLAGS)
> +include $(LEVEL)/Makefile.rules
>
>  a.o: a.cpp
> -   $(CXX) $< $(CXXFLAGS_NO_DEBUGINFO) -o $@
> -
> -b.o: b.cpp
> -   $(CXX) $< $(CXXFLAGS_DEBUGINFO) -o $@
> -
> -include $(LEVEL)/Makefile.rules
> +   $(CC) $(CFLAGS_NO_DEBUG) -c $< -o $@
>

Thanks for fixing this! Only one comment.
I originally wrote this in a way that `-g` is passed only to b.cpp
(and not to a).
I needed that flag just to set a breakpoint (and I'm not sure if it's
still hit, or just happens to work).
Did this preserve the exact same meaning for the test?

Best,

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


Re: [Lldb-commits] [lldb] r328083 - Fix TestOperatorOverload for 32-bit builds

2018-03-21 Thread Pavel Labath via lldb-commits
Affirmative.

I've checked the compiler invocations before and after the patch. -g goes
only to b.cpp. (also, this is the same pattern we use for other tests which
want to build stuff with no debug info).


On Wed, 21 Mar 2018 at 15:47, Davide Italiano  wrote:

> On Wed, Mar 21, 2018 at 2:43 AM, Pavel Labath via lldb-commits
>  wrote:
> > Author: labath
> > Date: Wed Mar 21 02:43:50 2018
> > New Revision: 328083
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=328083&view=rev
> > Log:
> > Fix TestOperatorOverload for 32-bit builds
> >
> > - use more goodies from Makefile.rules to correctly build a 32-bit
> > binary.
> > - avoid hardcoding typeof(nil) in the test.
> >
> > This should partially fix the linux bot. There is still one assertion
> > failure remaining, which I'll have to investigate separately, as I am
> > not experiencing it locally.
> >
> > Modified:
> >
>  lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/Makefile
> >
>  
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operator-overload/TestOperatorOverload.py
> >
> > 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=328083&r1=328082&r2=328083&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
> Wed Mar 21 02:43:50 2018
> > @@ -1,18 +1,8 @@
> >  LEVEL = ../../../make
> >
> >  CXX_SOURCES = a.cpp b.cpp
> > -CXXFLAGS_NO_DEBUGINFO = -c
> > -CXXFLAGS_DEBUGINFO = -c -g
> >
> > -all: main
> > -
> > -main: a.o b.o
> > -   $(CXX) $^ -o $@ $(LDFLAGS)
> > +include $(LEVEL)/Makefile.rules
> >
> >  a.o: a.cpp
> > -   $(CXX) $< $(CXXFLAGS_NO_DEBUGINFO) -o $@
> > -
> > -b.o: b.cpp
> > -   $(CXX) $< $(CXXFLAGS_DEBUGINFO) -o $@
> > -
> > -include $(LEVEL)/Makefile.rules
> > +   $(CC) $(CFLAGS_NO_DEBUG) -c $< -o $@
> >
>
> Thanks for fixing this! Only one comment.
> I originally wrote this in a way that `-g` is passed only to b.cpp
> (and not to a).
> I needed that flag just to set a breakpoint (and I'm not sure if it's
> still hit, or just happens to work).
> Did this preserve the exact same meaning for the test?
>
> Best,
>
> --
> Davide
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44693: Correctly handle float division in Scalar

2018-03-21 Thread Tom Tromey via Phabricator via lldb-commits
tromey added a comment.

I've also noticed that int->float conversion in Scalar seems incorrect.  At 
least, Scalar.h claims that Scalar follows C promotion rules, but int->float 
conversion is done using bitwise reinterpretation rather than preserving the 
value.  I have a patch for this, but I don't know whether or not it's correct 
to change.


https://reviews.llvm.org/D44693



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


[Lldb-commits] [PATCH] D44739: [SymbolFileDWARF] Replace FixedFormSizes with llvm::dwarf::getFixedFormByteSize

2018-03-21 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Looks fine. It would be nice to verify that there are no performance 
regressions due to this before making this change. Can you do some timings to 
make sure? Do anything that indexes a large C++ DWARF codebase, like clang, and 
make sure we don't regress by a significant amount.




Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:765-766
 size_t DWARFDebugInfoEntry::GetAttributes(
-const DWARFUnit *cu, DWARFFormValue::FixedFormSizes fixed_form_sizes,
+const DWARFUnit *cu,
+  llvm::dwarf::FormParams form_params,
 DWARFAttributes &attributes, uint32_t curr_depth) const {

formatting?


https://reviews.llvm.org/D44739



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


[Lldb-commits] [PATCH] D44693: Correctly handle float division in Scalar

2018-03-21 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Actually, we should add a test for this to ensure this doesn't regress.


https://reviews.llvm.org/D44693



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


[Lldb-commits] [PATCH] D44693: Correctly handle float division in Scalar

2018-03-21 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Seems like a unit test would work well in this case.


https://reviews.llvm.org/D44693



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


[Lldb-commits] [PATCH] D44693: Correctly handle float division in Scalar

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

Yes, this needs a test. Thanks!


https://reviews.llvm.org/D44693



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


[Lldb-commits] [PATCH] D44693: Correctly handle float division in Scalar

2018-03-21 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Bonus points for catching any other conversion errors that don't match the 
current C/C++ specs. The unit tests should be an easy place to test these kinds 
of things.


https://reviews.llvm.org/D44693



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