[Lldb-commits] [lldb] r356876 - Fix a broken comment line. NFC.

2019-03-25 Thread Hafiz Abid Qadeer via lldb-commits
Author: abidh
Date: Mon Mar 25 02:41:49 2019
New Revision: 356876

URL: http://llvm.org/viewvc/llvm-project?rev=356876&view=rev
Log:
Fix a broken comment line. NFC.

Just checking that commit access is working after licensing changes.


Modified:
lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp?rev=356876&r1=356875&r2=356876&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp Mon Mar 25 02:41:49 2019
@@ -468,8 +468,7 @@ bool CMICmdCmdInterpreterExec::Execute()
   CMICMDBASE_GETOPTION(pArgCommand, String, m_constStrArgNamedCommand);
 
   // Handle the interpreter parameter by do nothing on purpose (set to 
'handled'
-  // in
-  // the arg definition above)
+  // in the arg definition above)
   const CMIUtilString &rStrInterpreter(pArgInterpreter->GetValue());
   MIunused(rStrInterpreter);
 


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


[Lldb-commits] [PATCH] D59015: [lldb-mi] Include full path in the -data-disassemble response

2019-03-25 Thread Hafiz Abid Qadeer via Phabricator via lldb-commits
abidh accepted this revision.
abidh added a comment.
This revision is now accepted and ready to land.

Looks ok but I would like a testcase to go with the change.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59015



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


[Lldb-commits] [PATCH] D59719: [ScriptInterpreter] Make sure that PYTHONHOME is right.

2019-03-25 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

It sounds to me like you could achieve the same thing by generalizing the 
LLDB_PYTHON_HOME logic in LLDBConfig.cmake. This would have the advantage of 
centralizing the way we manage python-finding logic (instead of each OS doing 
it's own thing) and also enable those users, who know what they are doing, to 
override this logic and point lldb to a different python. (I don't know if 
there are any such users, but it does not sounds like an impossible scenario).

I think all it would take is to do something like:

- move LLDB_RELOCATABLE_PYTHON handling outside of `if(WINDOWS)`
- have the default value of `LLDB_RELOCATABLE_PYTHON` be `false` for darwin
- possibly tweak the python-finding logic so that it prefers the one in 
/System/Library/Frameworks/...


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59719



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


[Lldb-commits] [PATCH] D59590: Python 2/3 compat: queue vs Queue

2019-03-25 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.

It looks like this code hasn't been touched since 2013, so who knows if it even 
works. But fixing this should be fine anyway.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59590



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


[Lldb-commits] [PATCH] D59586: Python 2/3 compat: tkinter

2019-03-25 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.

LGTM, although this is looks like another piece of unmaintained code.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59586



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


[Lldb-commits] [PATCH] D59582: Python 2/3 compat: StringIO

2019-03-25 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.

I have a feeling most of these files should be just deleted, but since you went 
through the trouble of creating this patch, I see no reason why to not accept 
it.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59582



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


[Lldb-commits] [PATCH] D59537: Instantiate 'std' templates explicitly in the expression evaluator

2019-03-25 Thread Gabor Marton via Phabricator via lldb-commits
martong added inline comments.



Comment at: lldb/source/Symbol/StdModuleHandler.cpp:242
+// Instantiate the template.
+found_decl = ClassTemplateSpecializationDecl::Create(
+m_sema->getASTContext(),

Is there any guarantee that the before any subsequent 
clang::ASTImporter::Import call this newly created node is registered as 
imported (via ASTImporter::MapImported)?

The reason why I am asking this is because we have to enforce in 
clang::ASTImporter that after every Decl is created then immediately it is 
registered as an imported Decl, see `ASTImporter::GetImportedOrCreateDecl`. 
This we we make sure that no subsequent import calls will create the same node 
again.
The cycles in the AST are handled properly only this way.

This is one reason which makes me worried about exposing the import mechanism 
via `ImportInternal`.  Would it be working if `GetImportedOrCreateDecl` was 
virtual and overridden here?


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

https://reviews.llvm.org/D59537



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


[Lldb-commits] [PATCH] D59537: Instantiate 'std' templates explicitly in the expression evaluator

2019-03-25 Thread Gabor Marton via Phabricator via lldb-commits
martong added inline comments.



Comment at: lldb/source/Symbol/StdModuleHandler.cpp:242
+// Instantiate the template.
+found_decl = ClassTemplateSpecializationDecl::Create(
+m_sema->getASTContext(),

martong wrote:
> Is there any guarantee that the before any subsequent 
> clang::ASTImporter::Import call this newly created node is registered as 
> imported (via ASTImporter::MapImported)?
> 
> The reason why I am asking this is because we have to enforce in 
> clang::ASTImporter that after every Decl is created then immediately it is 
> registered as an imported Decl, see `ASTImporter::GetImportedOrCreateDecl`. 
> This we we make sure that no subsequent import calls will create the same 
> node again.
> The cycles in the AST are handled properly only this way.
> 
> This is one reason which makes me worried about exposing the import mechanism 
> via `ImportInternal`.  Would it be working if `GetImportedOrCreateDecl` was 
> virtual and overridden here?
> Would it be working if GetImportedOrCreateDecl was virtual and overridden 
> here?

Sorry, that would certainly not work, but perhaps a virtual hook inside that 
function could work...


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

https://reviews.llvm.org/D59537



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


[Lldb-commits] [lldb] r356896 - Reapply minidump changes reverted in r356806

2019-03-25 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Mar 25 07:02:16 2019
New Revision: 356896

URL: http://llvm.org/viewvc/llvm-project?rev=356896&view=rev
Log:
Reapply minidump changes reverted in r356806

The changes were reverted due to ubsan errors (unaligned accesses). Here
I fix those errors by first copying the data into aligned storage.
Besides fixing alignment issues, this also fixes reading of minidump
strings on big-endian systems.

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-16.dmp

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-20.dmp

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-zero.dmp

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-no-age.dmp

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-with-age.dmp

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.dmp

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/macos-arm-uuids-no-age.dmp
Modified:
lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp
lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py?rev=356896&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
 Mon Mar 25 07:02:16 2019
@@ -0,0 +1,134 @@
+"""
+Test basics of Minidump debugging.
+"""
+
+from __future__ import print_function
+from six import iteritems
+
+import shutil
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class MiniDumpUUIDTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+NO_DEBUG_INFO_TESTCASE = True
+
+def setUp(self):
+super(MiniDumpUUIDTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(MiniDumpUUIDTestCase, self).tearDown()
+
+def verify_module(self, module, verify_path, verify_uuid):
+uuid = module.GetUUIDString()
+self.assertEqual(verify_path, module.GetFileSpec().fullpath)
+self.assertEqual(verify_uuid, uuid)
+
+def test_zero_uuid_modules(self):
+"""
+Test multiple modules having a MINIDUMP_MODULE.CvRecord that is 
valid,
+but contains a PDB70 value whose age is zero and whose UUID values 
are 
+all zero. Prior to a fix all such modules would be duplicated to 
the
+first one since the UUIDs claimed to be valid and all zeroes. Now 
we
+ensure that the UUID is not valid for each module and that we have
+each of the modules in the target after loading the core
+"""
+self.dbg.CreateTarget(None)
+self.target = self.dbg.GetSelectedTarget()
+self.process = self.target.LoadCore("linux-arm-zero-uuids.dmp")
+modules = self.target.modules
+self.assertEqual(2, len(modules))
+self.verify_module(modules[0], "/file/does/not/exist/a", None)
+self.verify_module(modules[1], "/file/does/not/exist/b", None)
+
+def test_uuid_modules_no_age(self):
+"""
+Test multiple modules having a MINIDUMP_MODULE.CvRecord that is 
valid,
+and contains a PDB70 value whose age is zero and whose UUID values 
are 
+valid. Ensure we decode the UUID and don't include the age field 
in the UUID.
+"""
+self.dbg.CreateTarget(None)
+self.target = self.dbg.GetSelectedTarget()
+self.process = self.target.LoadCore("linux-arm-uuids-no-age.dmp")
+modules = self.target.modules
+self.assertEqual(2, len(modules))
+self.verify_module(modules[0], "/tmp/a", 
"01020304-0506-0708-090A-0B0C0D0E0F10")
+self.verify_module(modules[1], "/tmp/b", 
"0A141E28-323C-4650-5A64-6E78828C96A0")
+
+def test_uuid_modules_no_age_apple(self):
+"""
+Test multiple modules having a MINIDUMP_MODULE.CvRecord that is 
valid,
+and contains a PDB70 value whose age is zero and whose UUID values 
are 
+valid. Ensure we decode the UUID

[Lldb-commits] [lldb] r356898 - Minidump: Use minidump constants defined in llvm

2019-03-25 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Mar 25 07:09:27 2019
New Revision: 356898

URL: http://llvm.org/viewvc/llvm-project?rev=356898&view=rev
Log:
Minidump: Use minidump constants defined in llvm

This patch begins the process of migrating the "minidump" plugin to the
minidump parser in llvm. The llvm parser is not fully finished yet, but
even now, a lot of things can be switched over. The gradual migration
process will allow us to easier detect if things break than doing a big
one-step migration. Doing it early will allow us to make sure that the
llvm parser fits the use case that we need in lldb.

In this patch I start with the various minidump constants, which have
their llvm equivalent. It doesn't contain any functional changes. The
diff just reflects the different naming of things in llvm.

Modified:
lldb/trunk/lit/Minidump/dump-all.test
lldb/trunk/lit/Minidump/fb-dump.test
lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt
lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp
lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.h
lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp
lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.h
lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp

Modified: lldb/trunk/lit/Minidump/dump-all.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Minidump/dump-all.test?rev=356898&r1=356897&r2=356898&view=diff
==
--- lldb/trunk/lit/Minidump/dump-all.test (original)
+++ lldb/trunk/lit/Minidump/dump-all.test Mon Mar 25 07:09:27 2019
@@ -37,7 +37,7 @@
 # RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump -u' 
   | FileCheck --check-prefix=CHECKUP %s
 # RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --fd'   
   | FileCheck --check-prefix=CHECKFD %s
 # RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump -f' 
   | FileCheck --check-prefix=CHECKFD %s
-# CHECKDIR:  RVASIZE   TYPE   MinidumpStreamType
+# CHECKDIR:  RVASIZE   TYPE   StreamType
 # CHECKDIR-NEXT: -- -- -- --
 # CHECKDIR-NEXT: 0x00b0 0x0038 0x0007 SystemInfo
 # CHECKDIR-NEXT: 0x015d 0x001b 0x47670007 LinuxEnviron

Modified: lldb/trunk/lit/Minidump/fb-dump.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Minidump/fb-dump.test?rev=356898&r1=356897&r2=356898&view=diff
==
--- lldb/trunk/lit/Minidump/fb-dump.test (original)
+++ lldb/trunk/lit/Minidump/fb-dump.test Mon Mar 25 07:09:27 2019
@@ -55,7 +55,7 @@
 # RUN: %lldb -c %p/Inputs/fb-dump-content.dmp  \
 # RUN:   -o 'process plugin dump --fb-logcat' | \
 # RUN:   FileCheck --check-prefix=CHECK-LOGCAT %s
-# CHECK-DIR:  RVASIZE   TYPE   MinidumpStreamType
+# CHECK-DIR:  RVASIZE   TYPE   StreamType
 # CHECK-DIR-NEXT: -- -- -- --
 # CHECK-DIR-NEXT: 0x010c 0x0013 0xfacecb00 FacebookDumpErrorLog
 # CHECK-DIR-NEXT: 0x011f 0x0015 0xfacee000 FacebookThreadName

Modified: lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt?rev=356898&r1=356897&r2=356898&view=diff
==
--- lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Process/minidump/CMakeLists.txt Mon Mar 25 
07:09:27 2019
@@ -15,5 +15,6 @@ add_lldb_library(lldbPluginProcessMinidu
 lldbPluginProcessUtility
 lldbPluginProcessElfCore
   LINK_COMPONENTS
+BinaryFormat
 Support
   )

Modified: lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp?rev=356898&r1=356897&r2=356898&view=diff
==
--- lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp (original)
+++ lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp Mon Mar 25 
07:09:27 2019
@@ -130,7 +130,7 @@ llvm::ArrayRef MinidumpParser::
 }
 
 llvm::ArrayRef
-MinidumpParser::GetStream(MinidumpStreamType stream_type) {
+MinidumpParser::GetStream(StreamType stream_type) {
   auto iter = m_directory_map.find(static_cast(stream_type));
   if (iter == m_directory_map.end())
 return {};
@@ -210,7 +210,7 @@ UUID MinidumpParser::GetModuleUUID(const
 }
 
 llvm::ArrayRef MinidumpParser::GetThreads() {
-  llvm::ArrayRef data = GetStream(MinidumpStreamType::ThreadList);
+  llvm::ArrayRef data = GetStream(StreamType::ThreadList);
 
   if (data.size() == 0)
 return llvm::None;
@@ -262,7 +262,7 @@ MinidumpParser::GetThreadContextWow64(

[Lldb-commits] [PATCH] D59589: Python 2/3 compat: str vs basestring

2019-03-25 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.

LGTM.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59589



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


[Lldb-commits] [PATCH] D59590: Python 2/3 compat: queue vs Queue

2019-03-25 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL356905: Python 2/3 compat: queue vs Queue (authored by 
serge_sans_paille, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D59590?vs=191454&id=192111#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D59590

Files:
  llvm/trunk/tools/llvm-config/llvm-config.cpp


Index: llvm/trunk/tools/llvm-config/llvm-config.cpp
===
--- llvm/trunk/tools/llvm-config/llvm-config.cpp
+++ llvm/trunk/tools/llvm-config/llvm-config.cpp
@@ -268,7 +268,6 @@
   // tree.
   bool IsInDevelopmentTree;
   enum { CMakeStyle, CMakeBuildModeStyle } DevelopmentTreeLayout;
-  llvm::SmallString<256> CurrentPath(GetExecutablePath(argv[0]));
   std::string CurrentExecPrefix;
   std::string ActiveObjRoot;
 
@@ -279,11 +278,18 @@
 build_mode = CMAKE_CFG_INTDIR;
 #endif
 
-  // Create an absolute path, and pop up one directory (we expect to be inside 
a
-  // bin dir).
-  sys::fs::make_absolute(CurrentPath);
-  CurrentExecPrefix =
-  sys::path::parent_path(sys::path::parent_path(CurrentPath)).str();
+  // Create an absolute path, and pop up as much directory as in
+  // LLVM_TOOLS_INSTALL_DIR
+  {
+llvm::SmallString<256> CurrentPath(GetExecutablePath(argv[0]));
+sys::fs::make_absolute(CurrentPath);
+for (auto iter = sys::path::begin(LLVM_TOOLS_INSTALL_DIR),
+  end = sys::path::end(LLVM_TOOLS_INSTALL_DIR);
+ iter != end; ++iter) {
+  CurrentPath = sys::path::parent_path(CurrentPath).str();
+}
+CurrentExecPrefix = sys::path::parent_path(CurrentPath).str();
+  }
 
   // Check to see if we are inside a development tree by comparing to possible
   // locations (prefix style or CMake style).


Index: llvm/trunk/tools/llvm-config/llvm-config.cpp
===
--- llvm/trunk/tools/llvm-config/llvm-config.cpp
+++ llvm/trunk/tools/llvm-config/llvm-config.cpp
@@ -268,7 +268,6 @@
   // tree.
   bool IsInDevelopmentTree;
   enum { CMakeStyle, CMakeBuildModeStyle } DevelopmentTreeLayout;
-  llvm::SmallString<256> CurrentPath(GetExecutablePath(argv[0]));
   std::string CurrentExecPrefix;
   std::string ActiveObjRoot;
 
@@ -279,11 +278,18 @@
 build_mode = CMAKE_CFG_INTDIR;
 #endif
 
-  // Create an absolute path, and pop up one directory (we expect to be inside a
-  // bin dir).
-  sys::fs::make_absolute(CurrentPath);
-  CurrentExecPrefix =
-  sys::path::parent_path(sys::path::parent_path(CurrentPath)).str();
+  // Create an absolute path, and pop up as much directory as in
+  // LLVM_TOOLS_INSTALL_DIR
+  {
+llvm::SmallString<256> CurrentPath(GetExecutablePath(argv[0]));
+sys::fs::make_absolute(CurrentPath);
+for (auto iter = sys::path::begin(LLVM_TOOLS_INSTALL_DIR),
+  end = sys::path::end(LLVM_TOOLS_INSTALL_DIR);
+ iter != end; ++iter) {
+  CurrentPath = sys::path::parent_path(CurrentPath).str();
+}
+CurrentExecPrefix = sys::path::parent_path(CurrentPath).str();
+  }
 
   // Check to see if we are inside a development tree by comparing to possible
   // locations (prefix style or CMake style).
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59591: Python 2/3 compat: unichr vs chr

2019-03-25 Thread serge via Phabricator via lldb-commits
serge-sans-paille closed this revision.
serge-sans-paille added a comment.

Closed by https://reviews.llvm.org/rL356904


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59591



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


[Lldb-commits] [PATCH] D59589: Python 2/3 compat: str vs basestring

2019-03-25 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB356908: Python 2/3 compat: str vs basestring (authored by 
serge_sans_paille, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D59589?vs=191453&id=192112#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59589

Files:
  examples/summaries/cocoa/CFArray.py
  examples/summaries/cocoa/CFBag.py
  examples/summaries/cocoa/CFBinaryHeap.py
  examples/summaries/cocoa/CFDictionary.py
  examples/summaries/cocoa/NSData.py
  examples/summaries/cocoa/NSIndexSet.py
  examples/summaries/cocoa/NSMachPort.py
  examples/summaries/cocoa/NSSet.py

Index: examples/summaries/cocoa/NSSet.py
===
--- examples/summaries/cocoa/NSSet.py
+++ examples/summaries/cocoa/NSSet.py
@@ -13,6 +13,11 @@
 import CFBag
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError:
+basestring = str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
Index: examples/summaries/cocoa/CFBinaryHeap.py
===
--- examples/summaries/cocoa/CFBinaryHeap.py
+++ examples/summaries/cocoa/CFBinaryHeap.py
@@ -13,6 +13,11 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError:
+basestring = str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
Index: examples/summaries/cocoa/CFArray.py
===
--- examples/summaries/cocoa/CFArray.py
+++ examples/summaries/cocoa/CFArray.py
@@ -13,6 +13,11 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError:
+basestring = str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
Index: examples/summaries/cocoa/NSIndexSet.py
===
--- examples/summaries/cocoa/NSIndexSet.py
+++ examples/summaries/cocoa/NSIndexSet.py
@@ -13,6 +13,11 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError:
+basestring = str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
Index: examples/summaries/cocoa/CFDictionary.py
===
--- examples/summaries/cocoa/CFDictionary.py
+++ examples/summaries/cocoa/CFDictionary.py
@@ -13,6 +13,11 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError
+basestring = str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
Index: examples/summaries/cocoa/NSMachPort.py
===
--- examples/summaries/cocoa/NSMachPort.py
+++ examples/summaries/cocoa/NSMachPort.py
@@ -13,6 +13,11 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError:
+basestring =str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
Index: examples/summaries/cocoa/NSData.py
===
--- examples/summaries/cocoa/NSData.py
+++ examples/summaries/cocoa/NSData.py
@@ -13,6 +13,11 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError:
+basestring = str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
Index: examples/summaries/cocoa/CFBag.py
===
--- examples/summaries/cocoa/CFBag.py
+++ examples/summaries/cocoa/CFBag.py
@@ -13,6 +13,11 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError:
+basestring = str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59586: Python 2/3 compat: tkinter

2019-03-25 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB356909: Python 2/3 compat: tkinter (authored by 
serge_sans_paille, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D59586?vs=191448&id=192113#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59586

Files:
  examples/python/lldbtk.py


Index: examples/python/lldbtk.py
===
--- examples/python/lldbtk.py
+++ examples/python/lldbtk.py
@@ -1,10 +1,15 @@
 #!/usr/bin/python
+from __future__ import print_function
 
 import lldb
 import shlex
 import sys
-from Tkinter import *
-import ttk
+try:
+from tkinter import *
+import tkinter.ttk as ttk
+except ImportError:
+from Tkinter import *
+import ttk
 
 
 class ValueTreeItemDelegate(object):


Index: examples/python/lldbtk.py
===
--- examples/python/lldbtk.py
+++ examples/python/lldbtk.py
@@ -1,10 +1,15 @@
 #!/usr/bin/python
+from __future__ import print_function
 
 import lldb
 import shlex
 import sys
-from Tkinter import *
-import ttk
+try:
+from tkinter import *
+import tkinter.ttk as ttk
+except ImportError:
+from Tkinter import *
+import ttk
 
 
 class ValueTreeItemDelegate(object):
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59582: Python 2/3 compat: StringIO

2019-03-25 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL356910: Python 2/3 compat: StringIO (authored by 
serge_sans_paille, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D59582?vs=191444&id=192114#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D59582

Files:
  lldb/trunk/examples/customization/bin-utils/binutils.py
  lldb/trunk/examples/python/mach_o.py
  lldb/trunk/utils/git-svn/convert.py
  lldb/trunk/utils/lui/lldbutil.py
  lldb/trunk/utils/misc/grep-svn-log.py
  lldb/trunk/utils/sync-source/syncsource.py
  lldb/trunk/utils/test/disasm.py
  lldb/trunk/utils/test/run-until-faulted.py

Index: lldb/trunk/examples/python/mach_o.py
===
--- lldb/trunk/examples/python/mach_o.py
+++ lldb/trunk/examples/python/mach_o.py
@@ -8,7 +8,7 @@
 import re
 import struct
 import string
-import StringIO
+import io
 import sys
 import uuid
 
@@ -1054,7 +1054,7 @@
 if options.extract_modules:
 # print "Extracting modules from mach file..."
 data = file_extract.FileExtract(
-StringIO.StringIO(sect_bytes), self.data.byte_order)
+io.BytesIO(sect_bytes), self.data.byte_order)
 version = data.get_uint32()
 num_modules = data.get_uint32()
 # print "version = %u, num_modules = %u" %
Index: lldb/trunk/examples/customization/bin-utils/binutils.py
===
--- lldb/trunk/examples/customization/bin-utils/binutils.py
+++ lldb/trunk/examples/customization/bin-utils/binutils.py
@@ -1,7 +1,5 @@
 "Collection of tools for displaying bit representation of numbers."""
 
-import StringIO
-
 from __future__ import print_function
 
 def binary(n, width=None):
Index: lldb/trunk/utils/misc/grep-svn-log.py
===
--- lldb/trunk/utils/misc/grep-svn-log.py
+++ lldb/trunk/utils/misc/grep-svn-log.py
@@ -13,7 +13,7 @@
 import fileinput
 import re
 import sys
-import StringIO
+import io
 
 # Separator string for "svn log -v" output.
 separator = '-' * 72
@@ -23,7 +23,7 @@
 svn log -v | grep-svn-log.py '^   D.+why_are_you_missing.h'"""
 
 
-class Log(StringIO.StringIO):
+class Log(io.StringIO):
 """Simple facade to keep track of the log content."""
 
 def __init__(self):
Index: lldb/trunk/utils/sync-source/syncsource.py
===
--- lldb/trunk/utils/sync-source/syncsource.py
+++ lldb/trunk/utils/sync-source/syncsource.py
@@ -11,7 +11,7 @@
 """
 
 import argparse
-import cStringIO
+import io
 import importlib
 import json
 import os.path
@@ -89,11 +89,11 @@
 # preserving the line count.
 regex = re.compile(r"#.*$")
 
-comment_stripped_file = cStringIO.StringIO()
+comment_stripped_file = io.StringIO()
 with open(filename, "r") as json_file:
 for line in json_file:
 comment_stripped_file.write(regex.sub("", line))
-return json.load(cStringIO.StringIO(comment_stripped_file.getvalue()))
+return json.load(io.StringIO(comment_stripped_file.getvalue()))
 
 
 def find_appropriate_rcfile(options):
Index: lldb/trunk/utils/lui/lldbutil.py
===
--- lldb/trunk/utils/lui/lldbutil.py
+++ lldb/trunk/utils/lui/lldbutil.py
@@ -17,7 +17,7 @@
 import lldb
 import os
 import sys
-import StringIO
+import io
 
 # ===
 # Utilities for locating/checking executable programs
@@ -52,7 +52,7 @@
 
 It returns the disassembly content in a string object.
 """
-buf = StringIO.StringIO()
+buf = io.StringIO()
 insts = function_or_symbol.GetInstructions(target)
 for i in insts:
 print(i, file=buf)
@@ -776,7 +776,7 @@
 def print_stacktrace(thread, string_buffer=False):
 """Prints a simple stack trace of this thread."""
 
-output = StringIO.StringIO() if string_buffer else sys.stdout
+output = io.StringIO() if string_buffer else sys.stdout
 target = thread.GetProcess().GetTarget()
 
 depth = thread.GetNumFrames()
@@ -819,7 +819,7 @@
 def print_stacktraces(process, string_buffer=False):
 """Prints the stack traces of all the threads."""
 
-output = StringIO.StringIO() if string_buffer else sys.stdout
+output = io.StringIO() if string_buffer else sys.stdout
 
 print("Stack traces for " + str(process), file=output)
 
@@ -879,7 +879,7 @@
 def print_registers(frame, string_buffer=False):
 """Prints all the register sets of the frame."""
 
-output = StringIO.String

[Lldb-commits] [lldb] r356911 - Update the lldb driver to support the -O and -S options when passing --repl

2019-03-25 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Mon Mar 25 08:38:18 2019
New Revision: 356911

URL: http://llvm.org/viewvc/llvm-project?rev=356911&view=rev
Log:
Update the lldb driver to support the -O and -S options when passing --repl

At the moment when --repl is passed to lldb it silently ignores any
commands passed via the options below:

--one-line-before-file 
 Tells the debugger to execute this one-line lldb command 
before any file provided on the command line has been loaded.
--one-line 
 Tells the debugger to execute this one-line lldb command 
after any file provided on the command line has been loaded.
--source-before-file 
 Tells the debugger to read in and execute the lldb 
commands in the given file, before any file has been loaded.
--source 
 Tells the debugger to read in and execute the lldb 
commands in the given file, after any file has been loaded.
-OAlias for --one-line-before-file
-oAlias for --one-line
-SAlias for --source-before-file
-sAlias for --source

The -O and -S options are quite useful when writing tests for the REPL
though, e.g. to change settings prior to entering REPL mode. This
patch updates the driver to still respect the commands supplied via -O
and -S when passing --repl instead of silently ignoring them. As -s
and -o don't really make sense in REPL mode, commands supplied via
those options are still ignored, but the driver now emits a warning to
make that clear to the user.

Patch by Nathan Hawes!

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

Added:
lldb/trunk/lit/Driver/TestRepl.test
Modified:
lldb/trunk/tools/driver/Driver.cpp

Added: lldb/trunk/lit/Driver/TestRepl.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/TestRepl.test?rev=356911&view=auto
==
--- lldb/trunk/lit/Driver/TestRepl.test (added)
+++ lldb/trunk/lit/Driver/TestRepl.test Mon Mar 25 08:38:18 2019
@@ -0,0 +1,7 @@
+# RUN: echo ':quit' | %lldb -x --repl -O 'expr 42' -S %S/Inputs/Print2.in -o 
'expr 99' -s %s 2>&1 | FileCheck %s
+# CHECK: {{w}}arning: commands specified to run after file load (via -o or -s) 
are ignored in REPL mode
+# CHECK: (int) $0 = 42
+# CHECK: (int) $1 = 2
+# CHECK-NOT: 99
+
+expr 99

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=356911&r1=356910&r2=356911&view=diff
==
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Mon Mar 25 08:38:18 2019
@@ -609,48 +609,56 @@ int Driver::MainLoop() {
   // are processed.
   WriteCommandsForSourcing(eCommandPlacementBeforeFile, commands_stream);
 
-  const size_t num_args = m_option_data.m_args.size();
-  if (num_args > 0) {
-char arch_name[64];
-if (lldb::SBDebugger::GetDefaultArchitecture(arch_name, sizeof(arch_name)))
-  commands_stream.Printf("target create --arch=%s %s", arch_name,
- EscapeString(m_option_data.m_args[0]).c_str());
-else
-  commands_stream.Printf("target create %s",
- EscapeString(m_option_data.m_args[0]).c_str());
+  // If we're not in --repl mode, add the commands to process the file
+  // arguments, and the commands specified to run afterwards.
+  if (!m_option_data.m_repl) {
+const size_t num_args = m_option_data.m_args.size();
+if (num_args > 0) {
+  char arch_name[64];
+  if (lldb::SBDebugger::GetDefaultArchitecture(arch_name, 
sizeof(arch_name)))
+commands_stream.Printf("target create --arch=%s %s", arch_name,
+   EscapeString(m_option_data.m_args[0]).c_str());
+  else
+commands_stream.Printf("target create %s",
+   EscapeString(m_option_data.m_args[0]).c_str());
 
-if (!m_option_data.m_core_file.empty()) {
-  commands_stream.Printf(" --core %s",
+  if (!m_option_data.m_core_file.empty()) {
+commands_stream.Printf(" --core %s",
+   
EscapeString(m_option_data.m_core_file).c_str());
+  }
+  commands_stream.Printf("\n");
+
+  if (num_args > 1) {
+commands_stream.Printf("settings set -- target.run-args ");
+for (size_t arg_idx = 1; arg_idx < num_args; ++arg_idx)
+  commands_stream.Printf(
+  " %s", EscapeString(m_option_data.m_args[arg_idx]).c_str());
+commands_stream.Printf("\n");
+  }
+} else if (!m_option_data.m_core_file.empty()) {
+  commands_stream.Printf("target create --core %s\n",
  EscapeString(m_option_data.m_core_file).c_str());
-}
-commands_stream.Printf("\n");
+} else if (!m_option_data.m_process_name.empty()) {
+  commands_stream.Printf("process attach --name %s",
+  

[Lldb-commits] [PATCH] D59681: Update the lldb driver to support the -O and -S options when passing --repl

2019-03-25 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB356911: Update the lldb driver to support the -O and -S 
options when passing --repl (authored by adrian, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D59681?vs=191904&id=192116#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59681

Files:
  lit/Driver/TestRepl.test
  tools/driver/Driver.cpp

Index: lit/Driver/TestRepl.test
===
--- lit/Driver/TestRepl.test
+++ lit/Driver/TestRepl.test
@@ -0,0 +1,7 @@
+# RUN: echo ':quit' | %lldb -x --repl -O 'expr 42' -S %S/Inputs/Print2.in -o 'expr 99' -s %s 2>&1 | FileCheck %s
+# CHECK: {{w}}arning: commands specified to run after file load (via -o or -s) are ignored in REPL mode
+# CHECK: (int) $0 = 42
+# CHECK: (int) $1 = 2
+# CHECK-NOT: 99
+
+expr 99
Index: tools/driver/Driver.cpp
===
--- tools/driver/Driver.cpp
+++ tools/driver/Driver.cpp
@@ -609,48 +609,56 @@
   // are processed.
   WriteCommandsForSourcing(eCommandPlacementBeforeFile, commands_stream);
 
-  const size_t num_args = m_option_data.m_args.size();
-  if (num_args > 0) {
-char arch_name[64];
-if (lldb::SBDebugger::GetDefaultArchitecture(arch_name, sizeof(arch_name)))
-  commands_stream.Printf("target create --arch=%s %s", arch_name,
- EscapeString(m_option_data.m_args[0]).c_str());
-else
-  commands_stream.Printf("target create %s",
- EscapeString(m_option_data.m_args[0]).c_str());
+  // If we're not in --repl mode, add the commands to process the file
+  // arguments, and the commands specified to run afterwards.
+  if (!m_option_data.m_repl) {
+const size_t num_args = m_option_data.m_args.size();
+if (num_args > 0) {
+  char arch_name[64];
+  if (lldb::SBDebugger::GetDefaultArchitecture(arch_name, sizeof(arch_name)))
+commands_stream.Printf("target create --arch=%s %s", arch_name,
+   EscapeString(m_option_data.m_args[0]).c_str());
+  else
+commands_stream.Printf("target create %s",
+   EscapeString(m_option_data.m_args[0]).c_str());
+
+  if (!m_option_data.m_core_file.empty()) {
+commands_stream.Printf(" --core %s",
+   EscapeString(m_option_data.m_core_file).c_str());
+  }
+  commands_stream.Printf("\n");
 
-if (!m_option_data.m_core_file.empty()) {
-  commands_stream.Printf(" --core %s",
+  if (num_args > 1) {
+commands_stream.Printf("settings set -- target.run-args ");
+for (size_t arg_idx = 1; arg_idx < num_args; ++arg_idx)
+  commands_stream.Printf(
+  " %s", EscapeString(m_option_data.m_args[arg_idx]).c_str());
+commands_stream.Printf("\n");
+  }
+} else if (!m_option_data.m_core_file.empty()) {
+  commands_stream.Printf("target create --core %s\n",
  EscapeString(m_option_data.m_core_file).c_str());
-}
-commands_stream.Printf("\n");
+} else if (!m_option_data.m_process_name.empty()) {
+  commands_stream.Printf("process attach --name %s",
+ EscapeString(m_option_data.m_process_name).c_str());
 
-if (num_args > 1) {
-  commands_stream.Printf("settings set -- target.run-args ");
-  for (size_t arg_idx = 1; arg_idx < num_args; ++arg_idx)
-commands_stream.Printf(
-" %s", EscapeString(m_option_data.m_args[arg_idx]).c_str());
-  commands_stream.Printf("\n");
-}
-  } else if (!m_option_data.m_core_file.empty()) {
-commands_stream.Printf("target create --core %s\n",
-   EscapeString(m_option_data.m_core_file).c_str());
-  } else if (!m_option_data.m_process_name.empty()) {
-commands_stream.Printf("process attach --name %s",
-   EscapeString(m_option_data.m_process_name).c_str());
+  if (m_option_data.m_wait_for)
+commands_stream.Printf(" --waitfor");
 
-if (m_option_data.m_wait_for)
-  commands_stream.Printf(" --waitfor");
+  commands_stream.Printf("\n");
 
-commands_stream.Printf("\n");
+} else if (LLDB_INVALID_PROCESS_ID != m_option_data.m_process_pid) {
+  commands_stream.Printf("process attach --pid %" PRIu64 "\n",
+ m_option_data.m_process_pid);
+}
 
-  } else if (LLDB_INVALID_PROCESS_ID != m_option_data.m_process_pid) {
-commands_stream.Printf("process attach --pid %" PRIu64 "\n",
-   m_option_data.m_process_pid);
+WriteCommandsForSourcing(eCommandPlacementAfterFile, commands_stream);
+  } else if (!m_option_data.m_after_file_commands.empty()) {
+// We're in repl mode and after-file-load commands were specified.
+WithCo

[Lldb-commits] [PATCH] D59775: Minidump: Add support for reading/writing strings

2019-03-25 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: jhenderson, zturner, clayborg.
Herald added a project: LLVM.
labath added a parent revision: D59634: Add minidump support to obj2yaml.

Strings in minidump files are stored as a 32-bit length field, giving
the length of the string in *bytes*, which is followed by the
appropriate number of UTF16 code units. The string is also supposed to
be null-terminated, and the null-terminator is not a part of the length
field. This patch:

- adds support for reading these strings out of the minidump file (this 
implementation does not depend on proper null-termination)
- adds support for writing them to a minidump file
- using the previous two pieces implements proper (de)serialization of the 
CSDVersion field of the SystemInfo stream. Previously, this was only 
read/written as hex, and no attempt was made to access the referenced string -- 
now this string is read and written correctly.

The changes are tested via yaml2obj|obj2yaml round-trip as well as a
unit test which checks the corner cases of the string deserialization
logic.


Repository:
  rL LLVM

https://reviews.llvm.org/D59775

Files:
  include/llvm/Object/Minidump.h
  include/llvm/ObjectYAML/MinidumpYAML.h
  lib/Object/Minidump.cpp
  lib/ObjectYAML/MinidumpYAML.cpp
  test/tools/obj2yaml/basic-minidump.yaml
  unittests/Object/MinidumpTest.cpp
  unittests/ObjectYAML/MinidumpYAMLTest.cpp

Index: unittests/ObjectYAML/MinidumpYAMLTest.cpp
===
--- unittests/ObjectYAML/MinidumpYAMLTest.cpp
+++ unittests/ObjectYAML/MinidumpYAMLTest.cpp
@@ -33,7 +33,6 @@
   - Type:SystemInfo
 Processor Arch:  ARM64
 Platform ID: Linux
-CSD Version RVA: 0x01020304
 CPU:
   CPUID:   0x05060708
   - Type:LinuxMaps
@@ -54,7 +53,6 @@
   const SystemInfo &SysInfo = *ExpectedSysInfo;
   EXPECT_EQ(ProcessorArchitecture::ARM64, SysInfo.ProcessorArch);
   EXPECT_EQ(OSPlatform::Linux, SysInfo.PlatformId);
-  EXPECT_EQ(0x01020304u, SysInfo.CSDVersionRVA);
   EXPECT_EQ(0x05060708u, SysInfo.CPU.Arm.CPUID);
 
   EXPECT_EQ(StreamType::LinuxMaps, File.streams()[1].Type);
Index: unittests/Object/MinidumpTest.cpp
===
--- unittests/Object/MinidumpTest.cpp
+++ unittests/Object/MinidumpTest.cpp
@@ -249,3 +249,34 @@
   EXPECT_EQ(0x08070605u, Info.CPU.X86.FeatureInfo);
   EXPECT_EQ(0x02010009u, Info.CPU.X86.AMDExtendedFeatures);
 }
+
+TEST(MinidumpFile, getString) {
+  std::vector ManyStrings{
+  // Header
+  'M', 'D', 'M', 'P', 0x93, 0xa7, 0, 0, // Signature, Version
+  2, 0, 0, 0,   // NumberOfStreams,
+  0x20, 0, 0, 0,// StreamDirectoryRVA
+  0, 1, 2, 3, 4, 5, 6, 7,   // Checksum, TimeDateStamp
+  8, 9, 0, 1, 2, 3, 4, 5,   // Flags
+// Stream Directory
+  0, 0, 0, 0, 0, 0, 0, 0,   // Type, DataSize,
+  0x20, 0, 0, 0,// RVA
+  1, 0, 0, 0, 0, 0, // String1 - odd length
+  0, 0, 1, 0, 0, 0, // String2 - too long
+  2, 0, 0, 0, 0, 0xd8,  // String3 - invalid utf16
+  0, 0, 0, 0, 0, 0, // String4 - ""
+  2, 0, 0, 0, 'a', 0,   // String5 - "a"
+  0,// Mis-align next string
+  2, 0, 0, 0, 'a', 0,   // String6 - "a"
+
+  };
+  auto ExpectedFile = create(ManyStrings);
+  ASSERT_THAT_EXPECTED(ExpectedFile, Succeeded());
+  const MinidumpFile &File = **ExpectedFile;
+  EXPECT_THAT_EXPECTED(File.getString(44), Failed());
+  EXPECT_THAT_EXPECTED(File.getString(50), Failed());
+  EXPECT_THAT_EXPECTED(File.getString(56), Failed());
+  EXPECT_THAT_EXPECTED(File.getString(62), HasValue(""));
+  EXPECT_THAT_EXPECTED(File.getString(68), HasValue("a"));
+  EXPECT_THAT_EXPECTED(File.getString(75), HasValue("a"));
+}
Index: test/tools/obj2yaml/basic-minidump.yaml
===
--- test/tools/obj2yaml/basic-minidump.yaml
+++ test/tools/obj2yaml/basic-minidump.yaml
@@ -5,7 +5,7 @@
   - Type:SystemInfo
 Processor Arch:  ARM64
 Platform ID: Linux
-CSD Version RVA: 0x01020304
+CSD Version: Linux 3.13.0-91-generic
 CPU: 
   CPUID:   0x05060708
   - Type:LinuxAuxv
@@ -22,7 +22,7 @@
 # CHECK-NEXT:   - Type:SystemInfo
 # CHECK-NEXT: Processor Arch:  ARM64
 # CHECK-NEXT: Platform ID: Linux
-# CHECK-NEXT: CSD Version RVA: 0x01020304
+# CHECK-NEXT: CSD Version: Linux 3.13.0-91-generic
 # CHECK-NEXT: CPU: 
 # CHECK-NEXT:   CPUID:   0x05060708
 # CHECK-NEXT:   - Type:LinuxAuxv
Index: lib/ObjectYAML/MinidumpYAML.cpp
===

[Lldb-commits] [PATCH] D59779: [Args] Handle backticks

2019-03-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: labath, zturner, davide.
Herald added a subscriber: jdoerfert.
Herald added a project: LLDB.

Currently LLDB crashes when autocompleting a command that ends with a backtick.

   ./bin/lldb test.tmp.out
  (lldb) target create "test.tmp.out"
  Current executable set to 'test.tmp.out' (x86_64).
  (lldb) b main
  Breakpoint 1: where = TestGDBRemoteRepro.test.tmp.out`main + 22 at 
simple.c:16:5, address = 0x00010f76
  (lldb) r
  Process 66563 launched: 'test.tmp.out' (x86_64)
  Process 66563 stopped
  * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
  frame #0: 0x00010f76 TestGDBRemoteRepro.test.tmp.out`main(argc=1, 
argv=0x7ffeefbff608) at simple.c:16:5
 13   }
 14
 15   int main (int argc, char const *argv[]) {
  -> 16   foo();
 17   return 0;
 18   }
  (lldb) bt`Assertion failed: (false && "Unhandled quote character"), function 
EscapeLLDBCommandArgument, file 
/Users/jonas/llvm/git-mono/llvm-project/llvm/tools/lldb/source/Utility/Args.cpp,
 line 650.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59779

Files:
  lldb/source/Utility/Args.cpp
  lldb/unittests/Utility/ArgsTest.cpp


Index: lldb/unittests/Utility/ArgsTest.cpp
===
--- lldb/unittests/Utility/ArgsTest.cpp
+++ lldb/unittests/Utility/ArgsTest.cpp
@@ -188,3 +188,29 @@
   EXPECT_STREQ("foo", ref[0]);
   EXPECT_STREQ("bar", ref[1]);
 }
+
+TEST(ArgsTest, EscapeLLDBCommandArgument) {
+  const std::string foo = "foo'";
+  EXPECT_EQ("foo\\'", Args::EscapeLLDBCommandArgument(foo, '\0'));
+  EXPECT_EQ("foo'", Args::EscapeLLDBCommandArgument(foo, '\''));
+  EXPECT_EQ("foo'", Args::EscapeLLDBCommandArgument(foo, '`'));
+  EXPECT_EQ("foo'", Args::EscapeLLDBCommandArgument(foo, '"'));
+
+  const std::string bar = "bar\"";
+  EXPECT_EQ("bar\\\"", Args::EscapeLLDBCommandArgument(bar, '\0'));
+  EXPECT_EQ("bar\"", Args::EscapeLLDBCommandArgument(bar, '\''));
+  EXPECT_EQ("bar\"", Args::EscapeLLDBCommandArgument(bar, '`'));
+  EXPECT_EQ("bar\\\"", Args::EscapeLLDBCommandArgument(bar, '"'));
+
+  const std::string baz = "baz`";
+  EXPECT_EQ("baz\\`", Args::EscapeLLDBCommandArgument(baz, '\0'));
+  EXPECT_EQ("baz`", Args::EscapeLLDBCommandArgument(baz, '\''));
+  EXPECT_EQ("baz`", Args::EscapeLLDBCommandArgument(baz, '`'));
+  EXPECT_EQ("baz\\`", Args::EscapeLLDBCommandArgument(baz, '"'));
+
+  const std::string quux = "quux\t";
+  EXPECT_EQ("quux\\\t", Args::EscapeLLDBCommandArgument(quux, '\0'));
+  EXPECT_EQ("quux\t", Args::EscapeLLDBCommandArgument(quux, '\''));
+  EXPECT_EQ("quux\t", Args::EscapeLLDBCommandArgument(quux, '`'));
+  EXPECT_EQ("quux\t", Args::EscapeLLDBCommandArgument(quux, '"'));
+}
Index: lldb/source/Utility/Args.cpp
===
--- lldb/source/Utility/Args.cpp
+++ lldb/source/Utility/Args.cpp
@@ -640,14 +640,15 @@
   case '\0':
 chars_to_escape = " \t\\'\"`";
 break;
-  case '\'':
-chars_to_escape = "";
-break;
   case '"':
 chars_to_escape = "$\"`\\";
 break;
+  case '`':
+  case '\'':
+return arg;
   default:
 assert(false && "Unhandled quote character");
+return arg;
   }
 
   std::string res;


Index: lldb/unittests/Utility/ArgsTest.cpp
===
--- lldb/unittests/Utility/ArgsTest.cpp
+++ lldb/unittests/Utility/ArgsTest.cpp
@@ -188,3 +188,29 @@
   EXPECT_STREQ("foo", ref[0]);
   EXPECT_STREQ("bar", ref[1]);
 }
+
+TEST(ArgsTest, EscapeLLDBCommandArgument) {
+  const std::string foo = "foo'";
+  EXPECT_EQ("foo\\'", Args::EscapeLLDBCommandArgument(foo, '\0'));
+  EXPECT_EQ("foo'", Args::EscapeLLDBCommandArgument(foo, '\''));
+  EXPECT_EQ("foo'", Args::EscapeLLDBCommandArgument(foo, '`'));
+  EXPECT_EQ("foo'", Args::EscapeLLDBCommandArgument(foo, '"'));
+
+  const std::string bar = "bar\"";
+  EXPECT_EQ("bar\\\"", Args::EscapeLLDBCommandArgument(bar, '\0'));
+  EXPECT_EQ("bar\"", Args::EscapeLLDBCommandArgument(bar, '\''));
+  EXPECT_EQ("bar\"", Args::EscapeLLDBCommandArgument(bar, '`'));
+  EXPECT_EQ("bar\\\"", Args::EscapeLLDBCommandArgument(bar, '"'));
+
+  const std::string baz = "baz`";
+  EXPECT_EQ("baz\\`", Args::EscapeLLDBCommandArgument(baz, '\0'));
+  EXPECT_EQ("baz`", Args::EscapeLLDBCommandArgument(baz, '\''));
+  EXPECT_EQ("baz`", Args::EscapeLLDBCommandArgument(baz, '`'));
+  EXPECT_EQ("baz\\`", Args::EscapeLLDBCommandArgument(baz, '"'));
+
+  const std::string quux = "quux\t";
+  EXPECT_EQ("quux\\\t", Args::EscapeLLDBCommandArgument(quux, '\0'));
+  EXPECT_EQ("quux\t", Args::EscapeLLDBCommandArgument(quux, '\''));
+  EXPECT_EQ("quux\t", Args::EscapeLLDBCommandArgument(quux, '`'));
+  EXPECT_EQ("quux\t", Args::EscapeLLDBCommandArgument(quux, '"'));
+}
Index: lldb/source/Utility/Args.cpp
===
--- lldb/source/Util

[Lldb-commits] [PATCH] D59779: [Args] Handle backticks

2019-03-25 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Given the current way lldb command interpreter parser does things (which tries 
to model a posix shell), (one of) the correct ways to do `'`-quoting would be 
to replace each `'` char by `'\''`.

However,  this isn't the only problem with how we do tab-completion of quoted 
strings, so if you want to just fix the crash, I think this is fine.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59779



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


[Lldb-commits] [PATCH] D59779: [Args] Handle backticks

2019-03-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D59779#1441705 , @labath wrote:

> Given the current way lldb command interpreter parser does things (which 
> tries to model a posix shell), (one of) the correct ways to do `'`-quoting 
> would be to replace each `'` char by `'\''`.
>
> However,  this isn't the only problem with how we do tab-completion of quoted 
> strings, so if you want to just fix the crash, I think this is fine.


Yeah. I didn't dive into the intricacies of this function.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59779



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


[Lldb-commits] [lldb] r356927 - [Args] Handle backticks to prevent crash.

2019-03-25 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Mar 25 10:27:14 2019
New Revision: 356927

URL: http://llvm.org/viewvc/llvm-project?rev=356927&view=rev
Log:
[Args] Handle backticks to prevent crash.

Currently LLDB crashes when autocompleting a command that ends with a
backtick because the quote character wasn't handled. This fixes that and
adds a unit test for this function.

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

Modified:
lldb/trunk/source/Utility/Args.cpp
lldb/trunk/unittests/Utility/ArgsTest.cpp

Modified: lldb/trunk/source/Utility/Args.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Args.cpp?rev=356927&r1=356926&r2=356927&view=diff
==
--- lldb/trunk/source/Utility/Args.cpp (original)
+++ lldb/trunk/source/Utility/Args.cpp Mon Mar 25 10:27:14 2019
@@ -640,14 +640,15 @@ std::string Args::EscapeLLDBCommandArgum
   case '\0':
 chars_to_escape = " \t\\'\"`";
 break;
-  case '\'':
-chars_to_escape = "";
-break;
   case '"':
 chars_to_escape = "$\"`\\";
 break;
+  case '`':
+  case '\'':
+return arg;
   default:
 assert(false && "Unhandled quote character");
+return arg;
   }
 
   std::string res;

Modified: lldb/trunk/unittests/Utility/ArgsTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ArgsTest.cpp?rev=356927&r1=356926&r2=356927&view=diff
==
--- lldb/trunk/unittests/Utility/ArgsTest.cpp (original)
+++ lldb/trunk/unittests/Utility/ArgsTest.cpp Mon Mar 25 10:27:14 2019
@@ -188,3 +188,29 @@ TEST(ArgsTest, GetArgumentArrayRef) {
   EXPECT_STREQ("foo", ref[0]);
   EXPECT_STREQ("bar", ref[1]);
 }
+
+TEST(ArgsTest, EscapeLLDBCommandArgument) {
+  const std::string foo = "foo'";
+  EXPECT_EQ("foo\\'", Args::EscapeLLDBCommandArgument(foo, '\0'));
+  EXPECT_EQ("foo'", Args::EscapeLLDBCommandArgument(foo, '\''));
+  EXPECT_EQ("foo'", Args::EscapeLLDBCommandArgument(foo, '`'));
+  EXPECT_EQ("foo'", Args::EscapeLLDBCommandArgument(foo, '"'));
+
+  const std::string bar = "bar\"";
+  EXPECT_EQ("bar\\\"", Args::EscapeLLDBCommandArgument(bar, '\0'));
+  EXPECT_EQ("bar\"", Args::EscapeLLDBCommandArgument(bar, '\''));
+  EXPECT_EQ("bar\"", Args::EscapeLLDBCommandArgument(bar, '`'));
+  EXPECT_EQ("bar\\\"", Args::EscapeLLDBCommandArgument(bar, '"'));
+
+  const std::string baz = "baz`";
+  EXPECT_EQ("baz\\`", Args::EscapeLLDBCommandArgument(baz, '\0'));
+  EXPECT_EQ("baz`", Args::EscapeLLDBCommandArgument(baz, '\''));
+  EXPECT_EQ("baz`", Args::EscapeLLDBCommandArgument(baz, '`'));
+  EXPECT_EQ("baz\\`", Args::EscapeLLDBCommandArgument(baz, '"'));
+
+  const std::string quux = "quux\t";
+  EXPECT_EQ("quux\\\t", Args::EscapeLLDBCommandArgument(quux, '\0'));
+  EXPECT_EQ("quux\t", Args::EscapeLLDBCommandArgument(quux, '\''));
+  EXPECT_EQ("quux\t", Args::EscapeLLDBCommandArgument(quux, '`'));
+  EXPECT_EQ("quux\t", Args::EscapeLLDBCommandArgument(quux, '"'));
+}


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


[Lldb-commits] [PATCH] D59779: [Args] Handle backticks

2019-03-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB356927: [Args] Handle backticks to prevent crash. 
(authored by JDevlieghere, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D59779?vs=192131&id=192139#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59779

Files:
  source/Utility/Args.cpp
  unittests/Utility/ArgsTest.cpp


Index: unittests/Utility/ArgsTest.cpp
===
--- unittests/Utility/ArgsTest.cpp
+++ unittests/Utility/ArgsTest.cpp
@@ -188,3 +188,29 @@
   EXPECT_STREQ("foo", ref[0]);
   EXPECT_STREQ("bar", ref[1]);
 }
+
+TEST(ArgsTest, EscapeLLDBCommandArgument) {
+  const std::string foo = "foo'";
+  EXPECT_EQ("foo\\'", Args::EscapeLLDBCommandArgument(foo, '\0'));
+  EXPECT_EQ("foo'", Args::EscapeLLDBCommandArgument(foo, '\''));
+  EXPECT_EQ("foo'", Args::EscapeLLDBCommandArgument(foo, '`'));
+  EXPECT_EQ("foo'", Args::EscapeLLDBCommandArgument(foo, '"'));
+
+  const std::string bar = "bar\"";
+  EXPECT_EQ("bar\\\"", Args::EscapeLLDBCommandArgument(bar, '\0'));
+  EXPECT_EQ("bar\"", Args::EscapeLLDBCommandArgument(bar, '\''));
+  EXPECT_EQ("bar\"", Args::EscapeLLDBCommandArgument(bar, '`'));
+  EXPECT_EQ("bar\\\"", Args::EscapeLLDBCommandArgument(bar, '"'));
+
+  const std::string baz = "baz`";
+  EXPECT_EQ("baz\\`", Args::EscapeLLDBCommandArgument(baz, '\0'));
+  EXPECT_EQ("baz`", Args::EscapeLLDBCommandArgument(baz, '\''));
+  EXPECT_EQ("baz`", Args::EscapeLLDBCommandArgument(baz, '`'));
+  EXPECT_EQ("baz\\`", Args::EscapeLLDBCommandArgument(baz, '"'));
+
+  const std::string quux = "quux\t";
+  EXPECT_EQ("quux\\\t", Args::EscapeLLDBCommandArgument(quux, '\0'));
+  EXPECT_EQ("quux\t", Args::EscapeLLDBCommandArgument(quux, '\''));
+  EXPECT_EQ("quux\t", Args::EscapeLLDBCommandArgument(quux, '`'));
+  EXPECT_EQ("quux\t", Args::EscapeLLDBCommandArgument(quux, '"'));
+}
Index: source/Utility/Args.cpp
===
--- source/Utility/Args.cpp
+++ source/Utility/Args.cpp
@@ -640,14 +640,15 @@
   case '\0':
 chars_to_escape = " \t\\'\"`";
 break;
-  case '\'':
-chars_to_escape = "";
-break;
   case '"':
 chars_to_escape = "$\"`\\";
 break;
+  case '`':
+  case '\'':
+return arg;
   default:
 assert(false && "Unhandled quote character");
+return arg;
   }
 
   std::string res;


Index: unittests/Utility/ArgsTest.cpp
===
--- unittests/Utility/ArgsTest.cpp
+++ unittests/Utility/ArgsTest.cpp
@@ -188,3 +188,29 @@
   EXPECT_STREQ("foo", ref[0]);
   EXPECT_STREQ("bar", ref[1]);
 }
+
+TEST(ArgsTest, EscapeLLDBCommandArgument) {
+  const std::string foo = "foo'";
+  EXPECT_EQ("foo\\'", Args::EscapeLLDBCommandArgument(foo, '\0'));
+  EXPECT_EQ("foo'", Args::EscapeLLDBCommandArgument(foo, '\''));
+  EXPECT_EQ("foo'", Args::EscapeLLDBCommandArgument(foo, '`'));
+  EXPECT_EQ("foo'", Args::EscapeLLDBCommandArgument(foo, '"'));
+
+  const std::string bar = "bar\"";
+  EXPECT_EQ("bar\\\"", Args::EscapeLLDBCommandArgument(bar, '\0'));
+  EXPECT_EQ("bar\"", Args::EscapeLLDBCommandArgument(bar, '\''));
+  EXPECT_EQ("bar\"", Args::EscapeLLDBCommandArgument(bar, '`'));
+  EXPECT_EQ("bar\\\"", Args::EscapeLLDBCommandArgument(bar, '"'));
+
+  const std::string baz = "baz`";
+  EXPECT_EQ("baz\\`", Args::EscapeLLDBCommandArgument(baz, '\0'));
+  EXPECT_EQ("baz`", Args::EscapeLLDBCommandArgument(baz, '\''));
+  EXPECT_EQ("baz`", Args::EscapeLLDBCommandArgument(baz, '`'));
+  EXPECT_EQ("baz\\`", Args::EscapeLLDBCommandArgument(baz, '"'));
+
+  const std::string quux = "quux\t";
+  EXPECT_EQ("quux\\\t", Args::EscapeLLDBCommandArgument(quux, '\0'));
+  EXPECT_EQ("quux\t", Args::EscapeLLDBCommandArgument(quux, '\''));
+  EXPECT_EQ("quux\t", Args::EscapeLLDBCommandArgument(quux, '`'));
+  EXPECT_EQ("quux\t", Args::EscapeLLDBCommandArgument(quux, '"'));
+}
Index: source/Utility/Args.cpp
===
--- source/Utility/Args.cpp
+++ source/Utility/Args.cpp
@@ -640,14 +640,15 @@
   case '\0':
 chars_to_escape = " \t\\'\"`";
 break;
-  case '\'':
-chars_to_escape = "";
-break;
   case '"':
 chars_to_escape = "$\"`\\";
 break;
+  case '`':
+  case '\'':
+return arg;
   default:
 assert(false && "Unhandled quote character");
+return arg;
   }
 
   std::string res;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59708: [ExpressionParser] Add swift-lldb case for finding clang resource dir

2019-03-25 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

In D59708#1439872 , @jingham wrote:

> The behavior when verify is false seems a little weird to me.  In that case 
> you will just always get the $install_dir/lib/clang/$clang_version path.  
> That's fairly different from the verify = true case.  OTOH, I couldn't see 
> anybody passing verify = false anywhere.  Do we need that?


The only use of `verify = false` is in the ClangHostTest (in the poorly named 
`unittests/Expression/ClangParserTest.cpp`). We pass a dummy path with verify 
set to false in order to make sure that it can correctly append 
`lib/clang/$clang_version`. Then we pass verify = true and make sure that it 
doesn't actually exist.




Comment at: source/Plugins/ExpressionParser/Clang/ClangHost.cpp:67
+  relative_path.clear();
+  llvm::sys::path::append(relative_path, "lib", "lldb", "clang");
+  llvm::sys::path::append(clang_dir, relative_path);

compnerd wrote:
> Does swift-lldb never honour `LIBDIR`?  That is, can it never end up in 
> `lib64`?
Oh, it absolutely does. I'll fix that!



Comment at: source/Plugins/ExpressionParser/Clang/ClangHost.cpp:73
+return true;
+  }
+

compnerd wrote:
> I think it would be nicer if you could create a static list of the paths and 
> loop over it:
> 
> ```
> static const StringRef kResourceDirSuffixes[] = {
>   "lib" TO_STRING(CLANG_LIBDIR_SUFFIX) "/clang" CLANG_VERSION_STRING,
>   "lib" TO_STRING(CLANG_LIBDIR_SUFFIX) "/lldb/clang",
> };
> 
> for (const auto &Suffix : kResourceDirSuffixes) {
> llvm::SmallString<256> clang_dir(parent_dir);
> llvm::SmallString<32> relative_path(Suffix);
> llvm::sys::path::native(relative_path);
> llvm::sys::path::append(clang_dir, relative_path);
> if (!verify || VerifyClangPath(clang_dir)) {
>   file_spec.GetDirectory().SetString(clang_dir);
>   FileSystem::Instance().Resolve(file_spec);
>   return true;
> }
> }
> ```
Yeah sounds good to me. Seems more manageable.


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

https://reviews.llvm.org/D59708



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


[Lldb-commits] [PATCH] D54747: Discard debuginfo for object files empty after GC

2019-03-25 Thread Rui Ueyama via Phabricator via lldb-commits
ruiu added inline comments.



Comment at: lld/ELF/MarkLive.cpp:190
 
+template  static void setSectionLive(InputSectionBase *Sec) {
+  Sec->Live = true;

Since this file is MarkLive, markSection is perhaps a better name.



Comment at: lld/ELF/MarkLive.cpp:192
+  Sec->Live = true;
+  if (Sec->kind() != SectionBase::Kind::Regular &&
+  Sec->kind() != SectionBase::Kind::Merge)

rocallahan wrote:
> MaskRay wrote:
> > This check can be changed to `!isa && 
> > !isa`. But do you just want to exclude `EhInputSection`?
> Shouldn't I also be excluding `SyntheticSection`?
This needs a comment.

Do you have to visit each file during the mark phase? Looks like you can mark 
only sections first, and after marking all sections, you can scan all sections 
to mark files. Looks like they can be two separate stages.


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D54747



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


[Lldb-commits] [PATCH] D59708: [ExpressionParser] Add swift-lldb case for finding clang resource dir

2019-03-25 Thread Alex Langford via Phabricator via lldb-commits
xiaobai updated this revision to Diff 192185.
xiaobai added a comment.
Herald added a subscriber: jdoerfert.

- Respect LIBDIR for swift-lldb case
- Loop over a list of known directory suffixes
- Change default behavior to not set file_spec and return false upon failure.


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

https://reviews.llvm.org/D59708

Files:
  source/Plugins/ExpressionParser/Clang/ClangHost.cpp
  unittests/Expression/ClangParserTest.cpp


Index: unittests/Expression/ClangParserTest.cpp
===
--- unittests/Expression/ClangParserTest.cpp
+++ unittests/Expression/ClangParserTest.cpp
@@ -50,9 +50,8 @@
   EXPECT_EQ(ComputeClangResourceDir(path_to_liblldb), path_to_clang_dir);
 
   // The path doesn't really exist, so setting verify to true should make
-  // ComputeClangResourceDir to not give you path_to_clang_dir.
-  EXPECT_NE(ComputeClangResourceDir(path_to_liblldb, true),
-ComputeClangResourceDir(path_to_liblldb));
+  // ComputeClangResourceDir not give you path_to_clang_dir.
+  EXPECT_NE(ComputeClangResourceDir(path_to_liblldb, true), path_to_clang_dir);
 }
 
 #if defined(__APPLE__)
Index: source/Plugins/ExpressionParser/Clang/ClangHost.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangHost.cpp
@@ -16,6 +16,7 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Threading.h"
 
+#include "lldb/Host/Config.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Utility/FileSpec.h"
@@ -41,24 +42,39 @@
 /// installed with the same prefix as lldb.
 ///
 static bool DefaultComputeClangResourceDirectory(FileSpec &lldb_shlib_spec,
- FileSpec &file_spec, bool verify) {
+ FileSpec &file_spec,
+ bool verify) {
+  Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
   std::string raw_path = lldb_shlib_spec.GetPath();
   llvm::StringRef parent_dir = llvm::sys::path::parent_path(raw_path);
 
-  llvm::SmallString<256> clang_dir(parent_dir);
-  llvm::SmallString<32> relative_path;
-  llvm::sys::path::append(relative_path,
-  llvm::Twine("lib") + CLANG_LIBDIR_SUFFIX, "clang",
-  CLANG_VERSION_STRING);
-
-  llvm::sys::path::append(clang_dir, relative_path);
-  if (!verify || VerifyClangPath(clang_dir)) {
-file_spec.GetDirectory().SetString(clang_dir);
-FileSystem::Instance().Resolve(file_spec);
-return true;
+  static const llvm::StringRef kResourceDirSuffixes[] = {
+  // LLVM.org's build of LLDB uses the clang resource directory placed
+  // in $install_dir/lib{,64}/clang/$clang_version.
+  "lib" CLANG_LIBDIR_SUFFIX "/clang/" CLANG_VERSION_STRING,
+  // swift-lldb uses the clang resource directory copied from swift, which
+  // by default is placed in $install_dir/lib{,64}/lldb/clang. LLDB places
+  // it there, so we use LLDB_LIBDIR_SUFFIX.
+  "lib" LLDB_LIBDIR_SUFFIX "/lldb/clang",
+  };
+
+  for (const auto &Suffix : kResourceDirSuffixes) {
+llvm::SmallString<256> clang_dir(parent_dir);
+llvm::SmallString<32> relative_path(Suffix);
+llvm::sys::path::native(relative_path);
+llvm::sys::path::append(clang_dir, relative_path);
+if (!verify || VerifyClangPath(clang_dir)) {
+  if (log)
+log->Printf("DefaultComputeClangResourceDir: Setting ClangResourceDir "
+"to \"%s\", verify = %s",
+clang_dir.str().str().c_str(), verify ? "true" : "false");
+  file_spec.GetDirectory().SetString(clang_dir);
+  FileSystem::Instance().Resolve(file_spec);
+  return true;
+}
   }
 
-  return HostInfo::ComputePathRelativeToLibrary(file_spec, relative_path);
+  return false;
 }
 
 bool lldb_private::ComputeClangResourceDirectory(FileSpec &lldb_shlib_spec,


Index: unittests/Expression/ClangParserTest.cpp
===
--- unittests/Expression/ClangParserTest.cpp
+++ unittests/Expression/ClangParserTest.cpp
@@ -50,9 +50,8 @@
   EXPECT_EQ(ComputeClangResourceDir(path_to_liblldb), path_to_clang_dir);
 
   // The path doesn't really exist, so setting verify to true should make
-  // ComputeClangResourceDir to not give you path_to_clang_dir.
-  EXPECT_NE(ComputeClangResourceDir(path_to_liblldb, true),
-ComputeClangResourceDir(path_to_liblldb));
+  // ComputeClangResourceDir not give you path_to_clang_dir.
+  EXPECT_NE(ComputeClangResourceDir(path_to_liblldb, true), path_to_clang_dir);
 }
 
 #if defined(__APPLE__)
Index: source/Plugins/ExpressionParser/Clang/ClangHost.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+

[Lldb-commits] [PATCH] D59708: [ExpressionParser] Add swift-lldb case for finding clang resource dir

2019-03-25 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

I changed the default behavior here setting file_spec to some known default 
unverified value to not setting it at all. It previously relied on there being 
a relative path to the clang resource dir, of which there are now two to pick 
from. Additionally, we pass in the directory containing liblldb to 
ComputeClangResourceDirectory now. The default behavior of 
`HostInfo::ComputePathRelativeToLibrary` was just computing it again and 
munging paths without verifying it. I think that if we fail to find the clang 
resource directory, the logs here should be sufficient to get started debugging.


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

https://reviews.llvm.org/D59708



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


[Lldb-commits] [PATCH] D54747: Discard debuginfo for object files empty after GC

2019-03-25 Thread Robert O'Callahan via Phabricator via lldb-commits
rocallahan marked 2 inline comments as done.
rocallahan added inline comments.



Comment at: lld/ELF/MarkLive.cpp:190
 
+template  static void setSectionLive(InputSectionBase *Sec) {
+  Sec->Live = true;

ruiu wrote:
> Since this file is MarkLive, markSection is perhaps a better name.
OK



Comment at: lld/ELF/MarkLive.cpp:192
+  Sec->Live = true;
+  if (Sec->kind() != SectionBase::Kind::Regular &&
+  Sec->kind() != SectionBase::Kind::Merge)

ruiu wrote:
> rocallahan wrote:
> > MaskRay wrote:
> > > This check can be changed to `!isa && 
> > > !isa`. But do you just want to exclude 
> > > `EhInputSection`?
> > Shouldn't I also be excluding `SyntheticSection`?
> This needs a comment.
> 
> Do you have to visit each file during the mark phase? Looks like you can mark 
> only sections first, and after marking all sections, you can scan all 
> sections to mark files. Looks like they can be two separate stages.
Maybe I'm wrong but I would have expected adding another pass over all sections 
to be slower than what I'm doing here.

Also we need to distinguish LSDA sections from other live sections since LSDA 
does not count as "making the file live". So we'd have to add an LSDA flag to 
`InputSection`.

Are you sure you want me to make this change?

Also I just noticed I've written LDSA in several places where it should be LSDA!


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D54747



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


[Lldb-commits] [lldb] r356942 - [ScriptInterpreterPython] Move SWIG initialization into the Python plugin (NFC)

2019-03-25 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Mar 25 13:14:31 2019
New Revision: 356942

URL: http://llvm.org/viewvc/llvm-project?rev=356942&view=rev
Log:
[ScriptInterpreterPython] Move SWIG initialization into the Python plugin (NFC)

Abstract initialization of the Python SWIG support in the Python plugin.

Modified:
lldb/trunk/source/API/SystemInitializerFull.cpp

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h

Modified: lldb/trunk/source/API/SystemInitializerFull.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=356942&r1=356941&r2=356942&view=diff
==
--- lldb/trunk/source/API/SystemInitializerFull.cpp (original)
+++ lldb/trunk/source/API/SystemInitializerFull.cpp Mon Mar 25 13:14:31 2019
@@ -121,145 +121,6 @@
 
 using namespace lldb_private;
 
-#ifndef LLDB_DISABLE_PYTHON
-
-// Defined in the SWIG source file
-#if PY_MAJOR_VERSION >= 3
-extern "C" PyObject *PyInit__lldb(void);
-
-#define LLDBSwigPyInit PyInit__lldb
-
-#else
-extern "C" void init_lldb(void);
-
-#define LLDBSwigPyInit init_lldb
-#endif
-
-// these are the Pythonic implementations of the required callbacks these are
-// scripting-language specific, which is why they belong here we still need to
-// use function pointers to them instead of relying on linkage-time resolution
-// because the SWIG stuff and this file get built at different times
-extern "C" bool LLDBSwigPythonBreakpointCallbackFunction(
-const char *python_function_name, const char *session_dictionary_name,
-const lldb::StackFrameSP &sb_frame,
-const lldb::BreakpointLocationSP &sb_bp_loc);
-
-extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(
-const char *python_function_name, const char *session_dictionary_name,
-const lldb::StackFrameSP &sb_frame, const lldb::WatchpointSP &sb_wp);
-
-extern "C" bool LLDBSwigPythonCallTypeScript(
-const char *python_function_name, void *session_dictionary,
-const lldb::ValueObjectSP &valobj_sp, void **pyfunct_wrapper,
-const lldb::TypeSummaryOptionsSP &options_sp, std::string &retval);
-
-extern "C" void *
-LLDBSwigPythonCreateSyntheticProvider(const char *python_class_name,
-  const char *session_dictionary_name,
-  const lldb::ValueObjectSP &valobj_sp);
-
-extern "C" void *
-LLDBSwigPythonCreateCommandObject(const char *python_class_name,
-  const char *session_dictionary_name,
-  const lldb::DebuggerSP debugger_sp);
-
-extern "C" void *LLDBSwigPythonCreateScriptedThreadPlan(
-const char *python_class_name, const char *session_dictionary_name,
-const lldb::ThreadPlanSP &thread_plan_sp);
-
-extern "C" bool LLDBSWIGPythonCallThreadPlan(void *implementor,
- const char *method_name,
- Event *event_sp, bool &got_error);
-
-extern "C" void *LLDBSwigPythonCreateScriptedBreakpointResolver(
-const char *python_class_name,
-const char *session_dictionary_name,
-lldb_private::StructuredDataImpl *args,
-lldb::BreakpointSP &bkpt_sp);
-
-extern "C" unsigned int LLDBSwigPythonCallBreakpointResolver(
-void *implementor,
-const char *method_name,
-lldb_private::SymbolContext *sym_ctx
-);
-
-extern "C" size_t LLDBSwigPython_CalculateNumChildren(void *implementor,
-  uint32_t max);
-
-extern "C" void *LLDBSwigPython_GetChildAtIndex(void *implementor,
-uint32_t idx);
-
-extern "C" int LLDBSwigPython_GetIndexOfChildWithName(void *implementor,
-  const char *child_name);
-
-extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data);
-
-extern lldb::ValueObjectSP
-LLDBSWIGPython_GetValueObjectSPFromSBValue(void *data);
-
-extern "C" bool LLDBSwigPython_UpdateSynthProviderInstance(void *implementor);
-
-extern "C" bool
-LLDBSwigPython_MightHaveChildrenSynthProviderInstance(void *implementor);
-
-extern "C" void *
-LLDBSwigPython_GetValueSynthProviderInstance(void *implementor);
-
-extern "C" bool
-LLDBSwigPythonCallCommand(const char *python_function_name,
-  const char *session_dictionary_name,
-  lldb::DebuggerSP &debugger, const char *args,
-  lldb_private::CommandReturnObject &cmd_retobj,
-  lldb::ExecutionContextRefSP exe_ctx_ref_sp);
-
-extern "C" bool
-LLDBSwigPythonCallCommandObject(void *implementor, lldb::DebuggerSP &debugger,
-const char *args,
-lldb_private::CommandReturnObject &cmd_retobj,
-

[Lldb-commits] [PATCH] D59719: [ScriptInterpreter] Make sure that PYTHONHOME is right.

2019-03-25 Thread Ted Woodward via Phabricator via lldb-commits
ted added a comment.

This doesn't look correct to me - it looks like there are 1 too many #endifs. I 
think the one at line 179 should be removed - it should have been replaced by 
the #else that is at line 180.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59719



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


[Lldb-commits] [PATCH] D54747: Discard debuginfo for object files empty after GC

2019-03-25 Thread Rui Ueyama via Phabricator via lldb-commits
ruiu added inline comments.



Comment at: lld/ELF/MarkLive.cpp:192
+  Sec->Live = true;
+  if (Sec->kind() != SectionBase::Kind::Regular &&
+  Sec->kind() != SectionBase::Kind::Merge)

rocallahan wrote:
> ruiu wrote:
> > rocallahan wrote:
> > > MaskRay wrote:
> > > > This check can be changed to `!isa && 
> > > > !isa`. But do you just want to exclude 
> > > > `EhInputSection`?
> > > Shouldn't I also be excluding `SyntheticSection`?
> > This needs a comment.
> > 
> > Do you have to visit each file during the mark phase? Looks like you can 
> > mark only sections first, and after marking all sections, you can scan all 
> > sections to mark files. Looks like they can be two separate stages.
> Maybe I'm wrong but I would have expected adding another pass over all 
> sections to be slower than what I'm doing here.
> 
> Also we need to distinguish LSDA sections from other live sections since LSDA 
> does not count as "making the file live". So we'd have to add an LSDA flag to 
> `InputSection`.
> 
> Are you sure you want me to make this change?
> 
> Also I just noticed I've written LDSA in several places where it should be 
> LSDA!
Ah OK, I thought that you set Sec->Live  to true only in `setSectionLive()` but 
you manipulated that in EnqueueMaybeLDSA as well. Looks like we have too many 
callback functions in this function -- this file is organized that way because 
the callback functions were very simple. Now it's been growing organically and 
probably get to the point that we should just use the regular class-based 
abstraction. Let me do that first.


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D54747



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


[Lldb-commits] [PATCH] D59708: [ExpressionParser] Add swift-lldb case for finding clang resource dir

2019-03-25 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd accepted this revision.
compnerd added a comment.
This revision is now accepted and ready to land.

Please add a comment about `verify` being only for tests.


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

https://reviews.llvm.org/D59708



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


[Lldb-commits] [lldb] r356944 - [ScriptInterpreterPython] Make SWIG callback private (NFC)

2019-03-25 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Mar 25 13:39:08 2019
New Revision: 356944

URL: http://llvm.org/viewvc/llvm-project?rev=356944&view=rev
Log:
[ScriptInterpreterPython] Make SWIG callback private (NFC)

With the initialization taking place inside the Python script
interpreter, these function no longer need to be public. The exception
is the g_swig_init_callback which is used from the RAII object.

Modified:

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=356944&r1=356943&r2=356944&view=diff
==
--- 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
Mon Mar 25 13:39:08 2019
@@ -194,65 +194,66 @@ LLDBSWIGPython_GetDynamicSetting(void *m
 
 #endif
 
-static ScriptInterpreterPython::SWIGInitCallback g_swig_init_callback = 
nullptr;
-static ScriptInterpreterPython::SWIGBreakpointCallbackFunction
-g_swig_breakpoint_callback = nullptr;
-static ScriptInterpreterPython::SWIGWatchpointCallbackFunction
-g_swig_watchpoint_callback = nullptr;
-static ScriptInterpreterPython::SWIGPythonTypeScriptCallbackFunction
-g_swig_typescript_callback = nullptr;
-static ScriptInterpreterPython::SWIGPythonCreateSyntheticProvider
-g_swig_synthetic_script = nullptr;
-static ScriptInterpreterPython::SWIGPythonCreateCommandObject
-g_swig_create_cmd = nullptr;
-static ScriptInterpreterPython::SWIGPythonCalculateNumChildren
-g_swig_calc_children = nullptr;
-static ScriptInterpreterPython::SWIGPythonGetChildAtIndex
-g_swig_get_child_index = nullptr;
-static ScriptInterpreterPython::SWIGPythonGetIndexOfChildWithName
-g_swig_get_index_child = nullptr;
-static ScriptInterpreterPython::SWIGPythonCastPyObjectToSBValue
-g_swig_cast_to_sbvalue = nullptr;
-static ScriptInterpreterPython::SWIGPythonGetValueObjectSPFromSBValue
-g_swig_get_valobj_sp_from_sbvalue = nullptr;
-static ScriptInterpreterPython::SWIGPythonUpdateSynthProviderInstance
-g_swig_update_provider = nullptr;
-static 
ScriptInterpreterPython::SWIGPythonMightHaveChildrenSynthProviderInstance
-g_swig_mighthavechildren_provider = nullptr;
-static ScriptInterpreterPython::SWIGPythonGetValueSynthProviderInstance
-g_swig_getvalue_provider = nullptr;
-static ScriptInterpreterPython::SWIGPythonCallCommand g_swig_call_command =
-nullptr;
-static ScriptInterpreterPython::SWIGPythonCallCommandObject
-g_swig_call_command_object = nullptr;
-static ScriptInterpreterPython::SWIGPythonCallModuleInit
-g_swig_call_module_init = nullptr;
-static ScriptInterpreterPython::SWIGPythonCreateOSPlugin
-g_swig_create_os_plugin = nullptr;
-static ScriptInterpreterPython::SWIGPythonCreateFrameRecognizer
-g_swig_create_frame_recognizer = nullptr;
-static ScriptInterpreterPython::SWIGPythonGetRecognizedArguments
-g_swig_get_recognized_arguments = nullptr;
-static ScriptInterpreterPython::SWIGPythonScriptKeyword_Process
-g_swig_run_script_keyword_process = nullptr;
-static ScriptInterpreterPython::SWIGPythonScriptKeyword_Thread
-g_swig_run_script_keyword_thread = nullptr;
-static ScriptInterpreterPython::SWIGPythonScriptKeyword_Target
-g_swig_run_script_keyword_target = nullptr;
-static ScriptInterpreterPython::SWIGPythonScriptKeyword_Frame
-g_swig_run_script_keyword_frame = nullptr;
-static ScriptInterpreterPython::SWIGPythonScriptKeyword_Value
-g_swig_run_script_keyword_value = nullptr;
-static ScriptInterpreterPython::SWIGPython_GetDynamicSetting g_swig_plugin_get 
=
-nullptr;
-static ScriptInterpreterPython::SWIGPythonCreateScriptedThreadPlan
-g_swig_thread_plan_script = nullptr;
-static ScriptInterpreterPython::SWIGPythonCallThreadPlan
-g_swig_call_thread_plan = nullptr;
-static ScriptInterpreterPython::SWIGPythonCreateScriptedBreakpointResolver
-g_swig_bkpt_resolver_script = nullptr;
-static ScriptInterpreterPython::SWIGPythonCallBreakpointResolver
-g_swig_call_bkpt_resolver = nullptr;
+ScriptInterpreterPython::SWIGInitCallback
+ScriptInterpreterPython::g_swig_init_callback = nullptr;
+ScriptInterpreterPython::SWIGBreakpointCallbackFunction
+ScriptInterpreterPython::g_swig_breakpoint_callback = nullptr;
+ScriptInterpreterPython::SWIGWatchpointCallbackFunction
+ScriptInterpreterPython::g_swig_watchpoint_callback = nullptr;
+ScriptInterpreterPython::SWIGPythonTypeScriptCallbackFunction
+ScriptInterpreterPython::g_swig_typescript_callback = nullptr;
+ScriptInterpreterPython::SWIGPythonCreateSyntheticProvider
+ScriptInterpreterPython::g_swig_synthetic_script

[Lldb-commits] [lldb] r356950 - [PythonTestSuite] Fix usage of InitializePrivate in PythonTestSuite

2019-03-25 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Mar 25 14:07:53 2019
New Revision: 356950

URL: http://llvm.org/viewvc/llvm-project?rev=356950&view=rev
Log:
[PythonTestSuite] Fix usage of InitializePrivate in PythonTestSuite

Modified:
lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

Modified: lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp?rev=356950&r1=356949&r2=356950&view=diff
==
--- lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp (original)
+++ lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp Mon Mar 
25 14:07:53 2019
@@ -16,14 +16,19 @@
 #include "PythonTestSuite.h"
 
 using namespace lldb_private;
+class TestScriptInterpreterPython : public ScriptInterpreterPython {
+public:
+  using ScriptInterpreterPython::Initialize;
+  using ScriptInterpreterPython::InitializePrivate;
+};
 
 void PythonTestSuite::SetUp() {
   FileSystem::Initialize();
   HostInfoBase::Initialize();
   // ScriptInterpreterPython::Initialize() depends on HostInfo being
   // initializedso it can compute the python directory etc.
-  ScriptInterpreterPython::Initialize();
-  ScriptInterpreterPython::InitializePrivate();
+  TestScriptInterpreterPython::Initialize();
+  TestScriptInterpreterPython::InitializePrivate();
 
   // Although we don't care about concurrency for the purposes of running
   // this test suite, Python requires the GIL to be locked even for
@@ -36,7 +41,7 @@ void PythonTestSuite::SetUp() {
 void PythonTestSuite::TearDown() {
   PyGILState_Release(m_gil_state);
 
-  ScriptInterpreterPython::Terminate();
+  TestScriptInterpreterPython::Terminate();
   HostInfoBase::Terminate();
   FileSystem::Terminate();
 }


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


[Lldb-commits] [PATCH] D59708: [ExpressionParser] Add swift-lldb case for finding clang resource dir

2019-03-25 Thread Alex Langford via Phabricator via lldb-commits
xiaobai updated this revision to Diff 192204.
xiaobai added a comment.

Added comment about verify


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

https://reviews.llvm.org/D59708

Files:
  source/Plugins/ExpressionParser/Clang/ClangHost.cpp
  unittests/Expression/ClangParserTest.cpp


Index: unittests/Expression/ClangParserTest.cpp
===
--- unittests/Expression/ClangParserTest.cpp
+++ unittests/Expression/ClangParserTest.cpp
@@ -50,9 +50,8 @@
   EXPECT_EQ(ComputeClangResourceDir(path_to_liblldb), path_to_clang_dir);
 
   // The path doesn't really exist, so setting verify to true should make
-  // ComputeClangResourceDir to not give you path_to_clang_dir.
-  EXPECT_NE(ComputeClangResourceDir(path_to_liblldb, true),
-ComputeClangResourceDir(path_to_liblldb));
+  // ComputeClangResourceDir not give you path_to_clang_dir.
+  EXPECT_NE(ComputeClangResourceDir(path_to_liblldb, true), path_to_clang_dir);
 }
 
 #if defined(__APPLE__)
Index: source/Plugins/ExpressionParser/Clang/ClangHost.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangHost.cpp
@@ -16,6 +16,7 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Threading.h"
 
+#include "lldb/Host/Config.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Utility/FileSpec.h"
@@ -38,27 +39,43 @@
 
 ///
 /// This will compute the clang resource directory assuming that clang was
-/// installed with the same prefix as lldb.
+/// installed with the same prefix as lldb. Note: the verify paramter is
+/// currently only used for testing.
 ///
 static bool DefaultComputeClangResourceDirectory(FileSpec &lldb_shlib_spec,
- FileSpec &file_spec, bool verify) {
+ FileSpec &file_spec,
+ bool verify) {
+  Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
   std::string raw_path = lldb_shlib_spec.GetPath();
   llvm::StringRef parent_dir = llvm::sys::path::parent_path(raw_path);
 
-  llvm::SmallString<256> clang_dir(parent_dir);
-  llvm::SmallString<32> relative_path;
-  llvm::sys::path::append(relative_path,
-  llvm::Twine("lib") + CLANG_LIBDIR_SUFFIX, "clang",
-  CLANG_VERSION_STRING);
-
-  llvm::sys::path::append(clang_dir, relative_path);
-  if (!verify || VerifyClangPath(clang_dir)) {
-file_spec.GetDirectory().SetString(clang_dir);
-FileSystem::Instance().Resolve(file_spec);
-return true;
+  static const llvm::StringRef kResourceDirSuffixes[] = {
+  // LLVM.org's build of LLDB uses the clang resource directory placed
+  // in $install_dir/lib{,64}/clang/$clang_version.
+  "lib" CLANG_LIBDIR_SUFFIX "/clang/" CLANG_VERSION_STRING,
+  // swift-lldb uses the clang resource directory copied from swift, which
+  // by default is placed in $install_dir/lib{,64}/lldb/clang. LLDB places
+  // it there, so we use LLDB_LIBDIR_SUFFIX.
+  "lib" LLDB_LIBDIR_SUFFIX "/lldb/clang",
+  };
+
+  for (const auto &Suffix : kResourceDirSuffixes) {
+llvm::SmallString<256> clang_dir(parent_dir);
+llvm::SmallString<32> relative_path(Suffix);
+llvm::sys::path::native(relative_path);
+llvm::sys::path::append(clang_dir, relative_path);
+if (!verify || VerifyClangPath(clang_dir)) {
+  if (log)
+log->Printf("DefaultComputeClangResourceDir: Setting ClangResourceDir "
+"to \"%s\", verify = %s",
+clang_dir.str().str().c_str(), verify ? "true" : "false");
+  file_spec.GetDirectory().SetString(clang_dir);
+  FileSystem::Instance().Resolve(file_spec);
+  return true;
+}
   }
 
-  return HostInfo::ComputePathRelativeToLibrary(file_spec, relative_path);
+  return false;
 }
 
 bool lldb_private::ComputeClangResourceDirectory(FileSpec &lldb_shlib_spec,


Index: unittests/Expression/ClangParserTest.cpp
===
--- unittests/Expression/ClangParserTest.cpp
+++ unittests/Expression/ClangParserTest.cpp
@@ -50,9 +50,8 @@
   EXPECT_EQ(ComputeClangResourceDir(path_to_liblldb), path_to_clang_dir);
 
   // The path doesn't really exist, so setting verify to true should make
-  // ComputeClangResourceDir to not give you path_to_clang_dir.
-  EXPECT_NE(ComputeClangResourceDir(path_to_liblldb, true),
-ComputeClangResourceDir(path_to_liblldb));
+  // ComputeClangResourceDir not give you path_to_clang_dir.
+  EXPECT_NE(ComputeClangResourceDir(path_to_liblldb, true), path_to_clang_dir);
 }
 
 #if defined(__APPLE__)
Index: source/Plugins/ExpressionParser/Clang/ClangHost.cpp
===
--- source/Plugins/ExpressionParser

[Lldb-commits] [lldb] r356960 - [lldb] [Process/NetBSD] Use nullptr to fix template arg deduction

2019-03-25 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Mon Mar 25 15:29:29 2019
New Revision: 356960

URL: http://llvm.org/viewvc/llvm-project?rev=356960&view=rev
Log:
[lldb] [Process/NetBSD] Use nullptr to fix template arg deduction

Modified:
lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp

Modified: lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp?rev=356960&r1=356959&r2=356960&view=diff
==
--- lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp Mon Mar 25 
15:29:29 2019
@@ -666,7 +666,7 @@ Status NativeProcessNetBSD::Attach() {
   // Need to use WALLSIG otherwise we receive an error with errno=ECHLD At this
   // point we should have a thread stopped if waitpid succeeds.
   if ((wstatus = llvm::sys::RetryAfterSignal(-1, waitpid,
-  m_pid, NULL, WALLSIG)) < 0)
+  m_pid, nullptr, WALLSIG)) < 0)
 return Status(errno, eErrorTypePOSIX);
 
   /* Initialize threads */


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


[Lldb-commits] [PATCH] D54747: Discard debuginfo for object files empty after GC

2019-03-25 Thread Rui Ueyama via Phabricator via lldb-commits
ruiu added a comment.

I committed https://reviews.llvm.org/D59800 which I believe makes your change 
easier to follow once rebased. Could you rebase it and upload a patch? Thanks!


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D54747



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


[Lldb-commits] [lldb] r356967 - [Python] Move SWIG wrapper dependency into the plugin

2019-03-25 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Mar 25 16:36:12 2019
New Revision: 356967

URL: http://llvm.org/viewvc/llvm-project?rev=356967&view=rev
Log:
[Python] Move SWIG wrapper dependency into the plugin

This should fix the Windows bot (fingers crossed).

Modified:
lldb/trunk/source/API/CMakeLists.txt
lldb/trunk/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
lldb/trunk/unittests/ScriptInterpreter/Python/CMakeLists.txt

Modified: lldb/trunk/source/API/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/CMakeLists.txt?rev=356967&r1=356966&r2=356967&view=diff
==
--- lldb/trunk/source/API/CMakeLists.txt (original)
+++ lldb/trunk/source/API/CMakeLists.txt Mon Mar 25 16:36:12 2019
@@ -4,11 +4,6 @@ endif()
 
 get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
 
-if(NOT LLDB_DISABLE_PYTHON)
-  get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
-  set(lldb_python_wrapper ${lldb_scripts_dir}/LLDBWrapPython.cpp)
-endif()
-
 add_lldb_library(liblldb SHARED
   SBAddress.cpp
   SBAttachInfo.cpp

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt?rev=356967&r1=356966&r2=356967&view=diff
==
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt Mon Mar 
25 16:36:12 2019
@@ -11,10 +11,16 @@ if (NOT CMAKE_SYSTEM_NAME MATCHES "Windo
   endif()
 endif()
 
+if(NOT LLDB_DISABLE_PYTHON)
+  get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
+  set(lldb_python_wrapper ${lldb_scripts_dir}/LLDBWrapPython.cpp)
+endif()
+
 add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN
   PythonDataObjects.cpp
   PythonExceptionState.cpp
   ScriptInterpreterPython.cpp
+  ${lldb_python_wrapper}
 
   LINK_LIBS
 lldbBreakpoint
@@ -26,3 +32,24 @@ add_lldb_library(lldbPluginScriptInterpr
   LINK_COMPONENTS
 Support
   )
+
+if(lldb_python_wrapper)
+  add_dependencies(lldbPluginScriptInterpreterPython swig_wrapper)
+
+  if (MSVC)
+set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING PROPERTY 
COMPILE_FLAGS " /W0")
+  else()
+set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING PROPERTY 
COMPILE_FLAGS " -w")
+  endif()
+
+  set_source_files_properties(${lldb_python_wrapper} PROPERTIES GENERATED ON)
+  if (CLANG_CL)
+set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING
+  PROPERTY COMPILE_FLAGS " -Wno-unused-function")
+  endif()
+  if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
+  NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
+set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING
+  PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
+  endif ()
+endif()

Modified: lldb/trunk/unittests/ScriptInterpreter/Python/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ScriptInterpreter/Python/CMakeLists.txt?rev=356967&r1=356966&r2=356967&view=diff
==
--- lldb/trunk/unittests/ScriptInterpreter/Python/CMakeLists.txt (original)
+++ lldb/trunk/unittests/ScriptInterpreter/Python/CMakeLists.txt Mon Mar 25 
16:36:12 2019
@@ -7,7 +7,7 @@ add_lldb_unittest(ScriptInterpreterPytho
 lldbHost
 lldbPluginScriptInterpreterPython
 ${PYTHON_LIBRARY}
+${lldb_python_wrapper}
   LINK_COMPONENTS
 Support
   )
-  
\ No newline at end of file


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


[Lldb-commits] [PATCH] D59708: [ExpressionParser] Add swift-lldb case for finding clang resource dir

2019-03-25 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.

Except for a typo and a little quibble about a comment, this looks okay to me.




Comment at: source/Plugins/ExpressionParser/Clang/ClangHost.cpp:42
 /// This will compute the clang resource directory assuming that clang was
-/// installed with the same prefix as lldb.
+/// installed with the same prefix as lldb. Note: the verify paramter is
+/// currently only used for testing.

spelling: parameter

But also, you should say something more informative, like:

If verify is true, the first candidate resource directory will be returned.  
This mode is only used for testing


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

https://reviews.llvm.org/D59708



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


[Lldb-commits] [PATCH] D59719: [ScriptInterpreter] Make sure that PYTHONHOME is right.

2019-03-25 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

In D59719#1442181 , @ted wrote:

> This doesn't look correct to me - it looks like there are 1 too many #endifs. 
> I think the one at line 179 should be removed - it should have been replaced 
> by the #else that is at line 180.


Update your checkout.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59719



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


[Lldb-commits] [PATCH] D59719: [ScriptInterpreter] Make sure that PYTHONHOME is right.

2019-03-25 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

In D59719#1441254 , @labath wrote:

> It sounds to me like you could achieve the same thing by generalizing the 
> LLDB_PYTHON_HOME logic in LLDBConfig.cmake. This would have the advantage of 
> centralizing the way we manage python-finding logic (instead of each OS doing 
> it's own thing) and also enable those users, who know what they are doing, to 
> override this logic and point lldb to a different python. (I don't know if 
> there are any such users, but it does not sounds like an impossible scenario).
>
> I think all it would take is to do something like:
>
> - move LLDB_RELOCATABLE_PYTHON handling outside of `if(WINDOWS)`
> - have the default value of `LLDB_RELOCATABLE_PYTHON` be `false` for darwin
> - possibly tweak the python-finding logic so that it prefers the one in 
> /System/Library/Frameworks/...


I'll try to make this more generic. Thanks for the input.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59719



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


[Lldb-commits] [PATCH] D59719: [ScriptInterpreter] Make sure that PYTHONHOME is right.

2019-03-25 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

In D59719#1441254 , @labath wrote:

> It sounds to me like you could achieve the same thing by generalizing the 
> LLDB_PYTHON_HOME logic in LLDBConfig.cmake. This would have the advantage of 
> centralizing the way we manage python-finding logic (instead of each OS doing 
> it's own thing) and also enable those users, who know what they are doing, to 
> override this logic and point lldb to a different python. (I don't know if 
> there are any such users, but it does not sounds like an impossible scenario).
>
> I think all it would take is to do something like:
>
> - move LLDB_RELOCATABLE_PYTHON handling outside of `if(WINDOWS)`
> - have the default value of `LLDB_RELOCATABLE_PYTHON` be `false` for darwin
> - possibly tweak the python-finding logic so that it prefers the one in 
> /System/Library/Frameworks/...


Oh, this won't work with xcodebuild, I'm afraid.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59719



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


[Lldb-commits] [lldb] r356971 - [Python] Define empty SWIG wrapper for unit testin"

2019-03-25 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Mar 25 18:11:15 2019
New Revision: 356971

URL: http://llvm.org/viewvc/llvm-project?rev=356971&view=rev
Log:
[Python] Define empty SWIG wrapper for unit testin"

The python plugin uses wrappers generated by swig. For the symbols to be
available, we'd need to link against liblldb, which is not an option
because the symbols could conflict with the static library we are
testing. Instead we define the symbols ourselves in the unit test.

Modified:
lldb/trunk/source/API/CMakeLists.txt
lldb/trunk/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
lldb/trunk/unittests/ScriptInterpreter/Python/CMakeLists.txt
lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

Modified: lldb/trunk/source/API/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/CMakeLists.txt?rev=356971&r1=356970&r2=356971&view=diff
==
--- lldb/trunk/source/API/CMakeLists.txt (original)
+++ lldb/trunk/source/API/CMakeLists.txt Mon Mar 25 18:11:15 2019
@@ -4,6 +4,11 @@ endif()
 
 get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
 
+if(NOT LLDB_DISABLE_PYTHON)
+  get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
+  set(lldb_python_wrapper ${lldb_scripts_dir}/LLDBWrapPython.cpp)
+endif()
+
 add_lldb_library(liblldb SHARED
   SBAddress.cpp
   SBAttachInfo.cpp

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt?rev=356971&r1=356970&r2=356971&view=diff
==
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt Mon Mar 
25 18:11:15 2019
@@ -11,16 +11,10 @@ if (NOT CMAKE_SYSTEM_NAME MATCHES "Windo
   endif()
 endif()
 
-if(NOT LLDB_DISABLE_PYTHON)
-  get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
-  set(lldb_python_wrapper ${lldb_scripts_dir}/LLDBWrapPython.cpp)
-endif()
-
 add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN
   PythonDataObjects.cpp
   PythonExceptionState.cpp
   ScriptInterpreterPython.cpp
-  ${lldb_python_wrapper}
 
   LINK_LIBS
 lldbBreakpoint
@@ -32,24 +26,3 @@ add_lldb_library(lldbPluginScriptInterpr
   LINK_COMPONENTS
 Support
   )
-
-if(lldb_python_wrapper)
-  add_dependencies(lldbPluginScriptInterpreterPython swig_wrapper)
-
-  if (MSVC)
-set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING PROPERTY 
COMPILE_FLAGS " /W0")
-  else()
-set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING PROPERTY 
COMPILE_FLAGS " -w")
-  endif()
-
-  set_source_files_properties(${lldb_python_wrapper} PROPERTIES GENERATED ON)
-  if (CLANG_CL)
-set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING
-  PROPERTY COMPILE_FLAGS " -Wno-unused-function")
-  endif()
-  if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
-  NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
-set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING
-  PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
-  endif ()
-endif()

Modified: lldb/trunk/unittests/ScriptInterpreter/Python/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ScriptInterpreter/Python/CMakeLists.txt?rev=356971&r1=356970&r2=356971&view=diff
==
--- lldb/trunk/unittests/ScriptInterpreter/Python/CMakeLists.txt (original)
+++ lldb/trunk/unittests/ScriptInterpreter/Python/CMakeLists.txt Mon Mar 25 
18:11:15 2019
@@ -7,7 +7,7 @@ add_lldb_unittest(ScriptInterpreterPytho
 lldbHost
 lldbPluginScriptInterpreterPython
 ${PYTHON_LIBRARY}
-${lldb_python_wrapper}
   LINK_COMPONENTS
 Support
   )
+  
\ No newline at end of file

Modified: lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp?rev=356971&r1=356970&r2=356971&view=diff
==
--- lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp (original)
+++ lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp Mon Mar 
25 18:11:15 2019
@@ -45,3 +45,190 @@ void PythonTestSuite::TearDown() {
   HostInfoBase::Terminate();
   FileSystem::Terminate();
 }
+
+// The following functions are the Pythonic implementations of the required
+// callbacks. Because they're defined in libLLDB which we cannot link for the
+// unit test, we have a 'default' implementation here.
+
+#if PY_MAJOR_VERSION >= 3
+extern "C" PyObject *PyInit__lldb(void) { return nullptr; }
+#define LLDBSwigPyInit PyInit__lldb
+#else
+extern "C" void init_lldb(void) {}
+#define LLDBSwigPyInit init_lldb
+#endif
+
+extern "C" bool LLDBSwigPytho