[Lldb-commits] [lldb] 5ac6106 - [lldb] Re-add NSDate formatter

2020-01-16 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-01-17T08:56:05+01:00
New Revision: 5ac610668a7cbde4e8d7106b03ecb218b823fb5c

URL: 
https://github.com/llvm/llvm-project/commit/5ac610668a7cbde4e8d7106b03ecb218b823fb5c
DIFF: 
https://github.com/llvm/llvm-project/commit/5ac610668a7cbde4e8d7106b03ecb218b823fb5c.diff

LOG: [lldb] Re-add NSDate formatter

This test had been overwritten by accident in 
ff75262f701da396a0d34d4f6b67cf8e4c9dc7c2.
This just readds the test with the correct content.

Added: 

lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py

Modified: 


Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
new file mode 100644
index ..5cfaa892bb62
--- /dev/null
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
@@ -0,0 +1,60 @@
+# encoding: utf-8
+"""
+Test lldb date formatter subsystem.
+"""
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+from ObjCDataFormatterTestCase import ObjCDataFormatterTestCase
+
+import datetime
+
+class ObjCDataFormatterNSDate(ObjCDataFormatterTestCase):
+
+@skipUnlessDarwin
+def test_nsdate_with_run_command(self):
+"""Test formatters for  NSDate."""
+self.appkit_tester_impl(self.nsdate_data_formatter_commands)
+
+def nsdate_data_formatter_commands(self):
+self.expect(
+'frame variable date1 date2',
+patterns=[
+'(1985-04-10|1985-04-11)',
+'(2011-01-01|2010-12-31)'])
+
+# this test might fail if we hit the breakpoint late on December 31st 
of some given year
+# and midnight comes between hitting the breakpoint and running this 
line of code
+# hopefully the output will be revealing enough in that case :-)
+now_year = '%s-' % str(datetime.datetime.now().year)
+
+self.expect('frame variable date3', substrs=[now_year])
+self.expect('frame variable date4', substrs=['1970'])
+self.expect('frame variable date5', substrs=[now_year])
+
+self.expect('frame variable date1_abs date2_abs',
+substrs=['1985-04', '2011-01'])
+
+self.expect('frame variable date3_abs', substrs=[now_year])
+self.expect('frame variable date4_abs', substrs=['1970'])
+self.expect('frame variable date5_abs', substrs=[now_year])
+
+self.expect('frame variable cupertino home europe',
+substrs=['@"America/Los_Angeles"',
+ '@"Europe/Rome"',
+ '@"Europe/Paris"'])
+
+self.expect('frame variable cupertino_ns home_ns europe_ns',
+substrs=['@"America/Los_Angeles"',
+ '@"Europe/Rome"',
+ '@"Europe/Paris"'])
+
+self.expect(
+'frame variable mut_bv',
+substrs=[
+'(CFMutableBitVectorRef) mut_bv = ',
+'1110 0110 1011  1101 1010 1000  0011 0101 1101 0001 
00'])



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


Re: [Lldb-commits] [lldb] 8d2f252 - lldb: Run TestCrossDSOTailCalls.py and TestCrossObjectTailCalls.py on Darwin only

2020-01-16 Thread Pavel Labath via lldb-commits
On 16/01/2020 23:49, v...@apple.com wrote:
> I've reverted this and just xfailed the tests on arm/aarch64 in 6c4d37733. 
> I'll keep an eye on the bots.
> 
> vedant
> 
Thanks.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 9dbd395 - [lldb] Remove ClangASTContext.h inclusion in Target.cpp

2020-01-16 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2020-01-16T22:43:10-08:00
New Revision: 9dbd395b9b8b5f0cb4d10fa05f6f3591d338e486

URL: 
https://github.com/llvm/llvm-project/commit/9dbd395b9b8b5f0cb4d10fa05f6f3591d338e486
DIFF: 
https://github.com/llvm/llvm-project/commit/9dbd395b9b8b5f0cb4d10fa05f6f3591d338e486.diff

LOG: [lldb] Remove ClangASTContext.h inclusion in Target.cpp

Target doesn't use ClangASTContext, it just needs
PersistentExpressionState. Replace ClangASTContext.h with
ExpressionVariable.h

Added: 


Modified: 
lldb/source/Target/Target.cpp

Removed: 




diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 83e6f3062666..1b691e1332b6 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -27,6 +27,7 @@
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Core/StructuredDataImpl.h"
 #include "lldb/Core/ValueObject.h"
+#include "lldb/Expression/ExpressionVariable.h"
 #include "lldb/Expression/REPL.h"
 #include "lldb/Expression/UserExpression.h"
 #include "lldb/Host/Host.h"
@@ -36,7 +37,6 @@
 #include "lldb/Interpreter/OptionGroupWatchpoint.h"
 #include "lldb/Interpreter/OptionValues.h"
 #include "lldb/Interpreter/Property.h"
-#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ClangASTImporter.h"
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/ObjectFile.h"



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


[Lldb-commits] [lldb] e1f6b68 - [lldb/Cmake] Add a CMakeLists.txt to the utils directory...

2020-01-16 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-16T22:31:01-08:00
New Revision: e1f6b68d1fd117b92953d2e21567dd8dad759a8b

URL: 
https://github.com/llvm/llvm-project/commit/e1f6b68d1fd117b92953d2e21567dd8dad759a8b
DIFF: 
https://github.com/llvm/llvm-project/commit/e1f6b68d1fd117b92953d2e21567dd8dad759a8b.diff

LOG: [lldb/Cmake] Add a CMakeLists.txt to the utils directory...

... and include it from the main CMakeLists.txt instead of including the
utility subdirectories directly. This is consistent with the other
subdirectories and limits the scope of future changes.

Added: 
lldb/utils/CMakeLists.txt

Modified: 
lldb/CMakeLists.txt

Removed: 




diff  --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index 573b8556989e..00b06119d64a 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -92,8 +92,7 @@ option(LLDB_INCLUDE_TESTS "Generate build targets for the 
LLDB unit tests." ${LL
 if(LLDB_INCLUDE_TESTS)
   add_subdirectory(test)
   add_subdirectory(unittests)
-  add_subdirectory(utils/lit-cpuid)
-  add_subdirectory(utils/lldb-dotest)
+  add_subdirectory(utils)
 endif()
 
 if (LLDB_ENABLE_PYTHON)

diff  --git a/lldb/utils/CMakeLists.txt b/lldb/utils/CMakeLists.txt
new file mode 100644
index ..d08f66f7b6c5
--- /dev/null
+++ b/lldb/utils/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_subdirectory(lit-cpuid)
+add_subdirectory(lldb-dotest)



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


[Lldb-commits] [lldb] 911a4c4 - [lldb/Test] Fix API tests for mutli-config generators

2020-01-16 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-16T22:25:55-08:00
New Revision: 911a4c4dda9b3e50d4b610d50cc6368433a67684

URL: 
https://github.com/llvm/llvm-project/commit/911a4c4dda9b3e50d4b610d50cc6368433a67684
DIFF: 
https://github.com/llvm/llvm-project/commit/911a4c4dda9b3e50d4b610d50cc6368433a67684.diff

LOG: [lldb/Test] Fix API tests for mutli-config generators

The build configuration wasn't properly substituted for the
config.lldb_executable variable. This broke when the variable was
extracted from config.dotest_args_str which was properly substituted.

Added: 


Modified: 
lldb/test/API/lit.site.cfg.py.in

Removed: 




diff  --git a/lldb/test/API/lit.site.cfg.py.in 
b/lldb/test/API/lit.site.cfg.py.in
index d7e2764f672e..a675c978750c 100644
--- a/lldb/test/API/lit.site.cfg.py.in
+++ b/lldb/test/API/lit.site.cfg.py.in
@@ -42,8 +42,10 @@ if dotest_lit_args_str:
 try:
 config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
 config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
-config.dotest_args_str = config.dotest_args_str % lit_config.params
+config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params
 config.llvm_build_mode = config.llvm_build_mode % lit_config.params
+config.lldb_executable = config.lldb_executable % lit_config.params
+config.dotest_args_str = config.dotest_args_str % lit_config.params
 except KeyError as e:
 key, = e.args
 lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % 
(key,key))



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


[Lldb-commits] [PATCH] D72898: [lldb] add to gdb to lldb doc

2020-01-16 Thread pre-merge checks [bot] via Phabricator via lldb-commits
merge_guards_bot added a comment.

{icon check-circle color=green} Unit tests: pass. 61936 tests passed, 0 failed 
and 783 were skipped.

{icon question-circle color=gray} clang-tidy: unknown.

{icon check-circle color=green} clang-format: pass.

Build artifacts 
: 
diff.json 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72898/new/

https://reviews.llvm.org/D72898



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


[Lldb-commits] [lldb] d3d7666 - [lldb/CMake] Remove duplicate entry

2020-01-16 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-16T20:08:55-08:00
New Revision: d3d778a227cc4eed5a2e60a08a87f027cafb

URL: 
https://github.com/llvm/llvm-project/commit/d3d778a227cc4eed5a2e60a08a87f027cafb
DIFF: 
https://github.com/llvm/llvm-project/commit/d3d778a227cc4eed5a2e60a08a87f027cafb.diff

LOG: [lldb/CMake] Remove duplicate entry

Added: 


Modified: 
lldb/test/API/CMakeLists.txt

Removed: 




diff  --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt
index 1ea2844c2fea..0fe88337ba58 100644
--- a/lldb/test/API/CMakeLists.txt
+++ b/lldb/test/API/CMakeLists.txt
@@ -165,7 +165,6 @@ if(LLDB_BUILT_STANDALONE)
   endif()
 endif()
 
-string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_DOTEST_ARGS 
"${LLDB_DOTEST_ARGS}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_DOTEST_ARGS 
"${LLDB_DOTEST_ARGS}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_SOURCE_DIR 
"${LLDB_SOURCE_DIR}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} 
LLDB_TEST_BUILD_DIRECTORY "${LLDB_TEST_BUILD_DIRECTORY}")



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


[Lldb-commits] [PATCH] D72898: [lldb] add to gdb to lldb doc

2020-01-16 Thread Cyndy Ishida via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG24fca5cd7128: [lldb] add to gdb to lldb doc (authored by 
cishida).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72898/new/

https://reviews.llvm.org/D72898

Files:
  lldb/docs/use/map.rst


Index: lldb/docs/use/map.rst
===
--- lldb/docs/use/map.rst
+++ lldb/docs/use/map.rst
@@ -609,6 +609,38 @@

  
 
+ 
+   Disable a breakpoint.
+ 
+ 
+   
+  (gdb) disable 1
+  
+   
+   
+  (lldb) breakpoint disable 1
+  
+  (lldb) br dis 1
+  
+   
+ 
+
+ 
+   Enable a breakpoint.
+ 
+ 
+   
+  (gdb) enable 1
+  
+   
+   
+  (lldb) breakpoint enable 1
+  
+  (lldb) br en 1
+  
+   
+ 
+
   

 


Index: lldb/docs/use/map.rst
===
--- lldb/docs/use/map.rst
+++ lldb/docs/use/map.rst
@@ -609,6 +609,38 @@

  
 
+ 
+   Disable a breakpoint.
+ 
+ 
+   
+  (gdb) disable 1
+  
+   
+   
+  (lldb) breakpoint disable 1
+  
+  (lldb) br dis 1
+  
+   
+ 
+
+ 
+   Enable a breakpoint.
+ 
+ 
+   
+  (gdb) enable 1
+  
+   
+   
+  (lldb) breakpoint enable 1
+  
+  (lldb) br en 1
+  
+   
+ 
+
   

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


[Lldb-commits] [lldb] 25cf941 - [lldb/CMake] Set LLVM_HOST_TRIPLE from TARGET_TRIPLE in standalone builds.

2020-01-16 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-16T20:06:25-08:00
New Revision: 25cf941275edacd5199550fef638005f2ecfd35b

URL: 
https://github.com/llvm/llvm-project/commit/25cf941275edacd5199550fef638005f2ecfd35b
DIFF: 
https://github.com/llvm/llvm-project/commit/25cf941275edacd5199550fef638005f2ecfd35b.diff

LOG: [lldb/CMake] Set LLVM_HOST_TRIPLE from TARGET_TRIPLE in standalone builds.

LLVMConfig doesn't export LLVM_HOST_TRIPLE, but it sets the
TARGET_TRIPLE based on this variable. So use that again for the compiler
invocations in the shell tests.

Added: 


Modified: 
lldb/test/CMakeLists.txt

Removed: 




diff  --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt
index 4d9dfa561782..21a0ca47b716 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -116,6 +116,10 @@ if(TARGET clang)
   endif()
 endif()
 
+if (LLDB_BUILT_STANDALONE)
+  set(LLVM_HOST_TRIPLE ${TARGET_TRIPLE})
+endif()
+
 add_lldb_test_dependency(
   lit-cpuid
   llc



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


[Lldb-commits] [lldb] 24fca5c - [lldb] add to gdb to lldb doc

2020-01-16 Thread Cyndy Ishida via lldb-commits

Author: Cyndy Ishida
Date: 2020-01-16T19:56:45-08:00
New Revision: 24fca5cd712800ef17fac8c6cc158f8075e014dc

URL: 
https://github.com/llvm/llvm-project/commit/24fca5cd712800ef17fac8c6cc158f8075e014dc
DIFF: 
https://github.com/llvm/llvm-project/commit/24fca5cd712800ef17fac8c6cc158f8075e014dc.diff

LOG: [lldb] add to gdb to lldb doc

Summary: * enabling and disabling a breakpoint were missing.

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: merge_guards_bot, jingham, dexonsmith, ributzka, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D72898

Added: 


Modified: 
lldb/docs/use/map.rst

Removed: 




diff  --git a/lldb/docs/use/map.rst b/lldb/docs/use/map.rst
index 3c6c6e6ffc62..0a785f2c0d9d 100644
--- a/lldb/docs/use/map.rst
+++ b/lldb/docs/use/map.rst
@@ -609,6 +609,38 @@ Breakpoint Commands

  
 
+ 
+   Disable a breakpoint.
+ 
+ 
+   
+  (gdb) disable 1
+  
+   
+   
+  (lldb) breakpoint disable 1
+  
+  (lldb) br dis 1
+  
+   
+ 
+
+ 
+   Enable a breakpoint.
+ 
+ 
+   
+  (gdb) enable 1
+  
+   
+   
+  (lldb) breakpoint enable 1
+  
+  (lldb) br en 1
+  
+   
+ 
+
   

 



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


[Lldb-commits] [PATCH] D72898: [lldb] add to gdb to lldb doc

2020-01-16 Thread Cyndy Ishida via Phabricator via lldb-commits
cishida updated this revision to Diff 238688.
cishida added a comment.

Updating to fix copy/paste error


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72898/new/

https://reviews.llvm.org/D72898

Files:
  lldb/docs/use/map.rst


Index: lldb/docs/use/map.rst
===
--- lldb/docs/use/map.rst
+++ lldb/docs/use/map.rst
@@ -609,6 +609,38 @@

  
 
+ 
+   Disable a breakpoint.
+ 
+ 
+   
+  (gdb) disable 1
+  
+   
+   
+  (lldb) breakpoint disable 1
+  
+  (lldb) br dis 1
+  
+   
+ 
+
+ 
+   Enable a breakpoint.
+ 
+ 
+   
+  (gdb) enable 1
+  
+   
+   
+  (lldb) breakpoint enable 1
+  
+  (lldb) br en 1
+  
+   
+ 
+
   

 


Index: lldb/docs/use/map.rst
===
--- lldb/docs/use/map.rst
+++ lldb/docs/use/map.rst
@@ -609,6 +609,38 @@

  
 
+ 
+   Disable a breakpoint.
+ 
+ 
+   
+  (gdb) disable 1
+  
+   
+   
+  (lldb) breakpoint disable 1
+  
+  (lldb) br dis 1
+  
+   
+ 
+
+ 
+   Enable a breakpoint.
+ 
+ 
+   
+  (gdb) enable 1
+  
+   
+   
+  (lldb) breakpoint enable 1
+  
+  (lldb) br en 1
+  
+   
+ 
+
   

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


[Lldb-commits] [PATCH] D72898: [lldb] add to gdb to lldb doc

2020-01-16 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM with Jim's comment addressed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72898/new/

https://reviews.llvm.org/D72898



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


[Lldb-commits] [PATCH] D72898: [lldb] add to gdb to lldb doc

2020-01-16 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

There's a copy paste error in the first header.  Other than that, this is fine, 
thanks for adding the entries!




Comment at: lldb/docs/use/map.rst:613
+ 
+   Enable a breakpoint.
+ 

Shouldn't that be "Disable" not "Enable"



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72898/new/

https://reviews.llvm.org/D72898



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


[Lldb-commits] [PATCH] D72898: [lldb] add to gdb to lldb doc

2020-01-16 Thread pre-merge checks [bot] via Phabricator via lldb-commits
merge_guards_bot added a comment.

{icon check-circle color=green} Unit tests: pass. 61936 tests passed, 0 failed 
and 783 were skipped.

{icon question-circle color=gray} clang-tidy: unknown.

{icon check-circle color=green} clang-format: pass.

Build artifacts 
: 
diff.json 
,
 clang-format.patch 
,
 CMakeCache.txt 
,
 console-log.txt 
,
 test-results.xml 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72898/new/

https://reviews.llvm.org/D72898



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


[Lldb-commits] [PATCH] D72898: [lldb] add to gdb to lldb doc

2020-01-16 Thread Cyndy Ishida via Phabricator via lldb-commits
cishida created this revision.
cishida added a reviewer: JDevlieghere.
Herald added subscribers: lldb-commits, ributzka, dexonsmith.
Herald added a project: LLDB.

- enabling and disabling a breakpoint were missing.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72898

Files:
  lldb/docs/use/map.rst


Index: lldb/docs/use/map.rst
===
--- lldb/docs/use/map.rst
+++ lldb/docs/use/map.rst
@@ -609,6 +609,38 @@

  
 
+ 
+   Enable a breakpoint.
+ 
+ 
+   
+  (gdb) disable 1
+  
+   
+   
+  (lldb) breakpoint disable 1
+  
+  (lldb) br dis 1
+  
+   
+ 
+
+ 
+   Enable a breakpoint.
+ 
+ 
+   
+  (gdb) enable 1
+  
+   
+   
+  (lldb) breakpoint enable 1
+  
+  (lldb) br en 1
+  
+   
+ 
+
   

 


Index: lldb/docs/use/map.rst
===
--- lldb/docs/use/map.rst
+++ lldb/docs/use/map.rst
@@ -609,6 +609,38 @@

  
 
+ 
+   Enable a breakpoint.
+ 
+ 
+   
+  (gdb) disable 1
+  
+   
+   
+  (lldb) breakpoint disable 1
+  
+  (lldb) br dis 1
+  
+   
+ 
+
+ 
+   Enable a breakpoint.
+ 
+ 
+   
+  (gdb) enable 1
+  
+   
+   
+  (lldb) breakpoint enable 1
+  
+  (lldb) br en 1
+  
+   
+ 
+
   

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


[Lldb-commits] [PATCH] D72748: [lldb/IOHandler] Change the way we manage IO handler

2020-01-16 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 238684.
JDevlieghere added a comment.

Use recursive mutex


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72748/new/

https://reviews.llvm.org/D72748

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/source/Core/Debugger.cpp

Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -895,23 +895,62 @@
 }
 
 void Debugger::RunIOHandlers() {
+  IOHandlerSP reader_sp = m_io_handler_stack.Top();
   while (true) {
-IOHandlerSP reader_sp(m_io_handler_stack.Top());
 if (!reader_sp)
   break;
 
 reader_sp->Run();
+{
+  std::lock_guard guard(
+  m_io_handler_synchronous_mutex);
+
+  // Remove all input readers that are done from the top of the stack
+  while (true) {
+IOHandlerSP top_reader_sp = m_io_handler_stack.Top();
+if (top_reader_sp && top_reader_sp->GetIsDone())
+  PopIOHandler(top_reader_sp);
+else
+  break;
+  }
+  reader_sp = m_io_handler_stack.Top();
+}
+  }
+  ClearIOHandlers();
+}
+
+void Debugger::RunIOHandlerSync(const IOHandlerSP _sp) {
+  std::lock_guard guard(m_io_handler_synchronous_mutex);
+
+  PushIOHandler(reader_sp);
+  IOHandlerSP top_reader_sp = reader_sp;
 
-// Remove all input readers that are done from the top of the stack
+  while (top_reader_sp) {
+if (!top_reader_sp)
+  break;
+
+top_reader_sp->Run();
+
+// Don't unwind past the starting point.
+if (top_reader_sp.get() == reader_sp.get()) {
+  if (PopIOHandler(reader_sp))
+break;
+}
+
+// If we pushed new IO handlers, pop them if they're done or restart the
+// loop to run them if they're not.
 while (true) {
-  IOHandlerSP top_reader_sp = m_io_handler_stack.Top();
-  if (top_reader_sp && top_reader_sp->GetIsDone())
+  top_reader_sp = m_io_handler_stack.Top();
+  if (top_reader_sp && top_reader_sp->GetIsDone()) {
 PopIOHandler(top_reader_sp);
-  else
+// Don't unwind past the starting point.
+if (top_reader_sp.get() == reader_sp.get())
+  return;
+  } else {
 break;
+  }
 }
   }
-  ClearIOHandlers();
 }
 
 bool Debugger::IsTopIOHandler(const lldb::IOHandlerSP _sp) {
@@ -950,28 +989,6 @@
   PushIOHandler(reader_sp, cancel_top_handler);
 }
 
-void Debugger::RunIOHandlerSync(const IOHandlerSP _sp) {
-  PushIOHandler(reader_sp);
-
-  IOHandlerSP top_reader_sp = reader_sp;
-  while (top_reader_sp) {
-top_reader_sp->Run();
-
-if (top_reader_sp.get() == reader_sp.get()) {
-  if (PopIOHandler(reader_sp))
-break;
-}
-
-while (true) {
-  top_reader_sp = m_io_handler_stack.Top();
-  if (top_reader_sp && top_reader_sp->GetIsDone())
-PopIOHandler(top_reader_sp);
-  else
-break;
-}
-  }
-}
-
 void Debugger::AdoptTopIOHandlerFilesIfInvalid(FileSP , StreamFileSP ,
StreamFileSP ) {
   // Before an IOHandler runs, it must have in/out/err streams. This function
Index: lldb/include/lldb/Core/Debugger.h
===
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -410,6 +410,8 @@
   m_script_interpreters;
 
   IOHandlerStack m_io_handler_stack;
+  std::recursive_mutex m_io_handler_synchronous_mutex;
+
   llvm::StringMap> m_log_streams;
   std::shared_ptr m_log_callback_stream_sp;
   ConstString m_instance_name;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D72879: Add testing for DW_OP_piece and fix a bug with small Scalar values.

2020-01-16 Thread Adrian Prantl via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7b0d58e339b2: Add testing for DW_OP_piece and fix a bug with 
small Scalar values. (authored by aprantl).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72879/new/

https://reviews.llvm.org/D72879

Files:
  lldb/source/Expression/DWARFExpression.cpp
  lldb/unittests/Expression/DWARFExpressionTest.cpp


Index: lldb/unittests/Expression/DWARFExpressionTest.cpp
===
--- lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -37,7 +37,22 @@
   /*object_address_ptr*/ nullptr, result, ))
 return status.ToError();
 
-  return result.GetScalar();
+  switch (result.GetValueType()) {
+  case Value::eValueTypeScalar:
+return result.GetScalar();
+  case Value::eValueTypeHostAddress: {
+// Convert small buffers to scalars to simplify the tests.
+DataBufferHeap  = result.GetBuffer();
+if (buf.GetByteSize() <= 8) {
+  uint64_t val = 0;
+  memcpy(, buf.GetBytes(), buf.GetByteSize());
+  return Scalar(llvm::APInt(buf.GetByteSize()*8, val, false));
+}
+  }
+LLVM_FALLTHROUGH;
+  default:
+return status.ToError();
+  }
 }
 
 /// A mock module holding an object file parsed from YAML.
@@ -335,3 +350,9 @@
   t.Eval({DW_OP_const1s, 'X', DW_OP_convert, 0x1d}).takeError(),
   llvm::Failed());
 }
+
+TEST(DWARFExpression, DW_OP_piece) {
+  EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const2u, 0x11, 0x22, DW_OP_piece, 2,
+ DW_OP_const2u, 0x33, 0x44, DW_OP_piece, 2}),
+   llvm::HasValue(GetScalar(32, 0x44332211, true)));
+}
Index: lldb/source/Expression/DWARFExpression.cpp
===
--- lldb/source/Expression/DWARFExpression.cpp
+++ lldb/source/Expression/DWARFExpression.cpp
@@ -2128,7 +2128,8 @@
   case Value::eValueTypeScalar: {
 uint32_t bit_size = piece_byte_size * 8;
 uint32_t bit_offset = 0;
-if (!curr_piece_source_value.GetScalar().ExtractBitfield(
+Scalar  = curr_piece_source_value.GetScalar();
+if (!scalar.ExtractBitfield(
 bit_size, bit_offset)) {
   if (error_ptr)
 error_ptr->SetErrorStringWithFormat(
@@ -2139,7 +2140,14 @@
 .GetByteSize());
   return false;
 }
-curr_piece = curr_piece_source_value;
+// Create curr_piece with bit_size. By default Scalar
+// grows to the nearest host integer type.
+llvm::APInt fail_value(1, 0, false);
+llvm::APInt ap_int = scalar.UInt128(fail_value);
+assert(ap_int.getBitWidth() >= bit_size);
+llvm::ArrayRef buf{ap_int.getRawData(),
+ ap_int.getNumWords()};
+curr_piece.GetScalar() = Scalar(llvm::APInt(bit_size, buf));
   } break;
 
   case Value::eValueTypeVector: {
@@ -2161,7 +2169,7 @@
   if (op_piece_offset == 0) {
 // This is the first piece, we should push it back onto the stack
 // so subsequent pieces will be able to access this piece and add
-// to it
+// to it.
 if (pieces.AppendDataToHostBuffer(curr_piece) == 0) {
   if (error_ptr)
 error_ptr->SetErrorString("failed to append piece data");
@@ -2169,7 +2177,7 @@
 }
   } else {
 // If this is the second or later piece there should be a value on
-// the stack
+// the stack.
 if (pieces.GetBuffer().GetByteSize() != op_piece_offset) {
   if (error_ptr)
 error_ptr->SetErrorStringWithFormat(


Index: lldb/unittests/Expression/DWARFExpressionTest.cpp
===
--- lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -37,7 +37,22 @@
   /*object_address_ptr*/ nullptr, result, ))
 return status.ToError();
 
-  return result.GetScalar();
+  switch (result.GetValueType()) {
+  case Value::eValueTypeScalar:
+return result.GetScalar();
+  case Value::eValueTypeHostAddress: {
+// Convert small buffers to scalars to simplify the tests.
+DataBufferHeap  = result.GetBuffer();
+if (buf.GetByteSize() <= 8) {
+  uint64_t val = 0;
+  memcpy(, buf.GetBytes(), buf.GetByteSize());
+  return Scalar(llvm::APInt(buf.GetByteSize()*8, val, false));
+}
+  }
+LLVM_FALLTHROUGH;
+  default:
+return status.ToError();
+  }
 }
 
 /// A mock module holding an object file parsed from YAML.
@@ -335,3 +350,9 @@
   t.Eval({DW_OP_const1s, 'X', DW_OP_convert, 0x1d}).takeError(),
   llvm::Failed());
 

[Lldb-commits] [PATCH] D72880: Fix a buffer-size bug when the first DW_OP_piece is undefined

2020-01-16 Thread Adrian Prantl via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf55ab6f90b73: Fix a buffer-size bug when the first 
DW_OP_piece is undefined (authored by aprantl).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72880/new/

https://reviews.llvm.org/D72880

Files:
  lldb/source/Expression/DWARFExpression.cpp
  lldb/unittests/Expression/DWARFExpressionTest.cpp


Index: lldb/unittests/Expression/DWARFExpressionTest.cpp
===
--- lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -355,4 +355,9 @@
   EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const2u, 0x11, 0x22, DW_OP_piece, 2,
  DW_OP_const2u, 0x33, 0x44, DW_OP_piece, 2}),
llvm::HasValue(GetScalar(32, 0x44332211, true)));
+  EXPECT_THAT_EXPECTED(
+  Evaluate({DW_OP_piece, 1, DW_OP_const1u, 0xff, DW_OP_piece, 1}),
+  // Note that the "00" should really be "undef", but we can't
+  // represent that yet.
+  llvm::HasValue(GetScalar(16, 0xff00, true)));
 }
Index: lldb/source/Expression/DWARFExpression.cpp
===
--- lldb/source/Expression/DWARFExpression.cpp
+++ lldb/source/Expression/DWARFExpression.cpp
@@ -2071,6 +2071,10 @@
   // not available. Fill with zeros for now by resizing the data and
   // appending it
   curr_piece.ResizeData(piece_byte_size);
+  // Note that "0" is not a correct value for the unknown bits.
+  // It would be better to also return a mask of valid bits together
+  // with the expression result, so the debugger can print missing
+  // members as "" or something.
   ::memset(curr_piece.GetBuffer().GetBytes(), 0, piece_byte_size);
   pieces.AppendDataToHostBuffer(curr_piece);
 } else {
@@ -2193,8 +2197,8 @@
   return false;
 }
   }
-  op_piece_offset += piece_byte_size;
 }
+op_piece_offset += piece_byte_size;
   }
 } break;
 


Index: lldb/unittests/Expression/DWARFExpressionTest.cpp
===
--- lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -355,4 +355,9 @@
   EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const2u, 0x11, 0x22, DW_OP_piece, 2,
  DW_OP_const2u, 0x33, 0x44, DW_OP_piece, 2}),
llvm::HasValue(GetScalar(32, 0x44332211, true)));
+  EXPECT_THAT_EXPECTED(
+  Evaluate({DW_OP_piece, 1, DW_OP_const1u, 0xff, DW_OP_piece, 1}),
+  // Note that the "00" should really be "undef", but we can't
+  // represent that yet.
+  llvm::HasValue(GetScalar(16, 0xff00, true)));
 }
Index: lldb/source/Expression/DWARFExpression.cpp
===
--- lldb/source/Expression/DWARFExpression.cpp
+++ lldb/source/Expression/DWARFExpression.cpp
@@ -2071,6 +2071,10 @@
   // not available. Fill with zeros for now by resizing the data and
   // appending it
   curr_piece.ResizeData(piece_byte_size);
+  // Note that "0" is not a correct value for the unknown bits.
+  // It would be better to also return a mask of valid bits together
+  // with the expression result, so the debugger can print missing
+  // members as "" or something.
   ::memset(curr_piece.GetBuffer().GetBytes(), 0, piece_byte_size);
   pieces.AppendDataToHostBuffer(curr_piece);
 } else {
@@ -2193,8 +2197,8 @@
   return false;
 }
   }
-  op_piece_offset += piece_byte_size;
 }
+op_piece_offset += piece_byte_size;
   }
 } break;
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] f55ab6f - Fix a buffer-size bug when the first DW_OP_piece is undefined

2020-01-16 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2020-01-16T16:47:59-08:00
New Revision: f55ab6f90b7317a6bb85303a6102702bdae1199e

URL: 
https://github.com/llvm/llvm-project/commit/f55ab6f90b7317a6bb85303a6102702bdae1199e
DIFF: 
https://github.com/llvm/llvm-project/commit/f55ab6f90b7317a6bb85303a6102702bdae1199e.diff

LOG: Fix a buffer-size bug when the first DW_OP_piece is undefined

and document the shortcomings of LLDB's partially defined DW_OP_piece
handling.

This would manifest as "DW_OP_piece for offset foo but top of stack is
of size bar".

rdar://problem/46262998

Differential Revision: https://reviews.llvm.org/D72880

Added: 


Modified: 
lldb/source/Expression/DWARFExpression.cpp
lldb/unittests/Expression/DWARFExpressionTest.cpp

Removed: 




diff  --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 6af0f371d00e..e09b1a5dba49 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -2071,6 +2071,10 @@ bool DWARFExpression::Evaluate(
   // not available. Fill with zeros for now by resizing the data and
   // appending it
   curr_piece.ResizeData(piece_byte_size);
+  // Note that "0" is not a correct value for the unknown bits.
+  // It would be better to also return a mask of valid bits together
+  // with the expression result, so the debugger can print missing
+  // members as "" or something.
   ::memset(curr_piece.GetBuffer().GetBytes(), 0, piece_byte_size);
   pieces.AppendDataToHostBuffer(curr_piece);
 } else {
@@ -2193,8 +2197,8 @@ bool DWARFExpression::Evaluate(
   return false;
 }
   }
-  op_piece_offset += piece_byte_size;
 }
+op_piece_offset += piece_byte_size;
   }
 } break;
 

diff  --git a/lldb/unittests/Expression/DWARFExpressionTest.cpp 
b/lldb/unittests/Expression/DWARFExpressionTest.cpp
index fe5e9c957ba0..45876152f029 100644
--- a/lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ b/lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -355,4 +355,9 @@ TEST(DWARFExpression, DW_OP_piece) {
   EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const2u, 0x11, 0x22, DW_OP_piece, 2,
  DW_OP_const2u, 0x33, 0x44, DW_OP_piece, 2}),
llvm::HasValue(GetScalar(32, 0x44332211, true)));
+  EXPECT_THAT_EXPECTED(
+  Evaluate({DW_OP_piece, 1, DW_OP_const1u, 0xff, DW_OP_piece, 1}),
+  // Note that the "00" should really be "undef", but we can't
+  // represent that yet.
+  llvm::HasValue(GetScalar(16, 0xff00, true)));
 }



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


[Lldb-commits] [lldb] 7b0d58e - Add testing for DW_OP_piece and fix a bug with small Scalar values.

2020-01-16 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2020-01-16T16:47:36-08:00
New Revision: 7b0d58e339b271e3b1d9dc14b781b57fa0262e3a

URL: 
https://github.com/llvm/llvm-project/commit/7b0d58e339b271e3b1d9dc14b781b57fa0262e3a
DIFF: 
https://github.com/llvm/llvm-project/commit/7b0d58e339b271e3b1d9dc14b781b57fa0262e3a.diff

LOG: Add testing for DW_OP_piece and fix a bug with small Scalar values.

By switching to Scalars that are backed by explicitly-sized APInts we
can avoid a bug that increases the buffer reserved for a small piece
to the next-largest host integer type.

This manifests as "DW_OP_piece for offset foo but top of stack is of size bar".

Differential Revision: https://reviews.llvm.org/D72879

Added: 


Modified: 
lldb/source/Expression/DWARFExpression.cpp
lldb/unittests/Expression/DWARFExpressionTest.cpp

Removed: 




diff  --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 5dc0a7f876f4..6af0f371d00e 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -2128,7 +2128,8 @@ bool DWARFExpression::Evaluate(
   case Value::eValueTypeScalar: {
 uint32_t bit_size = piece_byte_size * 8;
 uint32_t bit_offset = 0;
-if (!curr_piece_source_value.GetScalar().ExtractBitfield(
+Scalar  = curr_piece_source_value.GetScalar();
+if (!scalar.ExtractBitfield(
 bit_size, bit_offset)) {
   if (error_ptr)
 error_ptr->SetErrorStringWithFormat(
@@ -2139,7 +2140,14 @@ bool DWARFExpression::Evaluate(
 .GetByteSize());
   return false;
 }
-curr_piece = curr_piece_source_value;
+// Create curr_piece with bit_size. By default Scalar
+// grows to the nearest host integer type.
+llvm::APInt fail_value(1, 0, false);
+llvm::APInt ap_int = scalar.UInt128(fail_value);
+assert(ap_int.getBitWidth() >= bit_size);
+llvm::ArrayRef buf{ap_int.getRawData(),
+ ap_int.getNumWords()};
+curr_piece.GetScalar() = Scalar(llvm::APInt(bit_size, buf));
   } break;
 
   case Value::eValueTypeVector: {
@@ -2161,7 +2169,7 @@ bool DWARFExpression::Evaluate(
   if (op_piece_offset == 0) {
 // This is the first piece, we should push it back onto the stack
 // so subsequent pieces will be able to access this piece and add
-// to it
+// to it.
 if (pieces.AppendDataToHostBuffer(curr_piece) == 0) {
   if (error_ptr)
 error_ptr->SetErrorString("failed to append piece data");
@@ -2169,7 +2177,7 @@ bool DWARFExpression::Evaluate(
 }
   } else {
 // If this is the second or later piece there should be a value on
-// the stack
+// the stack.
 if (pieces.GetBuffer().GetByteSize() != op_piece_offset) {
   if (error_ptr)
 error_ptr->SetErrorStringWithFormat(

diff  --git a/lldb/unittests/Expression/DWARFExpressionTest.cpp 
b/lldb/unittests/Expression/DWARFExpressionTest.cpp
index 8fad88a93e11..fe5e9c957ba0 100644
--- a/lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ b/lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -37,7 +37,22 @@ static llvm::Expected 
Evaluate(llvm::ArrayRef expr,
   /*object_address_ptr*/ nullptr, result, ))
 return status.ToError();
 
-  return result.GetScalar();
+  switch (result.GetValueType()) {
+  case Value::eValueTypeScalar:
+return result.GetScalar();
+  case Value::eValueTypeHostAddress: {
+// Convert small buffers to scalars to simplify the tests.
+DataBufferHeap  = result.GetBuffer();
+if (buf.GetByteSize() <= 8) {
+  uint64_t val = 0;
+  memcpy(, buf.GetBytes(), buf.GetByteSize());
+  return Scalar(llvm::APInt(buf.GetByteSize()*8, val, false));
+}
+  }
+LLVM_FALLTHROUGH;
+  default:
+return status.ToError();
+  }
 }
 
 /// A mock module holding an object file parsed from YAML.
@@ -335,3 +350,9 @@ TEST(DWARFExpression, DW_OP_convert) {
   t.Eval({DW_OP_const1s, 'X', DW_OP_convert, 0x1d}).takeError(),
   llvm::Failed());
 }
+
+TEST(DWARFExpression, DW_OP_piece) {
+  EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const2u, 0x11, 0x22, DW_OP_piece, 2,
+ DW_OP_const2u, 0x33, 0x44, DW_OP_piece, 2}),
+   llvm::HasValue(GetScalar(32, 0x44332211, true)));
+}



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


[Lldb-commits] [lldb] 2671df9 - [lldb/Debugger] Rename ExecuteIOHandlers to RunIOHandlers (NFC)

2020-01-16 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-16T16:45:47-08:00
New Revision: 2671df9bd675d4a1a07457dce748f4fe939e95fb

URL: 
https://github.com/llvm/llvm-project/commit/2671df9bd675d4a1a07457dce748f4fe939e95fb
DIFF: 
https://github.com/llvm/llvm-project/commit/2671df9bd675d4a1a07457dce748f4fe939e95fb.diff

LOG: [lldb/Debugger] Rename ExecuteIOHandlers to RunIOHandlers (NFC)

This improves consistency among the related methods.

Added: 


Modified: 
lldb/include/lldb/Core/Debugger.h
lldb/source/Core/Debugger.cpp
lldb/source/Interpreter/CommandInterpreter.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 6ee39f62be98..26fc0ccb5f8e 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -309,7 +309,7 @@ class Debugger : public 
std::enable_shared_from_this,
 
   bool LoadPlugin(const FileSpec , Status );
 
-  void ExecuteIOHandlers();
+  void RunIOHandlers();
 
   bool IsForwardingEvents();
 

diff  --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index eafb64173f6a..7fb4baa29390 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -894,7 +894,7 @@ void Debugger::ClearIOHandlers() {
   }
 }
 
-void Debugger::ExecuteIOHandlers() {
+void Debugger::RunIOHandlers() {
   while (true) {
 IOHandlerSP reader_sp(m_io_handler_stack.Top());
 if (!reader_sp)
@@ -1551,7 +1551,7 @@ void Debugger::StopEventHandlerThread() {
 
 lldb::thread_result_t Debugger::IOHandlerThread(lldb::thread_arg_t arg) {
   Debugger *debugger = (Debugger *)arg;
-  debugger->ExecuteIOHandlers();
+  debugger->RunIOHandlers();
   debugger->StopEventHandlerThread();
   return {};
 }

diff  --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index 3701ee1d0d27..e583142a063e 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2943,7 +2943,7 @@ void CommandInterpreter::RunCommandInterpreter(
   if (spawn_thread) {
 m_debugger.StartIOHandlerThread();
   } else {
-m_debugger.ExecuteIOHandlers();
+m_debugger.RunIOHandlers();
 
 if (auto_handle_events)
   m_debugger.StopEventHandlerThread();



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


[Lldb-commits] [PATCH] D72855: Make LLVM_APPEND_VC_REV=OFF affect clang, lld, and lldb as well.

2020-01-16 Thread Nico Weber via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfb5fafb23cc2: Make LLVM_APPEND_VC_REV=OFF affect clang, lld, 
and lldb as well. (authored by thakis).
Herald added projects: clang, LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72855/new/

https://reviews.llvm.org/D72855

Files:
  clang/lib/Basic/CMakeLists.txt
  lld/Common/CMakeLists.txt
  lldb/source/CMakeLists.txt
  llvm/cmake/modules/LLVMConfig.cmake.in
  llvm/docs/CMake.rst


Index: llvm/docs/CMake.rst
===
--- llvm/docs/CMake.rst
+++ llvm/docs/CMake.rst
@@ -272,7 +272,7 @@
   Generate build targets for the LLVM benchmarks. Defaults to ON.
 
 **LLVM_APPEND_VC_REV**:BOOL
-  Embed version control revision info (svn revision number or Git revision id).
+  Embed version control revision info (Git revision id).
   The version info is provided by the ``LLVM_REVISION`` macro in
   ``llvm/include/llvm/Support/VCSRevision.h``. Developers using git who don't
   need revision info can disable this option to avoid re-linking most binaries
Index: llvm/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -78,6 +78,8 @@
 set(LLVM_INCLUDE_DIRS "@LLVM_CONFIG_INCLUDE_DIRS@")
 set(LLVM_LIBRARY_DIRS "@LLVM_CONFIG_LIBRARY_DIRS@")
 
+set(LLVM_APPEND_VC_REV "@LLVM_APPEND_VC_REV@")
+
 # These variables are duplicated for install tree but they have different
 # values for build tree.  LLVM_INCLUDE_DIRS contains both source
 # and generated include directories while the following variables have
Index: lldb/source/CMakeLists.txt
===
--- lldb/source/CMakeLists.txt
+++ lldb/source/CMakeLists.txt
@@ -18,14 +18,14 @@
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
 set(generate_vcs_version_script 
"${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
 
-if(lldb_vc)
+if(lldb_vc AND LLVM_APPEND_VC_REV)
   set(lldb_source_dir ${LLDB_SOURCE_DIR})
 endif()
 
 add_custom_command(OUTPUT "${version_inc}"
   DEPENDS "${lldb_vc}" "${generate_vcs_version_script}"
   COMMAND ${CMAKE_COMMAND} "-DNAMES=LLDB"
-   "-DLLDB_SOURCE_DIR=${LLDB_SOURCE_DIR}"
+   "-DLLDB_SOURCE_DIR=${lldb_source_dir}"
"-DHEADER_FILE=${version_inc}"
-P "${generate_vcs_version_script}")
 
Index: lld/Common/CMakeLists.txt
===
--- lld/Common/CMakeLists.txt
+++ lld/Common/CMakeLists.txt
@@ -8,14 +8,14 @@
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
 set(generate_vcs_version_script 
"${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
 
-if(lld_vc)
+if(lld_vc AND LLVM_APPEND_VC_REV)
   set(lld_source_dir ${LLD_SOURCE_DIR})
 endif()
 
 add_custom_command(OUTPUT "${version_inc}"
   DEPENDS "${lld_vc}" "${generate_vcs_version_script}"
   COMMAND ${CMAKE_COMMAND} "-DNAMES=LLD"
-  "-DLLD_SOURCE_DIR=${LLD_SOURCE_DIR}"
+  "-DLLD_SOURCE_DIR=${lld_source_dir}"
   "-DHEADER_FILE=${version_inc}"
   -P "${generate_vcs_version_script}")
 
Index: clang/lib/Basic/CMakeLists.txt
===
--- clang/lib/Basic/CMakeLists.txt
+++ clang/lib/Basic/CMakeLists.txt
@@ -12,10 +12,10 @@
 
 set(generate_vcs_version_script 
"${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
 
-if(llvm_vc)
+if(llvm_vc AND LLVM_APPEND_VC_REV)
   set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
 endif()
-if(clang_vc)
+if(clang_vc AND LLVM_APPEND_VC_REV)
   set(clang_source_dir ${CLANG_SOURCE_DIR})
 endif()
 


Index: llvm/docs/CMake.rst
===
--- llvm/docs/CMake.rst
+++ llvm/docs/CMake.rst
@@ -272,7 +272,7 @@
   Generate build targets for the LLVM benchmarks. Defaults to ON.
 
 **LLVM_APPEND_VC_REV**:BOOL
-  Embed version control revision info (svn revision number or Git revision id).
+  Embed version control revision info (Git revision id).
   The version info is provided by the ``LLVM_REVISION`` macro in
   ``llvm/include/llvm/Support/VCSRevision.h``. Developers using git who don't
   need revision info can disable this option to avoid re-linking most binaries
Index: llvm/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -78,6 +78,8 @@
 set(LLVM_INCLUDE_DIRS "@LLVM_CONFIG_INCLUDE_DIRS@")
 set(LLVM_LIBRARY_DIRS "@LLVM_CONFIG_LIBRARY_DIRS@")
 
+set(LLVM_APPEND_VC_REV "@LLVM_APPEND_VC_REV@")
+
 # These variables are duplicated for install tree but they have different
 # values for build tree.  LLVM_INCLUDE_DIRS contains both source
 # and generated include directories while the 

[Lldb-commits] [PATCH] D72880: Fix a buffer-size bug when the first DW_OP_piece is undefined

2020-01-16 Thread Vedant Kumar via Phabricator via lldb-commits
vsk accepted this revision.
vsk added a comment.
This revision is now accepted and ready to land.

LGTM, this seems like a clear improvement.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72880/new/

https://reviews.llvm.org/D72880



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


[Lldb-commits] [PATCH] D72880: Fix a buffer-size bug when the first DW_OP_piece is undefined

2020-01-16 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added inline comments.



Comment at: lldb/source/Expression/DWARFExpression.cpp:2077
+  // with the expression result, so the debugger can print missing
+  // members as "" or something.
   ::memset(curr_piece.GetBuffer().GetBytes(), 0, piece_byte_size);

FTR I'm not really sure this case is allowed by the dwarf standard. Under 
DW_OP_piece the standard references a "preceding simple location description" 
-- istm like an error if the stack is empty. My $0.0002 :) 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72880/new/

https://reviews.llvm.org/D72880



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


[Lldb-commits] [PATCH] D72879: Add testing for DW_OP_piece and fix a bug with small Scalar values.

2020-01-16 Thread Vedant Kumar via Phabricator via lldb-commits
vsk accepted this revision.
vsk added a comment.

LGTM. In the future it'd be nice to maybe split out piece/bit_piece handling 
into their own self-contained functions, and maybe share more code between 
them. But landing this narrow fix now sounds good.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72879/new/

https://reviews.llvm.org/D72879



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


[Lldb-commits] [PATCH] D72879: Add testing for DW_OP_piece and fix a bug with small Scalar values.

2020-01-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

> My understanding is that DW_OP_piece is still incomplete, right?

DW_OP_piece should work (with the documented caveat about the undefined values) 
fine, what definitely doesn't yet work is the combination of DW_OP_piece and 
DW_OP_bit_piece.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72879/new/

https://reviews.llvm.org/D72879



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


[Lldb-commits] [PATCH] D72855: Make LLVM_APPEND_VC_REV=OFF affect clang, lld, and lldb as well.

2020-01-16 Thread Reid Kleckner via Phabricator via lldb-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm




Comment at: llvm/cmake/modules/LLVMConfig.cmake.in:81
 
+set(LLVM_APPEND_VC_REV "@LLVM_APPEND_VC_REV@")
+

This here should make the standalone build configs work, I think.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72855/new/

https://reviews.llvm.org/D72855



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


[Lldb-commits] [PATCH] D72879: Add testing for DW_OP_piece and fix a bug with small Scalar values.

2020-01-16 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

Looks great! Thanks Adrian. My understanding is that `DW_OP_piece` is still 
incomplete, right?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72879/new/

https://reviews.llvm.org/D72879



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


[Lldb-commits] [PATCH] D72823: [Reproducers] Add a tool to transparently capture and replay lldb sessions

2020-01-16 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere marked an inline comment as done.
JDevlieghere added inline comments.



Comment at: lldb/utils/lldb-repro/lldb-repro.py:49
+# run again but this time every invocation of lldb replays the previously
+# recorded session.
+if __name__ == '__main__':

aprantl wrote:
> Thanks! Sorry for being such a nuisance, but I think this should be a 
> doc-comment (""") at the top of the file?
No worries, totally fair! 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72823/new/

https://reviews.llvm.org/D72823



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


[Lldb-commits] [PATCH] D72823: [Reproducers] Add a tool to transparently capture and replay lldb sessions

2020-01-16 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 238626.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72823/new/

https://reviews.llvm.org/D72823

Files:
  lldb/CMakeLists.txt
  lldb/test/Shell/Reproducer/lit.local.cfg
  lldb/test/Shell/helper/toolchain.py
  lldb/test/Shell/lit.cfg.py
  lldb/utils/lldb-repro/CMakeLists.txt
  lldb/utils/lldb-repro/lldb-repro.py

Index: lldb/utils/lldb-repro/lldb-repro.py
===
--- /dev/null
+++ lldb/utils/lldb-repro/lldb-repro.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+"""lldb-repro
+
+lldb-repro is a utility to transparently capture and replay debugger sessions
+through the command line driver. Its used to test the reproducers by running
+the test suite twice.
+
+During the first run, with LLDB_REPRO_UTIL_CAPTURE set, it captures a
+reproducer for every lldb invocation and saves it to a well-know location
+derived from the arguments and current working directory.
+
+During the second run, with LLDB_REPRO_UTIL_CAPTURE set, the test suite is run
+again but this time every invocation of lldb replays the previously recorded
+session.
+"""
+
+import sys
+import os
+import tempfile
+import subprocess
+
+
+def main():
+# Compute a hash based on the input arguments and the current working
+# directory.
+args = ' '.join(sys.argv[1:])
+cwd = os.getcwd()
+input_hash = str(hash((cwd, args)))
+
+# Use the hash to "uniquely" identify a reproducer path.
+reproducer_path = os.path.join(tempfile.gettempdir(), input_hash)
+
+# Create a new lldb invocation with capture or replay enabled.
+lldb = os.path.join(os.path.dirname(sys.argv[0]), 'lldb')
+new_args = [lldb]
+if 'LLDB_REPRO_UTIL_REPLAY' in os.environ:
+new_args.extend(['--replay', reproducer_path])
+elif 'LLDB_REPRO_UTIL_CAPTURE' in os.environ:
+new_args.extend([
+'--capture', '--capture-path', reproducer_path,
+'--reproducer-auto-generate'
+])
+new_args.extend(sys.argv[1:])
+else:
+print("error: enable capture or replay by setting the environment "
+  "variables LLDB_REPRO_UTIL_CAPTURE and LLDB_REPRO_UTIL_REPLAY "
+  "respectively")
+return 1
+
+return subprocess.call(new_args)
+
+
+if __name__ == '__main__':
+exit(main())
Index: lldb/utils/lldb-repro/CMakeLists.txt
===
--- /dev/null
+++ lldb/utils/lldb-repro/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_custom_target(lldb-repro)
+add_dependencies(lldb-repro lldb-test-deps)
+set_target_properties(lldb-repro PROPERTIES FOLDER "lldb utils")
+configure_file(lldb-repro.py ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-repro COPYONLY)
Index: lldb/test/Shell/lit.cfg.py
===
--- lldb/test/Shell/lit.cfg.py
+++ lldb/test/Shell/lit.cfg.py
@@ -38,16 +38,27 @@
 # test_exec_root: The root path where tests should be run.
 config.test_exec_root = os.path.join(config.lldb_obj_root, 'test')
 
-# Propagate LLDB_CAPTURE_REPRODUCER
+# Propagate reproducer environment vars.
 if 'LLDB_CAPTURE_REPRODUCER' in os.environ:
   config.environment['LLDB_CAPTURE_REPRODUCER'] = os.environ[
   'LLDB_CAPTURE_REPRODUCER']
 
+# Support running the test suite under the lldb-repro wrapper. This makes it
+# possible to capture a test suite run and then rerun all the test from the
+# just captured reproducer.
+run_under_lldb_repro = lit_config.params.get('lldb-run-with-repro', '').lower()
+if run_under_lldb_repro == "capture":
+  config.environment['LLDB_REPRO_UTIL_CAPTURE'] = '1'
+  toolchain.use_lldb_repro_substitutions(config)
+elif run_under_lldb_repro == "replay":
+  lit_config.note("Running Shell test from reproducer replay")
+  config.environment['LLDB_REPRO_UTIL_REPLAY'] = '1'
+  toolchain.use_lldb_repro_substitutions(config)
+
 llvm_config.use_default_substitutions()
 toolchain.use_lldb_substitutions(config)
 toolchain.use_support_substitutions(config)
 
-
 if re.match(r'^arm(hf.*-linux)|(.*-linux-gnuabihf)', config.target_triple):
 config.available_features.add("armhf-linux")
 
Index: lldb/test/Shell/helper/toolchain.py
===
--- lldb/test/Shell/helper/toolchain.py
+++ lldb/test/Shell/helper/toolchain.py
@@ -9,6 +9,11 @@
 from lit.llvm.subst import FindTool
 from lit.llvm.subst import ToolSubst
 
+
+def _lldb_init(config):
+return os.path.join(config.test_exec_root, 'Shell', 'lit-lldb-init')
+
+
 def use_lldb_substitutions(config):
 # Set up substitutions for primary tools.  These tools must come from config.lldb_tools_dir
 # which is basically the build output directory.  We do not want to find these in path or
@@ -29,7 +34,7 @@
 if config.llvm_libs_dir:
 build_script_args.append('--libs-dir={0}'.format(config.llvm_libs_dir))
 
-lldb_init = os.path.join(config.test_exec_root, 'Shell', 

Re: [Lldb-commits] [lldb] 8d2f252 - lldb: Run TestCrossDSOTailCalls.py and TestCrossObjectTailCalls.py on Darwin only

2020-01-16 Thread via lldb-commits
I've reverted this and just xfailed the tests on arm/aarch64 in 6c4d37733. I'll 
keep an eye on the bots.

vedant

> On Jan 16, 2020, at 6:58 AM, Pavel Labath  wrote:
> 
> On 15/01/2020 23:00, Vedant Kumar via lldb-commits wrote:
>> 
>> Author: Vedant Kumar
>> Date: 2020-01-15T14:00:05-08:00
>> New Revision: 8d2f252bb8e4d199be8498c4ee2245117ef08fd2
>> 
>> URL: 
>> https://github.com/llvm/llvm-project/commit/8d2f252bb8e4d199be8498c4ee2245117ef08fd2
>> DIFF: 
>> https://github.com/llvm/llvm-project/commit/8d2f252bb8e4d199be8498c4ee2245117ef08fd2.diff
>> 
>> LOG: lldb: Run TestCrossDSOTailCalls.py and TestCrossObjectTailCalls.py on 
>> Darwin only
>> 
> 
> That seems pretty drastic given that the test works fine on linux/x86.
> 
> Can you change that to xfail: arm (or xfail: arm-linux, if you're
> certain that the tests actually work on arm-macos)?
> 
> pl

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


[Lldb-commits] [lldb] 6c4d377 - lldb: xfail TestCrossDSOTailCalls.py and TestCrossObjectTailCalls.py on arm/aarch64

2020-01-16 Thread Vedant Kumar via lldb-commits

Author: Vedant Kumar
Date: 2020-01-16T14:48:51-08:00
New Revision: 6c4d37733403bf3fda260f1b05fc899427a61cdc

URL: 
https://github.com/llvm/llvm-project/commit/6c4d37733403bf3fda260f1b05fc899427a61cdc
DIFF: 
https://github.com/llvm/llvm-project/commit/6c4d37733403bf3fda260f1b05fc899427a61cdc.diff

LOG: lldb: xfail TestCrossDSOTailCalls.py and TestCrossObjectTailCalls.py on 
arm/aarch64

This effectively reverts commit
8d2f252bb8e4d199be8498c4ee2245117ef08fd2, which went a bit too far and
disabled these on all non-Darwin systems.

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/cross_dso/TestCrossDSOTailCalls.py

lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/cross_object/TestCrossObjectTailCalls.py

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/cross_dso/TestCrossDSOTailCalls.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/cross_dso/TestCrossDSOTailCalls.py
index 4581a75fa0a5..3f7e060a9c9c 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/cross_dso/TestCrossDSOTailCalls.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/cross_dso/TestCrossDSOTailCalls.py
@@ -17,7 +17,8 @@ def setUp(self):
 
 @skipIf(compiler="clang", compiler_version=['<', '8.0'])
 @skipIf(dwarf_version=['<', '4'])
-@skipUnlessDarwin # llvm.org/PR44561
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr26265")
+@expectedFailureAll(archs=['arm', 'aarch64'], bugnumber="llvm.org/PR44561")
 def test_cross_dso_tail_calls(self):
 self.build()
 exe = self.getBuildArtifact("a.out")

diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/cross_object/TestCrossObjectTailCalls.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/cross_object/TestCrossObjectTailCalls.py
index dcdf95911de2..e04ef96f2790 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/cross_object/TestCrossObjectTailCalls.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/cross_object/TestCrossObjectTailCalls.py
@@ -17,7 +17,8 @@ def setUp(self):
 
 @skipIf(compiler="clang", compiler_version=['<', '8.0'])
 @skipIf(dwarf_version=['<', '4'])
-@skipUnlessDarwin # llvm.org/PR44561
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr26265")
+@expectedFailureAll(archs=['arm', 'aarch64'], bugnumber="llvm.org/PR44561")
 def test_cross_object_tail_calls(self):
 self.build()
 exe = self.getBuildArtifact("a.out")



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


[Lldb-commits] [PATCH] D72823: [Reproducers] Add a tool to transparently capture and replay lldb sessions

2020-01-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lldb/utils/lldb-repro/lldb-repro.py:49
+# run again but this time every invocation of lldb replays the previously
+# recorded session.
+if __name__ == '__main__':

Thanks! Sorry for being such a nuisance, but I think this should be a 
doc-comment (""") at the top of the file?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72823/new/

https://reviews.llvm.org/D72823



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


[Lldb-commits] [PATCH] D72880: Fix a buffer-size bug when the first DW_OP_piece is undefined

2020-01-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: davide, friss, jasonmolenda.
Herald added a project: LLDB.

  Fix a buffer-size bug when the first DW_OP_piece is undefined and document 
the shortcomings of LLDB's partially defined DW_OP_piece  handling.


This would manifest as "DW_OP_piece for offset foo but top of stack is of size 
bar".

  

rdar://problem/46262998


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72880

Files:
  lldb/source/Expression/DWARFExpression.cpp
  lldb/unittests/Expression/DWARFExpressionTest.cpp


Index: lldb/unittests/Expression/DWARFExpressionTest.cpp
===
--- lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -355,4 +355,9 @@
   EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const2u, 0x11, 0x22, DW_OP_piece, 2,
  DW_OP_const2u, 0x33, 0x44, DW_OP_piece, 2}),
llvm::HasValue(GetScalar(32, 0x44332211, true)));
+  EXPECT_THAT_EXPECTED(
+  Evaluate({DW_OP_piece, 1, DW_OP_const1u, 0xff, DW_OP_piece, 1}),
+  // Note that the "00" should really be "undef", but we can't
+  // represent that yet.
+  llvm::HasValue(GetScalar(16, 0xff00, true)));
 }
Index: lldb/source/Expression/DWARFExpression.cpp
===
--- lldb/source/Expression/DWARFExpression.cpp
+++ lldb/source/Expression/DWARFExpression.cpp
@@ -2071,6 +2071,10 @@
   // not available. Fill with zeros for now by resizing the data and
   // appending it
   curr_piece.ResizeData(piece_byte_size);
+  // Note that "0" is not a correct value for the unknown bits.
+  // It would be better to also return a mask of valid bits together
+  // with the expression result, so the debugger can print missing
+  // members as "" or something.
   ::memset(curr_piece.GetBuffer().GetBytes(), 0, piece_byte_size);
   pieces.AppendDataToHostBuffer(curr_piece);
 } else {
@@ -2193,8 +2197,8 @@
   return false;
 }
   }
-  op_piece_offset += piece_byte_size;
 }
+op_piece_offset += piece_byte_size;
   }
 } break;
 


Index: lldb/unittests/Expression/DWARFExpressionTest.cpp
===
--- lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -355,4 +355,9 @@
   EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const2u, 0x11, 0x22, DW_OP_piece, 2,
  DW_OP_const2u, 0x33, 0x44, DW_OP_piece, 2}),
llvm::HasValue(GetScalar(32, 0x44332211, true)));
+  EXPECT_THAT_EXPECTED(
+  Evaluate({DW_OP_piece, 1, DW_OP_const1u, 0xff, DW_OP_piece, 1}),
+  // Note that the "00" should really be "undef", but we can't
+  // represent that yet.
+  llvm::HasValue(GetScalar(16, 0xff00, true)));
 }
Index: lldb/source/Expression/DWARFExpression.cpp
===
--- lldb/source/Expression/DWARFExpression.cpp
+++ lldb/source/Expression/DWARFExpression.cpp
@@ -2071,6 +2071,10 @@
   // not available. Fill with zeros for now by resizing the data and
   // appending it
   curr_piece.ResizeData(piece_byte_size);
+  // Note that "0" is not a correct value for the unknown bits.
+  // It would be better to also return a mask of valid bits together
+  // with the expression result, so the debugger can print missing
+  // members as "" or something.
   ::memset(curr_piece.GetBuffer().GetBytes(), 0, piece_byte_size);
   pieces.AppendDataToHostBuffer(curr_piece);
 } else {
@@ -2193,8 +2197,8 @@
   return false;
 }
   }
-  op_piece_offset += piece_byte_size;
 }
+op_piece_offset += piece_byte_size;
   }
 } break;
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D72879: Add testing for DW_OP_piece and fix a bug with small Scalar values.

2020-01-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: davide, friss, jasonmolenda.
Herald added a project: LLDB.

By switching to Scalars that are backed by explicitly-sized APInts we can avoid 
a bug that increases the buffer reserved for a small piece to the next-largest 
host integer type.

  

This manifests as "DW_OP_piece for offset foo but top of stack is of size bar".


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72879

Files:
  lldb/source/Expression/DWARFExpression.cpp
  lldb/unittests/Expression/DWARFExpressionTest.cpp


Index: lldb/unittests/Expression/DWARFExpressionTest.cpp
===
--- lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -37,7 +37,22 @@
   /*object_address_ptr*/ nullptr, result, ))
 return status.ToError();
 
-  return result.GetScalar();
+  switch (result.GetValueType()) {
+  case Value::eValueTypeScalar:
+return result.GetScalar();
+  case Value::eValueTypeHostAddress: {
+// Convert small buffers to scalars to simplify the tests.
+DataBufferHeap  = result.GetBuffer();
+if (buf.GetByteSize() <= 8) {
+  uint64_t val = 0;
+  memcpy(, buf.GetBytes(), buf.GetByteSize());
+  return Scalar(llvm::APInt(buf.GetByteSize()*8, val, false));
+}
+  }
+LLVM_FALLTHROUGH;
+  default:
+return status.ToError();
+  }
 }
 
 /// A mock module holding an object file parsed from YAML.
@@ -335,3 +350,9 @@
   t.Eval({DW_OP_const1s, 'X', DW_OP_convert, 0x1d}).takeError(),
   llvm::Failed());
 }
+
+TEST(DWARFExpression, DW_OP_piece) {
+  EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const2u, 0x11, 0x22, DW_OP_piece, 2,
+ DW_OP_const2u, 0x33, 0x44, DW_OP_piece, 2}),
+   llvm::HasValue(GetScalar(32, 0x44332211, true)));
+}
Index: lldb/source/Expression/DWARFExpression.cpp
===
--- lldb/source/Expression/DWARFExpression.cpp
+++ lldb/source/Expression/DWARFExpression.cpp
@@ -2128,7 +2128,8 @@
   case Value::eValueTypeScalar: {
 uint32_t bit_size = piece_byte_size * 8;
 uint32_t bit_offset = 0;
-if (!curr_piece_source_value.GetScalar().ExtractBitfield(
+Scalar  = curr_piece_source_value.GetScalar();
+if (!scalar.ExtractBitfield(
 bit_size, bit_offset)) {
   if (error_ptr)
 error_ptr->SetErrorStringWithFormat(
@@ -2139,7 +2140,14 @@
 .GetByteSize());
   return false;
 }
-curr_piece = curr_piece_source_value;
+// Create curr_piece with bit_size. By default Scalar
+// grows to the nearest host integer type.
+llvm::APInt fail_value(1, 0, false);
+llvm::APInt ap_int = scalar.UInt128(fail_value);
+assert(ap_int.getBitWidth() >= bit_size);
+llvm::ArrayRef buf{ap_int.getRawData(),
+ ap_int.getNumWords()};
+curr_piece.GetScalar() = Scalar(llvm::APInt(bit_size, buf));
   } break;
 
   case Value::eValueTypeVector: {
@@ -2161,7 +2169,7 @@
   if (op_piece_offset == 0) {
 // This is the first piece, we should push it back onto the stack
 // so subsequent pieces will be able to access this piece and add
-// to it
+// to it.
 if (pieces.AppendDataToHostBuffer(curr_piece) == 0) {
   if (error_ptr)
 error_ptr->SetErrorString("failed to append piece data");
@@ -2169,7 +2177,7 @@
 }
   } else {
 // If this is the second or later piece there should be a value on
-// the stack
+// the stack.
 if (pieces.GetBuffer().GetByteSize() != op_piece_offset) {
   if (error_ptr)
 error_ptr->SetErrorStringWithFormat(


Index: lldb/unittests/Expression/DWARFExpressionTest.cpp
===
--- lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -37,7 +37,22 @@
   /*object_address_ptr*/ nullptr, result, ))
 return status.ToError();
 
-  return result.GetScalar();
+  switch (result.GetValueType()) {
+  case Value::eValueTypeScalar:
+return result.GetScalar();
+  case Value::eValueTypeHostAddress: {
+// Convert small buffers to scalars to simplify the tests.
+DataBufferHeap  = result.GetBuffer();
+if (buf.GetByteSize() <= 8) {
+  uint64_t val = 0;
+  memcpy(, buf.GetBytes(), buf.GetByteSize());
+  return Scalar(llvm::APInt(buf.GetByteSize()*8, val, false));
+}
+  }
+LLVM_FALLTHROUGH;
+  default:
+return status.ToError();
+  }
 }
 
 /// A mock module holding an object file parsed from 

[Lldb-commits] [PATCH] D72813: Fixes to lldb's eLaunchFlagLaunchInTTY feature on macOS

2020-01-16 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

In D72813#1825006 , @clayborg wrote:

> ok if this works for now that is fine. Just close the socket_fd when we fail 
> to write the pid to the socket and this is good to go.


I mark it as close-on-exec so we don't need to close it explicitly (I was going 
to try to detect the closing of the socket up in lldb to get us closer to the 
new process being launched, but the existing Read method doesn't detect it)

I'm looking at whether we can special case the "darwin-debug execs a process, 
and that process is started suspended" handling in debugserver/lldb.  If we 
attach while darwin-debug is executing, then we get the exec mach exception, 
and the inferior has a suspend count of two -- one, because we stopped for the 
mach exception we just got, but a second suspend because darwin-debug asked for 
the inferior to be started suspended.  We need that second suspend count if we 
don't attach until after the inferior has been started.  So I might toss this 
entire approach; working on this some more.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72813/new/

https://reviews.llvm.org/D72813



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


[Lldb-commits] [PATCH] D72823: [Reproducers] Add a tool to transparently capture and replay lldb sessions

2020-01-16 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 238597.
JDevlieghere added a comment.

Add a comment explaining the purpose of the utility.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72823/new/

https://reviews.llvm.org/D72823

Files:
  lldb/CMakeLists.txt
  lldb/test/Shell/Reproducer/lit.local.cfg
  lldb/test/Shell/helper/toolchain.py
  lldb/test/Shell/lit.cfg.py
  lldb/utils/lldb-repro/CMakeLists.txt
  lldb/utils/lldb-repro/lldb-repro.py

Index: lldb/utils/lldb-repro/lldb-repro.py
===
--- /dev/null
+++ lldb/utils/lldb-repro/lldb-repro.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+import sys
+import os
+import tempfile
+import subprocess
+
+
+def main():
+# Compute a hash based on the input arguments and the current working
+# directory.
+args = ' '.join(sys.argv[1:])
+cwd = os.getcwd()
+input_hash = str(hash((cwd, args)))
+
+# Use the hash to "uniquely" identify a reproducer path.
+reproducer_path = os.path.join(tempfile.gettempdir(), input_hash)
+
+# Create a new lldb invocation with capture or replay enabled.
+lldb = os.path.join(os.path.dirname(sys.argv[0]), 'lldb')
+new_args = [lldb]
+if 'LLDB_REPRO_UTIL_REPLAY' in os.environ:
+new_args.extend(['--replay', reproducer_path])
+elif 'LLDB_REPRO_UTIL_CAPTURE' in os.environ:
+new_args.extend([
+'--capture', '--capture-path', reproducer_path,
+'--reproducer-auto-generate'
+])
+new_args.extend(sys.argv[1:])
+else:
+print("error: enable capture or replay by setting the environment "
+  "variables LLDB_REPRO_UTIL_CAPTURE and LLDB_REPRO_UTIL_REPLAY "
+  "respectively")
+return 1
+
+return subprocess.call(new_args)
+
+
+# lldb-repro is a utility to transparently capture and replay debugger sessions
+# through the command line driver. Its used to test the reproducers by running
+# the test suite twice.
+#
+# During the first run, with LLDB_REPRO_UTIL_CAPTURE set, it captures a
+# reproducer for every lldb invocation and saves it to a well-know location
+# derived from the arguments and current working directory.
+#
+# During the second run, with LLDB_REPRO_UTIL_CAPTURE set, the test suite is
+# run again but this time every invocation of lldb replays the previously
+# recorded session.
+if __name__ == '__main__':
+exit(main())
Index: lldb/utils/lldb-repro/CMakeLists.txt
===
--- /dev/null
+++ lldb/utils/lldb-repro/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_custom_target(lldb-repro)
+add_dependencies(lldb-repro lldb-test-deps)
+set_target_properties(lldb-repro PROPERTIES FOLDER "lldb utils")
+configure_file(lldb-repro.py ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-repro COPYONLY)
Index: lldb/test/Shell/lit.cfg.py
===
--- lldb/test/Shell/lit.cfg.py
+++ lldb/test/Shell/lit.cfg.py
@@ -38,16 +38,27 @@
 # test_exec_root: The root path where tests should be run.
 config.test_exec_root = os.path.join(config.lldb_obj_root, 'test')
 
-# Propagate LLDB_CAPTURE_REPRODUCER
+# Propagate reproducer environment vars.
 if 'LLDB_CAPTURE_REPRODUCER' in os.environ:
   config.environment['LLDB_CAPTURE_REPRODUCER'] = os.environ[
   'LLDB_CAPTURE_REPRODUCER']
 
+# Support running the test suite under the lldb-repro wrapper. This makes it
+# possible to capture a test suite run and then rerun all the test from the
+# just captured reproducer.
+run_under_lldb_repro = lit_config.params.get('lldb-run-with-repro', '').lower()
+if run_under_lldb_repro == "capture":
+  config.environment['LLDB_REPRO_UTIL_CAPTURE'] = '1'
+  toolchain.use_lldb_repro_substitutions(config)
+elif run_under_lldb_repro == "replay":
+  lit_config.note("Running Shell test from reproducer replay")
+  config.environment['LLDB_REPRO_UTIL_REPLAY'] = '1'
+  toolchain.use_lldb_repro_substitutions(config)
+
 llvm_config.use_default_substitutions()
 toolchain.use_lldb_substitutions(config)
 toolchain.use_support_substitutions(config)
 
-
 if re.match(r'^arm(hf.*-linux)|(.*-linux-gnuabihf)', config.target_triple):
 config.available_features.add("armhf-linux")
 
Index: lldb/test/Shell/helper/toolchain.py
===
--- lldb/test/Shell/helper/toolchain.py
+++ lldb/test/Shell/helper/toolchain.py
@@ -9,6 +9,11 @@
 from lit.llvm.subst import FindTool
 from lit.llvm.subst import ToolSubst
 
+
+def _lldb_init(config):
+return os.path.join(config.test_exec_root, 'Shell', 'lit-lldb-init')
+
+
 def use_lldb_substitutions(config):
 # Set up substitutions for primary tools.  These tools must come from config.lldb_tools_dir
 # which is basically the build output directory.  We do not want to find these in path or
@@ -29,7 +34,7 @@
 if config.llvm_libs_dir:
 

[Lldb-commits] [PATCH] D72813: Fixes to lldb's eLaunchFlagLaunchInTTY feature on macOS

2020-01-16 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

ok if this works for now that is fine. Just close the socket_fd when we fail to 
write the pid to the socket and this is good to go.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72813/new/

https://reviews.llvm.org/D72813



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


[Lldb-commits] [PATCH] D72823: [Reproducers] Add a tool to transparently capture and replay lldb sessions

2020-01-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lldb/utils/lldb-repro/lldb-repro.py:1
+#!/usr/bin/env python
+

Could we add a top-level comment (and/or a Usage: message) that explains what 
this tool is used for? That's not really obvious for someone who hasn't read 
the commit message.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72823/new/

https://reviews.llvm.org/D72823



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


[Lldb-commits] [lldb] 5f8e412 - [lldb/test] Exted test for CMTime data formatter

2020-01-16 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-16T11:58:34-08:00
New Revision: 5f8e4121882b61d289237bb27636c76a030a9627

URL: 
https://github.com/llvm/llvm-project/commit/5f8e4121882b61d289237bb27636c76a030a9627
DIFF: 
https://github.com/llvm/llvm-project/commit/5f8e4121882b61d289237bb27636c76a030a9627.diff

LOG: [lldb/test] Exted test for CMTime data formatter

Cover more cases handled by the formatter.

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/cmtime/TestDataFormatterCMTime.py

lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/cmtime/main.m

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/cmtime/TestDataFormatterCMTime.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/cmtime/TestDataFormatterCMTime.py
index 4c3935c851c5..8943f8313f3c 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/cmtime/TestDataFormatterCMTime.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/cmtime/TestDataFormatterCMTime.py
@@ -30,10 +30,24 @@ def test_nsindexpath_with_run_command(self):
 
 self.expect(
 'frame variable t1',
+substrs=[
+'1 half seconds', 'value = 1', 'timescale = 2', 'epoch = 0'
+])
+self.expect(
+'frame variable t2',
+substrs=[
+'1 third of a second', 'value = 1', 'timescale = 3',
+'epoch = 0'
+])
+self.expect(
+'frame variable t3',
 substrs=[
 '1 10th of a second', 'value = 1', 'timescale = 10',
 'epoch = 0'
 ])
 self.expect(
-'frame variable t2',
+'frame variable t4',
 substrs=['10 seconds', 'value = 10', 'timescale = 1', 'epoch = 0'])
+self.expect('frame variable t5', '-oo')
+self.expect('frame variable t6', '+oo')
+self.expect('frame variable t7', 'indefinite')

diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/cmtime/main.m
 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/cmtime/main.m
index ecf7648c3f98..f32a347278bc 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/cmtime/main.m
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/cmtime/main.m
@@ -12,11 +12,24 @@ int main(int argc, const char **argv)
 {
 @autoreleasepool
 {
-CMTime t1 = CMTimeMake(1, 10);
-CMTime t2 = CMTimeMake(10, 1);
+CMTime t1 = CMTimeMake(1, 2);
+CMTime t2 = CMTimeMake(1, 3);
+CMTime t3 = CMTimeMake(1, 10);
+CMTime t4 = CMTimeMake(10, 1);
+CMTime t5 = CMTimeMake(10, 1);
+t5.flags = kCMTimeFlags_PositiveInfinity;
+CMTime t6 = CMTimeMake(10, 1);
+t6.flags = kCMTimeFlags_NegativeInfinity;
+CMTime t7 = CMTimeMake(10, 1);
+t7.flags = kCMTimeFlags_Indefinite;
 
 CMTimeShow(t1); // break here
 CMTimeShow(t2);
+CMTimeShow(t3);
+CMTimeShow(t4);
+CMTimeShow(t5);
+CMTimeShow(t6);
+CMTimeShow(t7);
 }
 return 0;
 }



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


[Lldb-commits] [PATCH] D72823: [Reproducers] Add a tool to transparently capture and replay lldb sessions

2020-01-16 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 238554.
JDevlieghere added a comment.

- Convert to Python
- Integrate with lit


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72823/new/

https://reviews.llvm.org/D72823

Files:
  lldb/CMakeLists.txt
  lldb/test/Shell/Reproducer/lit.local.cfg
  lldb/test/Shell/helper/toolchain.py
  lldb/test/Shell/lit.cfg.py
  lldb/utils/lldb-repro/CMakeLists.txt
  lldb/utils/lldb-repro/lldb-repro.py

Index: lldb/utils/lldb-repro/lldb-repro.py
===
--- /dev/null
+++ lldb/utils/lldb-repro/lldb-repro.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+import sys
+import os
+import tempfile
+import subprocess
+
+
+def main():
+# Compute a hash based on the input arguments and the current working
+# directory.
+args = ' '.join(sys.argv[1:])
+cwd = os.getcwd()
+input_hash = str(hash((cwd, args)))
+
+# Use the hash to "uniquely" identify a reproducer path.
+reproducer_path = os.path.join(tempfile.gettempdir(), input_hash)
+
+# Create a new lldb invocation with capture or replay enabled.
+lldb = os.path.join(os.path.dirname(sys.argv[0]), 'lldb')
+new_args = [lldb]
+if 'LLDB_REPRO_UTIL_REPLAY' in os.environ:
+new_args.extend(['--replay', reproducer_path])
+elif 'LLDB_REPRO_UTIL_CAPTURE' in os.environ:
+new_args.extend([
+'--capture', '--capture-path', reproducer_path,
+'--reproducer-auto-generate'
+])
+new_args.extend(sys.argv[1:])
+else:
+print("error: enable capture or replay by setting the environment "
+  "variables LLDB_REPRO_UTIL_CAPTURE and LLDB_REPRO_UTIL_REPLAY "
+  "respectively")
+return 1
+
+return subprocess.call(new_args)
+
+
+if __name__ == '__main__':
+exit(main())
Index: lldb/utils/lldb-repro/CMakeLists.txt
===
--- /dev/null
+++ lldb/utils/lldb-repro/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_custom_target(lldb-repro)
+add_dependencies(lldb-repro lldb-test-deps)
+set_target_properties(lldb-repro PROPERTIES FOLDER "lldb utils")
+configure_file(lldb-repro.py ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-repro COPYONLY)
Index: lldb/test/Shell/lit.cfg.py
===
--- lldb/test/Shell/lit.cfg.py
+++ lldb/test/Shell/lit.cfg.py
@@ -38,16 +38,27 @@
 # test_exec_root: The root path where tests should be run.
 config.test_exec_root = os.path.join(config.lldb_obj_root, 'test')
 
-# Propagate LLDB_CAPTURE_REPRODUCER
+# Propagate reproducer environment vars.
 if 'LLDB_CAPTURE_REPRODUCER' in os.environ:
   config.environment['LLDB_CAPTURE_REPRODUCER'] = os.environ[
   'LLDB_CAPTURE_REPRODUCER']
 
+# Support running the test suite under the lldb-repro wrapper. This makes it
+# possible to capture a test suite run and then rerun all the test from the
+# just captured reproducer.
+run_under_lldb_repro = lit_config.params.get('lldb-run-with-repro', '').lower()
+if run_under_lldb_repro == "capture":
+  config.environment['LLDB_REPRO_UTIL_CAPTURE'] = '1'
+  toolchain.use_lldb_repro_substitutions(config)
+elif run_under_lldb_repro == "replay":
+  lit_config.note("Running Shell test from reproducer replay")
+  config.environment['LLDB_REPRO_UTIL_REPLAY'] = '1'
+  toolchain.use_lldb_repro_substitutions(config)
+
 llvm_config.use_default_substitutions()
 toolchain.use_lldb_substitutions(config)
 toolchain.use_support_substitutions(config)
 
-
 if re.match(r'^arm(hf.*-linux)|(.*-linux-gnuabihf)', config.target_triple):
 config.available_features.add("armhf-linux")
 
Index: lldb/test/Shell/helper/toolchain.py
===
--- lldb/test/Shell/helper/toolchain.py
+++ lldb/test/Shell/helper/toolchain.py
@@ -9,6 +9,11 @@
 from lit.llvm.subst import FindTool
 from lit.llvm.subst import ToolSubst
 
+
+def _lldb_init(config):
+return os.path.join(config.test_exec_root, 'Shell', 'lit-lldb-init')
+
+
 def use_lldb_substitutions(config):
 # Set up substitutions for primary tools.  These tools must come from config.lldb_tools_dir
 # which is basically the build output directory.  We do not want to find these in path or
@@ -29,7 +34,7 @@
 if config.llvm_libs_dir:
 build_script_args.append('--libs-dir={0}'.format(config.llvm_libs_dir))
 
-lldb_init = os.path.join(config.test_exec_root, 'Shell', 'lit-lldb-init')
+lldb_init = _lldb_init(config)
 
 primary_tools = [
 ToolSubst('%lldb',
@@ -135,3 +140,15 @@
  'llvm-objcopy', 'lli']
 additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir]
 llvm_config.add_tool_substitutions(support_tools, additional_tool_dirs)
+
+def use_lldb_repro_substitutions(config):
+lldb_init = _lldb_init(config)
+substitutions = [
+ToolSubst('%lldb',
+  command=FindTool('lldb-repro'),
+  

[Lldb-commits] [lldb] c0d909a - Delete control character from comment. (NFC)

2020-01-16 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2020-01-16T10:44:07-08:00
New Revision: c0d909a1b12fd646f7dbca3cd098ff7e278d7446

URL: 
https://github.com/llvm/llvm-project/commit/c0d909a1b12fd646f7dbca3cd098ff7e278d7446
DIFF: 
https://github.com/llvm/llvm-project/commit/c0d909a1b12fd646f7dbca3cd098ff7e278d7446.diff

LOG: Delete control character from comment. (NFC)

Added: 


Modified: 
lldb/source/Expression/DWARFExpression.cpp

Removed: 




diff  --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 69c84640ef93..5dc0a7f876f4 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -933,7 +933,7 @@ bool DWARFExpression::Evaluate(
   Value tmp;
   uint32_t reg_num;
 
-  /// Insertion point for evaluating multi-piece expression.
+  /// Insertion point for evaluating multi-piece expression.
   uint64_t op_piece_offset = 0;
   Value pieces; // Used for DW_OP_piece
 



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


[Lldb-commits] [lldb] ee05138 - [lldb/test] Revert changes to debug-names-compressed.cpp

2020-01-16 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-01-16T18:56:26+01:00
New Revision: ee05138515abee2a349ad2fdc8320ab17ddfde12

URL: 
https://github.com/llvm/llvm-project/commit/ee05138515abee2a349ad2fdc8320ab17ddfde12
DIFF: 
https://github.com/llvm/llvm-project/commit/ee05138515abee2a349ad2fdc8320ab17ddfde12.diff

LOG: [lldb/test] Revert changes to debug-names-compressed.cpp

With the changes in 15a6df52efa, the test is failing in some
configurations. Reverting while I investigate

Added: 


Modified: 
lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp
index 4dcbb4715220..aeb0ff1d01b1 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp
@@ -3,15 +3,12 @@
 
 // REQUIRES: lld, zlib
 
-// RUN: %clang -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames %s
+// RUN: %clang -g -c -o %t.o --target=x86_64-pc-linux -mllvm 
-accel-tables=Dwarf %s
 // RUN: ld.lld %t.o -o %t --compress-debug-sections=zlib
-// RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES
 // RUN: lldb-test symbols --find=variable --name=foo %t | FileCheck %s
 
-// NAMES: Name: .debug_names
-
 // CHECK: Found 1 variables:
 int foo;
-// CHECK-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = 
debug-names-compressed.cpp:[[@LINE-1]]
+// ONE-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = 
debug-names-compressed.cpp:[[@LINE-1]]
 
 extern "C" void _start() {}



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


[Lldb-commits] [PATCH] D72823: [Reproducers] Add a tool to transparently capture and replay lldb sessions

2020-01-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lldb/tools/lldb-repro/lldb-repro.h.cmake:5
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//

aprantl wrote:
> Out of curiosity, is the `Copyright 2020` line part of the recommended 
> default file header?
To answer my own question: 
https://www.llvm.org/docs/CodingStandards.html#file-headers

No, that's a Swift-lldb-ism. That's great because those lines are annoying to 
keep up to date anyway.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72823/new/

https://reviews.llvm.org/D72823



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


[Lldb-commits] [PATCH] D72650: [LLDB] Add SymbolVendorWasm plugin for WebAssembly debugging

2020-01-16 Thread Derek Schuff via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9b3254dbf9f6: [LLDB] Add SymbolVendorWasm plugin for 
WebAssembly debugging (authored by paolosev, committed by dschuff).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72650/new/

https://reviews.llvm.org/D72650

Files:
  lldb/source/API/SystemInitializerFull.cpp
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
  lldb/source/Plugins/SymbolVendor/CMakeLists.txt
  lldb/source/Plugins/SymbolVendor/wasm/CMakeLists.txt
  lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp
  lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.h
  lldb/test/Shell/ObjectFile/wasm/unified-debug-sections.yaml
  lldb/tools/lldb-test/SystemInitializerTest.cpp

Index: lldb/tools/lldb-test/SystemInitializerTest.cpp
===
--- lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -76,6 +76,7 @@
 #include "Plugins/SymbolFile/PDB/SymbolFilePDB.h"
 #include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
 #include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
+#include "Plugins/SymbolVendor/wasm/SymbolVendorWasm.h"
 #include "Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h"
 #include "Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h"
 #include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h"
@@ -201,6 +202,7 @@
   SymbolFileDWARF::Initialize();
   SymbolFilePDB::Initialize();
   SymbolFileSymtab::Initialize();
+  wasm::SymbolVendorWasm::Initialize();
   UnwindAssemblyInstEmulation::Initialize();
   UnwindAssembly_x86::Initialize();
   EmulateInstructionARM64::Initialize();
@@ -288,6 +290,7 @@
   SymbolFileDWARF::Terminate();
   SymbolFilePDB::Terminate();
   SymbolFileSymtab::Terminate();
+  wasm::SymbolVendorWasm::Terminate();
   UnwindAssembly_x86::Terminate();
   UnwindAssemblyInstEmulation::Terminate();
   EmulateInstructionARM64::Terminate();
Index: lldb/test/Shell/ObjectFile/wasm/unified-debug-sections.yaml
===
--- /dev/null
+++ lldb/test/Shell/ObjectFile/wasm/unified-debug-sections.yaml
@@ -0,0 +1,85 @@
+# RUN: yaml2obj -docnum=1 %s > test.wasm
+# RUN: yaml2obj -docnum=2 %s > test_sym.wasm
+# RUN: lldb-test object-file test.wasm | FileCheck %s
+
+# This test checks that SymbolVendorWasm correctly loads DWARF debug sections
+# that have been stripped out into a separated Wasm module. The original Wasm
+# module contains a "external_debug_info" custom section with the absolute or
+# relative path of the debug module.
+
+# CHECK: Plugin name: wasm
+# CHECK: Architecture: wasm32-unknown-unknown-wasm
+# CHECK: UUID: 
+# CHECK: Executable: true
+# CHECK: Stripped: true
+# CHECK: Type: executable
+# CHECK: Strata: user
+# CHECK: Base VM address: 0xa
+
+# CHECK: Name: code
+# CHECK: Type: code
+# CHECK: VM address: 0x0
+# CHECK: VM size: 56
+# CHECK: File size: 56
+
+# CHECK: Name: .debug_info
+# CHECK: Type: dwarf-info
+# CHECK: VM address: 0x0
+# CHECK: VM size: 0
+# CHECK: File size: 2
+
+# CHECK: Name: .debug_abbrev
+# CHECK: Type: dwarf-abbrev
+# CHECK: VM address: 0x0
+# CHECK: VM size: 0
+# CHECK: File size: 2
+
+# CHECK: Name: .debug_line
+# CHECK: Type: dwarf-line
+# CHECK: VM address: 0x0
+# CHECK: VM size: 0
+# CHECK: File size: 2
+
+# CHECK: Name: .debug_str
+# CHECK: Type: dwarf-str
+# CHECK: VM address: 0x0
+# CHECK: VM size: 0
+# CHECK: File size: 3
+
+--- !WASM
+FileHeader:
+  Version: 0x0001
+Sections:
+  - Type:CODE
+Functions:
+  - Index:   0
+Locals:
+  - Type:I32
+Count:   6
+Body:238080808000210141102102200120026B21032003200036020C200328020C2104200328020C2105200420056C210620060F0B
+  - Type:CUSTOM
+Name:external_debug_info
+Payload: 0D746573745F73796D2E7761736D  # test_sym.wasm
+
+...
+
+
+--- !WASM
+FileHeader:
+  Version: 0x0001
+Sections:
+
+  - Type:CUSTOM
+Name:.debug_info
+Payload: 4C00
+  - Type:CUSTOM
+Name:.debug_abbrev
+Payload: 0111
+  - Type:CUSTOM
+Name:.debug_line
+Payload: 5100
+  - Type:CUSTOM
+Name:.debug_str
+Payload: 636CFF
+
+...
Index: lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.h
===
--- /dev/null
+++ lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.h
@@ -0,0 +1,44 @@
+//===-- SymbolVendorWasm.h --*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// 

[Lldb-commits] [lldb] d34e415 - [LLDB] Convert Plugins/ObjectFile/wasm/ObjectFileWasm.h to unix line endings

2020-01-16 Thread Derek Schuff via lldb-commits

Author: Derek Schuff
Date: 2020-01-16T09:38:37-08:00
New Revision: d34e4152e3e057b311d7d6c0c93dc30fa76aa94f

URL: 
https://github.com/llvm/llvm-project/commit/d34e4152e3e057b311d7d6c0c93dc30fa76aa94f
DIFF: 
https://github.com/llvm/llvm-project/commit/d34e4152e3e057b311d7d6c0c93dc30fa76aa94f.diff

LOG: [LLDB] Convert Plugins/ObjectFile/wasm/ObjectFileWasm.h to unix line 
endings

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h 
b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
index 65d237e20450..36ef56fe2cce 100644
--- a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
+++ b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
@@ -1,153 +1,153 @@
-//===-- ObjectFileWasm.h *- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#ifndef LLDB_PLUGINS_OBJECTFILE_WASM_OBJECTFILEWASM_H
-#define LLDB_PLUGINS_OBJECTFILE_WASM_OBJECTFILEWASM_H
-
-#include "lldb/Symbol/ObjectFile.h"
-#include "lldb/Utility/ArchSpec.h"
-
-namespace lldb_private {
-namespace wasm {
-
-/// Generic Wasm object file reader.
-///
-/// This class provides a generic wasm32 reader plugin implementing the
-/// ObjectFile protocol.
-class ObjectFileWasm : public ObjectFile {
-public:
-  static void Initialize();
-  static void Terminate();
-
-  static ConstString GetPluginNameStatic();
-  static const char *GetPluginDescriptionStatic() {
-return "WebAssembly object file reader.";
-  }
-
-  static ObjectFile *
-  CreateInstance(const lldb::ModuleSP _sp, lldb::DataBufferSP _sp,
- lldb::offset_t data_offset, const FileSpec *file,
- lldb::offset_t file_offset, lldb::offset_t length);
-
-  static ObjectFile *CreateMemoryInstance(const lldb::ModuleSP _sp,
-  lldb::DataBufferSP _sp,
-  const lldb::ProcessSP _sp,
-  lldb::addr_t header_addr);
-
-  static size_t GetModuleSpecifications(const FileSpec ,
-lldb::DataBufferSP _sp,
-lldb::offset_t data_offset,
-lldb::offset_t file_offset,
-lldb::offset_t length,
-ModuleSpecList );
-
-  /// PluginInterface protocol.
-  /// \{
-  ConstString GetPluginName() override { return GetPluginNameStatic(); }
-  uint32_t GetPluginVersion() override { return 1; }
-  /// \}
-
-  /// LLVM RTTI support
-  /// \{
-  static char ID;
-  bool isA(const void *ClassID) const override {
-return ClassID ==  || ObjectFile::isA(ClassID);
-  }
-  static bool classof(const ObjectFile *obj) { return obj->isA(); }
-  /// \}
-
-  /// ObjectFile Protocol.
-  /// \{
-  bool ParseHeader() override;
-
-  lldb::ByteOrder GetByteOrder() const override {
-return m_arch.GetByteOrder();
-  }
-
-  bool IsExecutable() const override { return true; }
-
-  uint32_t GetAddressByteSize() const override {
-return m_arch.GetAddressByteSize();
-  }
-
-  AddressClass GetAddressClass(lldb::addr_t file_addr) override {
-return AddressClass::eInvalid;
-  }
-
-  Symtab *GetSymtab() override;
-
-  bool IsStripped() override { return true; }
-
-  void CreateSections(SectionList _section_list) override;
-
-  void Dump(Stream *s) override;
-
-  ArchSpec GetArchitecture() override { return m_arch; }
-
-  UUID GetUUID() override { return m_uuid; }
-
-  uint32_t GetDependentModules(FileSpecList ) override { return 0; }
-
-  Type CalculateType() override { return eTypeExecutable; }
-
-  Strata CalculateStrata() override { return eStrataUser; }
-
-  bool SetLoadAddress(lldb_private::Target , lldb::addr_t value,
-  bool value_is_offset) override;
-
-  lldb_private::Address GetBaseAddress() override {
-return IsInMemory() ? Address(m_memory_addr + m_code_section_offset)
-: Address(m_code_section_offset);
-  }
-  /// \}
-
-  /// A Wasm module that has external DWARF debug information should contain a
-  /// custom section named "external_debug_info", whose payload is an UTF-8
-  /// encoded string that points to a Wasm module that contains the debug
-  /// information for this module.
-  llvm::Optional GetExternalDebugInfoFileSpec();
-
-private:
-  ObjectFileWasm(const lldb::ModuleSP _sp, lldb::DataBufferSP _sp,
- lldb::offset_t data_offset, const FileSpec *file,
- lldb::offset_t offset, lldb::offset_t length);
-  

[Lldb-commits] [lldb] 9b3254d - [LLDB] Add SymbolVendorWasm plugin for WebAssembly debugging

2020-01-16 Thread Derek Schuff via lldb-commits

Author: Paolo Severini
Date: 2020-01-16T09:36:17-08:00
New Revision: 9b3254dbf9f6624c772db7cfa7a3c29a0b94be8e

URL: 
https://github.com/llvm/llvm-project/commit/9b3254dbf9f6624c772db7cfa7a3c29a0b94be8e
DIFF: 
https://github.com/llvm/llvm-project/commit/9b3254dbf9f6624c772db7cfa7a3c29a0b94be8e.diff

LOG: [LLDB] Add SymbolVendorWasm plugin for WebAssembly debugging

Add plugin class SymbolVendorWasm, with the logic to manage debug symbols
for Wasm modules.

Reviewers: clayborg, labath, aprantl, sbc100, teemperor

Reviewed By: labath

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D72650

Added: 
lldb/source/Plugins/SymbolVendor/wasm/CMakeLists.txt
lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp
lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.h
lldb/test/Shell/ObjectFile/wasm/unified-debug-sections.yaml

Modified: 
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
lldb/source/Plugins/SymbolVendor/CMakeLists.txt
lldb/tools/lldb-test/SystemInitializerTest.cpp

Removed: 




diff  --git a/lldb/source/API/SystemInitializerFull.cpp 
b/lldb/source/API/SystemInitializerFull.cpp
index 2c567974891c..2bc53af91d00 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -95,6 +95,7 @@
 #include "Plugins/SymbolFile/PDB/SymbolFilePDB.h"
 #include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
 #include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
+#include "Plugins/SymbolVendor/wasm/SymbolVendorWasm.h"
 #include "Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h"
 #include "Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h"
 #include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h"
@@ -242,6 +243,7 @@ llvm::Error SystemInitializerFull::Initialize() {
   SymbolFileDWARF::Initialize();
   SymbolFilePDB::Initialize();
   SymbolFileSymtab::Initialize();
+  wasm::SymbolVendorWasm::Initialize();
   UnwindAssemblyInstEmulation::Initialize();
   UnwindAssembly_x86::Initialize();
 
@@ -334,6 +336,7 @@ void SystemInitializerFull::Terminate() {
   ThreadSanitizerRuntime::Terminate();
   UndefinedBehaviorSanitizerRuntime::Terminate();
   MainThreadCheckerRuntime::Terminate();
+  wasm::SymbolVendorWasm::Terminate();
   SymbolVendorELF::Terminate();
   breakpad::SymbolFileBreakpad::Terminate();
   SymbolFileDWARF::Terminate();

diff  --git a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp 
b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
index 2c918a8f9db3..bd4c3597b066 100644
--- a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
+++ b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
@@ -72,6 +72,8 @@ GetWasmString(llvm::DataExtractor , 
llvm::DataExtractor::Cursor ) {
   return ConstString(str);
 }
 
+char ObjectFileWasm::ID;
+
 void ObjectFileWasm::Initialize() {
   PluginManager::RegisterPlugin(GetPluginNameStatic(),
 GetPluginDescriptionStatic(), CreateInstance,
@@ -177,6 +179,9 @@ bool ObjectFileWasm::DecodeNextSection(lldb::offset_t 
*offset_ptr) {
 return false;
 
   if (section_id == llvm::wasm::WASM_SEC_CUSTOM) {
+// Custom sections have the id 0. Their contents consist of a name
+// identifying the custom section, followed by an uninterpreted sequence
+// of bytes.
 lldb::offset_t prev_offset = c.tell();
 llvm::Optional sect_name = GetWasmString(data, c);
 if (!sect_name)
@@ -389,6 +394,24 @@ DataExtractor ObjectFileWasm::ReadImageData(uint64_t 
offset, size_t size) {
   return data;
 }
 
+llvm::Optional ObjectFileWasm::GetExternalDebugInfoFileSpec() {
+  static ConstString g_sect_name_external_debug_info("external_debug_info");
+
+  for (const section_info _info : m_sect_infos) {
+if (g_sect_name_external_debug_info == sect_info.name) {
+  const uint32_t kBufferSize = 1024;
+  DataExtractor section_header_data =
+  ReadImageData(sect_info.offset, kBufferSize);
+  llvm::DataExtractor data = section_header_data.GetAsLLVM();
+  llvm::DataExtractor::Cursor c(0);
+  llvm::Optional symbols_url = GetWasmString(data, c);
+  if (symbols_url)
+return FileSpec(symbols_url->GetStringRef());
+}
+  }
+  return llvm::None;
+}
+
 void ObjectFileWasm::Dump(Stream *s) {
   ModuleSP module_sp(GetModule());
   if (!module_sp)

diff  --git a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h 
b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
index 986f7f9f1679..65d237e20450 100644
--- a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
+++ b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
@@ -52,6 +52,15 @@ class ObjectFileWasm : public ObjectFile {
   uint32_t GetPluginVersion() override { return 1; }
   /// \}
 
+  /// LLVM RTTI support
+  /// \{
+  static char ID;
+  bool 

[Lldb-commits] [PATCH] D72823: [Reproducers] Add a tool to transparently capture and replay lldb sessions

2020-01-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lldb/test/Shell/lit.cfg.py:42-46
 if 'LLDB_CAPTURE_REPRODUCER' in os.environ:
   config.environment['LLDB_CAPTURE_REPRODUCER'] = os.environ[
   'LLDB_CAPTURE_REPRODUCER']
+if 'LLDB_REPRO_CAPTURE' in os.environ:
+  config.environment['LLDB_REPRO_CAPTURE'] = os.environ['LLDB_REPRO_CAPTURE']

JDevlieghere wrote:
> labath wrote:
> > The difference between these two is super-unclear. Any chance to unify them?
> Not really, one is for the tool, the other is to enable reproducer capture by 
> default. They're totally orthogonal, but I agree it's confusing. 
How about adding this as a comment here?



Comment at: lldb/tools/lldb-repro/lldb-repro.cpp:25
+  const unsigned hash = djbHash(cwd);
+  return djbHash(args, hash);
+}

`hash_combine()`?



Comment at: lldb/tools/lldb-repro/lldb-repro.h.cmake:5
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//

Out of curiosity, is the `Copyright 2020` line part of the recommended default 
file header?


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72823/new/

https://reviews.llvm.org/D72823



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


Re: [Lldb-commits] [lldb] 15a6df5 - [lldb/DWARF/test] Freshen up debug_names tests

2020-01-16 Thread Adrian Prantl via lldb-commits
It looks like this broke on green dragon:

http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/5907/

http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/5907/testReport/junit/lldb-shell/SymbolFile_DWARF/debug_names_compressed_cpp/

Script:
--
: 'RUN: at line 6';   
/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/bin/clang 
--target=specify-a-target-or-use-a-_host-substitution -c -o 
/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/tools/lldb/test/SymbolFile/DWARF/Output/debug-names-compressed.cpp.tmp.o
 --target=x86_64-pc-linux -gdwarf-5 -gpubnames 
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp
: 'RUN: at line 7';   
/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/bin/ld.lld 
/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/tools/lldb/test/SymbolFile/DWARF/Output/debug-names-compressed.cpp.tmp.o
 -o 
/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/tools/lldb/test/SymbolFile/DWARF/Output/debug-names-compressed.cpp.tmp
 --compress-debug-sections=zlib
: 'RUN: at line 8';   
/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/bin/llvm-readobj 
--sections 
/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/tools/lldb/test/SymbolFile/DWARF/Output/debug-names-compressed.cpp.tmp
 | /Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/bin/FileCheck 
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp
 --check-prefix NAMES
: 'RUN: at line 9';   
/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/bin/lldb-test symbols 
--find=variable --name=foo 
/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/tools/lldb/test/SymbolFile/DWARF/Output/debug-names-compressed.cpp.tmp
 | /Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/bin/FileCheck 
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp
--
Exit Code: 1

Command Output (stderr):
--
b'/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp:15:15:
 error: CHECK-DAG: expected string not found in input\n// CHECK-DAG: name = 
"foo", type = {{.*}} (int), {{.*}} decl = 
debug-names-compressed.cpp:[[@LINE-1]]\n  ^\n:3:1: note: 
scanning from here\n0x7f9c96308c58: Variable{0x7fff0023}, name = "foo", 
type = {7fff002e} 0x7F9C96311718 (int), scope = global, decl = 
\xff\xff\xff\xff\x11:14, location = DW_OP_addrx 0x0, external\n:3:1: 
note: with "@LINE-1" equal to "14"\n0x7f9c96308c58: 
Variable{0x7fff0023}, name = "foo", type = {7fff002e} 
0x7F9C96311718 (int), scope = global, decl = \xff\xff\xff\xff\x11:14, 
location = DW_OP_addrx 0x0, external\n'
--



> On Jan 16, 2020, at 7:31 AM, Pavel Labath via lldb-commits 
>  wrote:
> 
> 
> Author: Pavel Labath
> Date: 2020-01-16T16:25:49+01:00
> New Revision: 15a6df52efaa74308bfdcd03718a84ac893b40d8
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/15a6df52efaa74308bfdcd03718a84ac893b40d8
> DIFF: 
> https://github.com/llvm/llvm-project/commit/15a6df52efaa74308bfdcd03718a84ac893b40d8.diff
> 
> LOG: [lldb/DWARF/test] Freshen up debug_names tests
> 
> These tests used "clang -mllvm -accel-tables=Dwarf" as a way to
> guarantee that clang will emit the debug_names table. Unfortunately,
> a change it clang made that insufficient (-gpubnames is required now
> too), which rendered these tests ineffective. Since lldb automatically
> falls back to the manual index, the tests didn't fail and this change
> went largely unnoticed.
> 
> This patch updates the tests to really use debug_names (-gdwarf-5
> -gpubnames) is the combination that works now, and it adds additional
> checks to ensure the section is actually emitted.
> 
> Fortunately, no regressions crept in while these tests were disabled.
> 
> Added: 
> 
> 
> Modified: 
>
> lldb/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py
>lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp
>lldb/test/Shell/SymbolFile/DWARF/dwarf5-index-is-used.cpp
>lldb/test/Shell/SymbolFile/DWARF/dwarf5-partial-index.cpp
>lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp
>lldb/test/Shell/SymbolFile/DWARF/find-basic-namespace.cpp
>lldb/test/Shell/SymbolFile/DWARF/find-basic-type.cpp
>lldb/test/Shell/SymbolFile/DWARF/find-basic-variable.cpp
>lldb/test/Shell/SymbolFile/DWARF/find-function-regex.cpp
>lldb/test/Shell/SymbolFile/DWARF/find-method.cpp
>lldb/test/Shell/SymbolFile/DWARF/find-variable-dwo.cpp
>lldb/test/Shell/SymbolFile/DWARF/find-variable-file.cpp
> 
> Removed: 
> 
> 
> 
> 
> diff  --git 
> a/lldb/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py
>  
> 

[Lldb-commits] [PATCH] D72823: [Reproducers] Add a tool to transparently capture and replay lldb sessions

2020-01-16 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere marked 4 inline comments as done.
JDevlieghere added a comment.

In D72823#1824152 , @labath wrote:

> Considered making this a python script?


I think that makes sense




Comment at: lldb/test/Shell/lit.cfg.py:42-46
 if 'LLDB_CAPTURE_REPRODUCER' in os.environ:
   config.environment['LLDB_CAPTURE_REPRODUCER'] = os.environ[
   'LLDB_CAPTURE_REPRODUCER']
+if 'LLDB_REPRO_CAPTURE' in os.environ:
+  config.environment['LLDB_REPRO_CAPTURE'] = os.environ['LLDB_REPRO_CAPTURE']

labath wrote:
> The difference between these two is super-unclear. Any chance to unify them?
Not really, one is for the tool, the other is to enable reproducer capture by 
default. They're totally orthogonal, but I agree it's confusing. 



Comment at: lldb/tools/lldb-repro/lldb-repro.cpp:23
+
+unsigned ComputerHash(StringRef args, StringRef cwd) {
+  const unsigned hash = djbHash(cwd);

labath wrote:
> Is the `r` in the name intentional?
Nope, this is a typo



Comment at: lldb/tools/lldb-repro/lldb-repro.cpp:63
+args.push_back(repro_dir.c_str());
+args.push_back("--reproducer-auto-generate");
+

labath wrote:
> I am wondering if this shouldn't even be the default behavior. If I already 
> passed `--capture` to lldb then it does not seem unreasonable to always write 
> it out when lldb exits (we already do it after a crash, right?)
My ultimate goal is to have reproducers enabled by default. The capture flag is 
just away to make that behavior opt-in for now. You might use it to get a 
reproducer on a crash, but you don't necessary want to keep all reproducers 
around otherwise. 



Comment at: lldb/tools/lldb-repro/lldb-repro.h.cmake:12
+
+#cmakedefine LLDB_TEST_EXECUTABLE "${LLDB_TEST_EXECUTABLE}"
+

labath wrote:
> labath wrote:
> > Are you sure this will work fine with multi-config generators? You might be 
> > better off just relying on the fact that the lldb executable will sit right 
> > next to this binary...
> Actually how, is this thing going to be invoked exactly? Couldn't the path to 
> lldb be passed simply as argv[1]?
It just needs patching up like lldb-dotest and lit. Assuming you mean 
`argv[0]`, it think we could make that work if I replace "%lldb" with a path to 
lldb-repro.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72823/new/

https://reviews.llvm.org/D72823



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


[Lldb-commits] [lldb] 2664676 - [lldb/Scripts] Remove swig_bot_lib/__init__.py

2020-01-16 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-16T09:15:41-08:00
New Revision: 26646761e2bf41eebcf58e09a6f9bb85b94ec3f6

URL: 
https://github.com/llvm/llvm-project/commit/26646761e2bf41eebcf58e09a6f9bb85b94ec3f6
DIFF: 
https://github.com/llvm/llvm-project/commit/26646761e2bf41eebcf58e09a6f9bb85b94ec3f6.diff

LOG: [lldb/Scripts] Remove swig_bot_lib/__init__.py

Added: 


Modified: 


Removed: 
lldb/scripts/swig_bot_lib/__init__.py



diff  --git a/lldb/scripts/swig_bot_lib/__init__.py 
b/lldb/scripts/swig_bot_lib/__init__.py
deleted file mode 100644
index e69de29bb2d1..



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


[Lldb-commits] [PATCH] D72855: Make LLVM_APPEND_VC_REV=OFF affect clang, lld, and lldb as well.

2020-01-16 Thread Nico Weber via Phabricator via lldb-commits
thakis added a comment.

A very late follow-up to my question in D37272 
 :)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72855/new/

https://reviews.llvm.org/D72855



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


[Lldb-commits] [PATCH] D72855: Make LLVM_APPEND_VC_REV=OFF affect clang, lld, and lldb as well.

2020-01-16 Thread Nico Weber via Phabricator via lldb-commits
thakis created this revision.
thakis added a reviewer: rnk.
Herald added a subscriber: mgorny.
Herald added a project: LLVM.
thakis added a comment.

A very late follow-up to my question in D37272 
 :)


When LLVM_APPEND_VC_REV=OFF is set, the current git hash is no
longer embedded into binaries (mostly for --version output).
Without it, most binaries need to relink after every single
commit, even if they didn't change otherwise (due to, say,
a documentation-only commit).

LLVM_APPEND_VC_REV is ON by default, so this doesn't change the
default behavior of anything.

With this, all clients of GenerateVersionFromVCS.cmake honor
LLVM_APPEND_VC_REV.


https://reviews.llvm.org/D72855

Files:
  clang/lib/Basic/CMakeLists.txt
  lld/Common/CMakeLists.txt
  lldb/source/CMakeLists.txt
  llvm/cmake/modules/LLVMConfig.cmake.in
  llvm/docs/CMake.rst


Index: llvm/docs/CMake.rst
===
--- llvm/docs/CMake.rst
+++ llvm/docs/CMake.rst
@@ -272,7 +272,7 @@
   Generate build targets for the LLVM benchmarks. Defaults to ON.
 
 **LLVM_APPEND_VC_REV**:BOOL
-  Embed version control revision info (svn revision number or Git revision id).
+  Embed version control revision info (Git revision id).
   The version info is provided by the ``LLVM_REVISION`` macro in
   ``llvm/include/llvm/Support/VCSRevision.h``. Developers using git who don't
   need revision info can disable this option to avoid re-linking most binaries
Index: llvm/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -78,6 +78,8 @@
 set(LLVM_INCLUDE_DIRS "@LLVM_CONFIG_INCLUDE_DIRS@")
 set(LLVM_LIBRARY_DIRS "@LLVM_CONFIG_LIBRARY_DIRS@")
 
+set(LLVM_APPEND_VC_REV "@LLVM_APPEND_VC_REV@")
+
 # These variables are duplicated for install tree but they have different
 # values for build tree.  LLVM_INCLUDE_DIRS contains both source
 # and generated include directories while the following variables have
Index: lldb/source/CMakeLists.txt
===
--- lldb/source/CMakeLists.txt
+++ lldb/source/CMakeLists.txt
@@ -18,14 +18,14 @@
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
 set(generate_vcs_version_script 
"${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
 
-if(lldb_vc)
+if(lldb_vc AND LLVM_APPEND_VC_REV)
   set(lldb_source_dir ${LLDB_SOURCE_DIR})
 endif()
 
 add_custom_command(OUTPUT "${version_inc}"
   DEPENDS "${lldb_vc}" "${generate_vcs_version_script}"
   COMMAND ${CMAKE_COMMAND} "-DNAMES=LLDB"
-   "-DLLDB_SOURCE_DIR=${LLDB_SOURCE_DIR}"
+   "-DLLDB_SOURCE_DIR=${lldb_source_dir}"
"-DHEADER_FILE=${version_inc}"
-P "${generate_vcs_version_script}")
 
Index: lld/Common/CMakeLists.txt
===
--- lld/Common/CMakeLists.txt
+++ lld/Common/CMakeLists.txt
@@ -8,14 +8,14 @@
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
 set(generate_vcs_version_script 
"${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
 
-if(lld_vc)
+if(lld_vc AND LLVM_APPEND_VC_REV)
   set(lld_source_dir ${LLD_SOURCE_DIR})
 endif()
 
 add_custom_command(OUTPUT "${version_inc}"
   DEPENDS "${lld_vc}" "${generate_vcs_version_script}"
   COMMAND ${CMAKE_COMMAND} "-DNAMES=LLD"
-  "-DLLD_SOURCE_DIR=${LLD_SOURCE_DIR}"
+  "-DLLD_SOURCE_DIR=${lld_source_dir}"
   "-DHEADER_FILE=${version_inc}"
   -P "${generate_vcs_version_script}")
 
Index: clang/lib/Basic/CMakeLists.txt
===
--- clang/lib/Basic/CMakeLists.txt
+++ clang/lib/Basic/CMakeLists.txt
@@ -12,10 +12,10 @@
 
 set(generate_vcs_version_script 
"${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
 
-if(llvm_vc)
+if(llvm_vc AND LLVM_APPEND_VC_REV)
   set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
 endif()
-if(clang_vc)
+if(clang_vc AND LLVM_APPEND_VC_REV)
   set(clang_source_dir ${CLANG_SOURCE_DIR})
 endif()
 


Index: llvm/docs/CMake.rst
===
--- llvm/docs/CMake.rst
+++ llvm/docs/CMake.rst
@@ -272,7 +272,7 @@
   Generate build targets for the LLVM benchmarks. Defaults to ON.
 
 **LLVM_APPEND_VC_REV**:BOOL
-  Embed version control revision info (svn revision number or Git revision id).
+  Embed version control revision info (Git revision id).
   The version info is provided by the ``LLVM_REVISION`` macro in
   ``llvm/include/llvm/Support/VCSRevision.h``. Developers using git who don't
   need revision info can disable this option to avoid re-linking most binaries
Index: llvm/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -78,6 

[Lldb-commits] [lldb] 81eaa3d - [lldb][NFC] Delete TestDataFormatterObjCNSDate.py

2020-01-16 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-01-16T17:28:07+01:00
New Revision: 81eaa3ddd060ab8486ed3fa349d23dbe8f00d8c5

URL: 
https://github.com/llvm/llvm-project/commit/81eaa3ddd060ab8486ed3fa349d23dbe8f00d8c5
DIFF: 
https://github.com/llvm/llvm-project/commit/81eaa3ddd060ab8486ed3fa349d23dbe8f00d8c5.diff

LOG: [lldb][NFC] Delete TestDataFormatterObjCNSDate.py

This test is just TestDataFormatterObjCNSData.py copied but without any changes
(and it therefore doesn't even test NSDate).

It's also failing as NSData has been changed by me in
4f244bba4f66b14382c446b62e122fa684b8db78.

Added: 


Modified: 


Removed: 

lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py



diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
deleted file mode 100644
index a064dd7a90b3..
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# encoding: utf-8
-"""
-Test lldb data formatter subsystem.
-"""
-
-
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-from ObjCDataFormatterTestCase import ObjCDataFormatterTestCase
-
-
-class ObjCDataFormatterNSDate(ObjCDataFormatterTestCase):
-
-@skipUnlessDarwin
-def test_nsdata_with_run_command(self):
-"""Test formatters for  NSData."""
-self.appkit_tester_impl(self.nsdata_data_formatter_commands)
-
-def nsdata_data_formatter_commands(self):
-self.expect(
-'frame variable immutableData mutableData data_ref 
mutable_data_ref mutable_string_ref concreteData concreteMutableData',
-substrs=[
-'(NSData *) immutableData = ', ' 4 bytes',
-'(NSData *) mutableData = ', ' 14 bytes',
-'(CFDataRef) data_ref = ', '@"5 bytes"',
-'(CFMutableDataRef) mutable_data_ref = ', '@"5 bytes"',
-'(CFMutableStringRef) mutable_string_ref = ',
-' @"Wish ya knew"', '(NSData *) concreteData = ',
-' 10 bytes', '(NSMutableData *) concreteMutableData = ',
-' 10 bytes'
-])



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


[Lldb-commits] [PATCH] D72823: [Reproducers] Add a tool to transparently capture and replay lldb sessions

2020-01-16 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Considered making this a python script?




Comment at: lldb/tools/lldb-repro/lldb-repro.h.cmake:12
+
+#cmakedefine LLDB_TEST_EXECUTABLE "${LLDB_TEST_EXECUTABLE}"
+

labath wrote:
> Are you sure this will work fine with multi-config generators? You might be 
> better off just relying on the fact that the lldb executable will sit right 
> next to this binary...
Actually how, is this thing going to be invoked exactly? Couldn't the path to 
lldb be passed simply as argv[1]?


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72823/new/

https://reviews.llvm.org/D72823



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


[Lldb-commits] [lldb] 15a6df5 - [lldb/DWARF/test] Freshen up debug_names tests

2020-01-16 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-01-16T16:25:49+01:00
New Revision: 15a6df52efaa74308bfdcd03718a84ac893b40d8

URL: 
https://github.com/llvm/llvm-project/commit/15a6df52efaa74308bfdcd03718a84ac893b40d8
DIFF: 
https://github.com/llvm/llvm-project/commit/15a6df52efaa74308bfdcd03718a84ac893b40d8.diff

LOG: [lldb/DWARF/test] Freshen up debug_names tests

These tests used "clang -mllvm -accel-tables=Dwarf" as a way to
guarantee that clang will emit the debug_names table. Unfortunately,
a change it clang made that insufficient (-gpubnames is required now
too), which rendered these tests ineffective. Since lldb automatically
falls back to the manual index, the tests didn't fail and this change
went largely unnoticed.

This patch updates the tests to really use debug_names (-gdwarf-5
-gpubnames) is the combination that works now, and it adds additional
checks to ensure the section is actually emitted.

Fortunately, no regressions crept in while these tests were disabled.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py
lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp
lldb/test/Shell/SymbolFile/DWARF/dwarf5-index-is-used.cpp
lldb/test/Shell/SymbolFile/DWARF/dwarf5-partial-index.cpp
lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp
lldb/test/Shell/SymbolFile/DWARF/find-basic-namespace.cpp
lldb/test/Shell/SymbolFile/DWARF/find-basic-type.cpp
lldb/test/Shell/SymbolFile/DWARF/find-basic-variable.cpp
lldb/test/Shell/SymbolFile/DWARF/find-function-regex.cpp
lldb/test/Shell/SymbolFile/DWARF/find-method.cpp
lldb/test/Shell/SymbolFile/DWARF/find-variable-dwo.cpp
lldb/test/Shell/SymbolFile/DWARF/find-variable-file.cpp

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py 
b/lldb/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py
index 9ea13612c07a..f955d013bc90 100644
--- 
a/lldb/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py
+++ 
b/lldb/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py
@@ -62,4 +62,4 @@ def test(self):
 def test_debug_names(self):
 """Test that we are able to find complete types when using DWARF v5
 accelerator tables"""
-self.do_test(dict(CFLAGS_EXTRAS="-mllvm -accel-tables=Dwarf"))
+self.do_test(dict(CFLAGS_EXTRAS="-gdwarf-5 -gpubnames"))

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp
index aeb0ff1d01b1..4dcbb4715220 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/debug-names-compressed.cpp
@@ -3,12 +3,15 @@
 
 // REQUIRES: lld, zlib
 
-// RUN: %clang -g -c -o %t.o --target=x86_64-pc-linux -mllvm 
-accel-tables=Dwarf %s
+// RUN: %clang -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames %s
 // RUN: ld.lld %t.o -o %t --compress-debug-sections=zlib
+// RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES
 // RUN: lldb-test symbols --find=variable --name=foo %t | FileCheck %s
 
+// NAMES: Name: .debug_names
+
 // CHECK: Found 1 variables:
 int foo;
-// ONE-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = 
debug-names-compressed.cpp:[[@LINE-1]]
+// CHECK-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = 
debug-names-compressed.cpp:[[@LINE-1]]
 
 extern "C" void _start() {}

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/dwarf5-index-is-used.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/dwarf5-index-is-used.cpp
index f5122ebadae2..d6ac23716f6c 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/dwarf5-index-is-used.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/dwarf5-index-is-used.cpp
@@ -2,7 +2,7 @@
 
 // REQUIRES: lld
 
-// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm 
-accel-tables=Dwarf -gpubnames
+// RUN: %clang %s -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames
 // RUN: ld.lld %t.o -o %t
 // RUN: lldb-test symbols %t | FileCheck %s
 

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/dwarf5-partial-index.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/dwarf5-partial-index.cpp
index 84e3b62e17bb..ab84415f61b2 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/dwarf5-partial-index.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/dwarf5-partial-index.cpp
@@ -3,11 +3,14 @@
 
 // REQUIRES: lld
 
-// RUN: %clang %s -g -c -o %t-1.o --target=x86_64-pc-linux -DONE -mllvm 
-accel-tables=Dwarf
-// RUN: %clang %s -g -c -o %t-2.o --target=x86_64-pc-linux -DTWO -mllvm 
-accel-tables=Dwarf
+// RUN: %clang %s -c -o %t-1.o --target=x86_64-pc-linux -DONE -gdwarf-5 
-gpubnames
+// RUN: llvm-readobj --sections %t-1.o | FileCheck %s --check-prefix NAMES
+// RUN: %clang %s -c -o %t-2.o --target=x86_64-pc-linux -DTWO -gdwarf-5 
-gno-pubnames
 // RUN: ld.lld %t-1.o %t-2.o -o %t
 // RUN: lldb-test symbols 

[Lldb-commits] [PATCH] D72823: [Reproducers] Add a tool to transparently capture and replay lldb sessions

2020-01-16 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

This seems like it could be useful. Some random questions inline..




Comment at: lldb/test/Shell/lit.cfg.py:42-46
 if 'LLDB_CAPTURE_REPRODUCER' in os.environ:
   config.environment['LLDB_CAPTURE_REPRODUCER'] = os.environ[
   'LLDB_CAPTURE_REPRODUCER']
+if 'LLDB_REPRO_CAPTURE' in os.environ:
+  config.environment['LLDB_REPRO_CAPTURE'] = os.environ['LLDB_REPRO_CAPTURE']

The difference between these two is super-unclear. Any chance to unify them?



Comment at: lldb/tools/lldb-repro/lldb-repro.cpp:23
+
+unsigned ComputerHash(StringRef args, StringRef cwd) {
+  const unsigned hash = djbHash(cwd);

Is the `r` in the name intentional?



Comment at: lldb/tools/lldb-repro/lldb-repro.cpp:63
+args.push_back(repro_dir.c_str());
+args.push_back("--reproducer-auto-generate");
+

I am wondering if this shouldn't even be the default behavior. If I already 
passed `--capture` to lldb then it does not seem unreasonable to always write 
it out when lldb exits (we already do it after a crash, right?)



Comment at: lldb/tools/lldb-repro/lldb-repro.h.cmake:12
+
+#cmakedefine LLDB_TEST_EXECUTABLE "${LLDB_TEST_EXECUTABLE}"
+

Are you sure this will work fine with multi-config generators? You might be 
better off just relying on the fact that the lldb executable will sit right 
next to this binary...


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72823/new/

https://reviews.llvm.org/D72823



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


[Lldb-commits] [PATCH] D72650: [LLDB] Add SymbolVendorWasm plugin for WebAssembly debugging

2020-01-16 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.

This looks good.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72650/new/

https://reviews.llvm.org/D72650



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


Re: [Lldb-commits] [lldb] 8d2f252 - lldb: Run TestCrossDSOTailCalls.py and TestCrossObjectTailCalls.py on Darwin only

2020-01-16 Thread Pavel Labath via lldb-commits
On 15/01/2020 23:00, Vedant Kumar via lldb-commits wrote:
> 
> Author: Vedant Kumar
> Date: 2020-01-15T14:00:05-08:00
> New Revision: 8d2f252bb8e4d199be8498c4ee2245117ef08fd2
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/8d2f252bb8e4d199be8498c4ee2245117ef08fd2
> DIFF: 
> https://github.com/llvm/llvm-project/commit/8d2f252bb8e4d199be8498c4ee2245117ef08fd2.diff
> 
> LOG: lldb: Run TestCrossDSOTailCalls.py and TestCrossObjectTailCalls.py on 
> Darwin only
> 

That seems pretty drastic given that the test works fine on linux/x86.

Can you change that to xfail: arm (or xfail: arm-linux, if you're
certain that the tests actually work on arm-macos)?

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


[Lldb-commits] [PATCH] D72748: [lldb/IOHandler] Change the way we manage IO handler

2020-01-16 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I didn't actually try it but I am pretty sure this will deadlock with nested 
lldb command files (running `command source` from a file that is itself being 
sourced). Changing the mutex to a recursive_mutex would fix that, but I don't 
believe it would make this fully correct -- it would just make it harder to 
demonstrate that it's wrong. OTOH, that may be the best thing we can do in the 
current state of affairs.

The thing I don't understand now is why do we even need this stack in the first 
place. It seems like this could be handled by just running a new iohandler 
"main loop" instead of pushing something. Take the "expr" command for example. 
In the single-line mode it evaluates the expression synchronously, but in a 
multi-line expression, it returns immediately after pushing it's own IOHandler 
(which then gathers the expression and calls back into the command to run it). 
I don't see why we couldn't achieve the same thing by "running" the iohandler 
directly, instead of pushing it to some stack and waiting for it to be executed 
at the top level. The same thing could be said for the "script" command and 
various other things which "hijack" the main (lldb) iohandler.

Greg, am I missing something?




Comment at: lldb/include/lldb/Core/Debugger.h:406
   IOHandlerStack m_input_reader_stack;
+  std::mutex m_io_hanlder_synchronous_mutex;
+

typo


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72748/new/

https://reviews.llvm.org/D72748



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


[Lldb-commits] [PATCH] D71575: [LLDB] Add ObjectFileWasm plugin for WebAssembly debugging

2020-01-16 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D71575#1822343 , @paolosev wrote:

> In D71575#1821312 , @labath wrote:
>
> > Do you have commit access?
>
>
> No, I certainly don't have commit access, this would be my first accepted 
> patch. :)


Well.. congratulations. :) I was making sure you are able to commit this, but 
it looks like you already have that covered.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71575/new/

https://reviews.llvm.org/D71575



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


[Lldb-commits] [PATCH] D72684: [lldb][NFC] Rename ClangASTContext to TypeSystemClang

2020-01-16 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.
Herald added a subscriber: wuzish.

Are there any objections against this? Otherwise I'll land this tomorrow.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72684/new/

https://reviews.llvm.org/D72684



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


[Lldb-commits] [lldb] 4f244bb - [lldb] Fix asan failures in data-formatter-objc tests

2020-01-16 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-01-16T09:59:07+01:00
New Revision: 4f244bba4f66b14382c446b62e122fa684b8db78

URL: 
https://github.com/llvm/llvm-project/commit/4f244bba4f66b14382c446b62e122fa684b8db78
DIFF: 
https://github.com/llvm/llvm-project/commit/4f244bba4f66b14382c446b62e122fa684b8db78.diff

LOG: [lldb] Fix asan failures in data-formatter-objc tests

The test is currently failing on some systems with ASAN enabled due to:
```
==22898==ERROR: AddressSanitizer: heap-buffer-overflow on address 
0x60303da4 at pc 0x00010951c33d bp 0x7ffee6709e00 sp 0x7ffee67095c0
READ of size 5 at 0x60303da4 thread T0
#0 0x10951c33c in wrap_memmove+0x16c 
(libclang_rt.asan_osx_dynamic.dylib:x86_64+0x1833c)
#1 0x7fff4a327f57 in CFDataReplaceBytes+0x1ba 
(CoreFoundation:x86_64+0x13f57)
#2 0x7fff4a415a44 in __CFDataInit+0x2db (CoreFoundation:x86_64+0x101a44)
#3 0x1094f8490 in main main.m:424
#4 0x7fff77482084 in start+0x0 (libdyld.dylib:x86_64+0x17084)
0x60303da4 is located 0 bytes to the right of 20-byte region 
[0x60303d90,0x60303da4)
allocated by thread T0 here:
#0 0x109547c02 in wrap_calloc+0xa2 
(libclang_rt.asan_osx_dynamic.dylib:x86_64+0x43c02)
#1 0x7fff763ad3ef in class_createInstance+0x52 
(libobjc.A.dylib:x86_64+0x73ef)
#2 0x7fff4c6b2d73 in NSAllocateObject+0x12 (Foundation:x86_64+0x1d73)
#3 0x7fff4c6b5e5f in -[_NSPlaceholderData 
initWithBytes:length:copy:deallocator:]+0x40 (Foundation:x86_64+0x4e5f)
#4 0x7fff4c6d4cf1 in -[NSData(NSData) initWithBytes:length:]+0x24 
(Foundation:x86_64+0x23cf1)
#5 0x1094f8245 in main main.m:404
#6 0x7fff77482084 in start+0x0 (libdyld.dylib:x86_64+0x17084)
```

The reason is that we create a string "HELLO" but get the size wrong (it's 5 
bytes instead
of 4). Later on we read the buffer and pretend it is 5 bytes long, causing an 
OOB read
which ASAN detects.

In general this test probably needs some cleanup as it produces on macOS 10.15 
around
100 compiler warnings which isn't great, but let's first get the bot green.

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSData.py

lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSData.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSData.py
index 37991ddb99d8..4fe687866f3b 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSData.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSData.py
@@ -23,7 +23,7 @@ def nsdata_data_formatter_commands(self):
 self.expect(
 'frame variable immutableData mutableData data_ref 
mutable_data_ref mutable_string_ref concreteData concreteMutableData',
 substrs=[
-'(NSData *) immutableData = ', ' 4 bytes',
+'(NSData *) immutableData = ', ' 5 bytes',
 '(NSData *) mutableData = ', ' 14 bytes',
 '(CFDataRef) data_ref = ', '@"5 bytes"',
 '(CFMutableDataRef) mutable_data_ref = ', '@"5 bytes"',

diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
index f0dc2055976a..aac729c74590 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
@@ -401,7 +401,7 @@ int main (int argc, const char * argv[])
 
[mutableGetConst length];
 
-   NSData *immutableData = [[NSData alloc] initWithBytes:"HELLO" 
length:4];
+   NSData *immutableData = [[NSData alloc] initWithBytes:"HELLO" 
length:5];
NSData *mutableData = [[NSMutableData alloc] initWithBytes:"NODATA" 
length:6];
 
// No-copy versions of NSData initializers use NSConcreteData if 
over 2^16 elements are specified.



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