[Lldb-commits] [lldb] r280751 - *** This commit represents a complete reformatting of the LLDB source code

Kate Stone via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 6 13:58:36 PDT 2016


Modified: lldb/trunk/unittests/ScriptInterpreter/Python/PythonExceptionStateTests.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ScriptInterpreter/Python/PythonExceptionStateTests.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/ScriptInterpreter/Python/PythonExceptionStateTests.cpp (original)
+++ lldb/trunk/unittests/ScriptInterpreter/Python/PythonExceptionStateTests.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- PythonExceptionStateTest.cpp ------------------------------*- C++ -*-===//
+//===-- PythonExceptionStateTest.cpp ------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -9,166 +10,156 @@
 
 #include "gtest/gtest.h"
 
-#include "Plugins/ScriptInterpreter/Python/lldb-python.h"
 #include "Plugins/ScriptInterpreter/Python/PythonDataObjects.h"
 #include "Plugins/ScriptInterpreter/Python/PythonExceptionState.h"
 #include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h"
+#include "Plugins/ScriptInterpreter/Python/lldb-python.h"
 
 #include "PythonTestSuite.h"
 
 using namespace lldb_private;
 
-class PythonExceptionStateTest : public PythonTestSuite
-{
-  public:
-  protected:
-    void
-    RaiseException()
-    {
-        PyErr_SetString(PyExc_RuntimeError, "PythonExceptionStateTest test error");
-    }
+class PythonExceptionStateTest : public PythonTestSuite {
+public:
+protected:
+  void RaiseException() {
+    PyErr_SetString(PyExc_RuntimeError, "PythonExceptionStateTest test error");
+  }
 };
 
-TEST_F(PythonExceptionStateTest, TestExceptionStateChecking)
-{
-    PyErr_Clear();
-    EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
-
-    RaiseException();
-    EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
-
-    PyErr_Clear();
-}
-
-TEST_F(PythonExceptionStateTest, TestAcquisitionSemantics)
-{
-    PyErr_Clear();
-    PythonExceptionState no_error(false);
-    EXPECT_FALSE(no_error.IsError());
-    EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
-
-    PyErr_Clear();
+TEST_F(PythonExceptionStateTest, TestExceptionStateChecking) {
+  PyErr_Clear();
+  EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
+
+  RaiseException();
+  EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
+
+  PyErr_Clear();
+}
+
+TEST_F(PythonExceptionStateTest, TestAcquisitionSemantics) {
+  PyErr_Clear();
+  PythonExceptionState no_error(false);
+  EXPECT_FALSE(no_error.IsError());
+  EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
+
+  PyErr_Clear();
+  RaiseException();
+  PythonExceptionState error(false);
+  EXPECT_TRUE(error.IsError());
+  EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
+  error.Discard();
+
+  PyErr_Clear();
+  RaiseException();
+  error.Acquire(false);
+  EXPECT_TRUE(error.IsError());
+  EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
+
+  PyErr_Clear();
+}
+
+TEST_F(PythonExceptionStateTest, TestDiscardSemantics) {
+  PyErr_Clear();
+
+  // Test that discarding an exception does not restore the exception
+  // state even when auto-restore==true is set
+  RaiseException();
+  PythonExceptionState error(true);
+  EXPECT_TRUE(error.IsError());
+  EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
+
+  error.Discard();
+  EXPECT_FALSE(error.IsError());
+  EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
+}
+
+TEST_F(PythonExceptionStateTest, TestResetSemantics) {
+  PyErr_Clear();
+
+  // Resetting when auto-restore is true should restore.
+  RaiseException();
+  PythonExceptionState error(true);
+  EXPECT_TRUE(error.IsError());
+  EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
+  error.Reset();
+  EXPECT_FALSE(error.IsError());
+  EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
+
+  PyErr_Clear();
+
+  // Resetting when auto-restore is false should discard.
+  RaiseException();
+  PythonExceptionState error2(false);
+  EXPECT_TRUE(error2.IsError());
+  EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
+  error2.Reset();
+  EXPECT_FALSE(error2.IsError());
+  EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
+
+  PyErr_Clear();
+}
+
+TEST_F(PythonExceptionStateTest, TestManualRestoreSemantics) {
+  PyErr_Clear();
+  RaiseException();
+  PythonExceptionState error(false);
+  EXPECT_TRUE(error.IsError());
+  EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
+
+  error.Restore();
+  EXPECT_FALSE(error.IsError());
+  EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
+
+  PyErr_Clear();
+}
+
+TEST_F(PythonExceptionStateTest, TestAutoRestoreSemantics) {
+  PyErr_Clear();
+  // Test that using the auto-restore flag correctly restores the exception
+  // state on destruction, and not using the auto-restore flag correctly
+  // does NOT restore the state on destruction.
+  {
     RaiseException();
     PythonExceptionState error(false);
     EXPECT_TRUE(error.IsError());
     EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
-    error.Discard();
+  }
+  EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
 
-    PyErr_Clear();
-    RaiseException();
-    error.Acquire(false);
-    EXPECT_TRUE(error.IsError());
-    EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
-
-    PyErr_Clear();
-}
-
-TEST_F(PythonExceptionStateTest, TestDiscardSemantics)
-{
-    PyErr_Clear();
-
-    // Test that discarding an exception does not restore the exception
-    // state even when auto-restore==true is set
+  PyErr_Clear();
+  {
     RaiseException();
     PythonExceptionState error(true);
     EXPECT_TRUE(error.IsError());
     EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
+  }
+  EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
 
-    error.Discard();
-    EXPECT_FALSE(error.IsError());
-    EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
+  PyErr_Clear();
 }
 
-TEST_F(PythonExceptionStateTest, TestResetSemantics)
-{
-    PyErr_Clear();
+TEST_F(PythonExceptionStateTest, TestAutoRestoreChanged) {
+  // Test that if we re-acquire with different auto-restore semantics,
+  // that the new semantics are respected.
+  PyErr_Clear();
 
-    // Resetting when auto-restore is true should restore.
-    RaiseException();
-    PythonExceptionState error(true);
-    EXPECT_TRUE(error.IsError());
-    EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
-    error.Reset();
-    EXPECT_FALSE(error.IsError());
-    EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
+  RaiseException();
+  PythonExceptionState error(false);
+  EXPECT_TRUE(error.IsError());
 
-    PyErr_Clear();
+  error.Reset();
+  EXPECT_FALSE(error.IsError());
+  EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
 
-    // Resetting when auto-restore is false should discard.
-    RaiseException();
-    PythonExceptionState error2(false);
-    EXPECT_TRUE(error2.IsError());
-    EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
-    error2.Reset();
-    EXPECT_FALSE(error2.IsError());
-    EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
-
-    PyErr_Clear();
-}
-
-TEST_F(PythonExceptionStateTest, TestManualRestoreSemantics)
-{
-    PyErr_Clear();
-    RaiseException();
-    PythonExceptionState error(false);
-    EXPECT_TRUE(error.IsError());
-    EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
-
-    error.Restore();
-    EXPECT_FALSE(error.IsError());
-    EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
-
-    PyErr_Clear();
-}
-
-TEST_F(PythonExceptionStateTest, TestAutoRestoreSemantics)
-{
-    PyErr_Clear();
-    // Test that using the auto-restore flag correctly restores the exception
-    // state on destruction, and not using the auto-restore flag correctly
-    // does NOT restore the state on destruction.
-    {
-        RaiseException();
-        PythonExceptionState error(false);
-        EXPECT_TRUE(error.IsError());
-        EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
-    }
-    EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
-
-    PyErr_Clear();
-    {
-        RaiseException();
-        PythonExceptionState error(true);
-        EXPECT_TRUE(error.IsError());
-        EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
-    }
-    EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
-
-    PyErr_Clear();
-}
-
-TEST_F(PythonExceptionStateTest, TestAutoRestoreChanged)
-{
-    // Test that if we re-acquire with different auto-restore semantics,
-    // that the new semantics are respected.
-    PyErr_Clear();
-
-    RaiseException();
-    PythonExceptionState error(false);
-    EXPECT_TRUE(error.IsError());
-
-    error.Reset();
-    EXPECT_FALSE(error.IsError());
-    EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
-
-    RaiseException();
-    error.Acquire(true);
-    EXPECT_TRUE(error.IsError());
-    EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
+  RaiseException();
+  error.Acquire(true);
+  EXPECT_TRUE(error.IsError());
+  EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
 
-    error.Reset();
-    EXPECT_FALSE(error.IsError());
-    EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
+  error.Reset();
+  EXPECT_FALSE(error.IsError());
+  EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
 
-    PyErr_Clear();
+  PyErr_Clear();
 }

Modified: lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp (original)
+++ lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp Tue Sep  6 15:57:50 2016
@@ -7,37 +7,33 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "gtest/gtest.h"
 #include "Plugins/ScriptInterpreter/Python/lldb-python.h"
+#include "gtest/gtest.h"
 
-#include "lldb/Host/HostInfo.h"
 #include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h"
+#include "lldb/Host/HostInfo.h"
 
 #include "PythonTestSuite.h"
 
 using namespace lldb_private;
 
-void
-PythonTestSuite::SetUp()
-{
-    HostInfoBase::Initialize();
-    // ScriptInterpreterPython::Initialize() depends on HostInfo being
-    // initializedso it can compute the python directory etc.
-    ScriptInterpreterPython::Initialize();
-    ScriptInterpreterPython::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
-    // deallocating memory, which can happen when you call Py_DECREF or
-    // Py_INCREF.  So acquire the GIL for the entire duration of this
-    // test suite.
-    m_gil_state = PyGILState_Ensure();
+void PythonTestSuite::SetUp() {
+  HostInfoBase::Initialize();
+  // ScriptInterpreterPython::Initialize() depends on HostInfo being
+  // initializedso it can compute the python directory etc.
+  ScriptInterpreterPython::Initialize();
+  ScriptInterpreterPython::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
+  // deallocating memory, which can happen when you call Py_DECREF or
+  // Py_INCREF.  So acquire the GIL for the entire duration of this
+  // test suite.
+  m_gil_state = PyGILState_Ensure();
 }
 
-void
-PythonTestSuite::TearDown()
-{
-    PyGILState_Release(m_gil_state);
+void PythonTestSuite::TearDown() {
+  PyGILState_Release(m_gil_state);
 
-    ScriptInterpreterPython::Terminate();
+  ScriptInterpreterPython::Terminate();
 }

Modified: lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.h (original)
+++ lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.h Tue Sep  6 15:57:50 2016
@@ -11,16 +11,12 @@
 
 using namespace lldb_private;
 
-class PythonTestSuite : public testing::Test
-{
+class PythonTestSuite : public testing::Test {
 public:
-    void
-    SetUp() override;
+  void SetUp() override;
 
-    void
-    TearDown() override;
+  void TearDown() override;
 
 private:
-    PyGILState_STATE m_gil_state;
+  PyGILState_STATE m_gil_state;
 };
-

Modified: lldb/trunk/unittests/Symbol/TestClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Symbol/TestClangASTContext.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/Symbol/TestClangASTContext.cpp (original)
+++ lldb/trunk/unittests/Symbol/TestClangASTContext.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- TestClangASTContext.cpp ---------------------------------------*- C++ -*-===//
+//===-- TestClangASTContext.cpp ---------------------------------------*- C++
+//-*-===//
 
 //
 //                     The LLVM Compiler Infrastructure
@@ -20,296 +21,358 @@ using namespace clang;
 using namespace lldb;
 using namespace lldb_private;
 
-class TestClangASTContext : public testing::Test
-{
+class TestClangASTContext : public testing::Test {
 public:
-    static void
-    SetUpTestCase()
-    {
-        HostInfo::Initialize();
-    }
-
-    static void
-    TearDownTestCase()
-    {
-        HostInfo::Terminate();
-    }
-
-    virtual void
-    SetUp() override
-    {
-        std::string triple = HostInfo::GetTargetTriple();
-        m_ast.reset(new ClangASTContext(triple.c_str()));
-    }
-
-    virtual void
-    TearDown() override
-    {
-        m_ast.reset();
-    }
+  static void SetUpTestCase() { HostInfo::Initialize(); }
+
+  static void TearDownTestCase() { HostInfo::Terminate(); }
+
+  virtual void SetUp() override {
+    std::string triple = HostInfo::GetTargetTriple();
+    m_ast.reset(new ClangASTContext(triple.c_str()));
+  }
+
+  virtual void TearDown() override { m_ast.reset(); }
 
 protected:
-    std::unique_ptr<ClangASTContext> m_ast;
+  std::unique_ptr<ClangASTContext> m_ast;
 
-    QualType
-    GetBasicQualType(BasicType type) const
-    {
-        return ClangUtil::GetQualType(m_ast->GetBasicTypeFromAST(type));
-    }
-
-    QualType
-    GetBasicQualType(const char *name) const
-    {
-        return ClangUtil::GetQualType(m_ast->GetBuiltinTypeByName(ConstString(name)));
-    }
+  QualType GetBasicQualType(BasicType type) const {
+    return ClangUtil::GetQualType(m_ast->GetBasicTypeFromAST(type));
+  }
+
+  QualType GetBasicQualType(const char *name) const {
+    return ClangUtil::GetQualType(
+        m_ast->GetBuiltinTypeByName(ConstString(name)));
+  }
 };
 
-TEST_F(TestClangASTContext, TestGetBasicTypeFromEnum)
-{
-    clang::ASTContext *context = m_ast->getASTContext();
-
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeBool), context->BoolTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeChar), context->CharTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeChar16), context->Char16Ty));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeChar32), context->Char32Ty));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeDouble), context->DoubleTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeDoubleComplex), context->DoubleComplexTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeFloat), context->FloatTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeFloatComplex), context->FloatComplexTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeHalf), context->HalfTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeInt), context->IntTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeInt128), context->Int128Ty));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeLong), context->LongTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeLongDouble), context->LongDoubleTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeLongDoubleComplex), context->LongDoubleComplexTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeLongLong), context->LongLongTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeNullPtr), context->NullPtrTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeObjCClass), context->getObjCClassType()));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeObjCID), context->getObjCIdType()));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeObjCSel), context->getObjCSelType()));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeShort), context->ShortTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeSignedChar), context->SignedCharTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeUnsignedChar), context->UnsignedCharTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeUnsignedInt), context->UnsignedIntTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeUnsignedInt128), context->UnsignedInt128Ty));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeUnsignedLong), context->UnsignedLongTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeUnsignedLongLong), context->UnsignedLongLongTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeUnsignedShort), context->UnsignedShortTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeVoid), context->VoidTy));
-    EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeWChar), context->WCharTy));
+TEST_F(TestClangASTContext, TestGetBasicTypeFromEnum) {
+  clang::ASTContext *context = m_ast->getASTContext();
+
+  EXPECT_TRUE(
+      context->hasSameType(GetBasicQualType(eBasicTypeBool), context->BoolTy));
+  EXPECT_TRUE(
+      context->hasSameType(GetBasicQualType(eBasicTypeChar), context->CharTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeChar16),
+                                   context->Char16Ty));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeChar32),
+                                   context->Char32Ty));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeDouble),
+                                   context->DoubleTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeDoubleComplex),
+                                   context->DoubleComplexTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeFloat),
+                                   context->FloatTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeFloatComplex),
+                                   context->FloatComplexTy));
+  EXPECT_TRUE(
+      context->hasSameType(GetBasicQualType(eBasicTypeHalf), context->HalfTy));
+  EXPECT_TRUE(
+      context->hasSameType(GetBasicQualType(eBasicTypeInt), context->IntTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeInt128),
+                                   context->Int128Ty));
+  EXPECT_TRUE(
+      context->hasSameType(GetBasicQualType(eBasicTypeLong), context->LongTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeLongDouble),
+                                   context->LongDoubleTy));
+  EXPECT_TRUE(
+      context->hasSameType(GetBasicQualType(eBasicTypeLongDoubleComplex),
+                           context->LongDoubleComplexTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeLongLong),
+                                   context->LongLongTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeNullPtr),
+                                   context->NullPtrTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeObjCClass),
+                                   context->getObjCClassType()));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeObjCID),
+                                   context->getObjCIdType()));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeObjCSel),
+                                   context->getObjCSelType()));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeShort),
+                                   context->ShortTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeSignedChar),
+                                   context->SignedCharTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeUnsignedChar),
+                                   context->UnsignedCharTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeUnsignedInt),
+                                   context->UnsignedIntTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeUnsignedInt128),
+                                   context->UnsignedInt128Ty));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeUnsignedLong),
+                                   context->UnsignedLongTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeUnsignedLongLong),
+                                   context->UnsignedLongLongTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeUnsignedShort),
+                                   context->UnsignedShortTy));
+  EXPECT_TRUE(
+      context->hasSameType(GetBasicQualType(eBasicTypeVoid), context->VoidTy));
+  EXPECT_TRUE(context->hasSameType(GetBasicQualType(eBasicTypeWChar),
+                                   context->WCharTy));
 }
 
-TEST_F(TestClangASTContext, TestGetBasicTypeFromName)
-{
-    EXPECT_EQ(GetBasicQualType(eBasicTypeChar), GetBasicQualType("char"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeSignedChar), GetBasicQualType("signed char"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedChar), GetBasicQualType("unsigned char"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeWChar), GetBasicQualType("wchar_t"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeSignedWChar), GetBasicQualType("signed wchar_t"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedWChar), GetBasicQualType("unsigned wchar_t"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeShort), GetBasicQualType("short"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeShort), GetBasicQualType("short int"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedShort), GetBasicQualType("unsigned short"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedShort), GetBasicQualType("unsigned short int"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeInt), GetBasicQualType("int"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeInt), GetBasicQualType("signed int"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedInt), GetBasicQualType("unsigned int"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedInt), GetBasicQualType("unsigned"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeLong), GetBasicQualType("long"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeLong), GetBasicQualType("long int"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedLong), GetBasicQualType("unsigned long"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedLong), GetBasicQualType("unsigned long int"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeLongLong), GetBasicQualType("long long"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeLongLong), GetBasicQualType("long long int"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedLongLong), GetBasicQualType("unsigned long long"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedLongLong), GetBasicQualType("unsigned long long int"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeInt128), GetBasicQualType("__int128_t"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedInt128), GetBasicQualType("__uint128_t"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeVoid), GetBasicQualType("void"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeBool), GetBasicQualType("bool"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeFloat), GetBasicQualType("float"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeDouble), GetBasicQualType("double"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeLongDouble), GetBasicQualType("long double"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeObjCID), GetBasicQualType("id"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeObjCSel), GetBasicQualType("SEL"));
-    EXPECT_EQ(GetBasicQualType(eBasicTypeNullPtr), GetBasicQualType("nullptr"));
+TEST_F(TestClangASTContext, TestGetBasicTypeFromName) {
+  EXPECT_EQ(GetBasicQualType(eBasicTypeChar), GetBasicQualType("char"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeSignedChar),
+            GetBasicQualType("signed char"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedChar),
+            GetBasicQualType("unsigned char"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeWChar), GetBasicQualType("wchar_t"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeSignedWChar),
+            GetBasicQualType("signed wchar_t"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedWChar),
+            GetBasicQualType("unsigned wchar_t"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeShort), GetBasicQualType("short"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeShort), GetBasicQualType("short int"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedShort),
+            GetBasicQualType("unsigned short"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedShort),
+            GetBasicQualType("unsigned short int"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeInt), GetBasicQualType("int"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeInt), GetBasicQualType("signed int"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedInt),
+            GetBasicQualType("unsigned int"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedInt),
+            GetBasicQualType("unsigned"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeLong), GetBasicQualType("long"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeLong), GetBasicQualType("long int"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedLong),
+            GetBasicQualType("unsigned long"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedLong),
+            GetBasicQualType("unsigned long int"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeLongLong),
+            GetBasicQualType("long long"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeLongLong),
+            GetBasicQualType("long long int"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedLongLong),
+            GetBasicQualType("unsigned long long"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedLongLong),
+            GetBasicQualType("unsigned long long int"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeInt128), GetBasicQualType("__int128_t"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeUnsignedInt128),
+            GetBasicQualType("__uint128_t"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeVoid), GetBasicQualType("void"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeBool), GetBasicQualType("bool"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeFloat), GetBasicQualType("float"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeDouble), GetBasicQualType("double"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeLongDouble),
+            GetBasicQualType("long double"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeObjCID), GetBasicQualType("id"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeObjCSel), GetBasicQualType("SEL"));
+  EXPECT_EQ(GetBasicQualType(eBasicTypeNullPtr), GetBasicQualType("nullptr"));
 }
 
-void
-VerifyEncodingAndBitSize(clang::ASTContext *context, lldb::Encoding encoding, int bit_size)
-{
-    CompilerType type = ClangASTContext::GetBuiltinTypeForEncodingAndBitSize(context, encoding, bit_size);
-    EXPECT_TRUE(type.IsValid());
-
-    QualType qtype = ClangUtil::GetQualType(type);
-    EXPECT_FALSE(qtype.isNull());
-    if (qtype.isNull())
-        return;
-
-    uint64_t actual_size = context->getTypeSize(qtype);
-    EXPECT_EQ(bit_size, actual_size);
-
-    const clang::Type *type_ptr = qtype.getTypePtr();
-    EXPECT_NE(nullptr, type_ptr);
-    if (!type_ptr)
-        return;
-
-    EXPECT_TRUE(type_ptr->isBuiltinType());
-    if (encoding == eEncodingSint)
-        EXPECT_TRUE(type_ptr->isSignedIntegerType());
-    else if (encoding == eEncodingUint)
-        EXPECT_TRUE(type_ptr->isUnsignedIntegerType());
-    else if (encoding == eEncodingIEEE754)
-        EXPECT_TRUE(type_ptr->isFloatingType());
+void VerifyEncodingAndBitSize(clang::ASTContext *context,
+                              lldb::Encoding encoding, int bit_size) {
+  CompilerType type = ClangASTContext::GetBuiltinTypeForEncodingAndBitSize(
+      context, encoding, bit_size);
+  EXPECT_TRUE(type.IsValid());
+
+  QualType qtype = ClangUtil::GetQualType(type);
+  EXPECT_FALSE(qtype.isNull());
+  if (qtype.isNull())
+    return;
+
+  uint64_t actual_size = context->getTypeSize(qtype);
+  EXPECT_EQ(bit_size, actual_size);
+
+  const clang::Type *type_ptr = qtype.getTypePtr();
+  EXPECT_NE(nullptr, type_ptr);
+  if (!type_ptr)
+    return;
+
+  EXPECT_TRUE(type_ptr->isBuiltinType());
+  if (encoding == eEncodingSint)
+    EXPECT_TRUE(type_ptr->isSignedIntegerType());
+  else if (encoding == eEncodingUint)
+    EXPECT_TRUE(type_ptr->isUnsignedIntegerType());
+  else if (encoding == eEncodingIEEE754)
+    EXPECT_TRUE(type_ptr->isFloatingType());
 }
 
-TEST_F(TestClangASTContext, TestBuiltinTypeForEncodingAndBitSize)
-{
-    clang::ASTContext *context = m_ast->getASTContext();
-
-    // Make sure we can get types of every possible size in every possible encoding.
-    // We can't make any guarantee about which specific type we get, because the standard
-    // isn't that specific.  We only need to make sure the compiler hands us some type that
-    // is both a builtin type and matches the requested bit size.
-    VerifyEncodingAndBitSize(context, eEncodingSint, 8);
-    VerifyEncodingAndBitSize(context, eEncodingSint, 16);
-    VerifyEncodingAndBitSize(context, eEncodingSint, 32);
-    VerifyEncodingAndBitSize(context, eEncodingSint, 64);
-    VerifyEncodingAndBitSize(context, eEncodingSint, 128);
-
-    VerifyEncodingAndBitSize(context, eEncodingUint, 8);
-    VerifyEncodingAndBitSize(context, eEncodingUint, 16);
-    VerifyEncodingAndBitSize(context, eEncodingUint, 32);
-    VerifyEncodingAndBitSize(context, eEncodingUint, 64);
-    VerifyEncodingAndBitSize(context, eEncodingUint, 128);
+TEST_F(TestClangASTContext, TestBuiltinTypeForEncodingAndBitSize) {
+  clang::ASTContext *context = m_ast->getASTContext();
+
+  // Make sure we can get types of every possible size in every possible
+  // encoding.
+  // We can't make any guarantee about which specific type we get, because the
+  // standard
+  // isn't that specific.  We only need to make sure the compiler hands us some
+  // type that
+  // is both a builtin type and matches the requested bit size.
+  VerifyEncodingAndBitSize(context, eEncodingSint, 8);
+  VerifyEncodingAndBitSize(context, eEncodingSint, 16);
+  VerifyEncodingAndBitSize(context, eEncodingSint, 32);
+  VerifyEncodingAndBitSize(context, eEncodingSint, 64);
+  VerifyEncodingAndBitSize(context, eEncodingSint, 128);
+
+  VerifyEncodingAndBitSize(context, eEncodingUint, 8);
+  VerifyEncodingAndBitSize(context, eEncodingUint, 16);
+  VerifyEncodingAndBitSize(context, eEncodingUint, 32);
+  VerifyEncodingAndBitSize(context, eEncodingUint, 64);
+  VerifyEncodingAndBitSize(context, eEncodingUint, 128);
 
-    VerifyEncodingAndBitSize(context, eEncodingIEEE754, 32);
-    VerifyEncodingAndBitSize(context, eEncodingIEEE754, 64);
+  VerifyEncodingAndBitSize(context, eEncodingIEEE754, 32);
+  VerifyEncodingAndBitSize(context, eEncodingIEEE754, 64);
 }
 
-TEST_F(TestClangASTContext, TestIsClangType)
-{
-    clang::ASTContext *context = m_ast->getASTContext();
-    lldb::opaque_compiler_type_t bool_ctype = ClangASTContext::GetOpaqueCompilerType(context, lldb::eBasicTypeBool);
-    CompilerType bool_type(m_ast.get(), bool_ctype);
-    CompilerType record_type = m_ast->CreateRecordType(nullptr, lldb::eAccessPublic, "FooRecord", clang::TTK_Struct,
-                                                       lldb::eLanguageTypeC_plus_plus, nullptr);
-    // Clang builtin type and record type should pass
-    EXPECT_TRUE(ClangUtil::IsClangType(bool_type));
-    EXPECT_TRUE(ClangUtil::IsClangType(record_type));
-
-    // Default constructed type should fail
-    EXPECT_FALSE(ClangUtil::IsClangType(CompilerType()));
-
-    // Go type should fail
-    GoASTContext go_ast;
-    CompilerType go_type(&go_ast, bool_ctype);
-    EXPECT_FALSE(ClangUtil::IsClangType(go_type));
+TEST_F(TestClangASTContext, TestIsClangType) {
+  clang::ASTContext *context = m_ast->getASTContext();
+  lldb::opaque_compiler_type_t bool_ctype =
+      ClangASTContext::GetOpaqueCompilerType(context, lldb::eBasicTypeBool);
+  CompilerType bool_type(m_ast.get(), bool_ctype);
+  CompilerType record_type = m_ast->CreateRecordType(
+      nullptr, lldb::eAccessPublic, "FooRecord", clang::TTK_Struct,
+      lldb::eLanguageTypeC_plus_plus, nullptr);
+  // Clang builtin type and record type should pass
+  EXPECT_TRUE(ClangUtil::IsClangType(bool_type));
+  EXPECT_TRUE(ClangUtil::IsClangType(record_type));
+
+  // Default constructed type should fail
+  EXPECT_FALSE(ClangUtil::IsClangType(CompilerType()));
+
+  // Go type should fail
+  GoASTContext go_ast;
+  CompilerType go_type(&go_ast, bool_ctype);
+  EXPECT_FALSE(ClangUtil::IsClangType(go_type));
 }
 
-TEST_F(TestClangASTContext, TestRemoveFastQualifiers)
-{
-    CompilerType record_type = m_ast->CreateRecordType(nullptr, lldb::eAccessPublic, "FooRecord", clang::TTK_Struct,
-                                                       lldb::eLanguageTypeC_plus_plus, nullptr);
-    QualType qt;
-
-    qt = ClangUtil::GetQualType(record_type);
-    EXPECT_EQ(0, qt.getLocalFastQualifiers());
-    record_type = record_type.AddConstModifier();
-    record_type = record_type.AddVolatileModifier();
-    record_type = record_type.AddRestrictModifier();
-    qt = ClangUtil::GetQualType(record_type);
-    EXPECT_NE(0, qt.getLocalFastQualifiers());
-    record_type = ClangUtil::RemoveFastQualifiers(record_type);
-    qt = ClangUtil::GetQualType(record_type);
-    EXPECT_EQ(0, qt.getLocalFastQualifiers());
+TEST_F(TestClangASTContext, TestRemoveFastQualifiers) {
+  CompilerType record_type = m_ast->CreateRecordType(
+      nullptr, lldb::eAccessPublic, "FooRecord", clang::TTK_Struct,
+      lldb::eLanguageTypeC_plus_plus, nullptr);
+  QualType qt;
+
+  qt = ClangUtil::GetQualType(record_type);
+  EXPECT_EQ(0, qt.getLocalFastQualifiers());
+  record_type = record_type.AddConstModifier();
+  record_type = record_type.AddVolatileModifier();
+  record_type = record_type.AddRestrictModifier();
+  qt = ClangUtil::GetQualType(record_type);
+  EXPECT_NE(0, qt.getLocalFastQualifiers());
+  record_type = ClangUtil::RemoveFastQualifiers(record_type);
+  qt = ClangUtil::GetQualType(record_type);
+  EXPECT_EQ(0, qt.getLocalFastQualifiers());
 }
 
-TEST_F(TestClangASTContext, TestConvertAccessTypeToAccessSpecifier)
-{
-    EXPECT_EQ(AS_none, ClangASTContext::ConvertAccessTypeToAccessSpecifier(eAccessNone));
-    EXPECT_EQ(AS_none, ClangASTContext::ConvertAccessTypeToAccessSpecifier(eAccessPackage));
-    EXPECT_EQ(AS_public, ClangASTContext::ConvertAccessTypeToAccessSpecifier(eAccessPublic));
-    EXPECT_EQ(AS_private, ClangASTContext::ConvertAccessTypeToAccessSpecifier(eAccessPrivate));
-    EXPECT_EQ(AS_protected, ClangASTContext::ConvertAccessTypeToAccessSpecifier(eAccessProtected));
+TEST_F(TestClangASTContext, TestConvertAccessTypeToAccessSpecifier) {
+  EXPECT_EQ(AS_none,
+            ClangASTContext::ConvertAccessTypeToAccessSpecifier(eAccessNone));
+  EXPECT_EQ(AS_none, ClangASTContext::ConvertAccessTypeToAccessSpecifier(
+                         eAccessPackage));
+  EXPECT_EQ(AS_public,
+            ClangASTContext::ConvertAccessTypeToAccessSpecifier(eAccessPublic));
+  EXPECT_EQ(AS_private, ClangASTContext::ConvertAccessTypeToAccessSpecifier(
+                            eAccessPrivate));
+  EXPECT_EQ(AS_protected, ClangASTContext::ConvertAccessTypeToAccessSpecifier(
+                              eAccessProtected));
 }
 
-TEST_F(TestClangASTContext, TestUnifyAccessSpecifiers)
-{
-    // Unifying two of the same type should return the same type
-    EXPECT_EQ(AS_public, ClangASTContext::UnifyAccessSpecifiers(AS_public, AS_public));
-    EXPECT_EQ(AS_private, ClangASTContext::UnifyAccessSpecifiers(AS_private, AS_private));
-    EXPECT_EQ(AS_protected, ClangASTContext::UnifyAccessSpecifiers(AS_protected, AS_protected));
-
-    // Otherwise the result should be the strictest of the two.
-    EXPECT_EQ(AS_private, ClangASTContext::UnifyAccessSpecifiers(AS_private, AS_public));
-    EXPECT_EQ(AS_private, ClangASTContext::UnifyAccessSpecifiers(AS_private, AS_protected));
-    EXPECT_EQ(AS_private, ClangASTContext::UnifyAccessSpecifiers(AS_public, AS_private));
-    EXPECT_EQ(AS_private, ClangASTContext::UnifyAccessSpecifiers(AS_protected, AS_private));
-    EXPECT_EQ(AS_protected, ClangASTContext::UnifyAccessSpecifiers(AS_protected, AS_public));
-    EXPECT_EQ(AS_protected, ClangASTContext::UnifyAccessSpecifiers(AS_public, AS_protected));
-
-    // None is stricter than everything (by convention)
-    EXPECT_EQ(AS_none, ClangASTContext::UnifyAccessSpecifiers(AS_none, AS_public));
-    EXPECT_EQ(AS_none, ClangASTContext::UnifyAccessSpecifiers(AS_none, AS_protected));
-    EXPECT_EQ(AS_none, ClangASTContext::UnifyAccessSpecifiers(AS_none, AS_private));
-    EXPECT_EQ(AS_none, ClangASTContext::UnifyAccessSpecifiers(AS_public, AS_none));
-    EXPECT_EQ(AS_none, ClangASTContext::UnifyAccessSpecifiers(AS_protected, AS_none));
-    EXPECT_EQ(AS_none, ClangASTContext::UnifyAccessSpecifiers(AS_private, AS_none));
+TEST_F(TestClangASTContext, TestUnifyAccessSpecifiers) {
+  // Unifying two of the same type should return the same type
+  EXPECT_EQ(AS_public,
+            ClangASTContext::UnifyAccessSpecifiers(AS_public, AS_public));
+  EXPECT_EQ(AS_private,
+            ClangASTContext::UnifyAccessSpecifiers(AS_private, AS_private));
+  EXPECT_EQ(AS_protected,
+            ClangASTContext::UnifyAccessSpecifiers(AS_protected, AS_protected));
+
+  // Otherwise the result should be the strictest of the two.
+  EXPECT_EQ(AS_private,
+            ClangASTContext::UnifyAccessSpecifiers(AS_private, AS_public));
+  EXPECT_EQ(AS_private,
+            ClangASTContext::UnifyAccessSpecifiers(AS_private, AS_protected));
+  EXPECT_EQ(AS_private,
+            ClangASTContext::UnifyAccessSpecifiers(AS_public, AS_private));
+  EXPECT_EQ(AS_private,
+            ClangASTContext::UnifyAccessSpecifiers(AS_protected, AS_private));
+  EXPECT_EQ(AS_protected,
+            ClangASTContext::UnifyAccessSpecifiers(AS_protected, AS_public));
+  EXPECT_EQ(AS_protected,
+            ClangASTContext::UnifyAccessSpecifiers(AS_public, AS_protected));
+
+  // None is stricter than everything (by convention)
+  EXPECT_EQ(AS_none,
+            ClangASTContext::UnifyAccessSpecifiers(AS_none, AS_public));
+  EXPECT_EQ(AS_none,
+            ClangASTContext::UnifyAccessSpecifiers(AS_none, AS_protected));
+  EXPECT_EQ(AS_none,
+            ClangASTContext::UnifyAccessSpecifiers(AS_none, AS_private));
+  EXPECT_EQ(AS_none,
+            ClangASTContext::UnifyAccessSpecifiers(AS_public, AS_none));
+  EXPECT_EQ(AS_none,
+            ClangASTContext::UnifyAccessSpecifiers(AS_protected, AS_none));
+  EXPECT_EQ(AS_none,
+            ClangASTContext::UnifyAccessSpecifiers(AS_private, AS_none));
 }
 
-TEST_F(TestClangASTContext, TestRecordHasFields)
-{
-    CompilerType int_type = ClangASTContext::GetBasicType(m_ast->getASTContext(), eBasicTypeInt);
-
-    // Test that a record with no fields returns false
-    CompilerType empty_base = m_ast->CreateRecordType(nullptr, lldb::eAccessPublic, "EmptyBase", clang::TTK_Struct,
-                                                      lldb::eLanguageTypeC_plus_plus, nullptr);
-    ClangASTContext::StartTagDeclarationDefinition(empty_base);
-    ClangASTContext::CompleteTagDeclarationDefinition(empty_base);
-
-    RecordDecl *empty_base_decl = ClangASTContext::GetAsRecordDecl(empty_base);
-    EXPECT_NE(nullptr, empty_base_decl);
-    EXPECT_FALSE(ClangASTContext::RecordHasFields(empty_base_decl));
-
-    // Test that a record with direct fields returns true
-    CompilerType non_empty_base = m_ast->CreateRecordType(nullptr, lldb::eAccessPublic, "NonEmptyBase",
-                                                          clang::TTK_Struct, lldb::eLanguageTypeC_plus_plus, nullptr);
-    ClangASTContext::StartTagDeclarationDefinition(non_empty_base);
-    FieldDecl *non_empty_base_field_decl =
-        m_ast->AddFieldToRecordType(non_empty_base, "MyField", int_type, eAccessPublic, 0);
-    ClangASTContext::CompleteTagDeclarationDefinition(non_empty_base);
-    RecordDecl *non_empty_base_decl = ClangASTContext::GetAsRecordDecl(non_empty_base);
-    EXPECT_NE(nullptr, non_empty_base_decl);
-    EXPECT_NE(nullptr, non_empty_base_field_decl);
-    EXPECT_TRUE(ClangASTContext::RecordHasFields(non_empty_base_decl));
-
-    // Test that a record with no direct fields, but fields in a base returns true
-    CompilerType empty_derived = m_ast->CreateRecordType(nullptr, lldb::eAccessPublic, "EmptyDerived",
-                                                         clang::TTK_Struct, lldb::eLanguageTypeC_plus_plus, nullptr);
-    ClangASTContext::StartTagDeclarationDefinition(empty_derived);
-    CXXBaseSpecifier *non_empty_base_spec =
-        m_ast->CreateBaseClassSpecifier(non_empty_base.GetOpaqueQualType(), lldb::eAccessPublic, false, false);
-    bool result = m_ast->SetBaseClassesForClassType(empty_derived.GetOpaqueQualType(), &non_empty_base_spec, 1);
-    ClangASTContext::CompleteTagDeclarationDefinition(empty_derived);
-    EXPECT_TRUE(result);
-    CXXRecordDecl *empty_derived_non_empty_base_cxx_decl = m_ast->GetAsCXXRecordDecl(empty_derived.GetOpaqueQualType());
-    RecordDecl *empty_derived_non_empty_base_decl = ClangASTContext::GetAsRecordDecl(empty_derived);
-    EXPECT_EQ(1, ClangASTContext::GetNumBaseClasses(empty_derived_non_empty_base_cxx_decl, false));
-    EXPECT_TRUE(ClangASTContext::RecordHasFields(empty_derived_non_empty_base_decl));
-
-    // Test that a record with no direct fields, but fields in a virtual base returns true
-    CompilerType empty_derived2 = m_ast->CreateRecordType(nullptr, lldb::eAccessPublic, "EmptyDerived2",
-                                                          clang::TTK_Struct, lldb::eLanguageTypeC_plus_plus, nullptr);
-    ClangASTContext::StartTagDeclarationDefinition(empty_derived2);
-    CXXBaseSpecifier *non_empty_vbase_spec =
-        m_ast->CreateBaseClassSpecifier(non_empty_base.GetOpaqueQualType(), lldb::eAccessPublic, true, false);
-    result = m_ast->SetBaseClassesForClassType(empty_derived2.GetOpaqueQualType(), &non_empty_vbase_spec, 1);
-    ClangASTContext::CompleteTagDeclarationDefinition(empty_derived2);
-    EXPECT_TRUE(result);
-    CXXRecordDecl *empty_derived_non_empty_vbase_cxx_decl =
-        m_ast->GetAsCXXRecordDecl(empty_derived2.GetOpaqueQualType());
-    RecordDecl *empty_derived_non_empty_vbase_decl = ClangASTContext::GetAsRecordDecl(empty_derived2);
-    EXPECT_EQ(1, ClangASTContext::GetNumBaseClasses(empty_derived_non_empty_vbase_cxx_decl, false));
-    EXPECT_TRUE(ClangASTContext::RecordHasFields(empty_derived_non_empty_vbase_decl));
+TEST_F(TestClangASTContext, TestRecordHasFields) {
+  CompilerType int_type =
+      ClangASTContext::GetBasicType(m_ast->getASTContext(), eBasicTypeInt);
+
+  // Test that a record with no fields returns false
+  CompilerType empty_base = m_ast->CreateRecordType(
+      nullptr, lldb::eAccessPublic, "EmptyBase", clang::TTK_Struct,
+      lldb::eLanguageTypeC_plus_plus, nullptr);
+  ClangASTContext::StartTagDeclarationDefinition(empty_base);
+  ClangASTContext::CompleteTagDeclarationDefinition(empty_base);
+
+  RecordDecl *empty_base_decl = ClangASTContext::GetAsRecordDecl(empty_base);
+  EXPECT_NE(nullptr, empty_base_decl);
+  EXPECT_FALSE(ClangASTContext::RecordHasFields(empty_base_decl));
+
+  // Test that a record with direct fields returns true
+  CompilerType non_empty_base = m_ast->CreateRecordType(
+      nullptr, lldb::eAccessPublic, "NonEmptyBase", clang::TTK_Struct,
+      lldb::eLanguageTypeC_plus_plus, nullptr);
+  ClangASTContext::StartTagDeclarationDefinition(non_empty_base);
+  FieldDecl *non_empty_base_field_decl = m_ast->AddFieldToRecordType(
+      non_empty_base, "MyField", int_type, eAccessPublic, 0);
+  ClangASTContext::CompleteTagDeclarationDefinition(non_empty_base);
+  RecordDecl *non_empty_base_decl =
+      ClangASTContext::GetAsRecordDecl(non_empty_base);
+  EXPECT_NE(nullptr, non_empty_base_decl);
+  EXPECT_NE(nullptr, non_empty_base_field_decl);
+  EXPECT_TRUE(ClangASTContext::RecordHasFields(non_empty_base_decl));
+
+  // Test that a record with no direct fields, but fields in a base returns true
+  CompilerType empty_derived = m_ast->CreateRecordType(
+      nullptr, lldb::eAccessPublic, "EmptyDerived", clang::TTK_Struct,
+      lldb::eLanguageTypeC_plus_plus, nullptr);
+  ClangASTContext::StartTagDeclarationDefinition(empty_derived);
+  CXXBaseSpecifier *non_empty_base_spec = m_ast->CreateBaseClassSpecifier(
+      non_empty_base.GetOpaqueQualType(), lldb::eAccessPublic, false, false);
+  bool result = m_ast->SetBaseClassesForClassType(
+      empty_derived.GetOpaqueQualType(), &non_empty_base_spec, 1);
+  ClangASTContext::CompleteTagDeclarationDefinition(empty_derived);
+  EXPECT_TRUE(result);
+  CXXRecordDecl *empty_derived_non_empty_base_cxx_decl =
+      m_ast->GetAsCXXRecordDecl(empty_derived.GetOpaqueQualType());
+  RecordDecl *empty_derived_non_empty_base_decl =
+      ClangASTContext::GetAsRecordDecl(empty_derived);
+  EXPECT_EQ(1, ClangASTContext::GetNumBaseClasses(
+                   empty_derived_non_empty_base_cxx_decl, false));
+  EXPECT_TRUE(
+      ClangASTContext::RecordHasFields(empty_derived_non_empty_base_decl));
+
+  // Test that a record with no direct fields, but fields in a virtual base
+  // returns true
+  CompilerType empty_derived2 = m_ast->CreateRecordType(
+      nullptr, lldb::eAccessPublic, "EmptyDerived2", clang::TTK_Struct,
+      lldb::eLanguageTypeC_plus_plus, nullptr);
+  ClangASTContext::StartTagDeclarationDefinition(empty_derived2);
+  CXXBaseSpecifier *non_empty_vbase_spec = m_ast->CreateBaseClassSpecifier(
+      non_empty_base.GetOpaqueQualType(), lldb::eAccessPublic, true, false);
+  result = m_ast->SetBaseClassesForClassType(empty_derived2.GetOpaqueQualType(),
+                                             &non_empty_vbase_spec, 1);
+  ClangASTContext::CompleteTagDeclarationDefinition(empty_derived2);
+  EXPECT_TRUE(result);
+  CXXRecordDecl *empty_derived_non_empty_vbase_cxx_decl =
+      m_ast->GetAsCXXRecordDecl(empty_derived2.GetOpaqueQualType());
+  RecordDecl *empty_derived_non_empty_vbase_decl =
+      ClangASTContext::GetAsRecordDecl(empty_derived2);
+  EXPECT_EQ(1, ClangASTContext::GetNumBaseClasses(
+                   empty_derived_non_empty_vbase_cxx_decl, false));
+  EXPECT_TRUE(
+      ClangASTContext::RecordHasFields(empty_derived_non_empty_vbase_decl));
 }

Modified: lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp (original)
+++ lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp Tue Sep  6 15:57:50 2016
@@ -1,14 +1,6 @@
 // Compile with "cl /c /Zi /GR- test.cpp"
 // Link with "link test.obj /debug /nodefaultlib /entry:main /out:test.exe"
 
-int __cdecl _purecall(void)
-{
-    return 0;
-}
+int __cdecl _purecall(void) { return 0; }
 
-int
-main(int argc, char **argv)
-{
-
-    return 0;
-}
+int main(int argc, char **argv) { return 0; }

Modified: lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-alt.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-alt.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-alt.cpp (original)
+++ lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-alt.cpp Tue Sep  6 15:57:50 2016
@@ -1,9 +1,7 @@
 // Compile with "cl /c /Zi /GR- test-pdb-alt.cpp"
-// Link with "link test-pdb.obj test-pdb-alt.obj /debug /nodefaultlib /entry:main /out:test-pdb.exe"
+// Link with "link test-pdb.obj test-pdb-alt.obj /debug /nodefaultlib
+// /entry:main /out:test-pdb.exe"
 
 #include "test-pdb.h"
 
-int bar(int n)
-{
-    return n-1;
-}
+int bar(int n) { return n - 1; }

Modified: lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-nested.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-nested.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-nested.h (original)
+++ lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-nested.h Tue Sep  6 15:57:50 2016
@@ -1,9 +1,6 @@
 #ifndef TEST_PDB_NESTED_H
 #define TEST_PDB_NESTED_H
 
-inline int baz(int n)
-{
-    return n+1;
-}
+inline int baz(int n) { return n + 1; }
 
 #endif
\ No newline at end of file

Modified: lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp (original)
+++ lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp Tue Sep  6 15:57:50 2016
@@ -1,5 +1,6 @@
 // Compile with "cl /c /Zi /GR- /EHsc test-pdb-types.cpp"
-// Link with "link test-pdb-types.obj /debug /nodefaultlib /entry:main /out:test-pdb-types.exe"
+// Link with "link test-pdb-types.obj /debug /nodefaultlib /entry:main
+// /out:test-pdb-types.exe"
 
 using namespace std;
 
@@ -21,42 +22,29 @@ static const int sizeof_double = sizeof(
 static const int sizeof_bool = sizeof(bool);
 static const int sizeof_wchar = sizeof(wchar_t);
 
-enum Enum
-{
-    EValue1 = 1,
-    EValue2 = 2,
+enum Enum {
+  EValue1 = 1,
+  EValue2 = 2,
 };
 
-enum ShortEnum : short
-{
-    ESValue1 = 1,
-    ESValue2 = 2
-};
+enum ShortEnum : short { ESValue1 = 1, ESValue2 = 2 };
 
-namespace NS
-{
-class NSClass
-{
-    float f;
-    double d;
+namespace NS {
+class NSClass {
+  float f;
+  double d;
 };
 }
 
-class Class
-{
+class Class {
 public:
-    class NestedClass
-    {
-        Enum e;
-    };
-    ShortEnum se;
+  class NestedClass {
+    Enum e;
+  };
+  ShortEnum se;
 };
 
-int
-test_func(int a, int b)
-{
-    return a + b;
-}
+int test_func(int a, int b) { return a + b; }
 
 typedef Class ClassTypedef;
 typedef NS::NSClass NSClassTypedef;
@@ -71,16 +59,14 @@ static const int sizeof_ClassTypedef = s
 static const int sizeof_NSClassTypedef = sizeof(NSClassTypedef);
 static const int sizeof_GlobalArray = sizeof(GlobalArray);
 
-int
-main(int argc, char **argv)
-{
-    ShortEnum e1;
-    Enum e2;
-    Class c1;
-    Class::NestedClass c2;
-    NS::NSClass c3;
-
-    ClassTypedef t1;
-    NSClassTypedef t2;
-    return test_func(1, 2);
+int main(int argc, char **argv) {
+  ShortEnum e1;
+  Enum e2;
+  Class c1;
+  Class::NestedClass c2;
+  NS::NSClass c3;
+
+  ClassTypedef t1;
+  NSClassTypedef t2;
+  return test_func(1, 2);
 }

Modified: lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb.cpp (original)
+++ lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb.cpp Tue Sep  6 15:57:50 2016
@@ -1,15 +1,9 @@
 // Compile with "cl /c /Zi /GR- test-pdb.cpp"
-// Link with "link test-pdb.obj /debug /nodefaultlib /entry:main /out:test-pdb.exe"
+// Link with "link test-pdb.obj /debug /nodefaultlib /entry:main
+// /out:test-pdb.exe"
 
 #include "test-pdb.h"
 
-int __cdecl _purecall(void)
-{
-    return 0;
-}
+int __cdecl _purecall(void) { return 0; }
 
-int
-main(int argc, char **argv)
-{
-    return foo(argc) + bar(argc);
-}
+int main(int argc, char **argv) { return foo(argc) + bar(argc); }

Modified: lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb.h (original)
+++ lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-pdb.h Tue Sep  6 15:57:50 2016
@@ -5,9 +5,6 @@
 
 int bar(int n);
 
-inline int foo(int n)
-{
-    return baz(n)+1;
-}
+inline int foo(int n) { return baz(n) + 1; }
 
 #endif
\ No newline at end of file

Modified: lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp (original)
+++ lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Tue Sep  6 15:57:50 2016
@@ -42,126 +42,116 @@ extern const char *TestMainArgv0;
 
 using namespace lldb_private;
 
-class SymbolFilePDBTests : public testing::Test
-{
+class SymbolFilePDBTests : public testing::Test {
 public:
-    void
-    SetUp() override
-    {
+  void SetUp() override {
 // Initialize and TearDown the plugin every time, so we get a brand new
 // AST every time so that modifications to the AST from each test don't
 // leak into the next test.
 #if defined(_MSC_VER)
-        ::CoInitializeEx(nullptr, COINIT_MULTITHREADED);
+    ::CoInitializeEx(nullptr, COINIT_MULTITHREADED);
 #endif
 
-        HostInfo::Initialize();
-        ObjectFilePECOFF::Initialize();
-        SymbolFileDWARF::Initialize();
-        ClangASTContext::Initialize();
-        SymbolFilePDB::Initialize();
-
-        llvm::StringRef exe_folder = llvm::sys::path::parent_path(TestMainArgv0);
-        llvm::SmallString<128> inputs_folder = exe_folder;
-        llvm::sys::path::append(inputs_folder, "Inputs");
-
-        m_pdb_test_exe = inputs_folder;
-        m_dwarf_test_exe = inputs_folder;
-        m_types_test_exe = inputs_folder;
-        llvm::sys::path::append(m_pdb_test_exe, "test-pdb.exe");
-        llvm::sys::path::append(m_dwarf_test_exe, "test-dwarf.exe");
-        llvm::sys::path::append(m_types_test_exe, "test-pdb-types.exe");
-    }
-
-    void
-    TearDown() override
-    {
-        SymbolFilePDB::Terminate();
-        ClangASTContext::Initialize();
-        SymbolFileDWARF::Terminate();
-        ObjectFilePECOFF::Terminate();
-        HostInfo::Terminate();
+    HostInfo::Initialize();
+    ObjectFilePECOFF::Initialize();
+    SymbolFileDWARF::Initialize();
+    ClangASTContext::Initialize();
+    SymbolFilePDB::Initialize();
+
+    llvm::StringRef exe_folder = llvm::sys::path::parent_path(TestMainArgv0);
+    llvm::SmallString<128> inputs_folder = exe_folder;
+    llvm::sys::path::append(inputs_folder, "Inputs");
+
+    m_pdb_test_exe = inputs_folder;
+    m_dwarf_test_exe = inputs_folder;
+    m_types_test_exe = inputs_folder;
+    llvm::sys::path::append(m_pdb_test_exe, "test-pdb.exe");
+    llvm::sys::path::append(m_dwarf_test_exe, "test-dwarf.exe");
+    llvm::sys::path::append(m_types_test_exe, "test-pdb-types.exe");
+  }
+
+  void TearDown() override {
+    SymbolFilePDB::Terminate();
+    ClangASTContext::Initialize();
+    SymbolFileDWARF::Terminate();
+    ObjectFilePECOFF::Terminate();
+    HostInfo::Terminate();
 
 #if defined(_MSC_VER)
-        ::CoUninitialize();
+    ::CoUninitialize();
 #endif
-    }
+  }
 
 protected:
-    llvm::SmallString<128> m_pdb_test_exe;
-    llvm::SmallString<128> m_dwarf_test_exe;
-    llvm::SmallString<128> m_types_test_exe;
-
-    bool
-    FileSpecMatchesAsBaseOrFull(const FileSpec &left, const FileSpec &right) const
-    {
-        // If the filenames don't match, the paths can't be equal
-        if (!left.FileEquals(right))
-            return false;
-        // If BOTH have a directory, also compare the directories.
-        if (left.GetDirectory() && right.GetDirectory())
-            return left.DirectoryEquals(right);
-
-        // If one has a directory but not the other, they match.
+  llvm::SmallString<128> m_pdb_test_exe;
+  llvm::SmallString<128> m_dwarf_test_exe;
+  llvm::SmallString<128> m_types_test_exe;
+
+  bool FileSpecMatchesAsBaseOrFull(const FileSpec &left,
+                                   const FileSpec &right) const {
+    // If the filenames don't match, the paths can't be equal
+    if (!left.FileEquals(right))
+      return false;
+    // If BOTH have a directory, also compare the directories.
+    if (left.GetDirectory() && right.GetDirectory())
+      return left.DirectoryEquals(right);
+
+    // If one has a directory but not the other, they match.
+    return true;
+  }
+
+  void VerifyLineEntry(lldb::ModuleSP module, const SymbolContext &sc,
+                       const FileSpec &spec, LineTable &lt, uint32_t line,
+                       lldb::addr_t addr) {
+    LineEntry entry;
+    Address address;
+    EXPECT_TRUE(module->ResolveFileAddress(addr, address));
+
+    EXPECT_TRUE(lt.FindLineEntryByAddress(address, entry));
+    EXPECT_EQ(line, entry.line);
+    EXPECT_EQ(address, entry.range.GetBaseAddress());
+
+    EXPECT_TRUE(FileSpecMatchesAsBaseOrFull(spec, entry.file));
+  }
+
+  bool ContainsCompileUnit(const SymbolContextList &sc_list,
+                           const FileSpec &spec) const {
+    for (size_t i = 0; i < sc_list.GetSize(); ++i) {
+      const SymbolContext &sc = sc_list[i];
+      if (FileSpecMatchesAsBaseOrFull(*sc.comp_unit, spec))
         return true;
     }
+    return false;
+  }
 
-    void
-    VerifyLineEntry(lldb::ModuleSP module, const SymbolContext &sc, const FileSpec &spec, LineTable &lt, uint32_t line,
-                    lldb::addr_t addr)
-    {
-        LineEntry entry;
-        Address address;
-        EXPECT_TRUE(module->ResolveFileAddress(addr, address));
-
-        EXPECT_TRUE(lt.FindLineEntryByAddress(address, entry));
-        EXPECT_EQ(line, entry.line);
-        EXPECT_EQ(address, entry.range.GetBaseAddress());
-
-        EXPECT_TRUE(FileSpecMatchesAsBaseOrFull(spec, entry.file));
-    }
-
-    bool
-    ContainsCompileUnit(const SymbolContextList &sc_list, const FileSpec &spec) const
-    {
-        for (size_t i = 0; i < sc_list.GetSize(); ++i)
-        {
-            const SymbolContext &sc = sc_list[i];
-            if (FileSpecMatchesAsBaseOrFull(*sc.comp_unit, spec))
-                return true;
-        }
-        return false;
-    }
-
-    int
-    GetGlobalConstantInteger(const llvm::pdb::IPDBSession &session, llvm::StringRef var) const
-    {
-        auto global = session.getGlobalScope();
-        auto results =
-            global->findChildren(llvm::pdb::PDB_SymType::Data, var, llvm::pdb::PDB_NameSearchFlags::NS_Default);
-        uint32_t count = results->getChildCount();
-        if (count == 0)
-            return -1;
-
-        auto item = results->getChildAtIndex(0);
-        auto symbol = llvm::dyn_cast<llvm::pdb::PDBSymbolData>(item.get());
-        if (!symbol)
-            return -1;
-        llvm::pdb::Variant value = symbol->getValue();
-        switch (value.Type)
-        {
-            case llvm::pdb::PDB_VariantType::Int16:
-                return value.Value.Int16;
-            case llvm::pdb::PDB_VariantType::Int32:
-                return value.Value.Int32;
-            case llvm::pdb::PDB_VariantType::UInt16:
-                return value.Value.UInt16;
-            case llvm::pdb::PDB_VariantType::UInt32:
-                return value.Value.UInt32;
-            default:
-                return 0;
-        }
+  int GetGlobalConstantInteger(const llvm::pdb::IPDBSession &session,
+                               llvm::StringRef var) const {
+    auto global = session.getGlobalScope();
+    auto results =
+        global->findChildren(llvm::pdb::PDB_SymType::Data, var,
+                             llvm::pdb::PDB_NameSearchFlags::NS_Default);
+    uint32_t count = results->getChildCount();
+    if (count == 0)
+      return -1;
+
+    auto item = results->getChildAtIndex(0);
+    auto symbol = llvm::dyn_cast<llvm::pdb::PDBSymbolData>(item.get());
+    if (!symbol)
+      return -1;
+    llvm::pdb::Variant value = symbol->getValue();
+    switch (value.Type) {
+    case llvm::pdb::PDB_VariantType::Int16:
+      return value.Value.Int16;
+    case llvm::pdb::PDB_VariantType::Int32:
+      return value.Value.Int32;
+    case llvm::pdb::PDB_VariantType::UInt16:
+      return value.Value.UInt16;
+    case llvm::pdb::PDB_VariantType::UInt32:
+      return value.Value.UInt32;
+    default:
+      return 0;
     }
+  }
 };
 
 #if defined(HAVE_DIA_SDK)
@@ -170,414 +160,443 @@ protected:
 #define REQUIRES_DIA_SDK(TestName) DISABLED_##TestName
 #endif
 
-TEST_F(SymbolFilePDBTests, TestAbilitiesForDWARF)
-{
-    // Test that when we have Dwarf debug info, SymbolFileDWARF is used.
-    FileSpec fspec(m_dwarf_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    EXPECT_NE(nullptr, plugin);
-    SymbolFile *symfile = plugin->GetSymbolFile();
-    EXPECT_NE(nullptr, symfile);
-    EXPECT_EQ(symfile->GetPluginName(), SymbolFileDWARF::GetPluginNameStatic());
-
-    uint32_t expected_abilities = SymbolFile::kAllAbilities;
-    EXPECT_EQ(expected_abilities, symfile->CalculateAbilities());
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestAbilitiesForPDB))
-{
-    // Test that when we have PDB debug info, SymbolFilePDB is used.
-    FileSpec fspec(m_pdb_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    EXPECT_NE(nullptr, plugin);
-    SymbolFile *symfile = plugin->GetSymbolFile();
-    EXPECT_NE(nullptr, symfile);
-    EXPECT_EQ(symfile->GetPluginName(), SymbolFilePDB::GetPluginNameStatic());
-
-    uint32_t expected_abilities = SymbolFile::CompileUnits | SymbolFile::LineTables;
-    EXPECT_EQ(expected_abilities, symfile->CalculateAbilities());
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestResolveSymbolContextBasename))
-{
-    // Test that attempting to call ResolveSymbolContext with only a basename finds all full paths
-    // with the same basename
-    FileSpec fspec(m_pdb_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    EXPECT_NE(nullptr, plugin);
-    SymbolFile *symfile = plugin->GetSymbolFile();
-
-    FileSpec header_spec("test-pdb.cpp", false);
+TEST_F(SymbolFilePDBTests, TestAbilitiesForDWARF) {
+  // Test that when we have Dwarf debug info, SymbolFileDWARF is used.
+  FileSpec fspec(m_dwarf_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  EXPECT_NE(nullptr, plugin);
+  SymbolFile *symfile = plugin->GetSymbolFile();
+  EXPECT_NE(nullptr, symfile);
+  EXPECT_EQ(symfile->GetPluginName(), SymbolFileDWARF::GetPluginNameStatic());
+
+  uint32_t expected_abilities = SymbolFile::kAllAbilities;
+  EXPECT_EQ(expected_abilities, symfile->CalculateAbilities());
+}
+
+TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestAbilitiesForPDB)) {
+  // Test that when we have PDB debug info, SymbolFilePDB is used.
+  FileSpec fspec(m_pdb_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  EXPECT_NE(nullptr, plugin);
+  SymbolFile *symfile = plugin->GetSymbolFile();
+  EXPECT_NE(nullptr, symfile);
+  EXPECT_EQ(symfile->GetPluginName(), SymbolFilePDB::GetPluginNameStatic());
+
+  uint32_t expected_abilities =
+      SymbolFile::CompileUnits | SymbolFile::LineTables;
+  EXPECT_EQ(expected_abilities, symfile->CalculateAbilities());
+}
+
+TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestResolveSymbolContextBasename)) {
+  // Test that attempting to call ResolveSymbolContext with only a basename
+  // finds all full paths
+  // with the same basename
+  FileSpec fspec(m_pdb_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  EXPECT_NE(nullptr, plugin);
+  SymbolFile *symfile = plugin->GetSymbolFile();
+
+  FileSpec header_spec("test-pdb.cpp", false);
+  SymbolContextList sc_list;
+  uint32_t result_count = symfile->ResolveSymbolContext(
+      header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
+  EXPECT_EQ(1u, result_count);
+  EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec));
+}
+
+TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestResolveSymbolContextFullPath)) {
+  // Test that attempting to call ResolveSymbolContext with a full path only
+  // finds the one source
+  // file that matches the full path.
+  FileSpec fspec(m_pdb_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  EXPECT_NE(nullptr, plugin);
+  SymbolFile *symfile = plugin->GetSymbolFile();
+
+  FileSpec header_spec(
+      R"spec(D:\src\llvm\tools\lldb\unittests\SymbolFile\PDB\Inputs\test-pdb.cpp)spec",
+      false);
+  SymbolContextList sc_list;
+  uint32_t result_count = symfile->ResolveSymbolContext(
+      header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
+  EXPECT_GE(1u, result_count);
+  EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec));
+}
+
+TEST_F(SymbolFilePDBTests,
+       REQUIRES_DIA_SDK(TestLookupOfHeaderFileWithInlines)) {
+  // Test that when looking up a header file via ResolveSymbolContext (i.e. a
+  // file that was not by itself
+  // compiled, but only contributes to the combined code of other source files),
+  // a SymbolContext is returned
+  // for each compiland which has line contributions from the requested header.
+  FileSpec fspec(m_pdb_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  EXPECT_NE(nullptr, plugin);
+  SymbolFile *symfile = plugin->GetSymbolFile();
+
+  FileSpec header_specs[] = {FileSpec("test-pdb.h", false),
+                             FileSpec("test-pdb-nested.h", false)};
+  FileSpec main_cpp_spec("test-pdb.cpp", false);
+  FileSpec alt_cpp_spec("test-pdb-alt.cpp", false);
+  for (const auto &hspec : header_specs) {
     SymbolContextList sc_list;
-    uint32_t result_count = symfile->ResolveSymbolContext(header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
-    EXPECT_EQ(1u, result_count);
-    EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec));
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestResolveSymbolContextFullPath))
-{
-    // Test that attempting to call ResolveSymbolContext with a full path only finds the one source
-    // file that matches the full path.
-    FileSpec fspec(m_pdb_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    EXPECT_NE(nullptr, plugin);
-    SymbolFile *symfile = plugin->GetSymbolFile();
-
-    FileSpec header_spec(R"spec(D:\src\llvm\tools\lldb\unittests\SymbolFile\PDB\Inputs\test-pdb.cpp)spec", false);
-    SymbolContextList sc_list;
-    uint32_t result_count = symfile->ResolveSymbolContext(header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
-    EXPECT_GE(1u, result_count);
-    EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec));
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestLookupOfHeaderFileWithInlines))
-{
-    // Test that when looking up a header file via ResolveSymbolContext (i.e. a file that was not by itself
-    // compiled, but only contributes to the combined code of other source files), a SymbolContext is returned
-    // for each compiland which has line contributions from the requested header.
-    FileSpec fspec(m_pdb_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    EXPECT_NE(nullptr, plugin);
-    SymbolFile *symfile = plugin->GetSymbolFile();
-
-    FileSpec header_specs[] = {FileSpec("test-pdb.h", false), FileSpec("test-pdb-nested.h", false)};
-    FileSpec main_cpp_spec("test-pdb.cpp", false);
-    FileSpec alt_cpp_spec("test-pdb-alt.cpp", false);
-    for (const auto &hspec : header_specs)
-    {
-        SymbolContextList sc_list;
-        uint32_t result_count = symfile->ResolveSymbolContext(hspec, 0, true, lldb::eSymbolContextCompUnit, sc_list);
-        EXPECT_EQ(2u, result_count);
-        EXPECT_TRUE(ContainsCompileUnit(sc_list, main_cpp_spec));
-        EXPECT_TRUE(ContainsCompileUnit(sc_list, alt_cpp_spec));
-    }
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestLookupOfHeaderFileWithNoInlines))
-{
-    // Test that when looking up a header file via ResolveSymbolContext (i.e. a file that was not by itself
-    // compiled, but only contributes to the combined code of other source files), that if check_inlines
-    // is false, no SymbolContexts are returned.
-    FileSpec fspec(m_pdb_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    EXPECT_NE(nullptr, plugin);
-    SymbolFile *symfile = plugin->GetSymbolFile();
-
-    FileSpec header_specs[] = {FileSpec("test-pdb.h", false), FileSpec("test-pdb-nested.h", false)};
-    for (const auto &hspec : header_specs)
-    {
-        SymbolContextList sc_list;
-        uint32_t result_count = symfile->ResolveSymbolContext(hspec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
-        EXPECT_EQ(0u, result_count);
-    }
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestLineTablesMatchAll))
-{
-    // Test that when calling ResolveSymbolContext with a line number of 0, all line entries from
-    // the specified files are returned.
-    FileSpec fspec(m_pdb_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    SymbolFile *symfile = plugin->GetSymbolFile();
-
-    FileSpec source_file("test-pdb.cpp", false);
-    FileSpec header1("test-pdb.h", false);
-    FileSpec header2("test-pdb-nested.h", false);
-    uint32_t cus = symfile->GetNumCompileUnits();
-    EXPECT_EQ(2u, cus);
-
-    SymbolContextList sc_list;
-    uint32_t scope = lldb::eSymbolContextCompUnit | lldb::eSymbolContextLineEntry;
-
-    uint32_t count = symfile->ResolveSymbolContext(source_file, 0, true, scope, sc_list);
-    EXPECT_EQ(1u, count);
-    SymbolContext sc;
-    EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
-
-    LineTable *lt = sc.comp_unit->GetLineTable();
-    EXPECT_NE(nullptr, lt);
-    count = lt->GetSize();
-    // We expect one extra entry for termination (per function)
-    EXPECT_EQ(16u, count);
-
-    VerifyLineEntry(module, sc, source_file, *lt, 7, 0x401040);
-    VerifyLineEntry(module, sc, source_file, *lt, 8, 0x401043);
-    VerifyLineEntry(module, sc, source_file, *lt, 9, 0x401045);
-
-    VerifyLineEntry(module, sc, source_file, *lt, 13, 0x401050);
-    VerifyLineEntry(module, sc, source_file, *lt, 14, 0x401054);
-    VerifyLineEntry(module, sc, source_file, *lt, 15, 0x401070);
-
-    VerifyLineEntry(module, sc, header1, *lt, 9, 0x401090);
-    VerifyLineEntry(module, sc, header1, *lt, 10, 0x401093);
-    VerifyLineEntry(module, sc, header1, *lt, 11, 0x4010a2);
-
-    VerifyLineEntry(module, sc, header2, *lt, 5, 0x401080);
-    VerifyLineEntry(module, sc, header2, *lt, 6, 0x401083);
-    VerifyLineEntry(module, sc, header2, *lt, 7, 0x401089);
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestLineTablesMatchSpecific))
-{
-    // Test that when calling ResolveSymbolContext with a specific line number, only line entries
-    // which match the requested line are returned.
-    FileSpec fspec(m_pdb_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    SymbolFile *symfile = plugin->GetSymbolFile();
-
-    FileSpec source_file("test-pdb.cpp", false);
-    FileSpec header1("test-pdb.h", false);
-    FileSpec header2("test-pdb-nested.h", false);
-    uint32_t cus = symfile->GetNumCompileUnits();
-    EXPECT_EQ(2u, cus);
-
+    uint32_t result_count = symfile->ResolveSymbolContext(
+        hspec, 0, true, lldb::eSymbolContextCompUnit, sc_list);
+    EXPECT_EQ(2u, result_count);
+    EXPECT_TRUE(ContainsCompileUnit(sc_list, main_cpp_spec));
+    EXPECT_TRUE(ContainsCompileUnit(sc_list, alt_cpp_spec));
+  }
+}
+
+TEST_F(SymbolFilePDBTests,
+       REQUIRES_DIA_SDK(TestLookupOfHeaderFileWithNoInlines)) {
+  // Test that when looking up a header file via ResolveSymbolContext (i.e. a
+  // file that was not by itself
+  // compiled, but only contributes to the combined code of other source files),
+  // that if check_inlines
+  // is false, no SymbolContexts are returned.
+  FileSpec fspec(m_pdb_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  EXPECT_NE(nullptr, plugin);
+  SymbolFile *symfile = plugin->GetSymbolFile();
+
+  FileSpec header_specs[] = {FileSpec("test-pdb.h", false),
+                             FileSpec("test-pdb-nested.h", false)};
+  for (const auto &hspec : header_specs) {
     SymbolContextList sc_list;
-    uint32_t scope = lldb::eSymbolContextCompUnit | lldb::eSymbolContextLineEntry;
-
-    // First test with line 7, and verify that only line 7 entries are added.
-    uint32_t count = symfile->ResolveSymbolContext(source_file, 7, true, scope, sc_list);
-    EXPECT_EQ(1u, count);
-    SymbolContext sc;
-    EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
-
-    LineTable *lt = sc.comp_unit->GetLineTable();
-    EXPECT_NE(nullptr, lt);
-    count = lt->GetSize();
-    // We expect one extra entry for termination
-    EXPECT_EQ(3u, count);
-
-    VerifyLineEntry(module, sc, source_file, *lt, 7, 0x401040);
-    VerifyLineEntry(module, sc, header2, *lt, 7, 0x401089);
-
-    sc_list.Clear();
-    // Then test with line 9, and verify that only line 9 entries are added.
-    count = symfile->ResolveSymbolContext(source_file, 9, true, scope, sc_list);
-    EXPECT_EQ(1u, count);
-    EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
-
-    lt = sc.comp_unit->GetLineTable();
-    EXPECT_NE(nullptr, lt);
-    count = lt->GetSize();
-    // We expect one extra entry for termination
-    EXPECT_EQ(3u, count);
-
-    VerifyLineEntry(module, sc, source_file, *lt, 9, 0x401045);
-    VerifyLineEntry(module, sc, header1, *lt, 9, 0x401090);
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestSimpleClassTypes))
-{
-    FileSpec fspec(m_types_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    SymbolFilePDB *symfile = static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
-    const llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
-    SymbolContext sc;
-    llvm::DenseSet<SymbolFile *> searched_files;
-    TypeMap results;
-    EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString("Class"), nullptr, false, 0, searched_files, results));
-    EXPECT_EQ(1u, results.GetSize());
-    lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
-    EXPECT_EQ(ConstString("Class"), udt_type->GetName());
-    CompilerType compiler_type = udt_type->GetForwardCompilerType();
-    EXPECT_TRUE(ClangASTContext::IsClassType(compiler_type.GetOpaqueQualType()));
-    EXPECT_EQ(uint64_t(GetGlobalConstantInteger(session, "sizeof_Class")), udt_type->GetByteSize());
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestNestedClassTypes))
-{
-    FileSpec fspec(m_types_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    SymbolFilePDB *symfile = static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
-    const llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
-    SymbolContext sc;
-    llvm::DenseSet<SymbolFile *> searched_files;
-    TypeMap results;
-    EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString("Class::NestedClass"), nullptr, false, 0, searched_files, results));
-    EXPECT_EQ(1u, results.GetSize());
-    lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
-    EXPECT_EQ(ConstString("Class::NestedClass"), udt_type->GetName());
-    CompilerType compiler_type = udt_type->GetForwardCompilerType();
-    EXPECT_TRUE(ClangASTContext::IsClassType(compiler_type.GetOpaqueQualType()));
-    EXPECT_EQ(uint64_t(GetGlobalConstantInteger(session, "sizeof_NestedClass")), udt_type->GetByteSize());
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestClassInNamespace))
-{
-    FileSpec fspec(m_types_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    SymbolFilePDB *symfile = static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
-    const llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
-    SymbolContext sc;
-    llvm::DenseSet<SymbolFile *> searched_files;
+    uint32_t result_count = symfile->ResolveSymbolContext(
+        hspec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
+    EXPECT_EQ(0u, result_count);
+  }
+}
+
+TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestLineTablesMatchAll)) {
+  // Test that when calling ResolveSymbolContext with a line number of 0, all
+  // line entries from
+  // the specified files are returned.
+  FileSpec fspec(m_pdb_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  SymbolFile *symfile = plugin->GetSymbolFile();
+
+  FileSpec source_file("test-pdb.cpp", false);
+  FileSpec header1("test-pdb.h", false);
+  FileSpec header2("test-pdb-nested.h", false);
+  uint32_t cus = symfile->GetNumCompileUnits();
+  EXPECT_EQ(2u, cus);
+
+  SymbolContextList sc_list;
+  uint32_t scope = lldb::eSymbolContextCompUnit | lldb::eSymbolContextLineEntry;
+
+  uint32_t count =
+      symfile->ResolveSymbolContext(source_file, 0, true, scope, sc_list);
+  EXPECT_EQ(1u, count);
+  SymbolContext sc;
+  EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
+
+  LineTable *lt = sc.comp_unit->GetLineTable();
+  EXPECT_NE(nullptr, lt);
+  count = lt->GetSize();
+  // We expect one extra entry for termination (per function)
+  EXPECT_EQ(16u, count);
+
+  VerifyLineEntry(module, sc, source_file, *lt, 7, 0x401040);
+  VerifyLineEntry(module, sc, source_file, *lt, 8, 0x401043);
+  VerifyLineEntry(module, sc, source_file, *lt, 9, 0x401045);
+
+  VerifyLineEntry(module, sc, source_file, *lt, 13, 0x401050);
+  VerifyLineEntry(module, sc, source_file, *lt, 14, 0x401054);
+  VerifyLineEntry(module, sc, source_file, *lt, 15, 0x401070);
+
+  VerifyLineEntry(module, sc, header1, *lt, 9, 0x401090);
+  VerifyLineEntry(module, sc, header1, *lt, 10, 0x401093);
+  VerifyLineEntry(module, sc, header1, *lt, 11, 0x4010a2);
+
+  VerifyLineEntry(module, sc, header2, *lt, 5, 0x401080);
+  VerifyLineEntry(module, sc, header2, *lt, 6, 0x401083);
+  VerifyLineEntry(module, sc, header2, *lt, 7, 0x401089);
+}
+
+TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestLineTablesMatchSpecific)) {
+  // Test that when calling ResolveSymbolContext with a specific line number,
+  // only line entries
+  // which match the requested line are returned.
+  FileSpec fspec(m_pdb_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  SymbolFile *symfile = plugin->GetSymbolFile();
+
+  FileSpec source_file("test-pdb.cpp", false);
+  FileSpec header1("test-pdb.h", false);
+  FileSpec header2("test-pdb-nested.h", false);
+  uint32_t cus = symfile->GetNumCompileUnits();
+  EXPECT_EQ(2u, cus);
+
+  SymbolContextList sc_list;
+  uint32_t scope = lldb::eSymbolContextCompUnit | lldb::eSymbolContextLineEntry;
+
+  // First test with line 7, and verify that only line 7 entries are added.
+  uint32_t count =
+      symfile->ResolveSymbolContext(source_file, 7, true, scope, sc_list);
+  EXPECT_EQ(1u, count);
+  SymbolContext sc;
+  EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
+
+  LineTable *lt = sc.comp_unit->GetLineTable();
+  EXPECT_NE(nullptr, lt);
+  count = lt->GetSize();
+  // We expect one extra entry for termination
+  EXPECT_EQ(3u, count);
+
+  VerifyLineEntry(module, sc, source_file, *lt, 7, 0x401040);
+  VerifyLineEntry(module, sc, header2, *lt, 7, 0x401089);
+
+  sc_list.Clear();
+  // Then test with line 9, and verify that only line 9 entries are added.
+  count = symfile->ResolveSymbolContext(source_file, 9, true, scope, sc_list);
+  EXPECT_EQ(1u, count);
+  EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
+
+  lt = sc.comp_unit->GetLineTable();
+  EXPECT_NE(nullptr, lt);
+  count = lt->GetSize();
+  // We expect one extra entry for termination
+  EXPECT_EQ(3u, count);
+
+  VerifyLineEntry(module, sc, source_file, *lt, 9, 0x401045);
+  VerifyLineEntry(module, sc, header1, *lt, 9, 0x401090);
+}
+
+TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestSimpleClassTypes)) {
+  FileSpec fspec(m_types_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  SymbolFilePDB *symfile =
+      static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
+  const llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
+  SymbolContext sc;
+  llvm::DenseSet<SymbolFile *> searched_files;
+  TypeMap results;
+  EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString("Class"), nullptr, false, 0,
+                                   searched_files, results));
+  EXPECT_EQ(1u, results.GetSize());
+  lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
+  EXPECT_EQ(ConstString("Class"), udt_type->GetName());
+  CompilerType compiler_type = udt_type->GetForwardCompilerType();
+  EXPECT_TRUE(ClangASTContext::IsClassType(compiler_type.GetOpaqueQualType()));
+  EXPECT_EQ(uint64_t(GetGlobalConstantInteger(session, "sizeof_Class")),
+            udt_type->GetByteSize());
+}
+
+TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestNestedClassTypes)) {
+  FileSpec fspec(m_types_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  SymbolFilePDB *symfile =
+      static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
+  const llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
+  SymbolContext sc;
+  llvm::DenseSet<SymbolFile *> searched_files;
+  TypeMap results;
+  EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString("Class::NestedClass"),
+                                   nullptr, false, 0, searched_files, results));
+  EXPECT_EQ(1u, results.GetSize());
+  lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
+  EXPECT_EQ(ConstString("Class::NestedClass"), udt_type->GetName());
+  CompilerType compiler_type = udt_type->GetForwardCompilerType();
+  EXPECT_TRUE(ClangASTContext::IsClassType(compiler_type.GetOpaqueQualType()));
+  EXPECT_EQ(uint64_t(GetGlobalConstantInteger(session, "sizeof_NestedClass")),
+            udt_type->GetByteSize());
+}
+
+TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestClassInNamespace)) {
+  FileSpec fspec(m_types_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  SymbolFilePDB *symfile =
+      static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
+  const llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
+  SymbolContext sc;
+  llvm::DenseSet<SymbolFile *> searched_files;
+  TypeMap results;
+  EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString("NS::NSClass"), nullptr,
+                                   false, 0, searched_files, results));
+  EXPECT_EQ(1u, results.GetSize());
+  lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
+  EXPECT_EQ(ConstString("NS::NSClass"), udt_type->GetName());
+  CompilerType compiler_type = udt_type->GetForwardCompilerType();
+  EXPECT_TRUE(ClangASTContext::IsClassType(compiler_type.GetOpaqueQualType()));
+  EXPECT_EQ(GetGlobalConstantInteger(session, "sizeof_NSClass"),
+            udt_type->GetByteSize());
+}
+
+TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestEnumTypes)) {
+  FileSpec fspec(m_types_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  SymbolFilePDB *symfile =
+      static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
+  const llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
+  SymbolContext sc;
+  llvm::DenseSet<SymbolFile *> searched_files;
+  const char *EnumsToCheck[] = {"Enum", "ShortEnum"};
+  for (auto Enum : EnumsToCheck) {
     TypeMap results;
-    EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString("NS::NSClass"), nullptr, false, 0, searched_files, results));
+    EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString(Enum), nullptr, false, 0,
+                                     searched_files, results));
     EXPECT_EQ(1u, results.GetSize());
-    lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
-    EXPECT_EQ(ConstString("NS::NSClass"), udt_type->GetName());
-    CompilerType compiler_type = udt_type->GetForwardCompilerType();
-    EXPECT_TRUE(ClangASTContext::IsClassType(compiler_type.GetOpaqueQualType()));
-    EXPECT_EQ(GetGlobalConstantInteger(session, "sizeof_NSClass"), udt_type->GetByteSize());
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestEnumTypes))
-{
-    FileSpec fspec(m_types_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    SymbolFilePDB *symfile = static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
-    const llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
-    SymbolContext sc;
-    llvm::DenseSet<SymbolFile *> searched_files;
-    const char *EnumsToCheck[] = {"Enum", "ShortEnum"};
-    for (auto Enum : EnumsToCheck)
-    {
-        TypeMap results;
-        EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString(Enum), nullptr, false, 0, searched_files, results));
-        EXPECT_EQ(1u, results.GetSize());
-        lldb::TypeSP enum_type = results.GetTypeAtIndex(0);
-        EXPECT_EQ(ConstString(Enum), enum_type->GetName());
-        CompilerType compiler_type = enum_type->GetFullCompilerType();
-        EXPECT_TRUE(ClangASTContext::IsEnumType(compiler_type.GetOpaqueQualType()));
-        clang::EnumDecl *enum_decl = ClangASTContext::GetAsEnumDecl(compiler_type);
-        EXPECT_NE(nullptr, enum_decl);
-        EXPECT_EQ(2, std::distance(enum_decl->enumerator_begin(), enum_decl->enumerator_end()));
-
-        std::string sizeof_var = "sizeof_";
-        sizeof_var.append(Enum);
-        EXPECT_EQ(GetGlobalConstantInteger(session, sizeof_var.c_str()), enum_type->GetByteSize());
-    }
-}
+    lldb::TypeSP enum_type = results.GetTypeAtIndex(0);
+    EXPECT_EQ(ConstString(Enum), enum_type->GetName());
+    CompilerType compiler_type = enum_type->GetFullCompilerType();
+    EXPECT_TRUE(ClangASTContext::IsEnumType(compiler_type.GetOpaqueQualType()));
+    clang::EnumDecl *enum_decl = ClangASTContext::GetAsEnumDecl(compiler_type);
+    EXPECT_NE(nullptr, enum_decl);
+    EXPECT_EQ(2, std::distance(enum_decl->enumerator_begin(),
+                               enum_decl->enumerator_end()));
+
+    std::string sizeof_var = "sizeof_";
+    sizeof_var.append(Enum);
+    EXPECT_EQ(GetGlobalConstantInteger(session, sizeof_var.c_str()),
+              enum_type->GetByteSize());
+  }
+}
+
+TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestArrayTypes)) {
+  // In order to get this test working, we need to support lookup by symbol
+  // name.  Because array
+  // types themselves do not have names, only the symbols have names (i.e. the
+  // name of the array).
+}
+
+TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestFunctionTypes)) {
+  // In order to get this test working, we need to support lookup by symbol
+  // name.  Because array
+  // types themselves do not have names, only the symbols have names (i.e. the
+  // name of the array).
+}
+
+TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestTypedefs)) {
+  FileSpec fspec(m_types_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  SymbolFilePDB *symfile =
+      static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
+  const llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
+  SymbolContext sc;
+  llvm::DenseSet<SymbolFile *> searched_files;
+  TypeMap results;
 
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestArrayTypes))
-{
-    // In order to get this test working, we need to support lookup by symbol name.  Because array
-    // types themselves do not have names, only the symbols have names (i.e. the name of the array).
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestFunctionTypes))
-{
-    // In order to get this test working, we need to support lookup by symbol name.  Because array
-    // types themselves do not have names, only the symbols have names (i.e. the name of the array).
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestTypedefs))
-{
-    FileSpec fspec(m_types_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    SymbolFilePDB *symfile = static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
-    const llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
-    SymbolContext sc;
-    llvm::DenseSet<SymbolFile *> searched_files;
+  const char *TypedefsToCheck[] = {"ClassTypedef", "NSClassTypedef"};
+  for (auto Typedef : TypedefsToCheck) {
     TypeMap results;
-
-    const char *TypedefsToCheck[] = {"ClassTypedef", "NSClassTypedef"};
-    for (auto Typedef : TypedefsToCheck)
-    {
-        TypeMap results;
-        EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString(Typedef), nullptr, false, 0, searched_files, results));
-        EXPECT_EQ(1u, results.GetSize());
-        lldb::TypeSP typedef_type = results.GetTypeAtIndex(0);
-        EXPECT_EQ(ConstString(Typedef), typedef_type->GetName());
-        CompilerType compiler_type = typedef_type->GetFullCompilerType();
-        ClangASTContext *clang_type_system = llvm::dyn_cast_or_null<ClangASTContext>(compiler_type.GetTypeSystem());
-        EXPECT_TRUE(clang_type_system->IsTypedefType(compiler_type.GetOpaqueQualType()));
-
-        std::string sizeof_var = "sizeof_";
-        sizeof_var.append(Typedef);
-        EXPECT_EQ(GetGlobalConstantInteger(session, sizeof_var.c_str()), typedef_type->GetByteSize());
-    }
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestRegexNameMatch))
-{
-    FileSpec fspec(m_types_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    SymbolFilePDB *symfile = static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
-    SymbolContext sc;
-    llvm::DenseSet<SymbolFile *> searched_files;
-    TypeMap results;
-    uint32_t num_results = symfile->FindTypes(sc, ConstString(".*"), nullptr, false, 0, searched_files, results);
-    EXPECT_GT(num_results, 1u);
-    EXPECT_EQ(num_results, results.GetSize());
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestMaxMatches))
-{
-    FileSpec fspec(m_types_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    SymbolFilePDB *symfile = static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
-    SymbolContext sc;
-    llvm::DenseSet<SymbolFile *> searched_files;
-    TypeMap results;
-    uint32_t num_results = symfile->FindTypes(sc, ConstString(".*"), nullptr, false, 0, searched_files, results);
-    // Try to limit ourselves from 1 to 10 results, otherwise we could be doing this thousands of times.
-    // The idea is just to make sure that for a variety of values, the number of limited results always
-    // comes out to the number we are expecting.
-    uint32_t iterations = std::min(num_results, 10u);
-    for (uint32_t i = 1; i <= iterations; ++i)
-    {
-        uint32_t num_limited_results = symfile->FindTypes(sc, ConstString(".*"), nullptr, false, i, searched_files, results);
-        EXPECT_EQ(i, num_limited_results);
-        EXPECT_EQ(num_limited_results, results.GetSize());
-    }
-}
-
-TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestNullName))
-{
-    FileSpec fspec(m_types_test_exe.c_str(), false);
-    ArchSpec aspec("i686-pc-windows");
-    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
-    SymbolVendor *plugin = module->GetSymbolVendor();
-    SymbolFilePDB *symfile = static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
-    SymbolContext sc;
-    llvm::DenseSet<SymbolFile *> searched_files;
-    TypeMap results;
-    uint32_t num_results = symfile->FindTypes(sc, ConstString(), nullptr, false, 0, searched_files, results);
-    EXPECT_EQ(0u, num_results);
-    EXPECT_EQ(0u, results.GetSize());
+    EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString(Typedef), nullptr, false,
+                                     0, searched_files, results));
+    EXPECT_EQ(1u, results.GetSize());
+    lldb::TypeSP typedef_type = results.GetTypeAtIndex(0);
+    EXPECT_EQ(ConstString(Typedef), typedef_type->GetName());
+    CompilerType compiler_type = typedef_type->GetFullCompilerType();
+    ClangASTContext *clang_type_system =
+        llvm::dyn_cast_or_null<ClangASTContext>(compiler_type.GetTypeSystem());
+    EXPECT_TRUE(
+        clang_type_system->IsTypedefType(compiler_type.GetOpaqueQualType()));
+
+    std::string sizeof_var = "sizeof_";
+    sizeof_var.append(Typedef);
+    EXPECT_EQ(GetGlobalConstantInteger(session, sizeof_var.c_str()),
+              typedef_type->GetByteSize());
+  }
+}
+
+TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestRegexNameMatch)) {
+  FileSpec fspec(m_types_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  SymbolFilePDB *symfile =
+      static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
+  SymbolContext sc;
+  llvm::DenseSet<SymbolFile *> searched_files;
+  TypeMap results;
+  uint32_t num_results = symfile->FindTypes(sc, ConstString(".*"), nullptr,
+                                            false, 0, searched_files, results);
+  EXPECT_GT(num_results, 1u);
+  EXPECT_EQ(num_results, results.GetSize());
+}
+
+TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestMaxMatches)) {
+  FileSpec fspec(m_types_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  SymbolFilePDB *symfile =
+      static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
+  SymbolContext sc;
+  llvm::DenseSet<SymbolFile *> searched_files;
+  TypeMap results;
+  uint32_t num_results = symfile->FindTypes(sc, ConstString(".*"), nullptr,
+                                            false, 0, searched_files, results);
+  // Try to limit ourselves from 1 to 10 results, otherwise we could be doing
+  // this thousands of times.
+  // The idea is just to make sure that for a variety of values, the number of
+  // limited results always
+  // comes out to the number we are expecting.
+  uint32_t iterations = std::min(num_results, 10u);
+  for (uint32_t i = 1; i <= iterations; ++i) {
+    uint32_t num_limited_results = symfile->FindTypes(
+        sc, ConstString(".*"), nullptr, false, i, searched_files, results);
+    EXPECT_EQ(i, num_limited_results);
+    EXPECT_EQ(num_limited_results, results.GetSize());
+  }
+}
+
+TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestNullName)) {
+  FileSpec fspec(m_types_test_exe.c_str(), false);
+  ArchSpec aspec("i686-pc-windows");
+  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  SymbolFilePDB *symfile =
+      static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
+  SymbolContext sc;
+  llvm::DenseSet<SymbolFile *> searched_files;
+  TypeMap results;
+  uint32_t num_results = symfile->FindTypes(sc, ConstString(), nullptr, false,
+                                            0, searched_files, results);
+  EXPECT_EQ(0u, num_results);
+  EXPECT_EQ(0u, results.GetSize());
 }

Modified: lldb/trunk/unittests/Utility/Inputs/TestModule.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/Inputs/TestModule.c?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/Inputs/TestModule.c (original)
+++ lldb/trunk/unittests/Utility/Inputs/TestModule.c Tue Sep  6 15:57:50 2016
@@ -1,10 +1,9 @@
 // Compile with $CC -nostdlib -shared TestModule.c -o TestModule.so
-// The actual contents of the test module is not important here. I am using this because it
+// The actual contents of the test module is not important here. I am using this
+// because it
 // produces an extremely tiny (but still perfectly valid) module.
 
-void
-boom(void)
-{
-    char *BOOM;
-    *BOOM = 47;
+void boom(void) {
+  char *BOOM;
+  *BOOM = 47;
 }

Modified: lldb/trunk/unittests/Utility/ModuleCacheTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ModuleCacheTest.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/ModuleCacheTest.cpp (original)
+++ lldb/trunk/unittests/Utility/ModuleCacheTest.cpp Tue Sep  6 15:57:50 2016
@@ -16,24 +16,20 @@ extern const char *TestMainArgv0;
 using namespace lldb_private;
 using namespace lldb;
 
-namespace
-{
+namespace {
 
-class ModuleCacheTest : public testing::Test
-{
+class ModuleCacheTest : public testing::Test {
 public:
-    static void
-    SetUpTestCase();
+  static void SetUpTestCase();
 
-    static void
-    TearDownTestCase();
+  static void TearDownTestCase();
 
 protected:
-    static FileSpec s_cache_dir;
-    static llvm::SmallString<128> s_test_executable;
+  static FileSpec s_cache_dir;
+  static llvm::SmallString<128> s_test_executable;
 
-    void
-    TryGetAndPut(const FileSpec &cache_dir, const char *hostname, bool expect_download);
+  void TryGetAndPut(const FileSpec &cache_dir, const char *hostname,
+                    bool expect_download);
 };
 }
 
@@ -43,137 +39,131 @@ llvm::SmallString<128> ModuleCacheTest::
 static const char dummy_hostname[] = "dummy_hostname";
 static const char dummy_remote_dir[] = "bin";
 static const char module_name[] = "TestModule.so";
-static const char module_uuid[] = "F4E7E991-9B61-6AD4-0073-561AC3D9FA10-C043A476";
+static const char module_uuid[] =
+    "F4E7E991-9B61-6AD4-0073-561AC3D9FA10-C043A476";
 static const uint32_t uuid_bytes = 20;
 static const size_t module_size = 5602;
 
-static FileSpec
-GetDummyRemotePath()
-{
-    FileSpec fs("/", false, FileSpec::ePathSyntaxPosix);
-    fs.AppendPathComponent(dummy_remote_dir);
-    fs.AppendPathComponent(module_name);
-    return fs;
-}
-
-static FileSpec
-GetUuidView(FileSpec spec)
-{
-    spec.AppendPathComponent(".cache");
-    spec.AppendPathComponent(module_uuid);
-    spec.AppendPathComponent(module_name);
-    return spec;
-}
-
-static FileSpec
-GetSysrootView(FileSpec spec, const char *hostname)
-{
-    spec.AppendPathComponent(hostname);
-    spec.AppendPathComponent(dummy_remote_dir);
-    spec.AppendPathComponent(module_name);
-    return spec;
-}
-
-void
-ModuleCacheTest::SetUpTestCase()
-{
-    HostInfo::Initialize();
-    ObjectFileELF::Initialize();
-
-    FileSpec tmpdir_spec;
-    HostInfo::GetLLDBPath(lldb::ePathTypeLLDBTempSystemDir, s_cache_dir);
-
-    llvm::StringRef exe_folder = llvm::sys::path::parent_path(TestMainArgv0);
-    s_test_executable = exe_folder;
-    llvm::sys::path::append(s_test_executable, "Inputs", module_name);
-}
-
-void
-ModuleCacheTest::TearDownTestCase()
-{
-    ObjectFileELF::Terminate();
-    HostInfo::Terminate();
-}
-
-static void
-VerifyDiskState(const FileSpec &cache_dir, const char *hostname)
-{
-    FileSpec uuid_view = GetUuidView(cache_dir);
-    EXPECT_TRUE(uuid_view.Exists()) << "uuid_view is: " << uuid_view.GetCString();
-    EXPECT_EQ(module_size, uuid_view.GetByteSize());
-
-    FileSpec sysroot_view = GetSysrootView(cache_dir, hostname);
-    EXPECT_TRUE(sysroot_view.Exists()) << "sysroot_view is: " << sysroot_view.GetCString();
-    EXPECT_EQ(module_size, sysroot_view.GetByteSize());
-}
-
-void
-ModuleCacheTest::TryGetAndPut(const FileSpec &cache_dir, const char *hostname, bool expect_download)
-{
-    ModuleCache mc;
-    ModuleSpec module_spec;
-    module_spec.GetFileSpec() = GetDummyRemotePath();
-    module_spec.GetUUID().SetFromCString(module_uuid, uuid_bytes);
-    module_spec.SetObjectSize(module_size);
-    ModuleSP module_sp;
-    bool did_create;
-    bool download_called = false;
-
-    Error error = mc.GetAndPut(
-        cache_dir, hostname, module_spec,
-        [this, &download_called](const ModuleSpec &module_spec, const FileSpec &tmp_download_file_spec) {
-            download_called = true;
-            EXPECT_STREQ(GetDummyRemotePath().GetCString(), module_spec.GetFileSpec().GetCString());
-            std::error_code ec = llvm::sys::fs::copy_file(s_test_executable, tmp_download_file_spec.GetCString());
-            EXPECT_FALSE(ec);
-            return Error();
-        },
-        [](const ModuleSP &module_sp, const FileSpec &tmp_download_file_spec) { return Error("Not supported."); },
-        module_sp, &did_create);
-    EXPECT_EQ(expect_download, download_called);
-
-    EXPECT_TRUE(error.Success()) << "Error was: " << error.AsCString();
-    EXPECT_TRUE(did_create);
-    ASSERT_TRUE(bool(module_sp));
-
-    SymbolContextList sc_list;
-    EXPECT_EQ(1u, module_sp->FindFunctionSymbols(ConstString("boom"), eFunctionNameTypeFull, sc_list));
-    EXPECT_STREQ(GetDummyRemotePath().GetCString(), module_sp->GetPlatformFileSpec().GetCString());
-    EXPECT_STREQ(module_uuid, module_sp->GetUUID().GetAsString().c_str());
-}
-
-TEST_F(ModuleCacheTest, GetAndPut)
-{
-    FileSpec test_cache_dir = s_cache_dir;
-    test_cache_dir.AppendPathComponent("GetAndPut");
-
-    const bool expect_download = true;
-    TryGetAndPut(test_cache_dir, dummy_hostname, expect_download);
-    VerifyDiskState(test_cache_dir, dummy_hostname);
-}
-
-TEST_F(ModuleCacheTest, GetAndPutUuidExists)
-{
-    FileSpec test_cache_dir = s_cache_dir;
-    test_cache_dir.AppendPathComponent("GetAndPutUuidExists");
-
-    FileSpec uuid_view = GetUuidView(test_cache_dir);
-    std::error_code ec = llvm::sys::fs::create_directories(uuid_view.GetDirectory().GetCString());
-    ASSERT_FALSE(ec);
-    ec = llvm::sys::fs::copy_file(s_test_executable, uuid_view.GetCString());
-    ASSERT_FALSE(ec);
-
-    const bool expect_download = false;
-    TryGetAndPut(test_cache_dir, dummy_hostname, expect_download);
-    VerifyDiskState(test_cache_dir, dummy_hostname);
-}
-
-TEST_F(ModuleCacheTest, GetAndPutStrangeHostname)
-{
-    FileSpec test_cache_dir = s_cache_dir;
-    test_cache_dir.AppendPathComponent("GetAndPutStrangeHostname");
-
-    const bool expect_download = true;
-    TryGetAndPut(test_cache_dir, "tab\tcolon:asterisk*", expect_download);
-    VerifyDiskState(test_cache_dir, "tab_colon_asterisk_");
+static FileSpec GetDummyRemotePath() {
+  FileSpec fs("/", false, FileSpec::ePathSyntaxPosix);
+  fs.AppendPathComponent(dummy_remote_dir);
+  fs.AppendPathComponent(module_name);
+  return fs;
+}
+
+static FileSpec GetUuidView(FileSpec spec) {
+  spec.AppendPathComponent(".cache");
+  spec.AppendPathComponent(module_uuid);
+  spec.AppendPathComponent(module_name);
+  return spec;
+}
+
+static FileSpec GetSysrootView(FileSpec spec, const char *hostname) {
+  spec.AppendPathComponent(hostname);
+  spec.AppendPathComponent(dummy_remote_dir);
+  spec.AppendPathComponent(module_name);
+  return spec;
+}
+
+void ModuleCacheTest::SetUpTestCase() {
+  HostInfo::Initialize();
+  ObjectFileELF::Initialize();
+
+  FileSpec tmpdir_spec;
+  HostInfo::GetLLDBPath(lldb::ePathTypeLLDBTempSystemDir, s_cache_dir);
+
+  llvm::StringRef exe_folder = llvm::sys::path::parent_path(TestMainArgv0);
+  s_test_executable = exe_folder;
+  llvm::sys::path::append(s_test_executable, "Inputs", module_name);
+}
+
+void ModuleCacheTest::TearDownTestCase() {
+  ObjectFileELF::Terminate();
+  HostInfo::Terminate();
+}
+
+static void VerifyDiskState(const FileSpec &cache_dir, const char *hostname) {
+  FileSpec uuid_view = GetUuidView(cache_dir);
+  EXPECT_TRUE(uuid_view.Exists()) << "uuid_view is: " << uuid_view.GetCString();
+  EXPECT_EQ(module_size, uuid_view.GetByteSize());
+
+  FileSpec sysroot_view = GetSysrootView(cache_dir, hostname);
+  EXPECT_TRUE(sysroot_view.Exists()) << "sysroot_view is: "
+                                     << sysroot_view.GetCString();
+  EXPECT_EQ(module_size, sysroot_view.GetByteSize());
+}
+
+void ModuleCacheTest::TryGetAndPut(const FileSpec &cache_dir,
+                                   const char *hostname, bool expect_download) {
+  ModuleCache mc;
+  ModuleSpec module_spec;
+  module_spec.GetFileSpec() = GetDummyRemotePath();
+  module_spec.GetUUID().SetFromCString(module_uuid, uuid_bytes);
+  module_spec.SetObjectSize(module_size);
+  ModuleSP module_sp;
+  bool did_create;
+  bool download_called = false;
+
+  Error error = mc.GetAndPut(
+      cache_dir, hostname, module_spec,
+      [this, &download_called](const ModuleSpec &module_spec,
+                               const FileSpec &tmp_download_file_spec) {
+        download_called = true;
+        EXPECT_STREQ(GetDummyRemotePath().GetCString(),
+                     module_spec.GetFileSpec().GetCString());
+        std::error_code ec = llvm::sys::fs::copy_file(
+            s_test_executable, tmp_download_file_spec.GetCString());
+        EXPECT_FALSE(ec);
+        return Error();
+      },
+      [](const ModuleSP &module_sp, const FileSpec &tmp_download_file_spec) {
+        return Error("Not supported.");
+      },
+      module_sp, &did_create);
+  EXPECT_EQ(expect_download, download_called);
+
+  EXPECT_TRUE(error.Success()) << "Error was: " << error.AsCString();
+  EXPECT_TRUE(did_create);
+  ASSERT_TRUE(bool(module_sp));
+
+  SymbolContextList sc_list;
+  EXPECT_EQ(1u, module_sp->FindFunctionSymbols(ConstString("boom"),
+                                               eFunctionNameTypeFull, sc_list));
+  EXPECT_STREQ(GetDummyRemotePath().GetCString(),
+               module_sp->GetPlatformFileSpec().GetCString());
+  EXPECT_STREQ(module_uuid, module_sp->GetUUID().GetAsString().c_str());
+}
+
+TEST_F(ModuleCacheTest, GetAndPut) {
+  FileSpec test_cache_dir = s_cache_dir;
+  test_cache_dir.AppendPathComponent("GetAndPut");
+
+  const bool expect_download = true;
+  TryGetAndPut(test_cache_dir, dummy_hostname, expect_download);
+  VerifyDiskState(test_cache_dir, dummy_hostname);
+}
+
+TEST_F(ModuleCacheTest, GetAndPutUuidExists) {
+  FileSpec test_cache_dir = s_cache_dir;
+  test_cache_dir.AppendPathComponent("GetAndPutUuidExists");
+
+  FileSpec uuid_view = GetUuidView(test_cache_dir);
+  std::error_code ec =
+      llvm::sys::fs::create_directories(uuid_view.GetDirectory().GetCString());
+  ASSERT_FALSE(ec);
+  ec = llvm::sys::fs::copy_file(s_test_executable, uuid_view.GetCString());
+  ASSERT_FALSE(ec);
+
+  const bool expect_download = false;
+  TryGetAndPut(test_cache_dir, dummy_hostname, expect_download);
+  VerifyDiskState(test_cache_dir, dummy_hostname);
+}
+
+TEST_F(ModuleCacheTest, GetAndPutStrangeHostname) {
+  FileSpec test_cache_dir = s_cache_dir;
+  test_cache_dir.AppendPathComponent("GetAndPutStrangeHostname");
+
+  const bool expect_download = true;
+  TryGetAndPut(test_cache_dir, "tab\tcolon:asterisk*", expect_download);
+  VerifyDiskState(test_cache_dir, "tab_colon_asterisk_");
 }

Modified: lldb/trunk/unittests/Utility/StringExtractorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/StringExtractorTest.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/StringExtractorTest.cpp (original)
+++ lldb/trunk/unittests/Utility/StringExtractorTest.cpp Tue Sep  6 15:57:50 2016
@@ -1,738 +1,698 @@
-#include <limits.h>
 #include "gtest/gtest.h"
+#include <limits.h>
 
 #include "lldb/Utility/StringExtractor.h"
 
-namespace
-{
-    class StringExtractorTest: public ::testing::Test
-    {
-    };
-}
-
-TEST_F (StringExtractorTest, InitEmpty)
-{
-    const char kEmptyString[] = "";
-    StringExtractor ex (kEmptyString);
-
-    ASSERT_EQ (true, ex.IsGood());
-    ASSERT_EQ (0u, ex.GetFilePos());
-    ASSERT_STREQ (kEmptyString, ex.GetStringRef().c_str());
-    ASSERT_EQ (true, ex.Empty());
-    ASSERT_EQ (0u, ex.GetBytesLeft());
-    ASSERT_EQ (nullptr, ex.Peek());
-}
-
-TEST_F (StringExtractorTest, InitMisc)
-{
-    const char kInitMiscString[] = "Hello, StringExtractor!";
-    StringExtractor ex (kInitMiscString);
-
-    ASSERT_EQ (true, ex.IsGood());
-    ASSERT_EQ (0u, ex.GetFilePos());
-    ASSERT_STREQ (kInitMiscString, ex.GetStringRef().c_str());
-    ASSERT_EQ (false, ex.Empty());
-    ASSERT_EQ (sizeof(kInitMiscString)-1, ex.GetBytesLeft());
-    ASSERT_EQ (kInitMiscString[0], *ex.Peek());
-}
-
-TEST_F (StringExtractorTest, DecodeHexU8_Underflow)
-{
-    const char kEmptyString[] = "";
-    StringExtractor ex (kEmptyString);
-
-    ASSERT_EQ (-1, ex.DecodeHexU8());
-    ASSERT_EQ (true, ex.IsGood());
-    ASSERT_EQ (0u, ex.GetFilePos());
-    ASSERT_EQ (true, ex.Empty());
-    ASSERT_EQ (0u, ex.GetBytesLeft());
-    ASSERT_EQ (nullptr, ex.Peek());
-}
-
-TEST_F (StringExtractorTest, DecodeHexU8_Underflow2)
-{
-    const char kEmptyString[] = "1";
-    StringExtractor ex (kEmptyString);
-
-    ASSERT_EQ (-1, ex.DecodeHexU8());
-    ASSERT_EQ (true, ex.IsGood());
-    ASSERT_EQ (0u, ex.GetFilePos());
-    ASSERT_EQ (1u, ex.GetBytesLeft());
-    ASSERT_EQ ('1', *ex.Peek());
-}
-
-TEST_F (StringExtractorTest, DecodeHexU8_InvalidHex)
-{
-    const char kInvalidHex[] = "xa";
-    StringExtractor ex (kInvalidHex);
-
-    ASSERT_EQ (-1, ex.DecodeHexU8());
-    ASSERT_EQ (true, ex.IsGood());
-    ASSERT_EQ (0u, ex.GetFilePos());
-    ASSERT_EQ (2u, ex.GetBytesLeft());
-    ASSERT_EQ ('x', *ex.Peek());
-}
-
-TEST_F (StringExtractorTest, DecodeHexU8_InvalidHex2)
-{
-    const char kInvalidHex[] = "ax";
-    StringExtractor ex (kInvalidHex);
-
-    ASSERT_EQ (-1, ex.DecodeHexU8());
-    ASSERT_EQ (true, ex.IsGood());
-    ASSERT_EQ (0u, ex.GetFilePos());
-    ASSERT_EQ (2u, ex.GetBytesLeft());
-    ASSERT_EQ ('a', *ex.Peek());
-}
-
-TEST_F (StringExtractorTest, DecodeHexU8_Exact)
-{
-    const char kValidHexPair[] = "12";
-    StringExtractor ex (kValidHexPair);
-
-    ASSERT_EQ (0x12, ex.DecodeHexU8());
-    ASSERT_EQ (true, ex.IsGood());
-    ASSERT_EQ (2u, ex.GetFilePos());
-    ASSERT_EQ (0u, ex.GetBytesLeft());
-    ASSERT_EQ (nullptr, ex.Peek());
-}
-
-TEST_F (StringExtractorTest, DecodeHexU8_Extra)
-{
-    const char kValidHexPair[] = "1234";
-    StringExtractor ex (kValidHexPair);
-
-    ASSERT_EQ (0x12, ex.DecodeHexU8());
-    ASSERT_EQ (true, ex.IsGood());
-    ASSERT_EQ (2u, ex.GetFilePos());
-    ASSERT_EQ (2u, ex.GetBytesLeft());
-    ASSERT_EQ ('3', *ex.Peek());
-}
-
-TEST_F (StringExtractorTest, GetHexU8_Underflow)
-{
-    const char kEmptyString[] = "";
-    StringExtractor ex (kEmptyString);
-
-    ASSERT_EQ (0xab, ex.GetHexU8(0xab));
-    ASSERT_EQ (false, ex.IsGood());
-    ASSERT_EQ (UINT64_MAX, ex.GetFilePos());
-    ASSERT_EQ (true, ex.Empty());
-    ASSERT_EQ (0u, ex.GetBytesLeft());
-    ASSERT_EQ (nullptr, ex.Peek());
-}
-
-TEST_F (StringExtractorTest, GetHexU8_Underflow2)
-{
-    const char kOneNibble[] = "1";
-    StringExtractor ex (kOneNibble);
-
-    ASSERT_EQ (0xbc, ex.GetHexU8(0xbc));
-    ASSERT_EQ (false, ex.IsGood());
-    ASSERT_EQ (UINT64_MAX, ex.GetFilePos());
-    ASSERT_EQ (0u, ex.GetBytesLeft());
-    ASSERT_EQ (nullptr, ex.Peek());
-}
-
-TEST_F (StringExtractorTest, GetHexU8_InvalidHex)
-{
-    const char kInvalidHex[] = "xx";
-    StringExtractor ex (kInvalidHex);
-
-    ASSERT_EQ (0xcd, ex.GetHexU8(0xcd));
-    ASSERT_EQ (false, ex.IsGood());
-    ASSERT_EQ (UINT64_MAX, ex.GetFilePos());
-    ASSERT_EQ (0u, ex.GetBytesLeft());
-    ASSERT_EQ (nullptr, ex.Peek());
-}
-
-TEST_F (StringExtractorTest, GetHexU8_Exact)
-{
-    const char kValidHexPair[] = "12";
-    StringExtractor ex (kValidHexPair);
-
-    ASSERT_EQ (0x12, ex.GetHexU8(0x12));
-    ASSERT_EQ (true, ex.IsGood());
-    ASSERT_EQ (2u, ex.GetFilePos());
-    ASSERT_EQ (0u, ex.GetBytesLeft());
-    ASSERT_EQ (nullptr, ex.Peek());
-}
-
-TEST_F (StringExtractorTest, GetHexU8_Extra)
-{
-    const char kValidHexPair[] = "1234";
-    StringExtractor ex (kValidHexPair);
-
-    ASSERT_EQ (0x12, ex.GetHexU8(0x12));
-    ASSERT_EQ (true, ex.IsGood());
-    ASSERT_EQ (2u, ex.GetFilePos());
-    ASSERT_EQ (2u, ex.GetBytesLeft());
-    ASSERT_EQ ('3', *ex.Peek());
-}
-
-TEST_F (StringExtractorTest, GetHexU8_Underflow_NoEof)
-{
-    const char kEmptyString[] = "";
-    StringExtractor ex (kEmptyString);
-    const bool kSetEofOnFail = false;
-
-    ASSERT_EQ (0xab, ex.GetHexU8(0xab, kSetEofOnFail));
-    ASSERT_EQ (false, ex.IsGood()); // this result seems inconsistent with kSetEofOnFail == false
-    ASSERT_EQ (UINT64_MAX, ex.GetFilePos());
-    ASSERT_EQ (true, ex.Empty());
-    ASSERT_EQ (0u, ex.GetBytesLeft());
-    ASSERT_EQ (nullptr, ex.Peek());
-}
-
-TEST_F (StringExtractorTest, GetHexU8_Underflow2_NoEof)
-{
-    const char kOneNibble[] = "1";
-    StringExtractor ex (kOneNibble);
-    const bool kSetEofOnFail = false;
-
-    ASSERT_EQ (0xbc, ex.GetHexU8(0xbc, kSetEofOnFail));
-    ASSERT_EQ (true, ex.IsGood());
-    ASSERT_EQ (0u, ex.GetFilePos());
-    ASSERT_EQ (1u, ex.GetBytesLeft());
-    ASSERT_EQ ('1', *ex.Peek());
-}
-
-TEST_F (StringExtractorTest, GetHexU8_InvalidHex_NoEof)
-{
-    const char kInvalidHex[] = "xx";
-    StringExtractor ex (kInvalidHex);
-    const bool kSetEofOnFail = false;
-
-    ASSERT_EQ (0xcd, ex.GetHexU8(0xcd, kSetEofOnFail));
-    ASSERT_EQ (true, ex.IsGood());
-    ASSERT_EQ (0u, ex.GetFilePos());
-    ASSERT_EQ (2u, ex.GetBytesLeft());
-    ASSERT_EQ ('x', *ex.Peek());
-}
-
-TEST_F (StringExtractorTest, GetHexU8_Exact_NoEof)
-{
-    const char kValidHexPair[] = "12";
-    StringExtractor ex (kValidHexPair);
-    const bool kSetEofOnFail = false;
-
-    ASSERT_EQ (0x12, ex.GetHexU8(0x12, kSetEofOnFail));
-    ASSERT_EQ (true, ex.IsGood());
-    ASSERT_EQ (2u, ex.GetFilePos());
-    ASSERT_EQ (0u, ex.GetBytesLeft());
-    ASSERT_EQ (nullptr, ex.Peek());
-}
-
-TEST_F (StringExtractorTest, GetHexU8_Extra_NoEof)
-{
-    const char kValidHexPair[] = "1234";
-    StringExtractor ex (kValidHexPair);
-    const bool kSetEofOnFail = false;
-
-    ASSERT_EQ (0x12, ex.GetHexU8(0x12, kSetEofOnFail));
-    ASSERT_EQ (true, ex.IsGood());
-    ASSERT_EQ (2u, ex.GetFilePos());
-    ASSERT_EQ (2u, ex.GetBytesLeft());
-    ASSERT_EQ ('3', *ex.Peek());
-}
-
-TEST_F (StringExtractorTest, GetHexBytes)
-{
-    const char kHexEncodedBytes[] = "abcdef0123456789xyzw";
-    const size_t kValidHexPairs = 8;
-    StringExtractor ex(kHexEncodedBytes);
-
-    uint8_t dst[kValidHexPairs];
-    ASSERT_EQ(kValidHexPairs, ex.GetHexBytes (dst, 0xde));
-    EXPECT_EQ(0xab,dst[0]);
-    EXPECT_EQ(0xcd,dst[1]);
-    EXPECT_EQ(0xef,dst[2]);
-    EXPECT_EQ(0x01,dst[3]);
-    EXPECT_EQ(0x23,dst[4]);
-    EXPECT_EQ(0x45,dst[5]);
-    EXPECT_EQ(0x67,dst[6]);
-    EXPECT_EQ(0x89,dst[7]);
-
-    ASSERT_EQ(true, ex.IsGood());
-    ASSERT_EQ(2*kValidHexPairs, ex.GetFilePos());
-    ASSERT_EQ(false, ex.Empty());
-    ASSERT_EQ(4u, ex.GetBytesLeft());
-    ASSERT_EQ('x', *ex.Peek());
-}
-
-TEST_F(StringExtractorTest, GetHexBytes_FullString)
-{
-    const char kHexEncodedBytes[] = "abcdef0123456789";
-    const size_t kValidHexPairs = 8;
-    StringExtractor ex(kHexEncodedBytes);
-
-    uint8_t dst[kValidHexPairs];
-    ASSERT_EQ(kValidHexPairs, ex.GetHexBytes(dst, 0xde));
-    EXPECT_EQ(0xab, dst[0]);
-    EXPECT_EQ(0xcd, dst[1]);
-    EXPECT_EQ(0xef, dst[2]);
-    EXPECT_EQ(0x01, dst[3]);
-    EXPECT_EQ(0x23, dst[4]);
-    EXPECT_EQ(0x45, dst[5]);
-    EXPECT_EQ(0x67, dst[6]);
-    EXPECT_EQ(0x89, dst[7]);
-}
-
-TEST_F(StringExtractorTest, GetHexBytes_OddPair)
-{
-    const char kHexEncodedBytes[] = "abcdef012345678w";
-    const size_t kValidHexPairs = 7;
-    StringExtractor ex(kHexEncodedBytes);
-
-    uint8_t dst[8];
-    ASSERT_EQ(kValidHexPairs, ex.GetHexBytes(dst, 0xde));
-    EXPECT_EQ(0xab, dst[0]);
-    EXPECT_EQ(0xcd, dst[1]);
-    EXPECT_EQ(0xef, dst[2]);
-    EXPECT_EQ(0x01, dst[3]);
-    EXPECT_EQ(0x23, dst[4]);
-    EXPECT_EQ(0x45, dst[5]);
-    EXPECT_EQ(0x67, dst[6]);
-
-    // This one should be invalid
-    EXPECT_EQ(0xde, dst[7]);
-}
-
-
-TEST_F(StringExtractorTest, GetHexBytes_OddPair2)
-{
-    const char kHexEncodedBytes[] = "abcdef012345678";
-    const size_t kValidHexPairs = 7;
-    StringExtractor ex(kHexEncodedBytes);
-
-    uint8_t dst[8];
-    ASSERT_EQ(kValidHexPairs, ex.GetHexBytes(dst, 0xde));
-    EXPECT_EQ(0xab, dst[0]);
-    EXPECT_EQ(0xcd, dst[1]);
-    EXPECT_EQ(0xef, dst[2]);
-    EXPECT_EQ(0x01, dst[3]);
-    EXPECT_EQ(0x23, dst[4]);
-    EXPECT_EQ(0x45, dst[5]);
-    EXPECT_EQ(0x67, dst[6]);
-
-    EXPECT_EQ(0xde, dst[7]);
-}
-
-TEST_F (StringExtractorTest, GetHexBytes_Underflow)
-{
-    const char kHexEncodedBytes[] = "abcdef0123456789xyzw";
-    const size_t kValidHexPairs = 8;
-    StringExtractor ex(kHexEncodedBytes);
-
-    uint8_t dst[12];
-    ASSERT_EQ(kValidHexPairs, ex.GetHexBytes (dst, 0xde));
-    EXPECT_EQ(0xab,dst[0]);
-    EXPECT_EQ(0xcd,dst[1]);
-    EXPECT_EQ(0xef,dst[2]);
-    EXPECT_EQ(0x01,dst[3]);
-    EXPECT_EQ(0x23,dst[4]);
-    EXPECT_EQ(0x45,dst[5]);
-    EXPECT_EQ(0x67,dst[6]);
-    EXPECT_EQ(0x89,dst[7]);
-    // these bytes should be filled with fail_fill_value 0xde
-    EXPECT_EQ(0xde,dst[8]);
-    EXPECT_EQ(0xde,dst[9]);
-    EXPECT_EQ(0xde,dst[10]);
-    EXPECT_EQ(0xde,dst[11]);
-
-    ASSERT_EQ(false, ex.IsGood());
-    ASSERT_EQ(UINT64_MAX, ex.GetFilePos());
-    ASSERT_EQ(false, ex.Empty());
-    ASSERT_EQ(0u, ex.GetBytesLeft());
-    ASSERT_EQ(0, ex.Peek());
-}
-
-TEST_F (StringExtractorTest, GetHexBytes_Partial)
-{
-    const char kHexEncodedBytes[] = "abcdef0123456789xyzw";
-    const size_t kReadBytes = 4;
-    StringExtractor ex(kHexEncodedBytes);
-
-    uint8_t dst[12];
-    memset(dst, 0xab, sizeof(dst));
-    ASSERT_EQ(kReadBytes, ex.GetHexBytes (llvm::MutableArrayRef<uint8_t>(dst, kReadBytes), 0xde));
-    EXPECT_EQ(0xab,dst[0]);
-    EXPECT_EQ(0xcd,dst[1]);
-    EXPECT_EQ(0xef,dst[2]);
-    EXPECT_EQ(0x01,dst[3]);
-    // these bytes should be unchanged
-    EXPECT_EQ(0xab,dst[4]);
-    EXPECT_EQ(0xab,dst[5]);
-    EXPECT_EQ(0xab,dst[6]);
-    EXPECT_EQ(0xab,dst[7]);
-    EXPECT_EQ(0xab,dst[8]);
-    EXPECT_EQ(0xab,dst[9]);
-    EXPECT_EQ(0xab,dst[10]);
-    EXPECT_EQ(0xab,dst[11]);
-
-    ASSERT_EQ(true, ex.IsGood());
-    ASSERT_EQ(kReadBytes*2, ex.GetFilePos());
-    ASSERT_EQ(false, ex.Empty());
-    ASSERT_EQ(12u, ex.GetBytesLeft());
-    ASSERT_EQ('2', *ex.Peek());
-}
-
-TEST_F (StringExtractorTest, GetHexBytesAvail)
-{
-    const char kHexEncodedBytes[] = "abcdef0123456789xyzw";
-    const size_t kValidHexPairs = 8;
-    StringExtractor ex(kHexEncodedBytes);
-
-    uint8_t dst[kValidHexPairs];
-    ASSERT_EQ(kValidHexPairs, ex.GetHexBytesAvail (dst));
-    EXPECT_EQ(0xab,dst[0]);
-    EXPECT_EQ(0xcd,dst[1]);
-    EXPECT_EQ(0xef,dst[2]);
-    EXPECT_EQ(0x01,dst[3]);
-    EXPECT_EQ(0x23,dst[4]);
-    EXPECT_EQ(0x45,dst[5]);
-    EXPECT_EQ(0x67,dst[6]);
-    EXPECT_EQ(0x89,dst[7]);
-
-    ASSERT_EQ(true, ex.IsGood());
-    ASSERT_EQ(2*kValidHexPairs, ex.GetFilePos());
-    ASSERT_EQ(false, ex.Empty());
-    ASSERT_EQ(4u, ex.GetBytesLeft());
-    ASSERT_EQ('x', *ex.Peek());
-}
-
-TEST_F(StringExtractorTest, GetHexBytesAvail_FullString)
-{
-    const char kHexEncodedBytes[] = "abcdef0123456789";
-    const size_t kValidHexPairs = 8;
-    StringExtractor ex(kHexEncodedBytes);
-
-    uint8_t dst[kValidHexPairs];
-    ASSERT_EQ(kValidHexPairs, ex.GetHexBytesAvail(dst));
-    EXPECT_EQ(0xab, dst[0]);
-    EXPECT_EQ(0xcd, dst[1]);
-    EXPECT_EQ(0xef, dst[2]);
-    EXPECT_EQ(0x01, dst[3]);
-    EXPECT_EQ(0x23, dst[4]);
-    EXPECT_EQ(0x45, dst[5]);
-    EXPECT_EQ(0x67, dst[6]);
-    EXPECT_EQ(0x89, dst[7]);
-}
-
-TEST_F(StringExtractorTest, GetHexBytesAvail_OddPair)
-{
-    const char kHexEncodedBytes[] = "abcdef012345678w";
-    const size_t kValidHexPairs = 7;
-    StringExtractor ex(kHexEncodedBytes);
-
-    uint8_t dst[8];
-    ASSERT_EQ(kValidHexPairs, ex.GetHexBytesAvail(dst));
-    EXPECT_EQ(0xab, dst[0]);
-    EXPECT_EQ(0xcd, dst[1]);
-    EXPECT_EQ(0xef, dst[2]);
-    EXPECT_EQ(0x01, dst[3]);
-    EXPECT_EQ(0x23, dst[4]);
-    EXPECT_EQ(0x45, dst[5]);
-    EXPECT_EQ(0x67, dst[6]);
-}
-
-
-TEST_F(StringExtractorTest, GetHexBytesAvail_OddPair2)
-{
-    const char kHexEncodedBytes[] = "abcdef012345678";
-    const size_t kValidHexPairs = 7;
-    StringExtractor ex(kHexEncodedBytes);
-
-    uint8_t dst[8];
-    ASSERT_EQ(kValidHexPairs, ex.GetHexBytesAvail(dst));
-    EXPECT_EQ(0xab, dst[0]);
-    EXPECT_EQ(0xcd, dst[1]);
-    EXPECT_EQ(0xef, dst[2]);
-    EXPECT_EQ(0x01, dst[3]);
-    EXPECT_EQ(0x23, dst[4]);
-    EXPECT_EQ(0x45, dst[5]);
-    EXPECT_EQ(0x67, dst[6]);
-}
-
-TEST_F (StringExtractorTest, GetHexBytesAvail_Underflow)
-{
-    const char kHexEncodedBytes[] = "abcdef0123456789xyzw";
-    const size_t kValidHexPairs = 8;
-    StringExtractor ex(kHexEncodedBytes);
-
-    uint8_t dst[12];
-    memset(dst, 0xef, sizeof(dst));
-    ASSERT_EQ(kValidHexPairs, ex.GetHexBytesAvail (dst));
-    EXPECT_EQ(0xab,dst[0]);
-    EXPECT_EQ(0xcd,dst[1]);
-    EXPECT_EQ(0xef,dst[2]);
-    EXPECT_EQ(0x01,dst[3]);
-    EXPECT_EQ(0x23,dst[4]);
-    EXPECT_EQ(0x45,dst[5]);
-    EXPECT_EQ(0x67,dst[6]);
-    EXPECT_EQ(0x89,dst[7]);
-    // these bytes should be unchanged
-    EXPECT_EQ(0xef,dst[8]);
-    EXPECT_EQ(0xef,dst[9]);
-    EXPECT_EQ(0xef,dst[10]);
-    EXPECT_EQ(0xef,dst[11]);
-
-    ASSERT_EQ(true, ex.IsGood());
-    ASSERT_EQ(kValidHexPairs*2, ex.GetFilePos());
-    ASSERT_EQ(false, ex.Empty());
-    ASSERT_EQ(4u, ex.GetBytesLeft());
-    ASSERT_EQ('x', *ex.Peek());
-}
-
-TEST_F (StringExtractorTest, GetHexBytesAvail_Partial)
-{
-    const char kHexEncodedBytes[] = "abcdef0123456789xyzw";
-    const size_t kReadBytes = 4;
-    StringExtractor ex(kHexEncodedBytes);
-
-    uint8_t dst[12];
-    memset(dst, 0xab, sizeof(dst));
-    ASSERT_EQ(kReadBytes, ex.GetHexBytesAvail (llvm::MutableArrayRef<uint8_t>(dst, kReadBytes)));
-    EXPECT_EQ(0xab,dst[0]);
-    EXPECT_EQ(0xcd,dst[1]);
-    EXPECT_EQ(0xef,dst[2]);
-    EXPECT_EQ(0x01,dst[3]);
-    // these bytes should be unchanged
-    EXPECT_EQ(0xab,dst[4]);
-    EXPECT_EQ(0xab,dst[5]);
-    EXPECT_EQ(0xab,dst[6]);
-    EXPECT_EQ(0xab,dst[7]);
-    EXPECT_EQ(0xab,dst[8]);
-    EXPECT_EQ(0xab,dst[9]);
-    EXPECT_EQ(0xab,dst[10]);
-    EXPECT_EQ(0xab,dst[11]);
-
-    ASSERT_EQ(true, ex.IsGood());
-    ASSERT_EQ(kReadBytes*2, ex.GetFilePos());
-    ASSERT_EQ(false, ex.Empty());
-    ASSERT_EQ(12u, ex.GetBytesLeft());
-    ASSERT_EQ('2', *ex.Peek());
-}
-
-TEST_F(StringExtractorTest, GetNameColonValueSuccess)
-{
-    const char kNameColonPairs[] = "key1:value1;key2:value2;";
-    StringExtractor ex(kNameColonPairs);
-
-    llvm::StringRef name;
-    llvm::StringRef value;
-    EXPECT_TRUE(ex.GetNameColonValue(name, value));
-    EXPECT_EQ("key1", name);
-    EXPECT_EQ("value1", value);
-    EXPECT_TRUE(ex.GetNameColonValue(name, value));
-    EXPECT_EQ("key2", name);
-    EXPECT_EQ("value2", value);
-    EXPECT_EQ(0, ex.GetBytesLeft());
-}
-
-
-TEST_F(StringExtractorTest, GetNameColonValueContainsColon)
-{
-    const char kNameColonPairs[] = "key1:value1:value2;key2:value3;";
-    StringExtractor ex(kNameColonPairs);
-
-    llvm::StringRef name;
-    llvm::StringRef value;
-    EXPECT_TRUE(ex.GetNameColonValue(name, value));
-    EXPECT_EQ("key1", name);
-    EXPECT_EQ("value1:value2", value);
-    EXPECT_TRUE(ex.GetNameColonValue(name, value));
-    EXPECT_EQ("key2", name);
-    EXPECT_EQ("value3", value);
-    EXPECT_EQ(0, ex.GetBytesLeft());
-}
-
-TEST_F(StringExtractorTest, GetNameColonValueNoSemicolon)
-{
-    const char kNameColonPairs[] = "key1:value1";
-    StringExtractor ex(kNameColonPairs);
-
-    llvm::StringRef name;
-    llvm::StringRef value;
-    EXPECT_FALSE(ex.GetNameColonValue(name, value));
-    EXPECT_EQ(0, ex.GetBytesLeft());
-}
-
-TEST_F(StringExtractorTest, GetNameColonValueNoColon)
-{
-    const char kNameColonPairs[] = "key1value1;";
-    StringExtractor ex(kNameColonPairs);
-
-    llvm::StringRef name;
-    llvm::StringRef value;
-    EXPECT_FALSE(ex.GetNameColonValue(name, value));
-    EXPECT_EQ(0, ex.GetBytesLeft());
-}
-
-TEST_F(StringExtractorTest, GetU32LittleEndian)
-{
-    StringExtractor ex("");
-    EXPECT_EQ(0x0, ex.GetHexMaxU32(true, 0));
-
-    ex.Reset("0");
-    EXPECT_EQ(0x0, ex.GetHexMaxU32(true, 1));
-
-    ex.Reset("1");
-    EXPECT_EQ(0x1, ex.GetHexMaxU32(true, 0));
-
-    ex.Reset("01");
-    EXPECT_EQ(0x1, ex.GetHexMaxU32(true, 0));
-
-    ex.Reset("001");
-    EXPECT_EQ(0x100, ex.GetHexMaxU32(true, 0));
-
-    ex.Reset("12");
-    EXPECT_EQ(0x12, ex.GetHexMaxU32(true, 0));
-
-    ex.Reset("123");
-    EXPECT_EQ(0x312, ex.GetHexMaxU32(true, 0));
-
-    ex.Reset("1203");
-    EXPECT_EQ(0x312, ex.GetHexMaxU32(true, 0));
-
-    ex.Reset("1234");
-    EXPECT_EQ(0x3412, ex.GetHexMaxU32(true, 0));
-
-    ex.Reset("12340");
-    EXPECT_EQ(0x3412, ex.GetHexMaxU32(true, 0));
-
-    ex.Reset("123400");
-    EXPECT_EQ(0x3412, ex.GetHexMaxU32(true, 0));
-
-    ex.Reset("12345670");
-    EXPECT_EQ(0x70563412, ex.GetHexMaxU32(true, 0));
-
-    ex.Reset("123456701");
-    EXPECT_EQ(0, ex.GetHexMaxU32(true, 0));
-}
-
-TEST_F(StringExtractorTest, GetU32BigEndian)
-{
-    StringExtractor ex("");
-    EXPECT_EQ(0x0, ex.GetHexMaxU32(false, 0));
-
-    ex.Reset("0");
-    EXPECT_EQ(0x0, ex.GetHexMaxU32(false, 1));
-
-    ex.Reset("1");
-    EXPECT_EQ(0x1, ex.GetHexMaxU32(false, 0));
-
-    ex.Reset("01");
-    EXPECT_EQ(0x1, ex.GetHexMaxU32(false, 0));
-
-    ex.Reset("001");
-    EXPECT_EQ(0x1, ex.GetHexMaxU32(false, 0));
-
-    ex.Reset("12");
-    EXPECT_EQ(0x12, ex.GetHexMaxU32(false, 0));
-
-    ex.Reset("123");
-    EXPECT_EQ(0x123, ex.GetHexMaxU32(false, 0));
-
-    ex.Reset("1203");
-    EXPECT_EQ(0x1203, ex.GetHexMaxU32(false, 0));
-
-    ex.Reset("1234");
-    EXPECT_EQ(0x1234, ex.GetHexMaxU32(false, 0));
-
-    ex.Reset("12340");
-    EXPECT_EQ(0x12340, ex.GetHexMaxU32(false, 0));
-
-    ex.Reset("123400");
-    EXPECT_EQ(0x123400, ex.GetHexMaxU32(false, 0));
-
-    ex.Reset("12345670");
-    EXPECT_EQ(0x12345670, ex.GetHexMaxU32(false, 0));
-
-    ex.Reset("123456700");
-    EXPECT_EQ(0, ex.GetHexMaxU32(false, 0));
-}
-
-TEST_F(StringExtractorTest, GetU64LittleEndian)
-{
-    StringExtractor ex("");
-    EXPECT_EQ(0x0, ex.GetHexMaxU64(true, 0));
-
-    ex.Reset("0");
-    EXPECT_EQ(0x0, ex.GetHexMaxU64(true, 1));
-
-    ex.Reset("1");
-    EXPECT_EQ(0x1, ex.GetHexMaxU64(true, 0));
-
-    ex.Reset("01");
-    EXPECT_EQ(0x1, ex.GetHexMaxU64(true, 0));
-
-    ex.Reset("001");
-    EXPECT_EQ(0x100, ex.GetHexMaxU64(true, 0));
-
-    ex.Reset("12");
-    EXPECT_EQ(0x12, ex.GetHexMaxU64(true, 0));
-
-    ex.Reset("123");
-    EXPECT_EQ(0x312, ex.GetHexMaxU64(true, 0));
-
-    ex.Reset("1203");
-    EXPECT_EQ(0x312, ex.GetHexMaxU64(true, 0));
-
-    ex.Reset("1234");
-    EXPECT_EQ(0x3412, ex.GetHexMaxU64(true, 0));
-
-    ex.Reset("12340");
-    EXPECT_EQ(0x3412, ex.GetHexMaxU64(true, 0));
-
-    ex.Reset("123400");
-    EXPECT_EQ(0x3412, ex.GetHexMaxU64(true, 0));
-
-    ex.Reset("123456789ABCDEF0");
-    EXPECT_EQ(0xF0DEBC9A78563412ULL, ex.GetHexMaxU64(true, 0));
-
-    ex.Reset("123456789ABCDEF01");
-    EXPECT_EQ(0, ex.GetHexMaxU64(true, 0));
-}
-
-TEST_F(StringExtractorTest, GetU64BigEndian)
-{
-    StringExtractor ex("");
-    EXPECT_EQ(0x0, ex.GetHexMaxU64(false, 0));
-
-    ex.Reset("0");
-    EXPECT_EQ(0x0, ex.GetHexMaxU64(false, 1));
-
-    ex.Reset("1");
-    EXPECT_EQ(0x1, ex.GetHexMaxU64(false, 0));
-
-    ex.Reset("01");
-    EXPECT_EQ(0x1, ex.GetHexMaxU64(false, 0));
-
-    ex.Reset("001");
-    EXPECT_EQ(0x1, ex.GetHexMaxU64(false, 0));
-
-    ex.Reset("12");
-    EXPECT_EQ(0x12, ex.GetHexMaxU64(false, 0));
-
-    ex.Reset("123");
-    EXPECT_EQ(0x123, ex.GetHexMaxU64(false, 0));
-
-    ex.Reset("1203");
-    EXPECT_EQ(0x1203, ex.GetHexMaxU64(false, 0));
-
-    ex.Reset("1234");
-    EXPECT_EQ(0x1234, ex.GetHexMaxU64(false, 0));
-
-    ex.Reset("12340");
-    EXPECT_EQ(0x12340, ex.GetHexMaxU64(false, 0));
+namespace {
+class StringExtractorTest : public ::testing::Test {};
+}
+
+TEST_F(StringExtractorTest, InitEmpty) {
+  const char kEmptyString[] = "";
+  StringExtractor ex(kEmptyString);
+
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(0u, ex.GetFilePos());
+  ASSERT_STREQ(kEmptyString, ex.GetStringRef().c_str());
+  ASSERT_EQ(true, ex.Empty());
+  ASSERT_EQ(0u, ex.GetBytesLeft());
+  ASSERT_EQ(nullptr, ex.Peek());
+}
+
+TEST_F(StringExtractorTest, InitMisc) {
+  const char kInitMiscString[] = "Hello, StringExtractor!";
+  StringExtractor ex(kInitMiscString);
+
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(0u, ex.GetFilePos());
+  ASSERT_STREQ(kInitMiscString, ex.GetStringRef().c_str());
+  ASSERT_EQ(false, ex.Empty());
+  ASSERT_EQ(sizeof(kInitMiscString) - 1, ex.GetBytesLeft());
+  ASSERT_EQ(kInitMiscString[0], *ex.Peek());
+}
+
+TEST_F(StringExtractorTest, DecodeHexU8_Underflow) {
+  const char kEmptyString[] = "";
+  StringExtractor ex(kEmptyString);
+
+  ASSERT_EQ(-1, ex.DecodeHexU8());
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(0u, ex.GetFilePos());
+  ASSERT_EQ(true, ex.Empty());
+  ASSERT_EQ(0u, ex.GetBytesLeft());
+  ASSERT_EQ(nullptr, ex.Peek());
+}
+
+TEST_F(StringExtractorTest, DecodeHexU8_Underflow2) {
+  const char kEmptyString[] = "1";
+  StringExtractor ex(kEmptyString);
+
+  ASSERT_EQ(-1, ex.DecodeHexU8());
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(0u, ex.GetFilePos());
+  ASSERT_EQ(1u, ex.GetBytesLeft());
+  ASSERT_EQ('1', *ex.Peek());
+}
+
+TEST_F(StringExtractorTest, DecodeHexU8_InvalidHex) {
+  const char kInvalidHex[] = "xa";
+  StringExtractor ex(kInvalidHex);
+
+  ASSERT_EQ(-1, ex.DecodeHexU8());
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(0u, ex.GetFilePos());
+  ASSERT_EQ(2u, ex.GetBytesLeft());
+  ASSERT_EQ('x', *ex.Peek());
+}
+
+TEST_F(StringExtractorTest, DecodeHexU8_InvalidHex2) {
+  const char kInvalidHex[] = "ax";
+  StringExtractor ex(kInvalidHex);
+
+  ASSERT_EQ(-1, ex.DecodeHexU8());
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(0u, ex.GetFilePos());
+  ASSERT_EQ(2u, ex.GetBytesLeft());
+  ASSERT_EQ('a', *ex.Peek());
+}
+
+TEST_F(StringExtractorTest, DecodeHexU8_Exact) {
+  const char kValidHexPair[] = "12";
+  StringExtractor ex(kValidHexPair);
+
+  ASSERT_EQ(0x12, ex.DecodeHexU8());
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(2u, ex.GetFilePos());
+  ASSERT_EQ(0u, ex.GetBytesLeft());
+  ASSERT_EQ(nullptr, ex.Peek());
+}
+
+TEST_F(StringExtractorTest, DecodeHexU8_Extra) {
+  const char kValidHexPair[] = "1234";
+  StringExtractor ex(kValidHexPair);
+
+  ASSERT_EQ(0x12, ex.DecodeHexU8());
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(2u, ex.GetFilePos());
+  ASSERT_EQ(2u, ex.GetBytesLeft());
+  ASSERT_EQ('3', *ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexU8_Underflow) {
+  const char kEmptyString[] = "";
+  StringExtractor ex(kEmptyString);
+
+  ASSERT_EQ(0xab, ex.GetHexU8(0xab));
+  ASSERT_EQ(false, ex.IsGood());
+  ASSERT_EQ(UINT64_MAX, ex.GetFilePos());
+  ASSERT_EQ(true, ex.Empty());
+  ASSERT_EQ(0u, ex.GetBytesLeft());
+  ASSERT_EQ(nullptr, ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexU8_Underflow2) {
+  const char kOneNibble[] = "1";
+  StringExtractor ex(kOneNibble);
+
+  ASSERT_EQ(0xbc, ex.GetHexU8(0xbc));
+  ASSERT_EQ(false, ex.IsGood());
+  ASSERT_EQ(UINT64_MAX, ex.GetFilePos());
+  ASSERT_EQ(0u, ex.GetBytesLeft());
+  ASSERT_EQ(nullptr, ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexU8_InvalidHex) {
+  const char kInvalidHex[] = "xx";
+  StringExtractor ex(kInvalidHex);
+
+  ASSERT_EQ(0xcd, ex.GetHexU8(0xcd));
+  ASSERT_EQ(false, ex.IsGood());
+  ASSERT_EQ(UINT64_MAX, ex.GetFilePos());
+  ASSERT_EQ(0u, ex.GetBytesLeft());
+  ASSERT_EQ(nullptr, ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexU8_Exact) {
+  const char kValidHexPair[] = "12";
+  StringExtractor ex(kValidHexPair);
+
+  ASSERT_EQ(0x12, ex.GetHexU8(0x12));
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(2u, ex.GetFilePos());
+  ASSERT_EQ(0u, ex.GetBytesLeft());
+  ASSERT_EQ(nullptr, ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexU8_Extra) {
+  const char kValidHexPair[] = "1234";
+  StringExtractor ex(kValidHexPair);
+
+  ASSERT_EQ(0x12, ex.GetHexU8(0x12));
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(2u, ex.GetFilePos());
+  ASSERT_EQ(2u, ex.GetBytesLeft());
+  ASSERT_EQ('3', *ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexU8_Underflow_NoEof) {
+  const char kEmptyString[] = "";
+  StringExtractor ex(kEmptyString);
+  const bool kSetEofOnFail = false;
+
+  ASSERT_EQ(0xab, ex.GetHexU8(0xab, kSetEofOnFail));
+  ASSERT_EQ(false, ex.IsGood()); // this result seems inconsistent with
+                                 // kSetEofOnFail == false
+  ASSERT_EQ(UINT64_MAX, ex.GetFilePos());
+  ASSERT_EQ(true, ex.Empty());
+  ASSERT_EQ(0u, ex.GetBytesLeft());
+  ASSERT_EQ(nullptr, ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexU8_Underflow2_NoEof) {
+  const char kOneNibble[] = "1";
+  StringExtractor ex(kOneNibble);
+  const bool kSetEofOnFail = false;
+
+  ASSERT_EQ(0xbc, ex.GetHexU8(0xbc, kSetEofOnFail));
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(0u, ex.GetFilePos());
+  ASSERT_EQ(1u, ex.GetBytesLeft());
+  ASSERT_EQ('1', *ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexU8_InvalidHex_NoEof) {
+  const char kInvalidHex[] = "xx";
+  StringExtractor ex(kInvalidHex);
+  const bool kSetEofOnFail = false;
+
+  ASSERT_EQ(0xcd, ex.GetHexU8(0xcd, kSetEofOnFail));
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(0u, ex.GetFilePos());
+  ASSERT_EQ(2u, ex.GetBytesLeft());
+  ASSERT_EQ('x', *ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexU8_Exact_NoEof) {
+  const char kValidHexPair[] = "12";
+  StringExtractor ex(kValidHexPair);
+  const bool kSetEofOnFail = false;
+
+  ASSERT_EQ(0x12, ex.GetHexU8(0x12, kSetEofOnFail));
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(2u, ex.GetFilePos());
+  ASSERT_EQ(0u, ex.GetBytesLeft());
+  ASSERT_EQ(nullptr, ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexU8_Extra_NoEof) {
+  const char kValidHexPair[] = "1234";
+  StringExtractor ex(kValidHexPair);
+  const bool kSetEofOnFail = false;
+
+  ASSERT_EQ(0x12, ex.GetHexU8(0x12, kSetEofOnFail));
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(2u, ex.GetFilePos());
+  ASSERT_EQ(2u, ex.GetBytesLeft());
+  ASSERT_EQ('3', *ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexBytes) {
+  const char kHexEncodedBytes[] = "abcdef0123456789xyzw";
+  const size_t kValidHexPairs = 8;
+  StringExtractor ex(kHexEncodedBytes);
+
+  uint8_t dst[kValidHexPairs];
+  ASSERT_EQ(kValidHexPairs, ex.GetHexBytes(dst, 0xde));
+  EXPECT_EQ(0xab, dst[0]);
+  EXPECT_EQ(0xcd, dst[1]);
+  EXPECT_EQ(0xef, dst[2]);
+  EXPECT_EQ(0x01, dst[3]);
+  EXPECT_EQ(0x23, dst[4]);
+  EXPECT_EQ(0x45, dst[5]);
+  EXPECT_EQ(0x67, dst[6]);
+  EXPECT_EQ(0x89, dst[7]);
+
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(2 * kValidHexPairs, ex.GetFilePos());
+  ASSERT_EQ(false, ex.Empty());
+  ASSERT_EQ(4u, ex.GetBytesLeft());
+  ASSERT_EQ('x', *ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexBytes_FullString) {
+  const char kHexEncodedBytes[] = "abcdef0123456789";
+  const size_t kValidHexPairs = 8;
+  StringExtractor ex(kHexEncodedBytes);
+
+  uint8_t dst[kValidHexPairs];
+  ASSERT_EQ(kValidHexPairs, ex.GetHexBytes(dst, 0xde));
+  EXPECT_EQ(0xab, dst[0]);
+  EXPECT_EQ(0xcd, dst[1]);
+  EXPECT_EQ(0xef, dst[2]);
+  EXPECT_EQ(0x01, dst[3]);
+  EXPECT_EQ(0x23, dst[4]);
+  EXPECT_EQ(0x45, dst[5]);
+  EXPECT_EQ(0x67, dst[6]);
+  EXPECT_EQ(0x89, dst[7]);
+}
+
+TEST_F(StringExtractorTest, GetHexBytes_OddPair) {
+  const char kHexEncodedBytes[] = "abcdef012345678w";
+  const size_t kValidHexPairs = 7;
+  StringExtractor ex(kHexEncodedBytes);
+
+  uint8_t dst[8];
+  ASSERT_EQ(kValidHexPairs, ex.GetHexBytes(dst, 0xde));
+  EXPECT_EQ(0xab, dst[0]);
+  EXPECT_EQ(0xcd, dst[1]);
+  EXPECT_EQ(0xef, dst[2]);
+  EXPECT_EQ(0x01, dst[3]);
+  EXPECT_EQ(0x23, dst[4]);
+  EXPECT_EQ(0x45, dst[5]);
+  EXPECT_EQ(0x67, dst[6]);
+
+  // This one should be invalid
+  EXPECT_EQ(0xde, dst[7]);
+}
+
+TEST_F(StringExtractorTest, GetHexBytes_OddPair2) {
+  const char kHexEncodedBytes[] = "abcdef012345678";
+  const size_t kValidHexPairs = 7;
+  StringExtractor ex(kHexEncodedBytes);
+
+  uint8_t dst[8];
+  ASSERT_EQ(kValidHexPairs, ex.GetHexBytes(dst, 0xde));
+  EXPECT_EQ(0xab, dst[0]);
+  EXPECT_EQ(0xcd, dst[1]);
+  EXPECT_EQ(0xef, dst[2]);
+  EXPECT_EQ(0x01, dst[3]);
+  EXPECT_EQ(0x23, dst[4]);
+  EXPECT_EQ(0x45, dst[5]);
+  EXPECT_EQ(0x67, dst[6]);
+
+  EXPECT_EQ(0xde, dst[7]);
+}
+
+TEST_F(StringExtractorTest, GetHexBytes_Underflow) {
+  const char kHexEncodedBytes[] = "abcdef0123456789xyzw";
+  const size_t kValidHexPairs = 8;
+  StringExtractor ex(kHexEncodedBytes);
+
+  uint8_t dst[12];
+  ASSERT_EQ(kValidHexPairs, ex.GetHexBytes(dst, 0xde));
+  EXPECT_EQ(0xab, dst[0]);
+  EXPECT_EQ(0xcd, dst[1]);
+  EXPECT_EQ(0xef, dst[2]);
+  EXPECT_EQ(0x01, dst[3]);
+  EXPECT_EQ(0x23, dst[4]);
+  EXPECT_EQ(0x45, dst[5]);
+  EXPECT_EQ(0x67, dst[6]);
+  EXPECT_EQ(0x89, dst[7]);
+  // these bytes should be filled with fail_fill_value 0xde
+  EXPECT_EQ(0xde, dst[8]);
+  EXPECT_EQ(0xde, dst[9]);
+  EXPECT_EQ(0xde, dst[10]);
+  EXPECT_EQ(0xde, dst[11]);
+
+  ASSERT_EQ(false, ex.IsGood());
+  ASSERT_EQ(UINT64_MAX, ex.GetFilePos());
+  ASSERT_EQ(false, ex.Empty());
+  ASSERT_EQ(0u, ex.GetBytesLeft());
+  ASSERT_EQ(0, ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexBytes_Partial) {
+  const char kHexEncodedBytes[] = "abcdef0123456789xyzw";
+  const size_t kReadBytes = 4;
+  StringExtractor ex(kHexEncodedBytes);
+
+  uint8_t dst[12];
+  memset(dst, 0xab, sizeof(dst));
+  ASSERT_EQ(
+      kReadBytes,
+      ex.GetHexBytes(llvm::MutableArrayRef<uint8_t>(dst, kReadBytes), 0xde));
+  EXPECT_EQ(0xab, dst[0]);
+  EXPECT_EQ(0xcd, dst[1]);
+  EXPECT_EQ(0xef, dst[2]);
+  EXPECT_EQ(0x01, dst[3]);
+  // these bytes should be unchanged
+  EXPECT_EQ(0xab, dst[4]);
+  EXPECT_EQ(0xab, dst[5]);
+  EXPECT_EQ(0xab, dst[6]);
+  EXPECT_EQ(0xab, dst[7]);
+  EXPECT_EQ(0xab, dst[8]);
+  EXPECT_EQ(0xab, dst[9]);
+  EXPECT_EQ(0xab, dst[10]);
+  EXPECT_EQ(0xab, dst[11]);
+
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(kReadBytes * 2, ex.GetFilePos());
+  ASSERT_EQ(false, ex.Empty());
+  ASSERT_EQ(12u, ex.GetBytesLeft());
+  ASSERT_EQ('2', *ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexBytesAvail) {
+  const char kHexEncodedBytes[] = "abcdef0123456789xyzw";
+  const size_t kValidHexPairs = 8;
+  StringExtractor ex(kHexEncodedBytes);
+
+  uint8_t dst[kValidHexPairs];
+  ASSERT_EQ(kValidHexPairs, ex.GetHexBytesAvail(dst));
+  EXPECT_EQ(0xab, dst[0]);
+  EXPECT_EQ(0xcd, dst[1]);
+  EXPECT_EQ(0xef, dst[2]);
+  EXPECT_EQ(0x01, dst[3]);
+  EXPECT_EQ(0x23, dst[4]);
+  EXPECT_EQ(0x45, dst[5]);
+  EXPECT_EQ(0x67, dst[6]);
+  EXPECT_EQ(0x89, dst[7]);
+
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(2 * kValidHexPairs, ex.GetFilePos());
+  ASSERT_EQ(false, ex.Empty());
+  ASSERT_EQ(4u, ex.GetBytesLeft());
+  ASSERT_EQ('x', *ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexBytesAvail_FullString) {
+  const char kHexEncodedBytes[] = "abcdef0123456789";
+  const size_t kValidHexPairs = 8;
+  StringExtractor ex(kHexEncodedBytes);
+
+  uint8_t dst[kValidHexPairs];
+  ASSERT_EQ(kValidHexPairs, ex.GetHexBytesAvail(dst));
+  EXPECT_EQ(0xab, dst[0]);
+  EXPECT_EQ(0xcd, dst[1]);
+  EXPECT_EQ(0xef, dst[2]);
+  EXPECT_EQ(0x01, dst[3]);
+  EXPECT_EQ(0x23, dst[4]);
+  EXPECT_EQ(0x45, dst[5]);
+  EXPECT_EQ(0x67, dst[6]);
+  EXPECT_EQ(0x89, dst[7]);
+}
+
+TEST_F(StringExtractorTest, GetHexBytesAvail_OddPair) {
+  const char kHexEncodedBytes[] = "abcdef012345678w";
+  const size_t kValidHexPairs = 7;
+  StringExtractor ex(kHexEncodedBytes);
+
+  uint8_t dst[8];
+  ASSERT_EQ(kValidHexPairs, ex.GetHexBytesAvail(dst));
+  EXPECT_EQ(0xab, dst[0]);
+  EXPECT_EQ(0xcd, dst[1]);
+  EXPECT_EQ(0xef, dst[2]);
+  EXPECT_EQ(0x01, dst[3]);
+  EXPECT_EQ(0x23, dst[4]);
+  EXPECT_EQ(0x45, dst[5]);
+  EXPECT_EQ(0x67, dst[6]);
+}
+
+TEST_F(StringExtractorTest, GetHexBytesAvail_OddPair2) {
+  const char kHexEncodedBytes[] = "abcdef012345678";
+  const size_t kValidHexPairs = 7;
+  StringExtractor ex(kHexEncodedBytes);
+
+  uint8_t dst[8];
+  ASSERT_EQ(kValidHexPairs, ex.GetHexBytesAvail(dst));
+  EXPECT_EQ(0xab, dst[0]);
+  EXPECT_EQ(0xcd, dst[1]);
+  EXPECT_EQ(0xef, dst[2]);
+  EXPECT_EQ(0x01, dst[3]);
+  EXPECT_EQ(0x23, dst[4]);
+  EXPECT_EQ(0x45, dst[5]);
+  EXPECT_EQ(0x67, dst[6]);
+}
+
+TEST_F(StringExtractorTest, GetHexBytesAvail_Underflow) {
+  const char kHexEncodedBytes[] = "abcdef0123456789xyzw";
+  const size_t kValidHexPairs = 8;
+  StringExtractor ex(kHexEncodedBytes);
+
+  uint8_t dst[12];
+  memset(dst, 0xef, sizeof(dst));
+  ASSERT_EQ(kValidHexPairs, ex.GetHexBytesAvail(dst));
+  EXPECT_EQ(0xab, dst[0]);
+  EXPECT_EQ(0xcd, dst[1]);
+  EXPECT_EQ(0xef, dst[2]);
+  EXPECT_EQ(0x01, dst[3]);
+  EXPECT_EQ(0x23, dst[4]);
+  EXPECT_EQ(0x45, dst[5]);
+  EXPECT_EQ(0x67, dst[6]);
+  EXPECT_EQ(0x89, dst[7]);
+  // these bytes should be unchanged
+  EXPECT_EQ(0xef, dst[8]);
+  EXPECT_EQ(0xef, dst[9]);
+  EXPECT_EQ(0xef, dst[10]);
+  EXPECT_EQ(0xef, dst[11]);
+
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(kValidHexPairs * 2, ex.GetFilePos());
+  ASSERT_EQ(false, ex.Empty());
+  ASSERT_EQ(4u, ex.GetBytesLeft());
+  ASSERT_EQ('x', *ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetHexBytesAvail_Partial) {
+  const char kHexEncodedBytes[] = "abcdef0123456789xyzw";
+  const size_t kReadBytes = 4;
+  StringExtractor ex(kHexEncodedBytes);
+
+  uint8_t dst[12];
+  memset(dst, 0xab, sizeof(dst));
+  ASSERT_EQ(kReadBytes, ex.GetHexBytesAvail(
+                            llvm::MutableArrayRef<uint8_t>(dst, kReadBytes)));
+  EXPECT_EQ(0xab, dst[0]);
+  EXPECT_EQ(0xcd, dst[1]);
+  EXPECT_EQ(0xef, dst[2]);
+  EXPECT_EQ(0x01, dst[3]);
+  // these bytes should be unchanged
+  EXPECT_EQ(0xab, dst[4]);
+  EXPECT_EQ(0xab, dst[5]);
+  EXPECT_EQ(0xab, dst[6]);
+  EXPECT_EQ(0xab, dst[7]);
+  EXPECT_EQ(0xab, dst[8]);
+  EXPECT_EQ(0xab, dst[9]);
+  EXPECT_EQ(0xab, dst[10]);
+  EXPECT_EQ(0xab, dst[11]);
+
+  ASSERT_EQ(true, ex.IsGood());
+  ASSERT_EQ(kReadBytes * 2, ex.GetFilePos());
+  ASSERT_EQ(false, ex.Empty());
+  ASSERT_EQ(12u, ex.GetBytesLeft());
+  ASSERT_EQ('2', *ex.Peek());
+}
+
+TEST_F(StringExtractorTest, GetNameColonValueSuccess) {
+  const char kNameColonPairs[] = "key1:value1;key2:value2;";
+  StringExtractor ex(kNameColonPairs);
+
+  llvm::StringRef name;
+  llvm::StringRef value;
+  EXPECT_TRUE(ex.GetNameColonValue(name, value));
+  EXPECT_EQ("key1", name);
+  EXPECT_EQ("value1", value);
+  EXPECT_TRUE(ex.GetNameColonValue(name, value));
+  EXPECT_EQ("key2", name);
+  EXPECT_EQ("value2", value);
+  EXPECT_EQ(0, ex.GetBytesLeft());
+}
+
+TEST_F(StringExtractorTest, GetNameColonValueContainsColon) {
+  const char kNameColonPairs[] = "key1:value1:value2;key2:value3;";
+  StringExtractor ex(kNameColonPairs);
+
+  llvm::StringRef name;
+  llvm::StringRef value;
+  EXPECT_TRUE(ex.GetNameColonValue(name, value));
+  EXPECT_EQ("key1", name);
+  EXPECT_EQ("value1:value2", value);
+  EXPECT_TRUE(ex.GetNameColonValue(name, value));
+  EXPECT_EQ("key2", name);
+  EXPECT_EQ("value3", value);
+  EXPECT_EQ(0, ex.GetBytesLeft());
+}
+
+TEST_F(StringExtractorTest, GetNameColonValueNoSemicolon) {
+  const char kNameColonPairs[] = "key1:value1";
+  StringExtractor ex(kNameColonPairs);
+
+  llvm::StringRef name;
+  llvm::StringRef value;
+  EXPECT_FALSE(ex.GetNameColonValue(name, value));
+  EXPECT_EQ(0, ex.GetBytesLeft());
+}
+
+TEST_F(StringExtractorTest, GetNameColonValueNoColon) {
+  const char kNameColonPairs[] = "key1value1;";
+  StringExtractor ex(kNameColonPairs);
+
+  llvm::StringRef name;
+  llvm::StringRef value;
+  EXPECT_FALSE(ex.GetNameColonValue(name, value));
+  EXPECT_EQ(0, ex.GetBytesLeft());
+}
+
+TEST_F(StringExtractorTest, GetU32LittleEndian) {
+  StringExtractor ex("");
+  EXPECT_EQ(0x0, ex.GetHexMaxU32(true, 0));
+
+  ex.Reset("0");
+  EXPECT_EQ(0x0, ex.GetHexMaxU32(true, 1));
+
+  ex.Reset("1");
+  EXPECT_EQ(0x1, ex.GetHexMaxU32(true, 0));
+
+  ex.Reset("01");
+  EXPECT_EQ(0x1, ex.GetHexMaxU32(true, 0));
+
+  ex.Reset("001");
+  EXPECT_EQ(0x100, ex.GetHexMaxU32(true, 0));
+
+  ex.Reset("12");
+  EXPECT_EQ(0x12, ex.GetHexMaxU32(true, 0));
+
+  ex.Reset("123");
+  EXPECT_EQ(0x312, ex.GetHexMaxU32(true, 0));
+
+  ex.Reset("1203");
+  EXPECT_EQ(0x312, ex.GetHexMaxU32(true, 0));
+
+  ex.Reset("1234");
+  EXPECT_EQ(0x3412, ex.GetHexMaxU32(true, 0));
+
+  ex.Reset("12340");
+  EXPECT_EQ(0x3412, ex.GetHexMaxU32(true, 0));
+
+  ex.Reset("123400");
+  EXPECT_EQ(0x3412, ex.GetHexMaxU32(true, 0));
+
+  ex.Reset("12345670");
+  EXPECT_EQ(0x70563412, ex.GetHexMaxU32(true, 0));
+
+  ex.Reset("123456701");
+  EXPECT_EQ(0, ex.GetHexMaxU32(true, 0));
+}
+
+TEST_F(StringExtractorTest, GetU32BigEndian) {
+  StringExtractor ex("");
+  EXPECT_EQ(0x0, ex.GetHexMaxU32(false, 0));
+
+  ex.Reset("0");
+  EXPECT_EQ(0x0, ex.GetHexMaxU32(false, 1));
+
+  ex.Reset("1");
+  EXPECT_EQ(0x1, ex.GetHexMaxU32(false, 0));
+
+  ex.Reset("01");
+  EXPECT_EQ(0x1, ex.GetHexMaxU32(false, 0));
+
+  ex.Reset("001");
+  EXPECT_EQ(0x1, ex.GetHexMaxU32(false, 0));
+
+  ex.Reset("12");
+  EXPECT_EQ(0x12, ex.GetHexMaxU32(false, 0));
+
+  ex.Reset("123");
+  EXPECT_EQ(0x123, ex.GetHexMaxU32(false, 0));
+
+  ex.Reset("1203");
+  EXPECT_EQ(0x1203, ex.GetHexMaxU32(false, 0));
+
+  ex.Reset("1234");
+  EXPECT_EQ(0x1234, ex.GetHexMaxU32(false, 0));
+
+  ex.Reset("12340");
+  EXPECT_EQ(0x12340, ex.GetHexMaxU32(false, 0));
+
+  ex.Reset("123400");
+  EXPECT_EQ(0x123400, ex.GetHexMaxU32(false, 0));
+
+  ex.Reset("12345670");
+  EXPECT_EQ(0x12345670, ex.GetHexMaxU32(false, 0));
+
+  ex.Reset("123456700");
+  EXPECT_EQ(0, ex.GetHexMaxU32(false, 0));
+}
+
+TEST_F(StringExtractorTest, GetU64LittleEndian) {
+  StringExtractor ex("");
+  EXPECT_EQ(0x0, ex.GetHexMaxU64(true, 0));
+
+  ex.Reset("0");
+  EXPECT_EQ(0x0, ex.GetHexMaxU64(true, 1));
+
+  ex.Reset("1");
+  EXPECT_EQ(0x1, ex.GetHexMaxU64(true, 0));
+
+  ex.Reset("01");
+  EXPECT_EQ(0x1, ex.GetHexMaxU64(true, 0));
+
+  ex.Reset("001");
+  EXPECT_EQ(0x100, ex.GetHexMaxU64(true, 0));
+
+  ex.Reset("12");
+  EXPECT_EQ(0x12, ex.GetHexMaxU64(true, 0));
+
+  ex.Reset("123");
+  EXPECT_EQ(0x312, ex.GetHexMaxU64(true, 0));
+
+  ex.Reset("1203");
+  EXPECT_EQ(0x312, ex.GetHexMaxU64(true, 0));
+
+  ex.Reset("1234");
+  EXPECT_EQ(0x3412, ex.GetHexMaxU64(true, 0));
+
+  ex.Reset("12340");
+  EXPECT_EQ(0x3412, ex.GetHexMaxU64(true, 0));
+
+  ex.Reset("123400");
+  EXPECT_EQ(0x3412, ex.GetHexMaxU64(true, 0));
+
+  ex.Reset("123456789ABCDEF0");
+  EXPECT_EQ(0xF0DEBC9A78563412ULL, ex.GetHexMaxU64(true, 0));
+
+  ex.Reset("123456789ABCDEF01");
+  EXPECT_EQ(0, ex.GetHexMaxU64(true, 0));
+}
+
+TEST_F(StringExtractorTest, GetU64BigEndian) {
+  StringExtractor ex("");
+  EXPECT_EQ(0x0, ex.GetHexMaxU64(false, 0));
+
+  ex.Reset("0");
+  EXPECT_EQ(0x0, ex.GetHexMaxU64(false, 1));
+
+  ex.Reset("1");
+  EXPECT_EQ(0x1, ex.GetHexMaxU64(false, 0));
+
+  ex.Reset("01");
+  EXPECT_EQ(0x1, ex.GetHexMaxU64(false, 0));
+
+  ex.Reset("001");
+  EXPECT_EQ(0x1, ex.GetHexMaxU64(false, 0));
+
+  ex.Reset("12");
+  EXPECT_EQ(0x12, ex.GetHexMaxU64(false, 0));
+
+  ex.Reset("123");
+  EXPECT_EQ(0x123, ex.GetHexMaxU64(false, 0));
+
+  ex.Reset("1203");
+  EXPECT_EQ(0x1203, ex.GetHexMaxU64(false, 0));
+
+  ex.Reset("1234");
+  EXPECT_EQ(0x1234, ex.GetHexMaxU64(false, 0));
+
+  ex.Reset("12340");
+  EXPECT_EQ(0x12340, ex.GetHexMaxU64(false, 0));
 
-    ex.Reset("123400");
-    EXPECT_EQ(0x123400, ex.GetHexMaxU64(false, 0));
+  ex.Reset("123400");
+  EXPECT_EQ(0x123400, ex.GetHexMaxU64(false, 0));
 
-    ex.Reset("123456789ABCDEF0");
-    EXPECT_EQ(0x123456789ABCDEF0ULL, ex.GetHexMaxU64(false, 0));
+  ex.Reset("123456789ABCDEF0");
+  EXPECT_EQ(0x123456789ABCDEF0ULL, ex.GetHexMaxU64(false, 0));
 
-    ex.Reset("123456789ABCDEF000");
-    EXPECT_EQ(0, ex.GetHexMaxU64(false, 0));
+  ex.Reset("123456789ABCDEF000");
+  EXPECT_EQ(0, ex.GetHexMaxU64(false, 0));
 }

Modified: lldb/trunk/unittests/Utility/TaskPoolTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/TaskPoolTest.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/TaskPoolTest.cpp (original)
+++ lldb/trunk/unittests/Utility/TaskPoolTest.cpp Tue Sep  6 15:57:50 2016
@@ -2,61 +2,53 @@
 
 #include "lldb/Utility/TaskPool.h"
 
-TEST (TaskPoolTest, AddTask)
-{
-    auto fn = [](int x) { return x * x + 1; };
-
-    auto f1 = TaskPool::AddTask(fn, 1);
-    auto f2 = TaskPool::AddTask(fn, 2);
-    auto f3 = TaskPool::AddTask(fn, 3);
-    auto f4 = TaskPool::AddTask(fn, 4);
-
-    ASSERT_EQ (10, f3.get());
-    ASSERT_EQ ( 2, f1.get());
-    ASSERT_EQ (17, f4.get());
-    ASSERT_EQ ( 5, f2.get());
+TEST(TaskPoolTest, AddTask) {
+  auto fn = [](int x) { return x * x + 1; };
+
+  auto f1 = TaskPool::AddTask(fn, 1);
+  auto f2 = TaskPool::AddTask(fn, 2);
+  auto f3 = TaskPool::AddTask(fn, 3);
+  auto f4 = TaskPool::AddTask(fn, 4);
+
+  ASSERT_EQ(10, f3.get());
+  ASSERT_EQ(2, f1.get());
+  ASSERT_EQ(17, f4.get());
+  ASSERT_EQ(5, f2.get());
 }
 
-TEST (TaskPoolTest, RunTasks)
-{
-    std::vector<int> r(4);
-
-    auto fn = [](int x, int& y) { y = x * x + 1; };
-    
-    TaskPool::RunTasks(
-        [fn, &r]() { fn(1, r[0]); },
-        [fn, &r]() { fn(2, r[1]); },
-        [fn, &r]() { fn(3, r[2]); },
-        [fn, &r]() { fn(4, r[3]); }
-    );
-
-    ASSERT_EQ ( 2, r[0]);
-    ASSERT_EQ ( 5, r[1]);
-    ASSERT_EQ (10, r[2]);
-    ASSERT_EQ (17, r[3]);
+TEST(TaskPoolTest, RunTasks) {
+  std::vector<int> r(4);
+
+  auto fn = [](int x, int &y) { y = x * x + 1; };
+
+  TaskPool::RunTasks([fn, &r]() { fn(1, r[0]); }, [fn, &r]() { fn(2, r[1]); },
+                     [fn, &r]() { fn(3, r[2]); }, [fn, &r]() { fn(4, r[3]); });
+
+  ASSERT_EQ(2, r[0]);
+  ASSERT_EQ(5, r[1]);
+  ASSERT_EQ(10, r[2]);
+  ASSERT_EQ(17, r[3]);
 }
 
-TEST (TaskPoolTest, TaskRunner)
-{
-    auto fn = [](int x) { return std::make_pair(x, x * x); };
-
-    TaskRunner<std::pair<int, int>> tr;
-    tr.AddTask(fn, 1);
-    tr.AddTask(fn, 2);
-    tr.AddTask(fn, 3);
-    tr.AddTask(fn, 4);
-
-    int count = 0;
-    while (true)
-    {
-        auto f = tr.WaitForNextCompletedTask();
-        if (!f.valid())
-            break;
-
-        ++count;
-        std::pair<int, int> v = f.get();
-        ASSERT_EQ (v.first * v.first, v.second);
-    }
+TEST(TaskPoolTest, TaskRunner) {
+  auto fn = [](int x) { return std::make_pair(x, x * x); };
+
+  TaskRunner<std::pair<int, int>> tr;
+  tr.AddTask(fn, 1);
+  tr.AddTask(fn, 2);
+  tr.AddTask(fn, 3);
+  tr.AddTask(fn, 4);
+
+  int count = 0;
+  while (true) {
+    auto f = tr.WaitForNextCompletedTask();
+    if (!f.valid())
+      break;
+
+    ++count;
+    std::pair<int, int> v = f.get();
+    ASSERT_EQ(v.first * v.first, v.second);
+  }
 
-    ASSERT_EQ(4, count);
+  ASSERT_EQ(4, count);
 }

Modified: lldb/trunk/unittests/Utility/UriParserTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/UriParserTest.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/UriParserTest.cpp (original)
+++ lldb/trunk/unittests/Utility/UriParserTest.cpp Tue Sep  6 15:57:50 2016
@@ -1,159 +1,135 @@
-#include "gtest/gtest.h"
 #include "Utility/UriParser.h"
+#include "gtest/gtest.h"
 
-namespace
-{
-    class UriParserTest: public ::testing::Test
-    {
-    };
+namespace {
+class UriParserTest : public ::testing::Test {};
 }
 
 // result strings (scheme/hostname/port/path) passed into UriParser::Parse
-// are initialized to kAsdf so we can verify that they are unmodified if the 
+// are initialized to kAsdf so we can verify that they are unmodified if the
 // URI is invalid
-static const char* kAsdf = "asdf";
+static const char *kAsdf = "asdf";
 
-class UriTestCase
-{
+class UriTestCase {
 public:
-    UriTestCase(const char* uri, const char* scheme, const char* hostname, int port, const char* path) :
-      m_uri(uri),
-      m_result(true),
-      m_scheme(scheme),
-      m_hostname(hostname),
-      m_port(port),
-      m_path(path)
-    {
-    }
-
-    UriTestCase(const char* uri) :
-      m_uri(uri),
-      m_result(false),
-      m_scheme(kAsdf),
-      m_hostname(kAsdf),
-      m_port(1138),
-      m_path(kAsdf)
-    {
-    }
-
-    const char* m_uri;
-    bool        m_result;
-    const char* m_scheme;
-    const char* m_hostname;
-    int         m_port;
-    const char* m_path;
+  UriTestCase(const char *uri, const char *scheme, const char *hostname,
+              int port, const char *path)
+      : m_uri(uri), m_result(true), m_scheme(scheme), m_hostname(hostname),
+        m_port(port), m_path(path) {}
+
+  UriTestCase(const char *uri)
+      : m_uri(uri), m_result(false), m_scheme(kAsdf), m_hostname(kAsdf),
+        m_port(1138), m_path(kAsdf) {}
+
+  const char *m_uri;
+  bool m_result;
+  const char *m_scheme;
+  const char *m_hostname;
+  int m_port;
+  const char *m_path;
 };
 
-#define VALIDATE \
-    std::string scheme(kAsdf); \
-    std::string hostname(kAsdf); \
-    int port(1138); \
-    std::string path(kAsdf); \
-    EXPECT_EQ (testCase.m_result, UriParser::Parse(testCase.m_uri, scheme, hostname, port, path)); \
-    EXPECT_STREQ (testCase.m_scheme, scheme.c_str()); \
-    EXPECT_STREQ (testCase.m_hostname, hostname.c_str()); \
-    EXPECT_EQ (testCase.m_port, port); \
-    EXPECT_STREQ (testCase.m_path, path.c_str());
+#define VALIDATE                                                               \
+  std::string scheme(kAsdf);                                                   \
+  std::string hostname(kAsdf);                                                 \
+  int port(1138);                                                              \
+  std::string path(kAsdf);                                                     \
+  EXPECT_EQ(testCase.m_result,                                                 \
+            UriParser::Parse(testCase.m_uri, scheme, hostname, port, path));   \
+  EXPECT_STREQ(testCase.m_scheme, scheme.c_str());                             \
+  EXPECT_STREQ(testCase.m_hostname, hostname.c_str());                         \
+  EXPECT_EQ(testCase.m_port, port);                                            \
+  EXPECT_STREQ(testCase.m_path, path.c_str());
 
-TEST_F (UriParserTest, Minimal)
-{
-    const UriTestCase testCase("x://y", "x", "y", -1, "/");
-    VALIDATE
+TEST_F(UriParserTest, Minimal) {
+  const UriTestCase testCase("x://y", "x", "y", -1, "/");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, MinimalPort)
-{
-    const UriTestCase testCase("x://y:1", "x", "y", 1, "/");
-    VALIDATE
+TEST_F(UriParserTest, MinimalPort) {
+  const UriTestCase testCase("x://y:1", "x", "y", 1, "/");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, MinimalPath)
-{
-    const UriTestCase testCase("x://y/", "x", "y", -1, "/");
-    VALIDATE
+TEST_F(UriParserTest, MinimalPath) {
+  const UriTestCase testCase("x://y/", "x", "y", -1, "/");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, MinimalPortPath)
-{
-    const UriTestCase testCase("x://y:1/", "x", "y", 1, "/");
-    VALIDATE
+TEST_F(UriParserTest, MinimalPortPath) {
+  const UriTestCase testCase("x://y:1/", "x", "y", 1, "/");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, LongPath)
-{
-    const UriTestCase testCase("x://y/abc/def/xyz", "x", "y", -1, "/abc/def/xyz");
-    VALIDATE
+TEST_F(UriParserTest, LongPath) {
+  const UriTestCase testCase("x://y/abc/def/xyz", "x", "y", -1, "/abc/def/xyz");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, TypicalPortPath)
-{
-    const UriTestCase testCase("connect://192.168.100.132:5432/", "connect", "192.168.100.132", 5432, "/");
-    VALIDATE
+TEST_F(UriParserTest, TypicalPortPath) {
+  const UriTestCase testCase("connect://192.168.100.132:5432/", "connect",
+                             "192.168.100.132", 5432, "/");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, BracketedHostnamePort)
-{
-    const UriTestCase testCase("connect://[192.168.100.132]:5432/", "connect", "192.168.100.132", 5432, "/");
-    VALIDATE
+TEST_F(UriParserTest, BracketedHostnamePort) {
+  const UriTestCase testCase("connect://[192.168.100.132]:5432/", "connect",
+                             "192.168.100.132", 5432, "/");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, BracketedHostname)
-{
-    const UriTestCase testCase("connect://[192.168.100.132]", "connect", "192.168.100.132", -1, "/");
-    VALIDATE
+TEST_F(UriParserTest, BracketedHostname) {
+  const UriTestCase testCase("connect://[192.168.100.132]", "connect",
+                             "192.168.100.132", -1, "/");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, BracketedHostnameWithColon)
-{
-    const UriTestCase testCase("connect://[192.168.100.132:5555]:1234", "connect", "192.168.100.132:5555", 1234, "/");
-    VALIDATE
+TEST_F(UriParserTest, BracketedHostnameWithColon) {
+  const UriTestCase testCase("connect://[192.168.100.132:5555]:1234", "connect",
+                             "192.168.100.132:5555", 1234, "/");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, SchemeHostSeparator)
-{
-    const UriTestCase testCase("x:/y");
-    VALIDATE
+TEST_F(UriParserTest, SchemeHostSeparator) {
+  const UriTestCase testCase("x:/y");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, SchemeHostSeparator2)
-{
-    const UriTestCase testCase("x:y");
-    VALIDATE
+TEST_F(UriParserTest, SchemeHostSeparator2) {
+  const UriTestCase testCase("x:y");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, SchemeHostSeparator3)
-{
-    const UriTestCase testCase("x//y");
-    VALIDATE
+TEST_F(UriParserTest, SchemeHostSeparator3) {
+  const UriTestCase testCase("x//y");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, SchemeHostSeparator4)
-{
-    const UriTestCase testCase("x/y");
-    VALIDATE
+TEST_F(UriParserTest, SchemeHostSeparator4) {
+  const UriTestCase testCase("x/y");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, BadPort)
-{
-    const UriTestCase testCase("x://y:a/");
-    VALIDATE
+TEST_F(UriParserTest, BadPort) {
+  const UriTestCase testCase("x://y:a/");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, BadPort2)
-{
-    const UriTestCase testCase("x://y:5432a/");
-    VALIDATE
+TEST_F(UriParserTest, BadPort2) {
+  const UriTestCase testCase("x://y:5432a/");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, Empty)
-{
-    const UriTestCase testCase("");
-    VALIDATE
+TEST_F(UriParserTest, Empty) {
+  const UriTestCase testCase("");
+  VALIDATE
 }
 
-TEST_F (UriParserTest, PortOverflow)
-{
-    const UriTestCase testCase("x://y:0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/");
-    VALIDATE
+TEST_F(UriParserTest, PortOverflow) {
+  const UriTestCase testCase("x://"
+                             "y:"
+                             "0123456789012345678901234567890123456789012345678"
+                             "9012345678901234567890123456789012345678901234567"
+                             "89/");
+  VALIDATE
 }
-

Modified: lldb/trunk/unittests/gtest_common.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/gtest_common.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/unittests/gtest_common.h (original)
+++ lldb/trunk/unittests/gtest_common.h Tue Sep  6 15:57:50 2016
@@ -17,8 +17,10 @@
 // units.  Be very leary about putting anything in this file.
 
 #if defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0)
-// Due to a bug in <thread>, when _HAS_EXCEPTIONS == 0 the header will try to call
-// uncaught_exception() without having a declaration for it.  The fix for this is
+// Due to a bug in <thread>, when _HAS_EXCEPTIONS == 0 the header will try to
+// call
+// uncaught_exception() without having a declaration for it.  The fix for this
+// is
 // to manually #include <eh.h>, which contains this declaration.
 #include <eh.h>
 #endif

Modified: lldb/trunk/use_lldb_suite_root.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/use_lldb_suite_root.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/use_lldb_suite_root.py (original)
+++ lldb/trunk/use_lldb_suite_root.py Tue Sep  6 15:57:50 2016
@@ -2,8 +2,10 @@ import inspect
 import os
 import sys
 
+
 def add_third_party_module_dirs(lldb_root):
-    third_party_modules_dir = os.path.join(lldb_root, "third_party", "Python", "module")
+    third_party_modules_dir = os.path.join(
+        lldb_root, "third_party", "Python", "module")
     if not os.path.isdir(third_party_modules_dir):
         return
 
@@ -12,6 +14,7 @@ def add_third_party_module_dirs(lldb_roo
         module_dir = os.path.join(third_party_modules_dir, module_dir)
         sys.path.insert(0, module_dir)
 
+
 def add_lldbsuite_packages_dir(lldb_root):
     packages_dir = os.path.join(lldb_root, "packages", "Python")
     sys.path.insert(0, packages_dir)

Modified: lldb/trunk/utils/git-svn/convert.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/git-svn/convert.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/git-svn/convert.py (original)
+++ lldb/trunk/utils/git-svn/convert.py Tue Sep  6 15:57:50 2016
@@ -11,15 +11,19 @@ Usage:
 4. git svn dcommit [--commit-url https://id@llvm.org/svn/llvm-project/lldb/trunk]
 """
 
-import os, re, sys
+import os
+import re
+import sys
 import StringIO
 
+
 def usage(problem_file=None):
     if problem_file:
         print "%s is not a file" % problem_file
     print "Usage: convert.py raw-message-source [raw-message-source2 ...]"
     sys.exit(0)
 
+
 def do_convert(file):
     """Skip all preceding mail message headers until 'From: ' is encountered.
     Then for each line ('From: ' header included), replace the dos style CRLF
@@ -38,7 +42,8 @@ def do_convert(file):
 
     # By default, splitlines() don't include line breaks.  CRLF should be gone.
     for line in content.splitlines():
-        # Wait till we scan the 'From: ' header before start printing the lines.
+        # Wait till we scan the 'From: ' header before start printing the
+        # lines.
         if not from_header_seen:
             if not line.startswith('From: '):
                 continue
@@ -52,6 +57,7 @@ def do_convert(file):
 
     print "done"
 
+
 def main():
     if len(sys.argv) == 1:
         usage()

Modified: lldb/trunk/utils/lui/breakwin.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lui/breakwin.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/lui/breakwin.py (original)
+++ lldb/trunk/utils/lui/breakwin.py Tue Sep  6 15:57:50 2016
@@ -1,90 +1,94 @@
 ##===-- breakwin.py ------------------------------------------*- Python -*-===##
 ##
-##                     The LLVM Compiler Infrastructure
+# The LLVM Compiler Infrastructure
 ##
-## This file is distributed under the University of Illinois Open Source
-## License. See LICENSE.TXT for details.
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
 ##
 ##===----------------------------------------------------------------------===##
 
 import cui
 import curses
-import lldb, lldbutil
+import lldb
+import lldbutil
 import re
 
+
 class BreakWin(cui.ListWin):
-  def __init__(self, driver, x, y, w, h):
-    super(BreakWin, self).__init__(x, y, w, h)
-    self.driver = driver
-    self.update()
-    self.showDetails = {}
-
-  def handleEvent(self, event):
-    if isinstance(event, lldb.SBEvent):
-      if lldb.SBBreakpoint.EventIsBreakpointEvent(event):
+
+    def __init__(self, driver, x, y, w, h):
+        super(BreakWin, self).__init__(x, y, w, h)
+        self.driver = driver
         self.update()
-    if isinstance(event, int):
-      if event == ord('d'):
-        self.deleteSelected()
-      if event == curses.ascii.NL or event == curses.ascii.SP:
-        self.toggleSelected()
-      elif event == curses.ascii.TAB:
-        if self.getSelected() != -1:
-          target = self.driver.getTarget()
-          if not target.IsValid():
+        self.showDetails = {}
+
+    def handleEvent(self, event):
+        if isinstance(event, lldb.SBEvent):
+            if lldb.SBBreakpoint.EventIsBreakpointEvent(event):
+                self.update()
+        if isinstance(event, int):
+            if event == ord('d'):
+                self.deleteSelected()
+            if event == curses.ascii.NL or event == curses.ascii.SP:
+                self.toggleSelected()
+            elif event == curses.ascii.TAB:
+                if self.getSelected() != -1:
+                    target = self.driver.getTarget()
+                    if not target.IsValid():
+                        return
+                    i = target.GetBreakpointAtIndex(self.getSelected()).id
+                    self.showDetails[i] = not self.showDetails[i]
+                    self.update()
+        super(BreakWin, self).handleEvent(event)
+
+    def toggleSelected(self):
+        if self.getSelected() == -1:
+            return
+        target = self.driver.getTarget()
+        if not target.IsValid():
+            return
+        bp = target.GetBreakpointAtIndex(self.getSelected())
+        bp.SetEnabled(not bp.IsEnabled())
+
+    def deleteSelected(self):
+        if self.getSelected() == -1:
+            return
+        target = self.driver.getTarget()
+        if not target.IsValid():
+            return
+        bp = target.GetBreakpointAtIndex(self.getSelected())
+        target.BreakpointDelete(bp.id)
+
+    def update(self):
+        target = self.driver.getTarget()
+        if not target.IsValid():
+            self.win.erase()
+            self.win.noutrefresh()
             return
-          i = target.GetBreakpointAtIndex(self.getSelected()).id
-          self.showDetails[i] = not self.showDetails[i]
-          self.update()
-    super(BreakWin, self).handleEvent(event)
-
-  def toggleSelected(self):
-    if self.getSelected() == -1:
-      return
-    target = self.driver.getTarget()
-    if not target.IsValid():
-      return
-    bp = target.GetBreakpointAtIndex(self.getSelected())
-    bp.SetEnabled(not bp.IsEnabled())
-
-  def deleteSelected(self):
-    if self.getSelected() == -1:
-      return
-    target = self.driver.getTarget()
-    if not target.IsValid():
-      return
-    bp = target.GetBreakpointAtIndex(self.getSelected())
-    target.BreakpointDelete(bp.id)
-
-  def update(self):
-    target = self.driver.getTarget()
-    if not target.IsValid():
-      self.win.erase()
-      self.win.noutrefresh()
-      return
-    selected = self.getSelected()
-    self.clearItems()
-    for i in range(0, target.GetNumBreakpoints()):
-      bp = target.GetBreakpointAtIndex(i)
-      if bp.IsInternal():
-        continue
-      text = lldbutil.get_description(bp)
-      # FIXME: Use an API for this, not parsing the description.
-      match = re.search('SBBreakpoint: id = ([^,]+), (.*)', text)
-      try:
-        id = match.group(1)
-        desc = match.group(2).strip()
-        if bp.IsEnabled():
-          text = '%s: %s' % (id, desc)
-        else:
-          text = '%s: (disabled) %s' % (id, desc)
-      except ValueError as e:
-        # bp unparsable
-        pass
-
-      if self.showDetails.setdefault(bp.id, False):
-        for location in bp:
-          desc = lldbutil.get_description(location, lldb.eDescriptionLevelFull)
-          text += '\n  ' + desc
-      self.addItem(text)
-    self.setSelected(selected)
+        selected = self.getSelected()
+        self.clearItems()
+        for i in range(0, target.GetNumBreakpoints()):
+            bp = target.GetBreakpointAtIndex(i)
+            if bp.IsInternal():
+                continue
+            text = lldbutil.get_description(bp)
+            # FIXME: Use an API for this, not parsing the description.
+            match = re.search('SBBreakpoint: id = ([^,]+), (.*)', text)
+            try:
+                id = match.group(1)
+                desc = match.group(2).strip()
+                if bp.IsEnabled():
+                    text = '%s: %s' % (id, desc)
+                else:
+                    text = '%s: (disabled) %s' % (id, desc)
+            except ValueError as e:
+                # bp unparsable
+                pass
+
+            if self.showDetails.setdefault(bp.id, False):
+                for location in bp:
+                    desc = lldbutil.get_description(
+                        location, lldb.eDescriptionLevelFull)
+                    text += '\n  ' + desc
+            self.addItem(text)
+        self.setSelected(selected)

Modified: lldb/trunk/utils/lui/commandwin.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lui/commandwin.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/lui/commandwin.py (original)
+++ lldb/trunk/utils/lui/commandwin.py Tue Sep  6 15:57:50 2016
@@ -1,9 +1,9 @@
 ##===-- commandwin.py ----------------------------------------*- Python -*-===##
 ##
-##                     The LLVM Compiler Infrastructure
+# The LLVM Compiler Infrastructure
 ##
-## This file is distributed under the University of Illinois Open Source
-## License. See LICENSE.TXT for details.
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
 ##
 ##===----------------------------------------------------------------------===##
 
@@ -12,110 +12,120 @@ import curses
 import lldb
 from itertools import islice
 
+
 class History(object):
-  def __init__(self):
-    self.data = {}
-    self.pos = 0
-    self.tempEntry = ''
-
-  def previous(self, curr):
-    if self.pos == len(self.data):
-      self.tempEntry = curr
-
-    if self.pos < 0:
-      return ''
-    if self.pos == 0:
-      self.pos -= 1
-      return ''
-    if self.pos > 0:
-      self.pos -= 1
-      return self.data[self.pos]
-
-  def next(self):
-    if self.pos < len(self.data):
-      self.pos += 1
-
-    if self.pos < len(self.data):
-      return self.data[self.pos]
-    elif self.tempEntry != '':
-      return self.tempEntry
-    else:
-      return ''
-
-  def add(self, c):
-    self.tempEntry = ''
-    self.pos = len(self.data)
-    if self.pos == 0 or self.data[self.pos-1] != c:
-      self.data[self.pos] = c
-      self.pos += 1
+
+    def __init__(self):
+        self.data = {}
+        self.pos = 0
+        self.tempEntry = ''
+
+    def previous(self, curr):
+        if self.pos == len(self.data):
+            self.tempEntry = curr
+
+        if self.pos < 0:
+            return ''
+        if self.pos == 0:
+            self.pos -= 1
+            return ''
+        if self.pos > 0:
+            self.pos -= 1
+            return self.data[self.pos]
+
+    def next(self):
+        if self.pos < len(self.data):
+            self.pos += 1
+
+        if self.pos < len(self.data):
+            return self.data[self.pos]
+        elif self.tempEntry != '':
+            return self.tempEntry
+        else:
+            return ''
+
+    def add(self, c):
+        self.tempEntry = ''
+        self.pos = len(self.data)
+        if self.pos == 0 or self.data[self.pos - 1] != c:
+            self.data[self.pos] = c
+            self.pos += 1
+
 
 class CommandWin(cui.TitledWin):
-  def __init__(self, driver, x, y, w, h):
-    super(CommandWin, self).__init__(x, y, w, h, "Commands")
-    self.command = ""
-    self.data = ""
-    driver.setSize(w, h)
-
-    self.win.scrollok(1)
-
-    self.driver = driver
-    self.history = History()
-
-    def enterCallback(content):
-      self.handleCommand(content)
-    def tabCompleteCallback(content):
-      self.data = content
-      matches = lldb.SBStringList()
-      commandinterpreter = self.getCommandInterpreter()
-      commandinterpreter.HandleCompletion(self.data, self.el.index, 0, -1, matches)
-      if matches.GetSize() == 2:
-        self.el.content += matches.GetStringAtIndex(0)
-        self.el.index = len(self.el.content)
-        self.el.draw()
-      else:
-        self.win.move(self.el.starty, self.el.startx)
-        self.win.scroll(1)
-        self.win.addstr("Available Completions:")
+
+    def __init__(self, driver, x, y, w, h):
+        super(CommandWin, self).__init__(x, y, w, h, "Commands")
+        self.command = ""
+        self.data = ""
+        driver.setSize(w, h)
+
+        self.win.scrollok(1)
+
+        self.driver = driver
+        self.history = History()
+
+        def enterCallback(content):
+            self.handleCommand(content)
+
+        def tabCompleteCallback(content):
+            self.data = content
+            matches = lldb.SBStringList()
+            commandinterpreter = self.getCommandInterpreter()
+            commandinterpreter.HandleCompletion(
+                self.data, self.el.index, 0, -1, matches)
+            if matches.GetSize() == 2:
+                self.el.content += matches.GetStringAtIndex(0)
+                self.el.index = len(self.el.content)
+                self.el.draw()
+            else:
+                self.win.move(self.el.starty, self.el.startx)
+                self.win.scroll(1)
+                self.win.addstr("Available Completions:")
+                self.win.scroll(1)
+                for m in islice(matches, 1, None):
+                    self.win.addstr(self.win.getyx()[0], 0, m)
+                    self.win.scroll(1)
+                self.el.draw()
+
+        self.startline = self.win.getmaxyx()[0] - 2
+
+        self.el = cui.CursesEditLine(
+            self.win,
+            self.history,
+            enterCallback,
+            tabCompleteCallback)
+        self.el.prompt = self.driver.getPrompt()
+        self.el.showPrompt(self.startline, 0)
+
+    def handleCommand(self, cmd):
+       # enter!
+        self.win.scroll(1)  # TODO: scroll more for longer commands
+        if cmd == '':
+            cmd = self.history.previous('')
+        elif cmd in ('q', 'quit'):
+            self.driver.terminate()
+            return
+
+        self.history.add(cmd)
+        ret = self.driver.handleCommand(cmd)
+        if ret.Succeeded():
+            out = ret.GetOutput()
+            attr = curses.A_NORMAL
+        else:
+            out = ret.GetError()
+            attr = curses.color_pair(3)  # red on black
+        self.win.addstr(self.startline, 0, out + '\n', attr)
         self.win.scroll(1)
-        for m in islice(matches, 1, None):
-          self.win.addstr(self.win.getyx()[0], 0, m)
-          self.win.scroll(1)
-        self.el.draw()
-
-    self.startline = self.win.getmaxyx()[0]-2
-
-    self.el = cui.CursesEditLine(self.win, self.history, enterCallback, tabCompleteCallback)
-    self.el.prompt = self.driver.getPrompt()
-    self.el.showPrompt(self.startline, 0)
-
-  def handleCommand(self, cmd):
-     # enter!
-    self.win.scroll(1) # TODO: scroll more for longer commands
-    if cmd == '':
-      cmd = self.history.previous('')
-    elif cmd in ('q', 'quit'):
-      self.driver.terminate()
-      return
-
-    self.history.add(cmd)
-    ret = self.driver.handleCommand(cmd)
-    if ret.Succeeded():
-      out = ret.GetOutput()
-      attr = curses.A_NORMAL
-    else:
-      out = ret.GetError()
-      attr = curses.color_pair(3) # red on black
-    self.win.addstr(self.startline, 0, out + '\n', attr)
-    self.win.scroll(1)
-    self.el.showPrompt(self.startline, 0)
-
-  def handleEvent(self, event):
-    if isinstance(event, int):
-      if event == curses.ascii.EOT and self.el.content == '':
-        # When the command is empty, treat CTRL-D as EOF.
-        self.driver.terminate()
-        return
-      self.el.handleEvent(event)
+        self.el.showPrompt(self.startline, 0)
+
+    def handleEvent(self, event):
+        if isinstance(event, int):
+            if event == curses.ascii.EOT and self.el.content == '':
+                # When the command is empty, treat CTRL-D as EOF.
+                self.driver.terminate()
+                return
+            self.el.handleEvent(event)
 
-  def getCommandInterpreter(self):
-    return self.driver.getCommandInterpreter()
+    def getCommandInterpreter(self):
+        return self.driver.getCommandInterpreter()

Modified: lldb/trunk/utils/lui/cui.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lui/cui.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/lui/cui.py (original)
+++ lldb/trunk/utils/lui/cui.py Tue Sep  6 15:57:50 2016
@@ -1,9 +1,9 @@
 ##===-- cui.py -----------------------------------------------*- Python -*-===##
 ##
-##                     The LLVM Compiler Infrastructure
+# The LLVM Compiler Infrastructure
 ##
-## This file is distributed under the University of Illinois Open Source
-## License. See LICENSE.TXT for details.
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
 ##
 ##===----------------------------------------------------------------------===##
 
@@ -11,310 +11,329 @@ import curses
 import curses.ascii
 import threading
 
+
 class CursesWin(object):
-  def __init__(self, x, y, w, h):
-    self.win = curses.newwin(h, w, y, x)
-    self.focus = False
-
-  def setFocus(self, focus):
-    self.focus = focus
-  def getFocus(self):
-    return self.focus
-  def canFocus(self):
-    return True
-
-  def handleEvent(self, event):
-    return
-  def draw(self):
-    return
+
+    def __init__(self, x, y, w, h):
+        self.win = curses.newwin(h, w, y, x)
+        self.focus = False
+
+    def setFocus(self, focus):
+        self.focus = focus
+
+    def getFocus(self):
+        return self.focus
+
+    def canFocus(self):
+        return True
+
+    def handleEvent(self, event):
+        return
+
+    def draw(self):
+        return
+
 
 class TextWin(CursesWin):
-  def __init__(self, x, y, w):
-    super(TextWin, self).__init__(x, y, w, 1)
-    self.win.bkgd(curses.color_pair(1))
-    self.text = ''
-    self.reverse = False
-
-  def canFocus(self):
-    return False
-
-  def draw(self):
-    w = self.win.getmaxyx()[1]
-    text = self.text
-    if len(text) > w:
-      #trunc_length = len(text) - w
-      text = text[-w+1:]
-    if self.reverse:
-      self.win.addstr(0, 0, text, curses.A_REVERSE)
-    else:
-      self.win.addstr(0, 0, text)
-    self.win.noutrefresh()
 
-  def setReverse(self, reverse):
-    self.reverse = reverse 
+    def __init__(self, x, y, w):
+        super(TextWin, self).__init__(x, y, w, 1)
+        self.win.bkgd(curses.color_pair(1))
+        self.text = ''
+        self.reverse = False
+
+    def canFocus(self):
+        return False
+
+    def draw(self):
+        w = self.win.getmaxyx()[1]
+        text = self.text
+        if len(text) > w:
+            #trunc_length = len(text) - w
+            text = text[-w + 1:]
+        if self.reverse:
+            self.win.addstr(0, 0, text, curses.A_REVERSE)
+        else:
+            self.win.addstr(0, 0, text)
+        self.win.noutrefresh()
+
+    def setReverse(self, reverse):
+        self.reverse = reverse
+
+    def setText(self, text):
+        self.text = text
 
-  def setText(self, text):
-    self.text = text
 
 class TitledWin(CursesWin):
-  def __init__(self, x, y, w, h, title):
-    super(TitledWin, self).__init__(x, y+1, w, h-1)
-    self.title = title
-    self.title_win = TextWin(x, y, w)
-    self.title_win.setText(title)
-    self.draw()
-
-  def setTitle(self, title):
-    self.title_win.setText(title)
-
-  def draw(self):
-    self.title_win.setReverse(self.getFocus())
-    self.title_win.draw()
-    self.win.noutrefresh()
+
+    def __init__(self, x, y, w, h, title):
+        super(TitledWin, self).__init__(x, y + 1, w, h - 1)
+        self.title = title
+        self.title_win = TextWin(x, y, w)
+        self.title_win.setText(title)
+        self.draw()
+
+    def setTitle(self, title):
+        self.title_win.setText(title)
+
+    def draw(self):
+        self.title_win.setReverse(self.getFocus())
+        self.title_win.draw()
+        self.win.noutrefresh()
+
 
 class ListWin(CursesWin):
-  def __init__(self, x, y, w, h):
-    super(ListWin, self).__init__(x, y, w, h)
-    self.items = []
-    self.selected = 0
-    self.first_drawn = 0
-    self.win.leaveok(True)
-
-  def draw(self):
-    if len(self.items) == 0:
-      self.win.erase()
-      return
-
-    h, w = self.win.getmaxyx()
-
-    allLines = []
-    firstSelected = -1
-    lastSelected = -1
-    for i, item in enumerate(self.items):
-      lines = self.items[i].split('\n')
-      lines = lines if lines[len(lines)-1] != '' else lines[:-1]
-      if len(lines) == 0:
-        lines = ['']
-
-      if i == self.getSelected():
-        firstSelected = len(allLines)
-      allLines.extend(lines)
-      if i == self.selected:
-        lastSelected = len(allLines) - 1
-
-    if firstSelected < self.first_drawn:
-      self.first_drawn = firstSelected
-    elif lastSelected >= self.first_drawn + h:
-      self.first_drawn = lastSelected - h + 1
-
-    self.win.erase()
-
-    begin = self.first_drawn
-    end = begin + h
-
-    y = 0
-    for i, line in list(enumerate(allLines))[begin:end]:
-      attr = curses.A_NORMAL
-      if i >= firstSelected and i <= lastSelected:
-        attr = curses.A_REVERSE
-        line = '{0:{width}}'.format(line, width=w-1)
-
-      # Ignore the error we get from drawing over the bottom-right char.
-      try:
-        self.win.addstr(y, 0, line[:w], attr)
-      except curses.error:
-        pass
-      y += 1
-    self.win.noutrefresh()
-
-  def getSelected(self):
-    if self.items:
-      return self.selected
-    return -1
-
-  def setSelected(self, selected):
-    self.selected = selected
-    if self.selected < 0:
-      self.selected = 0
-    elif self.selected >= len(self.items):
-      self.selected = len(self.items) - 1
-
-  def handleEvent(self, event):
-    if isinstance(event, int):
-      if len(self.items) > 0:
-        if event == curses.KEY_UP:
-          self.setSelected(self.selected - 1)
-        if event == curses.KEY_DOWN:
-          self.setSelected(self.selected + 1)
-        if event == curses.ascii.NL:
-          self.handleSelect(self.selected)
 
-  def addItem(self, item):
-    self.items.append(item)
+    def __init__(self, x, y, w, h):
+        super(ListWin, self).__init__(x, y, w, h)
+        self.items = []
+        self.selected = 0
+        self.first_drawn = 0
+        self.win.leaveok(True)
+
+    def draw(self):
+        if len(self.items) == 0:
+            self.win.erase()
+            return
+
+        h, w = self.win.getmaxyx()
+
+        allLines = []
+        firstSelected = -1
+        lastSelected = -1
+        for i, item in enumerate(self.items):
+            lines = self.items[i].split('\n')
+            lines = lines if lines[len(lines) - 1] != '' else lines[:-1]
+            if len(lines) == 0:
+                lines = ['']
+
+            if i == self.getSelected():
+                firstSelected = len(allLines)
+            allLines.extend(lines)
+            if i == self.selected:
+                lastSelected = len(allLines) - 1
+
+        if firstSelected < self.first_drawn:
+            self.first_drawn = firstSelected
+        elif lastSelected >= self.first_drawn + h:
+            self.first_drawn = lastSelected - h + 1
+
+        self.win.erase()
+
+        begin = self.first_drawn
+        end = begin + h
+
+        y = 0
+        for i, line in list(enumerate(allLines))[begin:end]:
+            attr = curses.A_NORMAL
+            if i >= firstSelected and i <= lastSelected:
+                attr = curses.A_REVERSE
+                line = '{0:{width}}'.format(line, width=w - 1)
+
+            # Ignore the error we get from drawing over the bottom-right char.
+            try:
+                self.win.addstr(y, 0, line[:w], attr)
+            except curses.error:
+                pass
+            y += 1
+        self.win.noutrefresh()
+
+    def getSelected(self):
+        if self.items:
+            return self.selected
+        return -1
+
+    def setSelected(self, selected):
+        self.selected = selected
+        if self.selected < 0:
+            self.selected = 0
+        elif self.selected >= len(self.items):
+            self.selected = len(self.items) - 1
+
+    def handleEvent(self, event):
+        if isinstance(event, int):
+            if len(self.items) > 0:
+                if event == curses.KEY_UP:
+                    self.setSelected(self.selected - 1)
+                if event == curses.KEY_DOWN:
+                    self.setSelected(self.selected + 1)
+                if event == curses.ascii.NL:
+                    self.handleSelect(self.selected)
+
+    def addItem(self, item):
+        self.items.append(item)
 
-  def clearItems(self):
-    self.items = []
+    def clearItems(self):
+        self.items = []
+
+    def handleSelect(self, index):
+        return
 
-  def handleSelect(self, index):
-    return
 
 class InputHandler(threading.Thread):
-  def __init__(self, screen, queue):
-    super(InputHandler, self).__init__()
-    self.screen = screen
-    self.queue = queue
-
-  def run(self):
-    while True:
-      c = self.screen.getch()
-      self.queue.put(c)
+
+    def __init__(self, screen, queue):
+        super(InputHandler, self).__init__()
+        self.screen = screen
+        self.queue = queue
+
+    def run(self):
+        while True:
+            c = self.screen.getch()
+            self.queue.put(c)
 
 
 class CursesUI(object):
-  """ Responsible for updating the console UI with curses. """
-  def __init__(self, screen, event_queue):
-    self.screen = screen
-    self.event_queue = event_queue
-
-    curses.start_color()
-    curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE)
-    curses.init_pair(2, curses.COLOR_YELLOW, curses.COLOR_BLACK)
-    curses.init_pair(3, curses.COLOR_RED, curses.COLOR_BLACK)
-    self.screen.bkgd(curses.color_pair(1))
-    self.screen.clear()
-
-    self.input_handler = InputHandler(self.screen, self.event_queue)
-    self.input_handler.daemon = True
-
-    self.focus = 0
-
-    self.screen.refresh()
-
-  def focusNext(self):
-    self.wins[self.focus].setFocus(False)
-    old = self.focus
-    while True:
-      self.focus += 1
-      if self.focus >= len(self.wins):
+    """ Responsible for updating the console UI with curses. """
+
+    def __init__(self, screen, event_queue):
+        self.screen = screen
+        self.event_queue = event_queue
+
+        curses.start_color()
+        curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE)
+        curses.init_pair(2, curses.COLOR_YELLOW, curses.COLOR_BLACK)
+        curses.init_pair(3, curses.COLOR_RED, curses.COLOR_BLACK)
+        self.screen.bkgd(curses.color_pair(1))
+        self.screen.clear()
+
+        self.input_handler = InputHandler(self.screen, self.event_queue)
+        self.input_handler.daemon = True
+
         self.focus = 0
-      if self.wins[self.focus].canFocus():
-        break
-    self.wins[self.focus].setFocus(True)
-
-  def handleEvent(self, event):
-    if isinstance(event, int):
-      if event == curses.KEY_F3:
-        self.focusNext()
-
-  def eventLoop(self):
-
-    self.input_handler.start()
-    self.wins[self.focus].setFocus(True)
-
-    while True:
-      self.screen.noutrefresh()
-
-      for i, win in enumerate(self.wins):
-        if i != self.focus:
-          win.draw()
-      # Draw the focused window last so that the cursor shows up.
-      if self.wins:
-        self.wins[self.focus].draw()
-      curses.doupdate() # redraw the physical screen
 
-      event = self.event_queue.get()
+        self.screen.refresh()
 
-      for win in self.wins:
+    def focusNext(self):
+        self.wins[self.focus].setFocus(False)
+        old = self.focus
+        while True:
+            self.focus += 1
+            if self.focus >= len(self.wins):
+                self.focus = 0
+            if self.wins[self.focus].canFocus():
+                break
+        self.wins[self.focus].setFocus(True)
+
+    def handleEvent(self, event):
         if isinstance(event, int):
-          if win.getFocus() or not win.canFocus():
-            win.handleEvent(event)
-        else:
-          win.handleEvent(event)
-      self.handleEvent(event)
+            if event == curses.KEY_F3:
+                self.focusNext()
+
+    def eventLoop(self):
+
+        self.input_handler.start()
+        self.wins[self.focus].setFocus(True)
+
+        while True:
+            self.screen.noutrefresh()
+
+            for i, win in enumerate(self.wins):
+                if i != self.focus:
+                    win.draw()
+            # Draw the focused window last so that the cursor shows up.
+            if self.wins:
+                self.wins[self.focus].draw()
+            curses.doupdate()  # redraw the physical screen
+
+            event = self.event_queue.get()
+
+            for win in self.wins:
+                if isinstance(event, int):
+                    if win.getFocus() or not win.canFocus():
+                        win.handleEvent(event)
+                else:
+                    win.handleEvent(event)
+            self.handleEvent(event)
+
 
 class CursesEditLine(object):
-  """ Embed an 'editline'-compatible prompt inside a CursesWin. """
-  def __init__(self, win, history, enterCallback, tabCompleteCallback):
-    self.win = win
-    self.history = history
-    self.enterCallback = enterCallback
-    self.tabCompleteCallback = tabCompleteCallback
-
-    self.prompt = ''
-    self.content = ''
-    self.index = 0
-    self.startx = -1
-    self.starty = -1
-
-  def draw(self, prompt=None):
-    if not prompt:
-      prompt = self.prompt
-    (h, w) = self.win.getmaxyx()
-    if (len(prompt) + len(self.content)) / w + self.starty >= h-1:
-      self.win.scroll(1)
-      self.starty -= 1
-      if self.starty < 0:
-        raise RuntimeError('Input too long; aborting')
-    (y, x) = (self.starty, self.startx)
-
-    self.win.move(y, x)
-    self.win.clrtobot()
-    self.win.addstr(y, x, prompt)
-    remain = self.content
-    self.win.addstr(remain[:w-len(prompt)])
-    remain = remain[w-len(prompt):]
-    while remain != '':
-      y += 1
-      self.win.addstr(y, 0, remain[:w])
-      remain = remain[w:]
-
-    length = self.index + len(prompt)
-    self.win.move(self.starty + length / w, length % w)
-
-  def showPrompt(self, y, x, prompt=None):
-    self.content = ''
-    self.index = 0
-    self.startx = x
-    self.starty = y
-    self.draw(prompt)
-
-  def handleEvent(self, event):
-    if not isinstance(event, int):
-      return # not handled
-    key = event
-
-    if self.startx == -1:
-      raise RuntimeError('Trying to handle input without prompt')
-
-    if key == curses.ascii.NL:
-      self.enterCallback(self.content)
-    elif key == curses.ascii.TAB:
-      self.tabCompleteCallback(self.content)
-    elif curses.ascii.isprint(key):
-      self.content = self.content[:self.index] + chr(key) + self.content[self.index:]
-      self.index += 1
-    elif key == curses.KEY_BACKSPACE or key == curses.ascii.BS:
-      if self.index > 0:
-        self.index -= 1
-        self.content = self.content[:self.index] + self.content[self.index+1:]
-    elif key == curses.KEY_DC or key == curses.ascii.DEL or key == curses.ascii.EOT:
-      self.content = self.content[:self.index] + self.content[self.index+1:]
-    elif key == curses.ascii.VT: # CTRL-K
-      self.content = self.content[:self.index]
-    elif key == curses.KEY_LEFT or key == curses.ascii.STX: # left or CTRL-B
-      if self.index > 0:
-        self.index -= 1
-    elif key == curses.KEY_RIGHT or key == curses.ascii.ACK: # right or CTRL-F
-      if self.index < len(self.content):
-        self.index += 1
-    elif key == curses.ascii.SOH: # CTRL-A
-      self.index = 0
-    elif key == curses.ascii.ENQ: # CTRL-E
-      self.index = len(self.content)
-    elif key == curses.KEY_UP or key == curses.ascii.DLE: # up or CTRL-P
-      self.content = self.history.previous(self.content)
-      self.index = len(self.content)
-    elif key == curses.KEY_DOWN or key == curses.ascii.SO: # down or CTRL-N
-      self.content = self.history.next()
-      self.index = len(self.content)
-    self.draw()
+    """ Embed an 'editline'-compatible prompt inside a CursesWin. """
+
+    def __init__(self, win, history, enterCallback, tabCompleteCallback):
+        self.win = win
+        self.history = history
+        self.enterCallback = enterCallback
+        self.tabCompleteCallback = tabCompleteCallback
+
+        self.prompt = ''
+        self.content = ''
+        self.index = 0
+        self.startx = -1
+        self.starty = -1
+
+    def draw(self, prompt=None):
+        if not prompt:
+            prompt = self.prompt
+        (h, w) = self.win.getmaxyx()
+        if (len(prompt) + len(self.content)) / w + self.starty >= h - 1:
+            self.win.scroll(1)
+            self.starty -= 1
+            if self.starty < 0:
+                raise RuntimeError('Input too long; aborting')
+        (y, x) = (self.starty, self.startx)
+
+        self.win.move(y, x)
+        self.win.clrtobot()
+        self.win.addstr(y, x, prompt)
+        remain = self.content
+        self.win.addstr(remain[:w - len(prompt)])
+        remain = remain[w - len(prompt):]
+        while remain != '':
+            y += 1
+            self.win.addstr(y, 0, remain[:w])
+            remain = remain[w:]
+
+        length = self.index + len(prompt)
+        self.win.move(self.starty + length / w, length % w)
+
+    def showPrompt(self, y, x, prompt=None):
+        self.content = ''
+        self.index = 0
+        self.startx = x
+        self.starty = y
+        self.draw(prompt)
+
+    def handleEvent(self, event):
+        if not isinstance(event, int):
+            return  # not handled
+        key = event
+
+        if self.startx == -1:
+            raise RuntimeError('Trying to handle input without prompt')
+
+        if key == curses.ascii.NL:
+            self.enterCallback(self.content)
+        elif key == curses.ascii.TAB:
+            self.tabCompleteCallback(self.content)
+        elif curses.ascii.isprint(key):
+            self.content = self.content[:self.index] + \
+                chr(key) + self.content[self.index:]
+            self.index += 1
+        elif key == curses.KEY_BACKSPACE or key == curses.ascii.BS:
+            if self.index > 0:
+                self.index -= 1
+                self.content = self.content[
+                    :self.index] + self.content[self.index + 1:]
+        elif key == curses.KEY_DC or key == curses.ascii.DEL or key == curses.ascii.EOT:
+            self.content = self.content[
+                :self.index] + self.content[self.index + 1:]
+        elif key == curses.ascii.VT:  # CTRL-K
+            self.content = self.content[:self.index]
+        elif key == curses.KEY_LEFT or key == curses.ascii.STX:  # left or CTRL-B
+            if self.index > 0:
+                self.index -= 1
+        elif key == curses.KEY_RIGHT or key == curses.ascii.ACK:  # right or CTRL-F
+            if self.index < len(self.content):
+                self.index += 1
+        elif key == curses.ascii.SOH:  # CTRL-A
+            self.index = 0
+        elif key == curses.ascii.ENQ:  # CTRL-E
+            self.index = len(self.content)
+        elif key == curses.KEY_UP or key == curses.ascii.DLE:  # up or CTRL-P
+            self.content = self.history.previous(self.content)
+            self.index = len(self.content)
+        elif key == curses.KEY_DOWN or key == curses.ascii.SO:  # down or CTRL-N
+            self.content = self.history.next()
+            self.index = len(self.content)
+        self.draw()

Modified: lldb/trunk/utils/lui/debuggerdriver.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lui/debuggerdriver.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/lui/debuggerdriver.py (original)
+++ lldb/trunk/utils/lui/debuggerdriver.py Tue Sep  6 15:57:50 2016
@@ -1,9 +1,9 @@
 ##===-- debuggerdriver.py ------------------------------------*- Python -*-===##
 ##
-##                     The LLVM Compiler Infrastructure
+# The LLVM Compiler Infrastructure
 ##
-## This file is distributed under the University of Illinois Open Source
-## License. See LICENSE.TXT for details.
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
 ##
 ##===----------------------------------------------------------------------===##
 
@@ -13,12 +13,15 @@ import lldbutil
 import sys
 from threading import Thread
 
+
 class DebuggerDriver(Thread):
     """ Drives the debugger and responds to events. """
+
     def __init__(self, debugger, event_queue):
         Thread.__init__(self)
         self.event_queue = event_queue
-        # This is probably not great because it does not give liblldb a chance to clean up
+        # This is probably not great because it does not give liblldb a chance
+        # to clean up
         self.daemon = True
         self.initialize(debugger)
 
@@ -30,44 +33,45 @@ class DebuggerDriver(Thread):
             raise "Invalid listener"
 
         self.listener.StartListeningForEventClass(self.debugger,
-                                             lldb.SBTarget.GetBroadcasterClassName(),
-                                             lldb.SBTarget.eBroadcastBitBreakpointChanged
-                                           #| lldb.SBTarget.eBroadcastBitModuleLoaded
-                                           #| lldb.SBTarget.eBroadcastBitModuleUnloaded
-                                           | lldb.SBTarget.eBroadcastBitWatchpointChanged
-                                           #| lldb.SBTarget.eBroadcastBitSymbolLoaded
-                                           )
+                                                  lldb.SBTarget.GetBroadcasterClassName(),
+                                                  lldb.SBTarget.eBroadcastBitBreakpointChanged
+                                                  #| lldb.SBTarget.eBroadcastBitModuleLoaded
+                                                  #| lldb.SBTarget.eBroadcastBitModuleUnloaded
+                                                  | lldb.SBTarget.eBroadcastBitWatchpointChanged
+                                                  #| lldb.SBTarget.eBroadcastBitSymbolLoaded
+                                                  )
 
         self.listener.StartListeningForEventClass(self.debugger,
-                                             lldb.SBThread.GetBroadcasterClassName(),
-                                             lldb.SBThread.eBroadcastBitStackChanged
-                                           #  lldb.SBThread.eBroadcastBitBreakpointChanged
-                                           |  lldb.SBThread.eBroadcastBitThreadSuspended
-                                           | lldb.SBThread.eBroadcastBitThreadResumed
-                                           | lldb.SBThread.eBroadcastBitSelectedFrameChanged
-                                           | lldb.SBThread.eBroadcastBitThreadSelected
-                                           )
+                                                  lldb.SBThread.GetBroadcasterClassName(),
+                                                  lldb.SBThread.eBroadcastBitStackChanged
+                                                  #  lldb.SBThread.eBroadcastBitBreakpointChanged
+                                                  | lldb.SBThread.eBroadcastBitThreadSuspended
+                                                  | lldb.SBThread.eBroadcastBitThreadResumed
+                                                  | lldb.SBThread.eBroadcastBitSelectedFrameChanged
+                                                  | lldb.SBThread.eBroadcastBitThreadSelected
+                                                  )
 
         self.listener.StartListeningForEventClass(self.debugger,
-                                             lldb.SBProcess.GetBroadcasterClassName(),
-                                             lldb.SBProcess.eBroadcastBitStateChanged
-                                           | lldb.SBProcess.eBroadcastBitInterrupt
-                                           | lldb.SBProcess.eBroadcastBitSTDOUT
-                                           | lldb.SBProcess.eBroadcastBitSTDERR
-                                           | lldb.SBProcess.eBroadcastBitProfileData
-                                           )
+                                                  lldb.SBProcess.GetBroadcasterClassName(),
+                                                  lldb.SBProcess.eBroadcastBitStateChanged
+                                                  | lldb.SBProcess.eBroadcastBitInterrupt
+                                                  | lldb.SBProcess.eBroadcastBitSTDOUT
+                                                  | lldb.SBProcess.eBroadcastBitSTDERR
+                                                  | lldb.SBProcess.eBroadcastBitProfileData
+                                                  )
         self.listener.StartListeningForEventClass(self.debugger,
-                                             lldb.SBCommandInterpreter.GetBroadcasterClass(),
-                                             lldb.SBCommandInterpreter.eBroadcastBitThreadShouldExit
-                                           | lldb.SBCommandInterpreter.eBroadcastBitResetPrompt
-                                           | lldb.SBCommandInterpreter.eBroadcastBitQuitCommandReceived
-                                           | lldb.SBCommandInterpreter.eBroadcastBitAsynchronousOutputData
-                                           | lldb.SBCommandInterpreter.eBroadcastBitAsynchronousErrorData
-                                           )
+                                                  lldb.SBCommandInterpreter.GetBroadcasterClass(),
+                                                  lldb.SBCommandInterpreter.eBroadcastBitThreadShouldExit
+                                                  | lldb.SBCommandInterpreter.eBroadcastBitResetPrompt
+                                                  | lldb.SBCommandInterpreter.eBroadcastBitQuitCommandReceived
+                                                  | lldb.SBCommandInterpreter.eBroadcastBitAsynchronousOutputData
+                                                  | lldb.SBCommandInterpreter.eBroadcastBitAsynchronousErrorData
+                                                  )
+
     def createTarget(self, target_image, args=None):
         self.handleCommand("target create %s" % target_image)
         if args is not None:
-          self.handleCommand("settings set target.run-args %s" % args)
+            self.handleCommand("settings set target.run-args %s" % args)
 
     def attachProcess(self, pid):
         self.handleCommand("process attach -p %d" % pid)
@@ -123,9 +127,10 @@ class DebuggerDriver(Thread):
         lldb.SBDebugger.Terminate()
         sys.exit(0)
 
+
 def createDriver(debugger, event_queue):
     driver = DebuggerDriver(debugger, event_queue)
-    #driver.start()
+    # driver.start()
     # if pid specified:
     # - attach to pid
     # else if core file specified

Modified: lldb/trunk/utils/lui/eventwin.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lui/eventwin.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/lui/eventwin.py (original)
+++ lldb/trunk/utils/lui/eventwin.py Tue Sep  6 15:57:50 2016
@@ -1,25 +1,27 @@
 ##===-- eventwin.py ------------------------------------------*- Python -*-===##
 ##
-##                     The LLVM Compiler Infrastructure
+# The LLVM Compiler Infrastructure
 ##
-## This file is distributed under the University of Illinois Open Source
-## License. See LICENSE.TXT for details.
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
 ##
 ##===----------------------------------------------------------------------===##
 
 import cui
-import lldb, lldbutil
+import lldb
+import lldbutil
+
 
 class EventWin(cui.TitledWin):
-  def __init__(self, x, y, w, h):
-    super(EventWin, self).__init__(x, y, w, h, 'LLDB Event Log')
-    self.win.scrollok(1)
-    super(EventWin, self).draw()
 
-  def handleEvent(self, event):
-    if isinstance(event, lldb.SBEvent):
-      self.win.scroll()
-      h = self.win.getmaxyx()[0]
-      self.win.addstr(h-1, 0, lldbutil.get_description(event))
-    return
+    def __init__(self, x, y, w, h):
+        super(EventWin, self).__init__(x, y, w, h, 'LLDB Event Log')
+        self.win.scrollok(1)
+        super(EventWin, self).draw()
 
+    def handleEvent(self, event):
+        if isinstance(event, lldb.SBEvent):
+            self.win.scroll()
+            h = self.win.getmaxyx()[0]
+            self.win.addstr(h - 1, 0, lldbutil.get_description(event))
+        return

Modified: lldb/trunk/utils/lui/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lui/lldbutil.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/lui/lldbutil.py (original)
+++ lldb/trunk/utils/lui/lldbutil.py Tue Sep  6 15:57:50 2016
@@ -1,9 +1,9 @@
 ##===-- lldbutil.py ------------------------------------------*- Python -*-===##
 ##
-##                     The LLVM Compiler Infrastructure
+# The LLVM Compiler Infrastructure
 ##
-## This file is distributed under the University of Illinois Open Source
-## License. See LICENSE.TXT for details.
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
 ##
 ##===----------------------------------------------------------------------===##
 
@@ -14,17 +14,20 @@ They can also be useful for general purp
 """
 
 import lldb
-import os, sys
+import os
+import sys
 import StringIO
 
 # ===================================================
 # Utilities for locating/checking executable programs
 # ===================================================
 
+
 def is_exe(fpath):
     """Returns True if fpath is an executable."""
     return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
 
+
 def which(program):
     """Returns the full path to a program; None otherwise."""
     fpath, fname = os.path.split(program)
@@ -42,6 +45,7 @@ def which(program):
 # Disassembly for an SBFunction or an SBSymbol object
 # ===================================================
 
+
 def disassemble(target, function_or_symbol):
     """Disassemble the function or symbol given a target.
 
@@ -57,6 +61,7 @@ def disassemble(target, function_or_symb
 # Integer (byte size 1, 2, 4, and 8) to bytearray conversion
 # ==========================================================
 
+
 def int_to_bytearray(val, bytesize):
     """Utility function to convert an integer into a bytearray.
 
@@ -82,6 +87,7 @@ def int_to_bytearray(val, bytesize):
     packed = struct.pack(fmt, val)
     return bytearray(map(ord, packed))
 
+
 def bytearray_to_int(bytes, bytesize):
     """Utility function to convert a bytearray into an integer.
 
@@ -137,7 +143,7 @@ def get_description(obj, option=None):
     if not success:
         return None
     return stream.GetData()
-        
+
 
 # =================================================
 # Convert some enum value to its string counterpart
@@ -172,6 +178,7 @@ def state_type_to_str(enum):
     else:
         raise Exception("Unknown StateType enum")
 
+
 def stop_reason_to_str(enum):
     """Returns the stopReason string given an enum."""
     if enum == lldb.eStopReasonInvalid:
@@ -195,6 +202,7 @@ def stop_reason_to_str(enum):
     else:
         raise Exception("Unknown StopReason enum")
 
+
 def symbol_type_to_str(enum):
     """Returns the symbolType string given an enum."""
     if enum == lldb.eSymbolTypeInvalid:
@@ -246,6 +254,7 @@ def symbol_type_to_str(enum):
     elif enum == lldb.eSymbolTypeUndefined:
         return "undefined"
 
+
 def value_type_to_str(enum):
     """Returns the valueType string given an enum."""
     if enum == lldb.eValueTypeInvalid:
@@ -273,12 +282,12 @@ def value_type_to_str(enum):
 # ==================================================
 
 def sort_stopped_threads(process,
-                         breakpoint_threads = None,
-                         crashed_threads = None,
-                         watchpoint_threads = None,
-                         signal_threads = None,
-                         exiting_threads = None,
-                         other_threads = None):
+                         breakpoint_threads=None,
+                         crashed_threads=None,
+                         watchpoint_threads=None,
+                         signal_threads=None,
+                         exiting_threads=None,
+                         other_threads=None):
     """ Fills array *_threads with threads stopped for the corresponding stop
         reason.
     """
@@ -307,8 +316,16 @@ def sort_stopped_threads(process,
 # Utility functions for setting breakpoints
 # ==================================================
 
-def run_break_set_by_file_and_line (test, file_name, line_number, extra_options = None, num_expected_locations = 1, loc_exact=False, module_name=None):
-    """Set a breakpoint by file and line, returning the breakpoint number. 
+
+def run_break_set_by_file_and_line(
+        test,
+        file_name,
+        line_number,
+        extra_options=None,
+        num_expected_locations=1,
+        loc_exact=False,
+        module_name=None):
+    """Set a breakpoint by file and line, returning the breakpoint number.
 
     If extra_options is not None, then we append it to the breakpoint set command.
 
@@ -316,10 +333,10 @@ def run_break_set_by_file_and_line (test
 
     If loc_exact is true, we check that there is one location, and that location must be at the input file and line number."""
 
-    if file_name == None:
-        command = 'breakpoint set -l %d'%(line_number)
+    if file_name is None:
+        command = 'breakpoint set -l %d' % (line_number)
     else:
-        command = 'breakpoint set -f "%s" -l %d'%(file_name, line_number)
+        command = 'breakpoint set -f "%s" -l %d' % (file_name, line_number)
 
     if module_name:
         command += " --shlib '%s'" % (module_name)
@@ -327,20 +344,36 @@ def run_break_set_by_file_and_line (test
     if extra_options:
         command += " " + extra_options
 
-    break_results = run_break_set_command (test, command)
+    break_results = run_break_set_command(test, command)
 
     if num_expected_locations == 1 and loc_exact:
-        check_breakpoint_result (test, break_results, num_locations=num_expected_locations, file_name = file_name, line_number = line_number, module_name=module_name)
+        check_breakpoint_result(
+            test,
+            break_results,
+            num_locations=num_expected_locations,
+            file_name=file_name,
+            line_number=line_number,
+            module_name=module_name)
     else:
-        check_breakpoint_result (test, break_results, num_locations = num_expected_locations)
+        check_breakpoint_result(
+            test,
+            break_results,
+            num_locations=num_expected_locations)
+
+    return get_bpno_from_match(break_results)
 
-    return get_bpno_from_match (break_results)
 
-def run_break_set_by_symbol (test, symbol, extra_options = None, num_expected_locations = -1, sym_exact = False, module_name=None):
+def run_break_set_by_symbol(
+        test,
+        symbol,
+        extra_options=None,
+        num_expected_locations=-1,
+        sym_exact=False,
+        module_name=None):
     """Set a breakpoint by symbol name.  Common options are the same as run_break_set_by_file_and_line.
 
     If sym_exact is true, then the output symbol must match the input exactly, otherwise we do a substring match."""
-    command = 'breakpoint set -n "%s"'%(symbol)
+    command = 'breakpoint set -n "%s"' % (symbol)
 
     if module_name:
         command += " --shlib '%s'" % (module_name)
@@ -348,16 +381,30 @@ def run_break_set_by_symbol (test, symbo
     if extra_options:
         command += " " + extra_options
 
-    break_results = run_break_set_command (test, command)
+    break_results = run_break_set_command(test, command)
 
     if num_expected_locations == 1 and sym_exact:
-        check_breakpoint_result (test, break_results, num_locations = num_expected_locations, symbol_name = symbol, module_name=module_name)
+        check_breakpoint_result(
+            test,
+            break_results,
+            num_locations=num_expected_locations,
+            symbol_name=symbol,
+            module_name=module_name)
     else:
-        check_breakpoint_result (test, break_results, num_locations = num_expected_locations)
+        check_breakpoint_result(
+            test,
+            break_results,
+            num_locations=num_expected_locations)
+
+    return get_bpno_from_match(break_results)
 
-    return get_bpno_from_match (break_results)
 
-def run_break_set_by_selector (test, selector, extra_options = None, num_expected_locations = -1, module_name=None):
+def run_break_set_by_selector(
+        test,
+        selector,
+        extra_options=None,
+        num_expected_locations=-1,
+        module_name=None):
     """Set a breakpoint by selector.  Common options are the same as run_break_set_by_file_and_line."""
 
     command = 'breakpoint set -S "%s"' % (selector)
@@ -368,42 +415,68 @@ def run_break_set_by_selector (test, sel
     if extra_options:
         command += " " + extra_options
 
-    break_results = run_break_set_command (test, command)
+    break_results = run_break_set_command(test, command)
 
     if num_expected_locations == 1:
-        check_breakpoint_result (test, break_results, num_locations = num_expected_locations, symbol_name = selector, symbol_match_exact=False, module_name=module_name)
+        check_breakpoint_result(
+            test,
+            break_results,
+            num_locations=num_expected_locations,
+            symbol_name=selector,
+            symbol_match_exact=False,
+            module_name=module_name)
     else:
-        check_breakpoint_result (test, break_results, num_locations = num_expected_locations)
+        check_breakpoint_result(
+            test,
+            break_results,
+            num_locations=num_expected_locations)
+
+    return get_bpno_from_match(break_results)
 
-    return get_bpno_from_match (break_results)
 
-def run_break_set_by_regexp (test, regexp, extra_options=None, num_expected_locations=-1):
+def run_break_set_by_regexp(
+        test,
+        regexp,
+        extra_options=None,
+        num_expected_locations=-1):
     """Set a breakpoint by regular expression match on symbol name.  Common options are the same as run_break_set_by_file_and_line."""
 
-    command = 'breakpoint set -r "%s"'%(regexp)
+    command = 'breakpoint set -r "%s"' % (regexp)
     if extra_options:
         command += " " + extra_options
-    
-    break_results = run_break_set_command (test, command)
-    
-    check_breakpoint_result (test, break_results, num_locations=num_expected_locations)
 
-    return get_bpno_from_match (break_results)
+    break_results = run_break_set_command(test, command)
+
+    check_breakpoint_result(
+        test,
+        break_results,
+        num_locations=num_expected_locations)
 
-def run_break_set_by_source_regexp (test, regexp, extra_options=None, num_expected_locations=-1):
+    return get_bpno_from_match(break_results)
+
+
+def run_break_set_by_source_regexp(
+        test,
+        regexp,
+        extra_options=None,
+        num_expected_locations=-1):
     """Set a breakpoint by source regular expression.  Common options are the same as run_break_set_by_file_and_line."""
-    command = 'breakpoint set -p "%s"'%(regexp)
+    command = 'breakpoint set -p "%s"' % (regexp)
     if extra_options:
         command += " " + extra_options
-    
-    break_results = run_break_set_command (test, command)
-    
-    check_breakpoint_result (test, break_results, num_locations=num_expected_locations)
 
-    return get_bpno_from_match (break_results)
+    break_results = run_break_set_command(test, command)
+
+    check_breakpoint_result(
+        test,
+        break_results,
+        num_locations=num_expected_locations)
 
-def run_break_set_command (test, command):
-    """Run the command passed in - it must be some break set variant - and analyze the result.  
+    return get_bpno_from_match(break_results)
+
+
+def run_break_set_command(test, command):
+    """Run the command passed in - it must be some break set variant - and analyze the result.
     Returns a dictionary of information gleaned from the command-line results.
     Will assert if the breakpoint setting fails altogether.
 
@@ -420,11 +493,12 @@ def run_break_set_command (test, command
         module        - module
         address       - address at which the breakpoint was set."""
 
-    patterns = [r"^Breakpoint (?P<bpno>[0-9]+): (?P<num_locations>[0-9]+) locations\.$",
-                r"^Breakpoint (?P<bpno>[0-9]+): (?P<num_locations>no) locations \(pending\)\.",
-                r"^Breakpoint (?P<bpno>[0-9]+): where = (?P<module>.*)`(?P<symbol>[+\-]{0,1}[^+]+)( \+ (?P<offset>[0-9]+)){0,1}( \[inlined\] (?P<inline_symbol>.*)){0,1} at (?P<file>[^:]+):(?P<line_no>[0-9]+), address = (?P<address>0x[0-9a-fA-F]+)$",
-                r"^Breakpoint (?P<bpno>[0-9]+): where = (?P<module>.*)`(?P<symbol>.*)( \+ (?P<offset>[0-9]+)){0,1}, address = (?P<address>0x[0-9a-fA-F]+)$"]
-    match_object = test.match (command, patterns)
+    patterns = [
+        r"^Breakpoint (?P<bpno>[0-9]+): (?P<num_locations>[0-9]+) locations\.$",
+        r"^Breakpoint (?P<bpno>[0-9]+): (?P<num_locations>no) locations \(pending\)\.",
+        r"^Breakpoint (?P<bpno>[0-9]+): where = (?P<module>.*)`(?P<symbol>[+\-]{0,1}[^+]+)( \+ (?P<offset>[0-9]+)){0,1}( \[inlined\] (?P<inline_symbol>.*)){0,1} at (?P<file>[^:]+):(?P<line_no>[0-9]+), address = (?P<address>0x[0-9a-fA-F]+)$",
+        r"^Breakpoint (?P<bpno>[0-9]+): where = (?P<module>.*)`(?P<symbol>.*)( \+ (?P<offset>[0-9]+)){0,1}, address = (?P<address>0x[0-9a-fA-F]+)$"]
+    match_object = test.match(command, patterns)
     break_results = match_object.groupdict()
 
     # We always insert the breakpoint number, setting it to -1 if we couldn't find it
@@ -433,7 +507,7 @@ def run_break_set_command (test, command
         break_results['bpno'] = -1
     else:
         break_results['bpno'] = int(break_results['bpno'])
-        
+
     # We always insert the number of locations
     # If ONE location is set for the breakpoint, then the output doesn't mention locations, but it has to be 1...
     # We also make sure it is an integer.
@@ -448,61 +522,101 @@ def run_break_set_command (test, command
             num_locations = int(break_results['num_locations'])
 
     break_results['num_locations'] = num_locations
-    
+
     if 'line_no' in break_results:
         break_results['line_no'] = int(break_results['line_no'])
 
     return break_results
 
-def get_bpno_from_match (break_results):
-    return int (break_results['bpno'])
 
-def check_breakpoint_result (test, break_results, file_name=None, line_number=-1, symbol_name=None, symbol_match_exact=True, module_name=None, offset=-1, num_locations=-1):
+def get_bpno_from_match(break_results):
+    return int(break_results['bpno'])
+
+
+def check_breakpoint_result(
+        test,
+        break_results,
+        file_name=None,
+        line_number=-1,
+        symbol_name=None,
+        symbol_match_exact=True,
+        module_name=None,
+        offset=-1,
+        num_locations=-1):
 
     out_num_locations = break_results['num_locations']
 
     if num_locations == -1:
-        test.assertTrue (out_num_locations > 0, "Expecting one or more locations, got none.")
+        test.assertTrue(out_num_locations > 0,
+                        "Expecting one or more locations, got none.")
     else:
-        test.assertTrue (num_locations == out_num_locations, "Expecting %d locations, got %d."%(num_locations, out_num_locations))
+        test.assertTrue(
+            num_locations == out_num_locations,
+            "Expecting %d locations, got %d." %
+            (num_locations,
+             out_num_locations))
 
     if file_name:
         out_file_name = ""
         if 'file' in break_results:
             out_file_name = break_results['file']
-        test.assertTrue (file_name == out_file_name, "Breakpoint file name '%s' doesn't match resultant name '%s'."%(file_name, out_file_name))
+        test.assertTrue(
+            file_name == out_file_name,
+            "Breakpoint file name '%s' doesn't match resultant name '%s'." %
+            (file_name,
+             out_file_name))
 
     if line_number != -1:
         out_file_line = -1
         if 'line_no' in break_results:
             out_line_number = break_results['line_no']
 
-        test.assertTrue (line_number == out_line_number, "Breakpoint line number %s doesn't match resultant line %s."%(line_number, out_line_number))
+        test.assertTrue(
+            line_number == out_line_number,
+            "Breakpoint line number %s doesn't match resultant line %s." %
+            (line_number,
+             out_line_number))
 
     if symbol_name:
         out_symbol_name = ""
-        # Look first for the inlined symbol name, otherwise use the symbol name:
+        # Look first for the inlined symbol name, otherwise use the symbol
+        # name:
         if 'inline_symbol' in break_results and break_results['inline_symbol']:
             out_symbol_name = break_results['inline_symbol']
         elif 'symbol' in break_results:
             out_symbol_name = break_results['symbol']
 
         if symbol_match_exact:
-            test.assertTrue(symbol_name == out_symbol_name, "Symbol name '%s' doesn't match resultant symbol '%s'."%(symbol_name, out_symbol_name))
+            test.assertTrue(
+                symbol_name == out_symbol_name,
+                "Symbol name '%s' doesn't match resultant symbol '%s'." %
+                (symbol_name,
+                 out_symbol_name))
         else:
-            test.assertTrue(out_symbol_name.find(symbol_name) != -1, "Symbol name '%s' isn't in resultant symbol '%s'."%(symbol_name, out_symbol_name))
+            test.assertTrue(
+                out_symbol_name.find(symbol_name) != -
+                1,
+                "Symbol name '%s' isn't in resultant symbol '%s'." %
+                (symbol_name,
+                 out_symbol_name))
 
     if module_name:
         out_nodule_name = None
         if 'module' in break_results:
             out_module_name = break_results['module']
-        
-        test.assertTrue (module_name.find(out_module_name) != -1, "Symbol module name '%s' isn't in expected module name '%s'."%(out_module_name, module_name))
+
+        test.assertTrue(
+            module_name.find(out_module_name) != -
+            1,
+            "Symbol module name '%s' isn't in expected module name '%s'." %
+            (out_module_name,
+             module_name))
 
 # ==================================================
 # Utility functions related to Threads and Processes
 # ==================================================
 
+
 def get_stopped_threads(process, reason):
     """Returns the thread(s) with the specified stop reason in a list.
 
@@ -514,6 +628,7 @@ def get_stopped_threads(process, reason)
             threads.append(t)
     return threads
 
+
 def get_stopped_thread(process, reason):
     """A convenience function which returns the first thread with the given stop
     reason or None.
@@ -542,31 +657,34 @@ def get_stopped_thread(process, reason):
         return None
     return threads[0]
 
-def get_threads_stopped_at_breakpoint (process, bkpt):
+
+def get_threads_stopped_at_breakpoint(process, bkpt):
     """ For a stopped process returns the thread stopped at the breakpoint passed in bkpt"""
     stopped_threads = []
     threads = []
 
-    stopped_threads = get_stopped_threads (process, lldb.eStopReasonBreakpoint)
+    stopped_threads = get_stopped_threads(process, lldb.eStopReasonBreakpoint)
 
     if len(stopped_threads) == 0:
         return threads
-    
+
     for thread in stopped_threads:
         # Make sure we've hit our breakpoint...
-        break_id = thread.GetStopReasonDataAtIndex (0)
+        break_id = thread.GetStopReasonDataAtIndex(0)
         if break_id == bkpt.GetID():
             threads.append(thread)
 
     return threads
 
-def continue_to_breakpoint (process, bkpt):
+
+def continue_to_breakpoint(process, bkpt):
     """ Continues the process, if it stops, returns the threads stopped at bkpt; otherwise, returns None"""
     process.Continue()
     if process.GetState() != lldb.eStateStopped:
         return None
     else:
-        return get_threads_stopped_at_breakpoint (process, bkpt)
+        return get_threads_stopped_at_breakpoint(process, bkpt)
+
 
 def get_caller_symbol(thread):
     """
@@ -617,7 +735,8 @@ def get_filenames(thread):
     Returns a sequence of file names from the stack frames of this thread.
     """
     def GetFilename(i):
-        return thread.GetFrameAtIndex(i).GetLineEntry().GetFileSpec().GetFilename()
+        return thread.GetFrameAtIndex(
+            i).GetLineEntry().GetFileSpec().GetFilename()
 
     return map(GetFilename, range(thread.GetNumFrames()))
 
@@ -637,7 +756,8 @@ def get_module_names(thread):
     Returns a sequence of module names from the stack frames of this thread.
     """
     def GetModuleName(i):
-        return thread.GetFrameAtIndex(i).GetModule().GetFileSpec().GetFilename()
+        return thread.GetFrameAtIndex(
+            i).GetModule().GetFileSpec().GetFilename()
 
     return map(GetModuleName, range(thread.GetNumFrames()))
 
@@ -652,7 +772,7 @@ def get_stack_frames(thread):
     return map(GetStackFrame, range(thread.GetNumFrames()))
 
 
-def print_stacktrace(thread, string_buffer = False):
+def print_stacktrace(thread, string_buffer=False):
     """Prints a simple stack trace of this thread."""
 
     output = StringIO.StringIO() if string_buffer else sys.stdout
@@ -668,7 +788,7 @@ def print_stacktrace(thread, string_buff
     addrs = get_pc_addresses(thread)
 
     if thread.GetStopReason() != lldb.eStopReasonInvalid:
-        desc =  "stop reason=" + stop_reason_to_str(thread.GetStopReason())
+        desc = "stop reason=" + stop_reason_to_str(thread.GetStopReason())
     else:
         desc = ""
     print >> output, "Stack trace for thread id={0:#x} name={1} queue={2} ".format(
@@ -687,16 +807,15 @@ def print_stacktrace(thread, string_buff
                 num=i, addr=load_addr, mod=mods[i], symbol=symbols[i], offset=symbol_offset)
         else:
             print >> output, "  frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}".format(
-                num=i, addr=load_addr, mod=mods[i],
-                func='%s [inlined]' % funcs[i] if frame.IsInlined() else funcs[i],
-                file=files[i], line=lines[i],
-                args=get_args_as_string(frame, showFuncName=False) if not frame.IsInlined() else '()')
+                num=i, addr=load_addr, mod=mods[i], func='%s [inlined]' %
+                funcs[i] if frame.IsInlined() else funcs[i], file=files[i], line=lines[i], args=get_args_as_string(
+                    frame, showFuncName=False) if not frame.IsInlined() else '()')
 
     if string_buffer:
         return output.getvalue()
 
 
-def print_stacktraces(process, string_buffer = False):
+def print_stacktraces(process, string_buffer=False):
     """Prints the stack traces of all the threads."""
 
     output = StringIO.StringIO() if string_buffer else sys.stdout
@@ -713,6 +832,7 @@ def print_stacktraces(process, string_bu
 # Utility functions related to Frames
 # ===================================
 
+
 def get_parent_frame(frame):
     """
     Returns the parent frame of the input frame object; None if not available.
@@ -728,6 +848,7 @@ def get_parent_frame(frame):
     # If we reach here, no parent has been found, return None.
     return None
 
+
 def get_args_as_string(frame, showFuncName=True):
     """
     Returns the args of the input frame object as a string.
@@ -736,8 +857,8 @@ def get_args_as_string(frame, showFuncNa
     # locals        => False
     # statics       => False
     # in_scope_only => True
-    vars = frame.GetVariables(True, False, False, True) # type of SBValueList
-    args = [] # list of strings
+    vars = frame.GetVariables(True, False, False, True)  # type of SBValueList
+    args = []  # list of strings
     for var in vars:
         args.append("(%s)%s=%s" % (var.GetTypeName(),
                                    var.GetName(),
@@ -752,37 +873,43 @@ def get_args_as_string(frame, showFuncNa
         return "%s(%s)" % (name, ", ".join(args))
     else:
         return "(%s)" % (", ".join(args))
-        
-def print_registers(frame, string_buffer = False):
+
+
+def print_registers(frame, string_buffer=False):
     """Prints all the register sets of the frame."""
 
     output = StringIO.StringIO() if string_buffer else sys.stdout
 
     print >> output, "Register sets for " + str(frame)
 
-    registerSet = frame.GetRegisters() # Return type of SBValueList.
-    print >> output, "Frame registers (size of register set = %d):" % registerSet.GetSize()
+    registerSet = frame.GetRegisters()  # Return type of SBValueList.
+    print >> output, "Frame registers (size of register set = %d):" % registerSet.GetSize(
+    )
     for value in registerSet:
-        #print >> output, value 
-        print >> output, "%s (number of children = %d):" % (value.GetName(), value.GetNumChildren())
+        #print >> output, value
+        print >> output, "%s (number of children = %d):" % (
+            value.GetName(), value.GetNumChildren())
         for child in value:
-            print >> output, "Name: %s, Value: %s" % (child.GetName(), child.GetValue())
+            print >> output, "Name: %s, Value: %s" % (
+                child.GetName(), child.GetValue())
 
     if string_buffer:
         return output.getvalue()
 
+
 def get_registers(frame, kind):
     """Returns the registers given the frame and the kind of registers desired.
 
     Returns None if there's no such kind.
     """
-    registerSet = frame.GetRegisters() # Return type of SBValueList.
+    registerSet = frame.GetRegisters()  # Return type of SBValueList.
     for value in registerSet:
         if kind.lower() in value.GetName().lower():
             return value
 
     return None
 
+
 def get_GPRs(frame):
     """Returns the general purpose registers of the frame as an SBValue.
 
@@ -796,6 +923,7 @@ def get_GPRs(frame):
     """
     return get_registers(frame, "general purpose")
 
+
 def get_FPRs(frame):
     """Returns the floating point registers of the frame as an SBValue.
 
@@ -809,6 +937,7 @@ def get_FPRs(frame):
     """
     return get_registers(frame, "floating point")
 
+
 def get_ESRs(frame):
     """Returns the exception state registers of the frame as an SBValue.
 
@@ -826,8 +955,10 @@ def get_ESRs(frame):
 # Utility classes/functions for SBValues
 # ======================================
 
+
 class BasicFormatter(object):
     """The basic formatter inspects the value object and prints the value."""
+
     def format(self, value, buffer=None, indent=0):
         if not buffer:
             output = StringIO.StringIO()
@@ -836,25 +967,28 @@ class BasicFormatter(object):
         # If there is a summary, it suffices.
         val = value.GetSummary()
         # Otherwise, get the value.
-        if val == None:
+        if val is None:
             val = value.GetValue()
-        if val == None and value.GetNumChildren() > 0:
+        if val is None and value.GetNumChildren() > 0:
             val = "%s (location)" % value.GetLocation()
         print >> output, "{indentation}({type}) {name} = {value}".format(
-            indentation = ' ' * indent,
-            type = value.GetTypeName(),
-            name = value.GetName(),
-            value = val)
+            indentation=' ' * indent,
+            type=value.GetTypeName(),
+            name=value.GetName(),
+            value=val)
         return output.getvalue()
 
+
 class ChildVisitingFormatter(BasicFormatter):
     """The child visiting formatter prints the value and its immediate children.
 
     The constructor takes a keyword arg: indent_child, which defaults to 2.
     """
+
     def __init__(self, indent_child=2):
         """Default indentation of 2 SPC's for the children."""
         self.cindent = indent_child
+
     def format(self, value, buffer=None):
         if not buffer:
             output = StringIO.StringIO()
@@ -863,21 +997,25 @@ class ChildVisitingFormatter(BasicFormat
 
         BasicFormatter.format(self, value, buffer=output)
         for child in value:
-            BasicFormatter.format(self, child, buffer=output, indent=self.cindent)
+            BasicFormatter.format(
+                self, child, buffer=output, indent=self.cindent)
 
         return output.getvalue()
 
+
 class RecursiveDecentFormatter(BasicFormatter):
     """The recursive decent formatter prints the value and the decendents.
 
     The constructor takes two keyword args: indent_level, which defaults to 0,
     and indent_child, which defaults to 2.  The current indentation level is
     determined by indent_level, while the immediate children has an additional
-    indentation by inden_child. 
+    indentation by inden_child.
     """
+
     def __init__(self, indent_level=0, indent_child=2):
         self.lindent = indent_level
         self.cindent = indent_child
+
     def format(self, value, buffer=None):
         if not buffer:
             output = StringIO.StringIO()
@@ -887,13 +1025,15 @@ class RecursiveDecentFormatter(BasicForm
         BasicFormatter.format(self, value, buffer=output, indent=self.lindent)
         new_indent = self.lindent + self.cindent
         for child in value:
-            if child.GetSummary() != None:
-                BasicFormatter.format(self, child, buffer=output, indent=new_indent)
+            if child.GetSummary() is not None:
+                BasicFormatter.format(
+                    self, child, buffer=output, indent=new_indent)
             else:
                 if child.GetNumChildren() > 0:
                     rdf = RecursiveDecentFormatter(indent_level=new_indent)
                     rdf.format(child, buffer=output)
                 else:
-                    BasicFormatter.format(self, child, buffer=output, indent=new_indent)
+                    BasicFormatter.format(
+                        self, child, buffer=output, indent=new_indent)
 
         return output.getvalue()

Modified: lldb/trunk/utils/lui/lui.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lui/lui.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/lui/lui.py (original)
+++ lldb/trunk/utils/lui/lui.py Tue Sep  6 15:57:50 2016
@@ -1,15 +1,14 @@
 #!/usr/bin/env python
 ##===-- lui.py -----------------------------------------------*- Python -*-===##
 ##
-##                     The LLVM Compiler Infrastructure
+# The LLVM Compiler Infrastructure
 ##
-## This file is distributed under the University of Illinois Open Source
-## License. See LICENSE.TXT for details.
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
 ##
 ##===----------------------------------------------------------------------===##
 
 
-
 import curses
 
 import lldb
@@ -33,103 +32,119 @@ import statuswin
 
 event_queue = None
 
-def handle_args(driver, argv):
-  parser = OptionParser()
-  parser.add_option("-p", "--attach", dest="pid", help="Attach to specified Process ID", type="int")
-  parser.add_option("-c", "--core", dest="core", help="Load specified core file", type="string")
 
-  (options, args) = parser.parse_args(argv)
+def handle_args(driver, argv):
+    parser = OptionParser()
+    parser.add_option(
+        "-p",
+        "--attach",
+        dest="pid",
+        help="Attach to specified Process ID",
+        type="int")
+    parser.add_option(
+        "-c",
+        "--core",
+        dest="core",
+        help="Load specified core file",
+        type="string")
+
+    (options, args) = parser.parse_args(argv)
+
+    if options.pid is not None:
+        try:
+            pid = int(options.pid)
+            driver.attachProcess(ui, pid)
+        except ValueError:
+            print "Error: expecting integer PID, got '%s'" % options.pid
+    elif options.core is not None:
+        if not os.path.exists(options.core):
+            raise Exception(
+                "Specified core file '%s' does not exist." %
+                options.core)
+        driver.loadCore(options.core)
+    elif len(args) == 2:
+        if not os.path.isfile(args[1]):
+            raise Exception("Specified target '%s' does not exist" % args[1])
+        driver.createTarget(args[1])
+    elif len(args) > 2:
+        if not os.path.isfile(args[1]):
+            raise Exception("Specified target '%s' does not exist" % args[1])
+        driver.createTarget(args[1], args[2:])
 
-  if options.pid is not None:
-    try:
-      pid = int(options.pid)
-      driver.attachProcess(ui, pid)
-    except ValueError:
-      print "Error: expecting integer PID, got '%s'" % options.pid
-  elif options.core is not None:
-    if not os.path.exists(options.core):
-      raise Exception("Specified core file '%s' does not exist." % options.core)
-    driver.loadCore(options.core)
-  elif len(args) == 2:
-    if not os.path.isfile(args[1]):
-      raise Exception("Specified target '%s' does not exist" % args[1])
-    driver.createTarget(args[1])
-  elif len(args) > 2:
-    if not os.path.isfile(args[1]):
-      raise Exception("Specified target '%s' does not exist" % args[1])
-    driver.createTarget(args[1], args[2:])
 
 def sigint_handler(signal, frame):
-  global debugger
-  debugger.terminate()
+    global debugger
+    debugger.terminate()
+
 
 class LLDBUI(cui.CursesUI):
-  def __init__(self, screen, event_queue, driver):
-    super(LLDBUI, self).__init__(screen, event_queue)
 
-    self.driver = driver
+    def __init__(self, screen, event_queue, driver):
+        super(LLDBUI, self).__init__(screen, event_queue)
+
+        self.driver = driver
 
-    h, w = self.screen.getmaxyx()
+        h, w = self.screen.getmaxyx()
+
+        command_win_height = 20
+        break_win_width = 60
+
+        self.status_win = statuswin.StatusWin(0, h - 1, w, 1)
+        h -= 1
+        self.command_win = commandwin.CommandWin(
+            driver, 0, h - command_win_height, w, command_win_height)
+        h -= command_win_height
+        self.source_win = sourcewin.SourceWin(driver, 0, 0,
+                                              w - break_win_width - 1, h)
+        self.break_win = breakwin.BreakWin(driver, w - break_win_width, 0,
+                                           break_win_width, h)
+
+        self.wins = [self.status_win,
+                     # self.event_win,
+                     self.source_win,
+                     self.break_win,
+                     self.command_win,
+                     ]
+
+        self.focus = len(self.wins) - 1  # index of command window;
+
+    def handleEvent(self, event):
+        # hack
+        if isinstance(event, int):
+            if event == curses.KEY_F10:
+                self.driver.terminate()
+            if event == 20:  # ctrl-T
+                def foo(cmd):
+                    ret = lldb.SBCommandReturnObject()
+                    self.driver.getCommandInterpreter().HandleCommand(cmd, ret)
+                foo('target create a.out')
+                foo('b main')
+                foo('run')
+        super(LLDBUI, self).handleEvent(event)
 
-    command_win_height = 20
-    break_win_width = 60
-
-    self.status_win = statuswin.StatusWin(0, h-1, w, 1)
-    h -= 1
-    self.command_win = commandwin.CommandWin(driver, 0, h - command_win_height,
-                                             w, command_win_height)
-    h -= command_win_height
-    self.source_win = sourcewin.SourceWin(driver, 0, 0,
-                                          w - break_win_width - 1, h)
-    self.break_win = breakwin.BreakWin(driver, w - break_win_width, 0,
-                                       break_win_width, h)
-
-
-    self.wins = [self.status_win,
-                 #self.event_win,
-                 self.source_win,
-                 self.break_win,
-                 self.command_win,
-                 ]
-
-    self.focus = len(self.wins) - 1 # index of command window;
-
-  def handleEvent(self, event):
-    # hack
-    if isinstance(event, int):
-      if event == curses.KEY_F10:
-        self.driver.terminate()
-      if event == 20: # ctrl-T
-        def foo(cmd):
-          ret = lldb.SBCommandReturnObject()
-          self.driver.getCommandInterpreter().HandleCommand(cmd, ret)
-        foo('target create a.out')
-        foo('b main')
-        foo('run')
-    super(LLDBUI, self).handleEvent(event)
 
 def main(screen):
-  signal.signal(signal.SIGINT, sigint_handler)
+    signal.signal(signal.SIGINT, sigint_handler)
 
-  global event_queue
-  event_queue = Queue.Queue()
+    global event_queue
+    event_queue = Queue.Queue()
 
-  global debugger
-  debugger = lldb.SBDebugger.Create()
+    global debugger
+    debugger = lldb.SBDebugger.Create()
 
-  driver = debuggerdriver.createDriver(debugger, event_queue)
-  view = LLDBUI(screen, event_queue, driver)
+    driver = debuggerdriver.createDriver(debugger, event_queue)
+    view = LLDBUI(screen, event_queue, driver)
 
-  driver.start()
+    driver.start()
 
-  # hack to avoid hanging waiting for prompts!
-  driver.handleCommand("settings set auto-confirm true")
+    # hack to avoid hanging waiting for prompts!
+    driver.handleCommand("settings set auto-confirm true")
 
-  handle_args(driver, sys.argv)
-  view.eventLoop()
+    handle_args(driver, sys.argv)
+    view.eventLoop()
 
 if __name__ == "__main__":
-  try:
-    curses.wrapper(main)
-  except KeyboardInterrupt:
-    exit()
+    try:
+        curses.wrapper(main)
+    except KeyboardInterrupt:
+        exit()

Modified: lldb/trunk/utils/lui/sandbox.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lui/sandbox.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/lui/sandbox.py (original)
+++ lldb/trunk/utils/lui/sandbox.py Tue Sep  6 15:57:50 2016
@@ -1,15 +1,14 @@
 #!/usr/bin/env python
 ##===-- sandbox.py -------------------------------------------*- Python -*-===##
 ##
-##                     The LLVM Compiler Infrastructure
+# The LLVM Compiler Infrastructure
 ##
-## This file is distributed under the University of Illinois Open Source
-## License. See LICENSE.TXT for details.
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
 ##
 ##===----------------------------------------------------------------------===##
 
 
-
 import curses
 
 import os
@@ -22,52 +21,55 @@ import cui
 
 event_queue = None
 
+
 class SandboxUI(cui.CursesUI):
-  def __init__(self, screen, event_queue):
-    super(SandboxUI, self).__init__(screen, event_queue)
 
-    height, width = self.screen.getmaxyx()
-    w2 = width / 2
-    h2 = height / 2
-
-    self.wins = []
-    #self.wins.append(cui.TitledWin(w2, h2, w2, h2, "Test Window 4"))
-    list_win = cui.ListWin(w2, h2, w2, h2)
-    for i in range(0, 40):
-      list_win.addItem('Item %s' % i)
-    self.wins.append(list_win)
-    self.wins.append(cui.TitledWin( 0,  0, w2, h2, "Test Window 1"))
-    self.wins.append(cui.TitledWin(w2,  0, w2, h2, "Test Window 2"))
-    self.wins.append(cui.TitledWin( 0, h2, w2, h2, "Test Window 3"))
-
-    #def callback(s, content):
-    #  self.wins[0].win.scroll(1)
-    #  self.wins[0].win.addstr(10, 0, '%s: %s' % (s, content))
-    #  self.wins[0].win.scroll(1)
-    #  self.el.showPrompt(10, 0)
-
-    #self.wins[0].win.scrollok(1)
-    #self.el = cui.CursesEditLine(self.wins[0].win, None,
-    #  lambda c: callback('got', c), lambda c: callback('tab', c))
-    #self.el.prompt = '>>> '
-    #self.el.showPrompt(10, 0)
-
-  def handleEvent(self, event):
-    if isinstance(event, int):
-      if event == ord('q'):
-        sys.exit(0)
-      #self.el.handleEvent(event)
-    super(SandboxUI, self).handleEvent(event)
+    def __init__(self, screen, event_queue):
+        super(SandboxUI, self).__init__(screen, event_queue)
+
+        height, width = self.screen.getmaxyx()
+        w2 = width / 2
+        h2 = height / 2
+
+        self.wins = []
+        #self.wins.append(cui.TitledWin(w2, h2, w2, h2, "Test Window 4"))
+        list_win = cui.ListWin(w2, h2, w2, h2)
+        for i in range(0, 40):
+            list_win.addItem('Item %s' % i)
+        self.wins.append(list_win)
+        self.wins.append(cui.TitledWin(0, 0, w2, h2, "Test Window 1"))
+        self.wins.append(cui.TitledWin(w2, 0, w2, h2, "Test Window 2"))
+        self.wins.append(cui.TitledWin(0, h2, w2, h2, "Test Window 3"))
+
+        # def callback(s, content):
+        #  self.wins[0].win.scroll(1)
+        #  self.wins[0].win.addstr(10, 0, '%s: %s' % (s, content))
+        #  self.wins[0].win.scroll(1)
+        #  self.el.showPrompt(10, 0)
+
+        # self.wins[0].win.scrollok(1)
+        # self.el = cui.CursesEditLine(self.wins[0].win, None,
+        #  lambda c: callback('got', c), lambda c: callback('tab', c))
+        #self.el.prompt = '>>> '
+        #self.el.showPrompt(10, 0)
+
+    def handleEvent(self, event):
+        if isinstance(event, int):
+            if event == ord('q'):
+                sys.exit(0)
+            # self.el.handleEvent(event)
+        super(SandboxUI, self).handleEvent(event)
+
 
 def main(screen):
-  global event_queue
-  event_queue = Queue.Queue()
+    global event_queue
+    event_queue = Queue.Queue()
 
-  sandbox = SandboxUI(screen, event_queue)
-  sandbox.eventLoop()
+    sandbox = SandboxUI(screen, event_queue)
+    sandbox.eventLoop()
 
 if __name__ == "__main__":
-  try:
-    curses.wrapper(main)
-  except KeyboardInterrupt:
-    exit()
+    try:
+        curses.wrapper(main)
+    except KeyboardInterrupt:
+        exit()

Modified: lldb/trunk/utils/lui/sourcewin.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lui/sourcewin.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/lui/sourcewin.py (original)
+++ lldb/trunk/utils/lui/sourcewin.py Tue Sep  6 15:57:50 2016
@@ -1,232 +1,239 @@
 ##===-- sourcewin.py -----------------------------------------*- Python -*-===##
 ##
-##                     The LLVM Compiler Infrastructure
+# The LLVM Compiler Infrastructure
 ##
-## This file is distributed under the University of Illinois Open Source
-## License. See LICENSE.TXT for details.
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
 ##
 ##===----------------------------------------------------------------------===##
 
 import cui
 import curses
-import lldb, lldbutil
+import lldb
+import lldbutil
 import re
 import os
 
+
 class SourceWin(cui.TitledWin):
-  def __init__(self, driver, x, y, w, h):
-    super(SourceWin, self).__init__(x, y, w, h, "Source")
-    self.sourceman = driver.getSourceManager()
-    self.sources = {}
-
-    self.filename= None
-    self.pc_line = None
-    self.viewline = 0
-
-    self.breakpoints = { }
-
-    self.win.scrollok(1)
-
-    self.markerPC = ":) "
-    self.markerBP = "B> "
-    self.markerNone  = "   "
-
-    try:
-      from pygments.formatters import TerminalFormatter
-      self.formatter = TerminalFormatter()
-    except ImportError:
-      #self.win.addstr("\nWarning: no 'pygments' library found. Syntax highlighting is disabled.")
-      self.lexer = None
-      self.formatter = None
-      pass
-
-    # FIXME: syntax highlight broken
-    self.formatter = None
-    self.lexer = None
-
-  def handleEvent(self, event):
-    if isinstance(event, int):
-      self.handleKey(event)
-      return
-
-    if isinstance(event, lldb.SBEvent):
-      if lldb.SBBreakpoint.EventIsBreakpointEvent(event):
-        self.handleBPEvent(event)
-
-      if lldb.SBProcess.EventIsProcessEvent(event) and \
-          not lldb.SBProcess.GetRestartedFromEvent(event):
-        process = lldb.SBProcess.GetProcessFromEvent(event)
-        if not process.IsValid():
-          return
-        if process.GetState() == lldb.eStateStopped:
-          self.refreshSource(process)
-        elif process.GetState() == lldb.eStateExited:
-          self.notifyExited(process)
-
-  def notifyExited(self, process):
-    self.win.erase()
-    target = lldbutil.get_description(process.GetTarget())
-    pid = process.GetProcessID()
-    ec = process.GetExitStatus()
-    self.win.addstr("\nProcess %s [%d] has exited with exit-code %d" % (target, pid, ec))
-
-  def pageUp(self):
-    if self.viewline > 0:
-      self.viewline = self.viewline - 1
-      self.refreshSource()
-
-  def pageDown(self):
-    if self.viewline < len(self.content) - self.height + 1:
-      self.viewline = self.viewline + 1
-      self.refreshSource()
-    pass
-
-  def handleKey(self, key):
-    if key == curses.KEY_DOWN:
-      self.pageDown()
-    elif key == curses.KEY_UP:
-      self.pageUp()
-
-  def updateViewline(self):
-    half = self.height / 2
-    if self.pc_line < half:
-      self.viewline = 0
-    else:
-      self.viewline = self.pc_line - half + 1
-
-    if self.viewline < 0:
-      raise Exception("negative viewline: pc=%d viewline=%d" % (self.pc_line, self.viewline))
-
-  def refreshSource(self, process = None):
-    (self.height, self.width) = self.win.getmaxyx()
-
-    if process is not None:
-      loc = process.GetSelectedThread().GetSelectedFrame().GetLineEntry()
-      f = loc.GetFileSpec()
-      self.pc_line = loc.GetLine()
-
-      if not f.IsValid():
-        self.win.addstr(0, 0, "Invalid source file")
-        return
-
-      self.filename = f.GetFilename()
-      path = os.path.join(f.GetDirectory(), self.filename)
-      self.setTitle(path)
-      self.content = self.getContent(path)
-      self.updateViewline()
-
-    if self.filename is None:
-      return
-   
-    if self.formatter is not None:
-      from pygments.lexers import get_lexer_for_filename
-      self.lexer = get_lexer_for_filename(self.filename)
-
-    bps = [] if not self.filename in self.breakpoints else self.breakpoints[self.filename]
-    self.win.erase()
-    if self.content:
-      self.formatContent(self.content, self.pc_line, bps)
-
-  def getContent(self, path):
-    content = []
-    if path in self.sources:
-      content = self.sources[path]
-    else:
-      if os.path.exists(path): 
-        with open(path) as x:
-          content = x.readlines()
-        self.sources[path] = content
-    return content
-
-  def formatContent(self, content, pc_line, breakpoints):
-    source = ""
-    count = 1
-    self.win.erase()
-    end = min(len(content), self.viewline + self.height)
-    for i in range(self.viewline, end):
-      line_num = i + 1
-      marker = self.markerNone
-      attr = curses.A_NORMAL
-      if line_num == pc_line:
-        attr = curses.A_REVERSE
-      if line_num in breakpoints:
-        marker = self.markerBP
-      line = "%s%3d %s" % (marker, line_num, self.highlight(content[i]))
-      if len(line) >= self.width:
-        line = line[0:self.width-1] + "\n"
-      self.win.addstr(line, attr)
-      source += line
-      count = count + 1
-    return source
-
-  def highlight(self, source):
-    if self.lexer and self.formatter:
-      from pygments import highlight
-      return highlight(source, self.lexer, self.formatter)
-    else:
-      return source
-
-  def addBPLocations(self, locations):
-    for path in locations:
-      lines = locations[path]
-      if path in self.breakpoints:
-        self.breakpoints[path].update(lines)
-      else:
-        self.breakpoints[path] = lines
-
-  def removeBPLocations(self, locations):
-    for path in locations:
-      lines = locations[path]
-      if path in self.breakpoints:
-        self.breakpoints[path].difference_update(lines)
-      else:
-        raise "Removing locations that were never added...no good"
-
-  def handleBPEvent(self, event):
-    def getLocations(event):
-      locs = {}
-
-      bp = lldb.SBBreakpoint.GetBreakpointFromEvent(event)
-
-      if bp.IsInternal():
-        # don't show anything for internal breakpoints
-        return
-
-      for location in bp:
-        # hack! getting the LineEntry via SBBreakpointLocation.GetAddress.GetLineEntry does not work good for
-        # inlined frames, so we get the description (which does take into account inlined functions) and parse it.
-        desc = lldbutil.get_description(location, lldb.eDescriptionLevelFull)
-        match = re.search('at\ ([^:]+):([\d]+)', desc)
-        try:
-          path = match.group(1)
-          line = int(match.group(2).strip())
-        except ValueError as e:
-          # bp loc unparsable
-          continue
 
-        if path in locs:
-          locs[path].add(line)
-        else:
-          locs[path] = set([line])
-      return locs
+    def __init__(self, driver, x, y, w, h):
+        super(SourceWin, self).__init__(x, y, w, h, "Source")
+        self.sourceman = driver.getSourceManager()
+        self.sources = {}
+
+        self.filename = None
+        self.pc_line = None
+        self.viewline = 0
+
+        self.breakpoints = {}
+
+        self.win.scrollok(1)
+
+        self.markerPC = ":) "
+        self.markerBP = "B> "
+        self.markerNone = "   "
 
-    event_type = lldb.SBBreakpoint.GetBreakpointEventTypeFromEvent(event)
-    if event_type == lldb.eBreakpointEventTypeEnabled \
-        or event_type == lldb.eBreakpointEventTypeAdded \
-        or event_type == lldb.eBreakpointEventTypeLocationsResolved \
-        or event_type == lldb.eBreakpointEventTypeLocationsAdded:
-      self.addBPLocations(getLocations(event))
-    elif event_type == lldb.eBreakpointEventTypeRemoved \
-        or event_type == lldb.eBreakpointEventTypeLocationsRemoved \
-        or event_type == lldb.eBreakpointEventTypeDisabled:
-      self.removeBPLocations(getLocations(event))
-    elif event_type == lldb.eBreakpointEventTypeCommandChanged \
-        or event_type == lldb.eBreakpointEventTypeConditionChanged \
-        or event_type == lldb.eBreakpointEventTypeIgnoreChanged \
-        or event_type == lldb.eBreakpointEventTypeThreadChanged \
-        or event_type == lldb.eBreakpointEventTypeInvalidType:
-      # no-op
-      pass
-    self.refreshSource()
+        try:
+            from pygments.formatters import TerminalFormatter
+            self.formatter = TerminalFormatter()
+        except ImportError:
+            #self.win.addstr("\nWarning: no 'pygments' library found. Syntax highlighting is disabled.")
+            self.lexer = None
+            self.formatter = None
+            pass
+
+        # FIXME: syntax highlight broken
+        self.formatter = None
+        self.lexer = None
+
+    def handleEvent(self, event):
+        if isinstance(event, int):
+            self.handleKey(event)
+            return
+
+        if isinstance(event, lldb.SBEvent):
+            if lldb.SBBreakpoint.EventIsBreakpointEvent(event):
+                self.handleBPEvent(event)
+
+            if lldb.SBProcess.EventIsProcessEvent(event) and \
+                    not lldb.SBProcess.GetRestartedFromEvent(event):
+                process = lldb.SBProcess.GetProcessFromEvent(event)
+                if not process.IsValid():
+                    return
+                if process.GetState() == lldb.eStateStopped:
+                    self.refreshSource(process)
+                elif process.GetState() == lldb.eStateExited:
+                    self.notifyExited(process)
+
+    def notifyExited(self, process):
+        self.win.erase()
+        target = lldbutil.get_description(process.GetTarget())
+        pid = process.GetProcessID()
+        ec = process.GetExitStatus()
+        self.win.addstr(
+            "\nProcess %s [%d] has exited with exit-code %d" %
+            (target, pid, ec))
+
+    def pageUp(self):
+        if self.viewline > 0:
+            self.viewline = self.viewline - 1
+            self.refreshSource()
+
+    def pageDown(self):
+        if self.viewline < len(self.content) - self.height + 1:
+            self.viewline = self.viewline + 1
+            self.refreshSource()
+        pass
+
+    def handleKey(self, key):
+        if key == curses.KEY_DOWN:
+            self.pageDown()
+        elif key == curses.KEY_UP:
+            self.pageUp()
+
+    def updateViewline(self):
+        half = self.height / 2
+        if self.pc_line < half:
+            self.viewline = 0
+        else:
+            self.viewline = self.pc_line - half + 1
 
+        if self.viewline < 0:
+            raise Exception(
+                "negative viewline: pc=%d viewline=%d" %
+                (self.pc_line, self.viewline))
+
+    def refreshSource(self, process=None):
+        (self.height, self.width) = self.win.getmaxyx()
+
+        if process is not None:
+            loc = process.GetSelectedThread().GetSelectedFrame().GetLineEntry()
+            f = loc.GetFileSpec()
+            self.pc_line = loc.GetLine()
+
+            if not f.IsValid():
+                self.win.addstr(0, 0, "Invalid source file")
+                return
+
+            self.filename = f.GetFilename()
+            path = os.path.join(f.GetDirectory(), self.filename)
+            self.setTitle(path)
+            self.content = self.getContent(path)
+            self.updateViewline()
+
+        if self.filename is None:
+            return
+
+        if self.formatter is not None:
+            from pygments.lexers import get_lexer_for_filename
+            self.lexer = get_lexer_for_filename(self.filename)
+
+        bps = [] if not self.filename in self.breakpoints else self.breakpoints[self.filename]
+        self.win.erase()
+        if self.content:
+            self.formatContent(self.content, self.pc_line, bps)
+
+    def getContent(self, path):
+        content = []
+        if path in self.sources:
+            content = self.sources[path]
+        else:
+            if os.path.exists(path):
+                with open(path) as x:
+                    content = x.readlines()
+                self.sources[path] = content
+        return content
+
+    def formatContent(self, content, pc_line, breakpoints):
+        source = ""
+        count = 1
+        self.win.erase()
+        end = min(len(content), self.viewline + self.height)
+        for i in range(self.viewline, end):
+            line_num = i + 1
+            marker = self.markerNone
+            attr = curses.A_NORMAL
+            if line_num == pc_line:
+                attr = curses.A_REVERSE
+            if line_num in breakpoints:
+                marker = self.markerBP
+            line = "%s%3d %s" % (marker, line_num, self.highlight(content[i]))
+            if len(line) >= self.width:
+                line = line[0:self.width - 1] + "\n"
+            self.win.addstr(line, attr)
+            source += line
+            count = count + 1
+        return source
+
+    def highlight(self, source):
+        if self.lexer and self.formatter:
+            from pygments import highlight
+            return highlight(source, self.lexer, self.formatter)
+        else:
+            return source
 
+    def addBPLocations(self, locations):
+        for path in locations:
+            lines = locations[path]
+            if path in self.breakpoints:
+                self.breakpoints[path].update(lines)
+            else:
+                self.breakpoints[path] = lines
+
+    def removeBPLocations(self, locations):
+        for path in locations:
+            lines = locations[path]
+            if path in self.breakpoints:
+                self.breakpoints[path].difference_update(lines)
+            else:
+                raise "Removing locations that were never added...no good"
+
+    def handleBPEvent(self, event):
+        def getLocations(event):
+            locs = {}
+
+            bp = lldb.SBBreakpoint.GetBreakpointFromEvent(event)
+
+            if bp.IsInternal():
+                # don't show anything for internal breakpoints
+                return
+
+            for location in bp:
+                # hack! getting the LineEntry via SBBreakpointLocation.GetAddress.GetLineEntry does not work good for
+                # inlined frames, so we get the description (which does take
+                # into account inlined functions) and parse it.
+                desc = lldbutil.get_description(
+                    location, lldb.eDescriptionLevelFull)
+                match = re.search('at\ ([^:]+):([\d]+)', desc)
+                try:
+                    path = match.group(1)
+                    line = int(match.group(2).strip())
+                except ValueError as e:
+                    # bp loc unparsable
+                    continue
+
+                if path in locs:
+                    locs[path].add(line)
+                else:
+                    locs[path] = set([line])
+            return locs
+
+        event_type = lldb.SBBreakpoint.GetBreakpointEventTypeFromEvent(event)
+        if event_type == lldb.eBreakpointEventTypeEnabled \
+                or event_type == lldb.eBreakpointEventTypeAdded \
+                or event_type == lldb.eBreakpointEventTypeLocationsResolved \
+                or event_type == lldb.eBreakpointEventTypeLocationsAdded:
+            self.addBPLocations(getLocations(event))
+        elif event_type == lldb.eBreakpointEventTypeRemoved \
+                or event_type == lldb.eBreakpointEventTypeLocationsRemoved \
+                or event_type == lldb.eBreakpointEventTypeDisabled:
+            self.removeBPLocations(getLocations(event))
+        elif event_type == lldb.eBreakpointEventTypeCommandChanged \
+                or event_type == lldb.eBreakpointEventTypeConditionChanged \
+                or event_type == lldb.eBreakpointEventTypeIgnoreChanged \
+                or event_type == lldb.eBreakpointEventTypeThreadChanged \
+                or event_type == lldb.eBreakpointEventTypeInvalidType:
+            # no-op
+            pass
+        self.refreshSource()

Modified: lldb/trunk/utils/lui/statuswin.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lui/statuswin.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/lui/statuswin.py (original)
+++ lldb/trunk/utils/lui/statuswin.py Tue Sep  6 15:57:50 2016
@@ -1,40 +1,42 @@
 ##===-- statuswin.py -----------------------------------------*- Python -*-===##
 ##
-##                     The LLVM Compiler Infrastructure
+# The LLVM Compiler Infrastructure
 ##
-## This file is distributed under the University of Illinois Open Source
-## License. See LICENSE.TXT for details.
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
 ##
 ##===----------------------------------------------------------------------===##
 
-import lldb, lldbutil
+import lldb
+import lldbutil
 import cui
 import curses
 
+
 class StatusWin(cui.TextWin):
-  def __init__(self, x, y, w, h):
-    super(StatusWin, self).__init__(x, y, w)
 
-    self.keys = [#('F1', 'Help', curses.KEY_F1),
-                 ('F3', 'Cycle-focus', curses.KEY_F3),
-                 ('F10', 'Quit', curses.KEY_F10)]
-
-  def draw(self):
-    self.win.addstr(0, 0, '')
-    for key in self.keys:
-      self.win.addstr('{0}'.format(key[0]), curses.A_REVERSE)
-      self.win.addstr(' {0} '.format(key[1]), curses.A_NORMAL)
-    super(StatusWin, self).draw()
-
-  def handleEvent(self, event):
-    if isinstance(event, int):
-      pass
-    elif isinstance(event, lldb.SBEvent):
-      if lldb.SBProcess.EventIsProcessEvent(event):
-        state = lldb.SBProcess.GetStateFromEvent(event)
-        status = lldbutil.state_type_to_str(state)
-        self.win.erase()
-        x = self.win.getmaxyx()[1] - len(status) - 1
-        self.win.addstr(0, x, status)
-    return
+    def __init__(self, x, y, w, h):
+        super(StatusWin, self).__init__(x, y, w)
 
+        self.keys = [  # ('F1', 'Help', curses.KEY_F1),
+            ('F3', 'Cycle-focus', curses.KEY_F3),
+            ('F10', 'Quit', curses.KEY_F10)]
+
+    def draw(self):
+        self.win.addstr(0, 0, '')
+        for key in self.keys:
+            self.win.addstr('{0}'.format(key[0]), curses.A_REVERSE)
+            self.win.addstr(' {0} '.format(key[1]), curses.A_NORMAL)
+        super(StatusWin, self).draw()
+
+    def handleEvent(self, event):
+        if isinstance(event, int):
+            pass
+        elif isinstance(event, lldb.SBEvent):
+            if lldb.SBProcess.EventIsProcessEvent(event):
+                state = lldb.SBProcess.GetStateFromEvent(event)
+                status = lldbutil.state_type_to_str(state)
+                self.win.erase()
+                x = self.win.getmaxyx()[1] - len(status) - 1
+                self.win.addstr(0, x, status)
+        return

Modified: lldb/trunk/utils/misc/grep-svn-log.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/misc/grep-svn-log.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/misc/grep-svn-log.py (original)
+++ lldb/trunk/utils/misc/grep-svn-log.py Tue Sep  6 15:57:50 2016
@@ -9,7 +9,10 @@ Example:
 svn log -v | grep-svn-log.py '^   D.+why_are_you_missing.h$'
 """
 
-import fileinput, re, sys, StringIO
+import fileinput
+import re
+import sys
+import StringIO
 
 # Separator string for "svn log -v" output.
 separator = '-' * 72
@@ -18,30 +21,37 @@ usage = """Usage: grep-svn-log.py line-p
 Example:
     svn log -v | grep-svn-log.py '^   D.+why_are_you_missing.h'"""
 
+
 class Log(StringIO.StringIO):
     """Simple facade to keep track of the log content."""
+
     def __init__(self):
         self.reset()
+
     def add_line(self, a_line):
         """Add a line to the content, if there is a previous line, commit it."""
         global separator
-        if self.prev_line != None:
+        if self.prev_line is not None:
             print >> self, self.prev_line
         self.prev_line = a_line
         self.separator_added = (a_line == separator)
+
     def del_line(self):
         """Forget about the previous line, do not commit it."""
         self.prev_line = None
+
     def reset(self):
         """Forget about the previous lines entered."""
         StringIO.StringIO.__init__(self)
         self.prev_line = None
+
     def finish(self):
         """Call this when you're finished with populating content."""
-        if self.prev_line != None:
+        if self.prev_line is not None:
             print >> self, self.prev_line
         self.prev_line = None
 
+
 def grep(regexp):
     # The log content to be written out once a match is found.
     log = Log()
@@ -50,7 +60,7 @@ def grep(regexp):
     FOUND_LINE_MATCH = 1
     state = LOOKING_FOR_MATCH
 
-    while 1:
+    while True:
         line = sys.stdin.readline()
         if not line:
             return
@@ -72,6 +82,7 @@ def grep(regexp):
             if regexp.search(line):
                 state = FOUND_LINE_MATCH
 
+
 def main():
     if len(sys.argv) != 2:
         print usage

Modified: lldb/trunk/utils/sync-source/lib/transfer/protocol.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/sync-source/lib/transfer/protocol.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/sync-source/lib/transfer/protocol.py (original)
+++ lldb/trunk/utils/sync-source/lib/transfer/protocol.py Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
 class Protocol(object):
+
     def __init__(self, options, config):
         self.options = options
         self.config = config

Modified: lldb/trunk/utils/sync-source/lib/transfer/rsync.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/sync-source/lib/transfer/rsync.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/sync-source/lib/transfer/rsync.py (original)
+++ lldb/trunk/utils/sync-source/lib/transfer/rsync.py Tue Sep  6 15:57:50 2016
@@ -7,6 +7,7 @@ import transfer.protocol
 
 
 class RsyncOverSsh(transfer.protocol.Protocol):
+
     def __init__(self, options, config):
         super(RsyncOverSsh, self).__init__(options, config)
         self.ssh_config = config.get_value("ssh")

Modified: lldb/trunk/utils/sync-source/lib/transfer/transfer_spec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/sync-source/lib/transfer/transfer_spec.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/sync-source/lib/transfer/transfer_spec.py (original)
+++ lldb/trunk/utils/sync-source/lib/transfer/transfer_spec.py Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
 class TransferSpec(object):
+
     def __init__(self, source_path, exclude_paths, dest_path):
         self.source_path = source_path
         self.exclude_paths = exclude_paths

Modified: lldb/trunk/utils/sync-source/syncsource.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/sync-source/syncsource.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/sync-source/syncsource.py (original)
+++ lldb/trunk/utils/sync-source/syncsource.py Tue Sep  6 15:57:50 2016
@@ -33,6 +33,7 @@ DOTRC_BASE_FILENAME = ".syncsourcerc"
 
 class Configuration(object):
     """Provides chaining configuration lookup."""
+
     def __init__(self, rcdata_configs):
         self.__rcdata_configs = rcdata_configs
 

Modified: lldb/trunk/utils/test/disasm.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/test/disasm.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/test/disasm.py (original)
+++ lldb/trunk/utils/test/disasm.py Tue Sep  6 15:57:50 2016
@@ -10,10 +10,12 @@ import os
 import sys
 from optparse import OptionParser
 
+
 def is_exe(fpath):
     """Check whether fpath is an executable."""
     return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
 
+
 def which(program):
     """Find the full path to a program, or return None."""
     fpath, fname = os.path.split(program)
@@ -27,8 +29,15 @@ def which(program):
                 return exe_file
     return None
 
-def do_llvm_mc_disassembly(gdb_commands, gdb_options, exe, func, mc, mc_options):
-    from cStringIO import StringIO 
+
+def do_llvm_mc_disassembly(
+        gdb_commands,
+        gdb_options,
+        exe,
+        func,
+        mc,
+        mc_options):
+    from cStringIO import StringIO
     import pexpect
 
     gdb_prompt = "\r\n\(gdb\) "
@@ -37,7 +46,8 @@ def do_llvm_mc_disassembly(gdb_commands,
     gdb.logfile_read = sys.stdout
     gdb.expect(gdb_prompt)
 
-    # See if there any extra command(s) to execute before we issue the file command.
+    # See if there any extra command(s) to execute before we issue the file
+    # command.
     for cmd in gdb_commands:
         gdb.sendline(cmd)
         gdb.expect(gdb_prompt)
@@ -93,12 +103,14 @@ def do_llvm_mc_disassembly(gdb_commands,
             # Get the last output line from the gdb examine memory command,
             # split the string into a 3-tuple with separator '>:' to handle
             # objc method names.
-            memory_dump = x_output.split(os.linesep)[-1].partition('>:')[2].strip()
-            #print "\nbytes:", memory_dump
+            memory_dump = x_output.split(
+                os.linesep)[-1].partition('>:')[2].strip()
+            # print "\nbytes:", memory_dump
             disasm_str = prev_line.partition('>:')[2]
             print >> mc_input, '%s # %s' % (memory_dump, disasm_str)
 
-        # We're done with the processing.  Assign the current line to be prev_line.
+        # We're done with the processing.  Assign the current line to be
+        # prev_line.
         prev_line = line
 
     # Close the gdb session now that we are done with it.
@@ -117,15 +129,21 @@ def do_llvm_mc_disassembly(gdb_commands,
     # And invoke llvm-mc with the just recorded file.
     #mc = pexpect.spawn('%s -disassemble %s disasm-input.txt' % (mc, mc_options))
     #mc.logfile_read = sys.stdout
-    #print "mc:", mc
-    #mc.close()
-    
+    # print "mc:", mc
+    # mc.close()
+
 
 def main():
     # This is to set up the Python path to include the pexpect-2.4 dir.
     # Remember to update this when/if things change.
     scriptPath = sys.path[0]
-    sys.path.append(os.path.join(scriptPath, os.pardir, os.pardir, 'test', 'pexpect-2.4'))
+    sys.path.append(
+        os.path.join(
+            scriptPath,
+            os.pardir,
+            os.pardir,
+            'test',
+            'pexpect-2.4'))
 
     parser = OptionParser(usage="""\
 Run gdb to disassemble a function, feed the bytes to 'llvm-mc -disassemble' command,
@@ -133,32 +151,46 @@ and display the disassembly result.
 
 Usage: %prog [options]
 """)
-    parser.add_option('-C', '--gdb-command',
-                      type='string', action='append', metavar='COMMAND',
-                      default=[], dest='gdb_commands',
-                      help='Command(s) gdb executes after starting up (can be empty)')
-    parser.add_option('-O', '--gdb-options',
-                      type='string', action='store',
-                      dest='gdb_options',
-                      help="""The options passed to 'gdb' command if specified.""")
+    parser.add_option(
+        '-C',
+        '--gdb-command',
+        type='string',
+        action='append',
+        metavar='COMMAND',
+        default=[],
+        dest='gdb_commands',
+        help='Command(s) gdb executes after starting up (can be empty)')
+    parser.add_option(
+        '-O',
+        '--gdb-options',
+        type='string',
+        action='store',
+        dest='gdb_options',
+        help="""The options passed to 'gdb' command if specified.""")
     parser.add_option('-e', '--executable',
                       type='string', action='store',
                       dest='executable',
                       help="""The executable to do disassembly on.""")
-    parser.add_option('-f', '--function',
-                      type='string', action='store',
-                      dest='function',
-                      help="""The function name (could be an address to gdb) for disassembly.""")
+    parser.add_option(
+        '-f',
+        '--function',
+        type='string',
+        action='store',
+        dest='function',
+        help="""The function name (could be an address to gdb) for disassembly.""")
     parser.add_option('-m', '--llvm-mc',
                       type='string', action='store',
                       dest='llvm_mc',
                       help="""The llvm-mc executable full path, if specified.
                       Otherwise, it must be present in your PATH environment.""")
 
-    parser.add_option('-o', '--options',
-                      type='string', action='store',
-                      dest='llvm_mc_options',
-                      help="""The options passed to 'llvm-mc -disassemble' command if specified.""")
+    parser.add_option(
+        '-o',
+        '--options',
+        type='string',
+        action='store',
+        dest='llvm_mc_options',
+        help="""The options passed to 'llvm-mc -disassemble' command if specified.""")
 
     opts, args = parser.parse_args()
 
@@ -192,7 +224,13 @@ Usage: %prog [options]
     print "llvm-mc:", llvm_mc
     print "llvm-mc options:", llvm_mc_options
 
-    do_llvm_mc_disassembly(gdb_commands, gdb_options, executable, function, llvm_mc, llvm_mc_options)
+    do_llvm_mc_disassembly(
+        gdb_commands,
+        gdb_options,
+        executable,
+        function,
+        llvm_mc,
+        llvm_mc_options)
 
 if __name__ == '__main__':
     main()

Modified: lldb/trunk/utils/test/lldb-disasm.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/test/lldb-disasm.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/test/lldb-disasm.py (original)
+++ lldb/trunk/utils/test/lldb-disasm.py Tue Sep  6 15:57:50 2016
@@ -10,6 +10,7 @@ import re
 import sys
 from optparse import OptionParser
 
+
 def setupSysPath():
     """
     Add LLDB.framework/Resources/Python and the test dir to the sys.path.
@@ -24,7 +25,7 @@ def setupSysPath():
     base = os.path.abspath(os.path.join(scriptPath, os.pardir, os.pardir))
 
     # This is for the goodies in the test directory under base.
-    sys.path.append(os.path.join(base,'test'))
+    sys.path.append(os.path.join(base, 'test'))
 
     # These are for xcode build directories.
     xcode3_build_dir = ['build']
@@ -34,12 +35,18 @@ def setupSysPath():
     bai = ['BuildAndIntegration']
     python_resource_dir = ['LLDB.framework', 'Resources', 'Python']
 
-    dbgPath  = os.path.join(base, *(xcode3_build_dir + dbg + python_resource_dir))
-    dbgPath2 = os.path.join(base, *(xcode4_build_dir + dbg + python_resource_dir))
-    relPath  = os.path.join(base, *(xcode3_build_dir + rel + python_resource_dir))
-    relPath2 = os.path.join(base, *(xcode4_build_dir + rel + python_resource_dir))
-    baiPath  = os.path.join(base, *(xcode3_build_dir + bai + python_resource_dir))
-    baiPath2 = os.path.join(base, *(xcode4_build_dir + bai + python_resource_dir))
+    dbgPath = os.path.join(
+        base, *(xcode3_build_dir + dbg + python_resource_dir))
+    dbgPath2 = os.path.join(
+        base, *(xcode4_build_dir + dbg + python_resource_dir))
+    relPath = os.path.join(
+        base, *(xcode3_build_dir + rel + python_resource_dir))
+    relPath2 = os.path.join(
+        base, *(xcode4_build_dir + rel + python_resource_dir))
+    baiPath = os.path.join(
+        base, *(xcode3_build_dir + bai + python_resource_dir))
+    baiPath2 = os.path.join(
+        base, *(xcode4_build_dir + bai + python_resource_dir))
 
     lldbPath = None
     if os.path.isfile(os.path.join(dbgPath, 'lldb.py')):
@@ -62,7 +69,7 @@ def setupSysPath():
 
     # This is to locate the lldb.py module.  Insert it right after sys.path[0].
     sys.path[1:1] = [lldbPath]
-    #print "sys.path:", sys.path
+    # print "sys.path:", sys.path
 
 
 def run_command(ci, cmd, res, echo=True):
@@ -77,16 +84,19 @@ def run_command(ci, cmd, res, echo=True)
             print "run command failed!"
             print "run_command error:", res.GetError()
 
+
 def do_lldb_disassembly(lldb_commands, exe, disassemble_options, num_symbols,
                         symbols_to_disassemble,
                         re_symbol_pattern,
                         quiet_disassembly):
-    import lldb, atexit, re
+    import lldb
+    import atexit
+    import re
 
     # Create the debugger instance now.
     dbg = lldb.SBDebugger.Create()
     if not dbg:
-            raise Exception('Invalid debugger instance')
+        raise Exception('Invalid debugger instance')
 
     # Register an exit callback.
     atexit.register(lambda: lldb.SBDebugger.Terminate())
@@ -102,7 +112,8 @@ def do_lldb_disassembly(lldb_commands, e
     # And the associated result object.
     res = lldb.SBCommandReturnObject()
 
-    # See if there any extra command(s) to execute before we issue the file command.
+    # See if there any extra command(s) to execute before we issue the file
+    # command.
     for cmd in lldb_commands:
         run_command(ci, cmd, res, not quiet_disassembly)
 
@@ -141,7 +152,8 @@ def do_lldb_disassembly(lldb_commands, e
                         return
                     # If a regexp symbol pattern is supplied, consult it.
                     if re_symbol_pattern:
-                        # If the pattern does not match, look for the next symbol.
+                        # If the pattern does not match, look for the next
+                        # symbol.
                         if not pattern.match(s.GetName()):
                             continue
 
@@ -162,7 +174,12 @@ def do_lldb_disassembly(lldb_commands, e
                         stream.Clear()
 
     # Disassembly time.
-    for symbol in symbol_iter(num_symbols, symbols_to_disassemble, re_symbol_pattern, target, not quiet_disassembly):
+    for symbol in symbol_iter(
+            num_symbols,
+            symbols_to_disassemble,
+            re_symbol_pattern,
+            target,
+            not quiet_disassembly):
         cmd = "disassemble %s '%s'" % (disassemble_options, symbol)
         run_command(ci, cmd, res, not quiet_disassembly)
 
@@ -171,42 +188,74 @@ def main():
     # This is to set up the Python path to include the pexpect-2.4 dir.
     # Remember to update this when/if things change.
     scriptPath = sys.path[0]
-    sys.path.append(os.path.join(scriptPath, os.pardir, os.pardir, 'test', 'pexpect-2.4'))
+    sys.path.append(
+        os.path.join(
+            scriptPath,
+            os.pardir,
+            os.pardir,
+            'test',
+            'pexpect-2.4'))
 
     parser = OptionParser(usage="""\
 Run lldb to disassemble all the available functions for an executable image.
 
 Usage: %prog [options]
 """)
-    parser.add_option('-C', '--lldb-command',
-                      type='string', action='append', metavar='COMMAND',
-                      default=[], dest='lldb_commands',
-                      help='Command(s) lldb executes after starting up (can be empty)')
-    parser.add_option('-e', '--executable',
-                      type='string', action='store',
-                      dest='executable',
-                      help="""Mandatory: the executable to do disassembly on.""")
-    parser.add_option('-o', '--options',
-                      type='string', action='store',
-                      dest='disassemble_options',
-                      help="""Mandatory: the options passed to lldb's 'disassemble' command.""")
-    parser.add_option('-q', '--quiet-disassembly',
-                      action='store_true', default=False,
-                      dest='quiet_disassembly',
-                      help="""The symbol(s) to invoke lldb's 'disassemble' command on, if specified.""")
-    parser.add_option('-n', '--num-symbols',
-                      type='int', action='store', default=-1,
-                      dest='num_symbols',
-                      help="""The number of symbols to disassemble, if specified.""")
-    parser.add_option('-p', '--symbol_pattern',
-                      type='string', action='store',
-                      dest='re_symbol_pattern',
-                      help="""The regular expression of symbols to invoke lldb's 'disassemble' command.""")
-    parser.add_option('-s', '--symbol',
-                      type='string', action='append', metavar='SYMBOL', default=[],
-                      dest='symbols_to_disassemble',
-                      help="""The symbol(s) to invoke lldb's 'disassemble' command on, if specified.""")
-    
+    parser.add_option(
+        '-C',
+        '--lldb-command',
+        type='string',
+        action='append',
+        metavar='COMMAND',
+        default=[],
+        dest='lldb_commands',
+        help='Command(s) lldb executes after starting up (can be empty)')
+    parser.add_option(
+        '-e',
+        '--executable',
+        type='string',
+        action='store',
+        dest='executable',
+        help="""Mandatory: the executable to do disassembly on.""")
+    parser.add_option(
+        '-o',
+        '--options',
+        type='string',
+        action='store',
+        dest='disassemble_options',
+        help="""Mandatory: the options passed to lldb's 'disassemble' command.""")
+    parser.add_option(
+        '-q',
+        '--quiet-disassembly',
+        action='store_true',
+        default=False,
+        dest='quiet_disassembly',
+        help="""The symbol(s) to invoke lldb's 'disassemble' command on, if specified.""")
+    parser.add_option(
+        '-n',
+        '--num-symbols',
+        type='int',
+        action='store',
+        default=-1,
+        dest='num_symbols',
+        help="""The number of symbols to disassemble, if specified.""")
+    parser.add_option(
+        '-p',
+        '--symbol_pattern',
+        type='string',
+        action='store',
+        dest='re_symbol_pattern',
+        help="""The regular expression of symbols to invoke lldb's 'disassemble' command.""")
+    parser.add_option(
+        '-s',
+        '--symbol',
+        type='string',
+        action='append',
+        metavar='SYMBOL',
+        default=[],
+        dest='symbols_to_disassemble',
+        help="""The symbol(s) to invoke lldb's 'disassemble' command on, if specified.""")
+
     opts, args = parser.parse_args()
 
     lldb_commands = opts.lldb_commands

Modified: lldb/trunk/utils/test/llvm-mc-shell.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/test/llvm-mc-shell.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/test/llvm-mc-shell.py (original)
+++ lldb/trunk/utils/test/llvm-mc-shell.py Tue Sep  6 15:57:50 2016
@@ -9,10 +9,12 @@ import os
 import sys
 from optparse import OptionParser
 
+
 def is_exe(fpath):
     """Check whether fpath is an executable."""
     return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
 
+
 def which(program):
     """Find the full path to a program, or return None."""
     fpath, fname = os.path.split(program)
@@ -26,10 +28,12 @@ def which(program):
                 return exe_file
     return None
 
+
 def llvm_mc_loop(mc, mc_options):
     contents = []
     fname = 'mc-input.txt'
-    sys.stdout.write("Enter your input to llvm-mc.  A line starting with 'END' terminates the current batch of input.\n")
+    sys.stdout.write(
+        "Enter your input to llvm-mc.  A line starting with 'END' terminates the current batch of input.\n")
     sys.stdout.write("Enter 'quit' or Ctrl-D to quit the program.\n")
     while True:
         sys.stdout.write("> ")
@@ -54,11 +58,18 @@ def llvm_mc_loop(mc, mc_options):
             # Keep accumulating our input.
             contents.append(next)
 
+
 def main():
     # This is to set up the Python path to include the pexpect-2.4 dir.
     # Remember to update this when/if things change.
     scriptPath = sys.path[0]
-    sys.path.append(os.path.join(scriptPath, os.pardir, os.pardir, 'test', 'pexpect-2.4'))
+    sys.path.append(
+        os.path.join(
+            scriptPath,
+            os.pardir,
+            os.pardir,
+            'test',
+            'pexpect-2.4'))
 
     parser = OptionParser(usage="""\
 Do llvm-mc interactively within a shell-like environment.  A batch of input is
@@ -74,10 +85,13 @@ Usage: %prog [options]
                       help="""The llvm-mc executable full path, if specified.
                       Otherwise, it must be present in your PATH environment.""")
 
-    parser.add_option('-o', '--options',
-                      type='string', action='store',
-                      dest='llvm_mc_options',
-                      help="""The options passed to 'llvm-mc' command if specified.""")
+    parser.add_option(
+        '-o',
+        '--options',
+        type='string',
+        action='store',
+        dest='llvm_mc_options',
+        help="""The options passed to 'llvm-mc' command if specified.""")
 
     opts, args = parser.parse_args()
 

Modified: lldb/trunk/utils/test/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/test/main.c?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/test/main.c (original)
+++ lldb/trunk/utils/test/main.c Tue Sep  6 15:57:50 2016
@@ -1,14 +1,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-int main(int argc, const char* argv[])
-{
-    int *null_ptr = 0;
-    printf("Hello, fault!\n");
-    u_int32_t val = (arc4random() & 0x0f);
-    printf("val=%u\n", val);
-    if (val == 0x07) // Lucky 7 :-)
-        printf("Now segfault %d\n", *null_ptr);
-    else
-        printf("Better luck next time!\n");
+int main(int argc, const char *argv[]) {
+  int *null_ptr = 0;
+  printf("Hello, fault!\n");
+  u_int32_t val = (arc4random() & 0x0f);
+  printf("val=%u\n", val);
+  if (val == 0x07) // Lucky 7 :-)
+    printf("Now segfault %d\n", *null_ptr);
+  else
+    printf("Better luck next time!\n");
 }

Modified: lldb/trunk/utils/test/ras.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/test/ras.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/test/ras.py (original)
+++ lldb/trunk/utils/test/ras.py Tue Sep  6 15:57:50 2016
@@ -24,7 +24,8 @@ from email.mime.image import MIMEImage
 from email.mime.multipart import MIMEMultipart
 from email.mime.text import MIMEText
 
-def runTestsuite(testDir, sessDir, envs = None):
+
+def runTestsuite(testDir, sessDir, envs=None):
     """Run the testsuite and return a (summary, output) tuple."""
     os.chdir(testDir)
 
@@ -35,7 +36,8 @@ def runTestsuite(testDir, sessDir, envs
         print var + "=" + val
         os.environ[var] = val
 
-    import shlex, subprocess
+    import shlex
+    import subprocess
 
     command_line = "./dotest.py -w -s %s" % sessDir
     # Apply correct tokenization for subprocess.Popen().
@@ -46,7 +48,7 @@ def runTestsuite(testDir, sessDir, envs
                                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     # Wait for subprocess to terminate.
     stdout, stderr = process.communicate()
-    
+
     # This will be used as the subject line of our email about this test.
     cmd = "%s %s" % (' '.join(envs) if envs else "", command_line)
 
@@ -55,6 +57,7 @@ def runTestsuite(testDir, sessDir, envs
 
 COMMASPACE = ', '
 
+
 def main():
     parser = OptionParser(usage="""\
 Run lldb test suite and send the results as a MIME message.
@@ -103,7 +106,7 @@ SMTP server, which then does the normal
     sessDir = 'tmp-lldb-session'
     if os.path.exists(sessDir):
         shutil.rmtree(sessDir)
-    #print "environments:", opts.environments
+    # print "environments:", opts.environments
     summary, output = runTestsuite(testDir, sessDir, opts.environments)
 
     # Create the enclosing (outer) message
@@ -119,9 +122,10 @@ SMTP server, which then does the normal
     if not os.path.exists(sessDir):
         outer.attach(MIMEText(output, 'plain'))
     else:
-        outer.attach(MIMEText("%s\n%s\n\n" % (output,
-                                              "Session logs of test failures/errors:"),
-                              'plain'))
+        outer.attach(
+            MIMEText(
+                "%s\n%s\n\n" %
+                (output, "Session logs of test failures/errors:"), 'plain'))
 
     for filename in (os.listdir(sessDir) if os.path.exists(sessDir) else []):
         path = os.path.join(sessDir, filename)

Modified: lldb/trunk/utils/test/run-dis.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/test/run-dis.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/test/run-dis.py (original)
+++ lldb/trunk/utils/test/run-dis.py Tue Sep  6 15:57:50 2016
@@ -5,7 +5,9 @@ Run lldb disassembler on all the binarie
 and path pattern.
 """
 
-import os, sys, subprocess
+import os
+import sys
+import subprocess
 import re
 from optparse import OptionParser
 
@@ -29,11 +31,14 @@ template = '%s/lldb-disasm.py -C "platfo
 
 # Regular expression for detecting file output for Mach-o binary.
 mach_o = re.compile('\sMach-O.+binary')
+
+
 def isbinary(path):
-    file_output = subprocess.Popen(["file", path], 
+    file_output = subprocess.Popen(["file", path],
                                    stdout=subprocess.PIPE).stdout.read()
     return (mach_o.search(file_output) is not None)
 
+
 def walk_and_invoke(sdk_root, path_regexp, suffix, num_symbols):
     """Look for matched file and invoke lldb disassembly on it."""
     global scriptPath
@@ -49,7 +54,8 @@ def walk_and_invoke(sdk_root, path_regex
             if os.path.islink(path):
                 continue
 
-            # We'll be pattern matching based on the path relative to the SDK root.
+            # We'll be pattern matching based on the path relative to the SDK
+            # root.
             replaced_path = path.replace(root_dir, "", 1)
             # Check regular expression match for the replaced path.
             if not path_regexp.search(replaced_path):
@@ -60,10 +66,12 @@ def walk_and_invoke(sdk_root, path_regex
             if not isbinary(path):
                 continue
 
-            command = template % (scriptPath, path, num_symbols if num_symbols > 0 else 1000)
+            command = template % (
+                scriptPath, path, num_symbols if num_symbols > 0 else 1000)
             print "Running %s" % (command)
             os.system(command)
 
+
 def main():
     """Read the root dir and the path spec, invoke lldb-disasm.py on the file."""
     global scriptPath
@@ -78,23 +86,32 @@ def main():
 Run lldb disassembler on all the binaries specified by a combination of root dir
 and path pattern.
 """)
-    parser.add_option('-r', '--root-dir',
-                      type='string', action='store',
-                      dest='root_dir',
-                      help='Mandatory: the root directory for the SDK symbols.')
-    parser.add_option('-p', '--path-pattern',
-                      type='string', action='store',
-                      dest='path_pattern',
-                      help='Mandatory: regular expression pattern for the desired binaries.')
+    parser.add_option(
+        '-r',
+        '--root-dir',
+        type='string',
+        action='store',
+        dest='root_dir',
+        help='Mandatory: the root directory for the SDK symbols.')
+    parser.add_option(
+        '-p',
+        '--path-pattern',
+        type='string',
+        action='store',
+        dest='path_pattern',
+        help='Mandatory: regular expression pattern for the desired binaries.')
     parser.add_option('-s', '--suffix',
                       type='string', action='store', default=None,
                       dest='suffix',
                       help='Specify the suffix of the binaries to look for.')
-    parser.add_option('-n', '--num-symbols',
-                      type='int', action='store', default=-1,
-                      dest='num_symbols',
-                      help="""The number of symbols to disassemble, if specified.""")
-
+    parser.add_option(
+        '-n',
+        '--num-symbols',
+        type='int',
+        action='store',
+        default=-1,
+        dest='num_symbols',
+        help="""The number of symbols to disassemble, if specified.""")
 
     opts, args = parser.parse_args()
     if not opts.root_dir or not opts.path_pattern:

Modified: lldb/trunk/utils/test/run-until-faulted.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/test/run-until-faulted.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/test/run-until-faulted.py (original)
+++ lldb/trunk/utils/test/run-until-faulted.py Tue Sep  6 15:57:50 2016
@@ -9,10 +9,12 @@ import os
 import sys
 from optparse import OptionParser
 
+
 def is_exe(fpath):
     """Check whether fpath is an executable."""
     return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
 
+
 def which(program):
     """Find the full path to a program, or return None."""
     fpath, fname = os.path.split(program)
@@ -26,9 +28,11 @@ def which(program):
                 return exe_file
     return None
 
+
 def do_lldb_launch_loop(lldb_command, exe, exe_options):
-    from cStringIO import StringIO 
-    import pexpect, time
+    from cStringIO import StringIO
+    import pexpect
+    import time
 
     prompt = "\(lldb\) "
     lldb = pexpect.spawn(lldb_command)
@@ -37,17 +41,18 @@ def do_lldb_launch_loop(lldb_command, ex
     lldb.expect(prompt)
 
     # Now issue the file command.
-    #print "sending 'file %s' command..." % exe
+    # print "sending 'file %s' command..." % exe
     lldb.sendline('file %s' % exe)
     lldb.expect(prompt)
 
     # Loop until it faults....
     count = 0
-    #while True:
+    # while True:
     #    count = count + 1
     for i in range(100):
         count = i
-        #print "sending 'process launch -- %s' command... (iteration: %d)" % (exe_options, count)
+        # print "sending 'process launch -- %s' command... (iteration: %d)" %
+        # (exe_options, count)
         lldb.sendline('process launch -- %s' % exe_options)
         index = lldb.expect(['Process .* exited with status',
                              'Process .* stopped',
@@ -57,19 +62,26 @@ def do_lldb_launch_loop(lldb_command, ex
             time.sleep(3)
         elif index == 1:
             # Perfect, our process had stopped; break out of the loop.
-            break;
+            break
         elif index == 2:
             # Something went wrong.
-            print "TIMEOUT occurred:", str(lldb)        
+            print "TIMEOUT occurred:", str(lldb)
 
     # Give control of lldb shell to the user.
     lldb.interact()
 
+
 def main():
     # This is to set up the Python path to include the pexpect-2.4 dir.
     # Remember to update this when/if things change.
     scriptPath = sys.path[0]
-    sys.path.append(os.path.join(scriptPath, os.pardir, os.pardir, 'test', 'pexpect-2.4'))
+    sys.path.append(
+        os.path.join(
+            scriptPath,
+            os.pardir,
+            os.pardir,
+            'test',
+            'pexpect-2.4'))
 
     parser = OptionParser(usage="""\
 %prog [options]
@@ -80,14 +92,21 @@ The lldb executable is located via your
                       type='string', action='store', metavar='LLDB_COMMAND',
                       default='lldb', dest='lldb_command',
                       help='Full path to your lldb command')
-    parser.add_option('-e', '--executable',
-                      type='string', action='store',
-                      dest='exe',
-                      help="""(Mandatory) The executable to launch via lldb.""")
-    parser.add_option('-o', '--options',
-                      type='string', action='store',
-                      default = '', dest='exe_options',
-                      help="""The args/options passed to the launched program, if specified.""")
+    parser.add_option(
+        '-e',
+        '--executable',
+        type='string',
+        action='store',
+        dest='exe',
+        help="""(Mandatory) The executable to launch via lldb.""")
+    parser.add_option(
+        '-o',
+        '--options',
+        type='string',
+        action='store',
+        default='',
+        dest='exe_options',
+        help="""The args/options passed to the launched program, if specified.""")
 
     opts, args = parser.parse_args()
 

Modified: lldb/trunk/utils/vim-lldb/python-vim-lldb/import_lldb.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/vim-lldb/python-vim-lldb/import_lldb.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/vim-lldb/python-vim-lldb/import_lldb.py (original)
+++ lldb/trunk/utils/vim-lldb/python-vim-lldb/import_lldb.py Tue Sep  6 15:57:50 2016
@@ -1,61 +1,71 @@
 
 # Locate and load the lldb python module
 
-import os, sys
+import os
+import sys
+
 
 def import_lldb():
-  """ Find and import the lldb modules. This function tries to find the lldb module by:
-      1. Simply by doing "import lldb" in case the system python installation is aware of lldb. If that fails,
-      2. Executes the lldb executable pointed to by the LLDB environment variable (or if unset, the first lldb
-         on PATH") with the -P flag to determine the PYTHONPATH to set. If the lldb executable returns a valid
-         path, it is added to sys.path and the import is attempted again. If that fails, 3. On Mac OS X the
-         default Xcode 4.5 installation path.
-  """
-
-  # Try simple 'import lldb', in case of a system-wide install or a pre-configured PYTHONPATH
-  try:
-    import lldb
-    return True
-  except ImportError:
-    pass
-
-  # Allow overriding default path to lldb executable with the LLDB environment variable
-  lldb_executable = 'lldb'
-  if 'LLDB' in os.environ and os.path.exists(os.environ['LLDB']):
-    lldb_executable = os.environ['LLDB']
-
-  # Try using builtin module location support ('lldb -P')
-  from subprocess import check_output, CalledProcessError
-  try:
-    with open(os.devnull, 'w') as fnull:
-      lldb_minus_p_path = check_output("%s -P" % lldb_executable, shell=True, stderr=fnull).strip()
-    if not os.path.exists(lldb_minus_p_path):
-      #lldb -P returned invalid path, probably too old
-      pass
-    else:
-      sys.path.append(lldb_minus_p_path)
-      import lldb
-      return True
-  except CalledProcessError:
-    # Cannot run 'lldb -P' to determine location of lldb python module
-    pass
-  except ImportError:
-    # Unable to import lldb module from path returned by `lldb -P`
-    pass
-
-  # On Mac OS X, use the try the default path to XCode lldb module
-  if "darwin" in sys.platform:
-    xcode_python_path = "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/Current/Resources/Python/"
-    sys.path.append(xcode_python_path)
+    """ Find and import the lldb modules. This function tries to find the lldb module by:
+        1. Simply by doing "import lldb" in case the system python installation is aware of lldb. If that fails,
+        2. Executes the lldb executable pointed to by the LLDB environment variable (or if unset, the first lldb
+           on PATH") with the -P flag to determine the PYTHONPATH to set. If the lldb executable returns a valid
+           path, it is added to sys.path and the import is attempted again. If that fails, 3. On Mac OS X the
+           default Xcode 4.5 installation path.
+    """
+
+    # Try simple 'import lldb', in case of a system-wide install or a
+    # pre-configured PYTHONPATH
     try:
-      import lldb
-      return True
+        import lldb
+        return True
     except ImportError:
-      # Unable to import lldb module from default Xcode python path
-      pass
+        pass
+
+    # Allow overriding default path to lldb executable with the LLDB
+    # environment variable
+    lldb_executable = 'lldb'
+    if 'LLDB' in os.environ and os.path.exists(os.environ['LLDB']):
+        lldb_executable = os.environ['LLDB']
+
+    # Try using builtin module location support ('lldb -P')
+    from subprocess import check_output, CalledProcessError
+    try:
+        with open(os.devnull, 'w') as fnull:
+            lldb_minus_p_path = check_output(
+                "%s -P" %
+                lldb_executable,
+                shell=True,
+                stderr=fnull).strip()
+        if not os.path.exists(lldb_minus_p_path):
+            # lldb -P returned invalid path, probably too old
+            pass
+        else:
+            sys.path.append(lldb_minus_p_path)
+            import lldb
+            return True
+    except CalledProcessError:
+        # Cannot run 'lldb -P' to determine location of lldb python module
+        pass
+    except ImportError:
+        # Unable to import lldb module from path returned by `lldb -P`
+        pass
+
+    # On Mac OS X, use the try the default path to XCode lldb module
+    if "darwin" in sys.platform:
+        xcode_python_path = "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/Current/Resources/Python/"
+        sys.path.append(xcode_python_path)
+        try:
+            import lldb
+            return True
+        except ImportError:
+            # Unable to import lldb module from default Xcode python path
+            pass
 
-  return False
+    return False
 
 if not import_lldb():
-  import vim
-  vim.command('redraw | echo "%s"' % " Error loading lldb module; vim-lldb will be disabled. Check LLDB installation or set LLDB environment variable.")
+    import vim
+    vim.command(
+        'redraw | echo "%s"' %
+        " Error loading lldb module; vim-lldb will be disabled. Check LLDB installation or set LLDB environment variable.")

Modified: lldb/trunk/utils/vim-lldb/python-vim-lldb/lldb_controller.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/vim-lldb/python-vim-lldb/lldb_controller.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/vim-lldb/python-vim-lldb/lldb_controller.py (original)
+++ lldb/trunk/utils/vim-lldb/python-vim-lldb/lldb_controller.py Tue Sep  6 15:57:50 2016
@@ -3,7 +3,9 @@
 # This file defines the layer that talks to lldb
 #
 
-import os, re, sys
+import os
+import re
+import sys
 import lldb
 import vim
 from vim_ui import UI
@@ -13,372 +15,399 @@ from vim_ui import UI
 # =================================================
 
 # Shamelessly copy/pasted from lldbutil.py in the test suite
-def state_type_to_str(enum):
-  """Returns the stateType string given an enum."""
-  if enum == lldb.eStateInvalid:
-    return "invalid"
-  elif enum == lldb.eStateUnloaded:
-    return "unloaded"
-  elif enum == lldb.eStateConnected:
-    return "connected"
-  elif enum == lldb.eStateAttaching:
-    return "attaching"
-  elif enum == lldb.eStateLaunching:
-    return "launching"
-  elif enum == lldb.eStateStopped:
-    return "stopped"
-  elif enum == lldb.eStateRunning:
-    return "running"
-  elif enum == lldb.eStateStepping:
-    return "stepping"
-  elif enum == lldb.eStateCrashed:
-    return "crashed"
-  elif enum == lldb.eStateDetached:
-    return "detached"
-  elif enum == lldb.eStateExited:
-    return "exited"
-  elif enum == lldb.eStateSuspended:
-    return "suspended"
-  else:
-    raise Exception("Unknown StateType enum")
-
-class StepType:
-  INSTRUCTION = 1
-  INSTRUCTION_OVER = 2
-  INTO = 3
-  OVER = 4
-  OUT = 5
 
-class LLDBController(object):
-  """ Handles Vim and LLDB events such as commands and lldb events. """
 
-  # Timeouts (sec) for waiting on new events. Because vim is not multi-threaded, we are restricted to
-  # servicing LLDB events from the main UI thread. Usually, we only process events that are already
-  # sitting on the queue. But in some situations (when we are expecting an event as a result of some
-  # user interaction) we want to wait for it. The constants below set these wait period in which the
-  # Vim UI is "blocked". Lower numbers will make Vim more responsive, but LLDB will be delayed and higher
-  # numbers will mean that LLDB events are processed faster, but the Vim UI may appear less responsive at
-  # times.
-  eventDelayStep = 2
-  eventDelayLaunch = 1
-  eventDelayContinue = 1
-
-  def __init__(self):
-    """ Creates the LLDB SBDebugger object and initializes the UI class. """
-    self.target = None
-    self.process = None
-    self.load_dependent_modules = True
-
-    self.dbg = lldb.SBDebugger.Create()
-    self.commandInterpreter = self.dbg.GetCommandInterpreter()
-
-    self.ui = UI()
-
-  def completeCommand(self, a, l, p):
-    """ Returns a list of viable completions for command a with length l and cursor at p  """
-
-    assert l[0] == 'L'
-    # Remove first 'L' character that all commands start with
-    l = l[1:]
-
-    # Adjust length as string has 1 less character
-    p = int(p) - 1
-
-    result = lldb.SBStringList()
-    num = self.commandInterpreter.HandleCompletion(l, p, 1, -1, result)
-
-    if num == -1:
-      # FIXME: insert completion character... what's a completion character?
-      pass
-    elif num == -2:
-      # FIXME: replace line with result.GetStringAtIndex(0)
-      pass
-
-    if result.GetSize() > 0:
-      results =  filter(None, [result.GetStringAtIndex(x) for x in range(result.GetSize())])
-      return results
-    else:
-      return []
-
-  def doStep(self, stepType):
-    """ Perform a step command and block the UI for eventDelayStep seconds in order to process
-        events on lldb's event queue.
-        FIXME: if the step does not complete in eventDelayStep seconds, we relinquish control to
-               the main thread to avoid the appearance of a "hang". If this happens, the UI will
-               update whenever; usually when the user moves the cursor. This is somewhat annoying.
-    """
-    if not self.process:
-      sys.stderr.write("No process to step")
-      return
-    
-    t = self.process.GetSelectedThread()
-    if stepType == StepType.INSTRUCTION:
-      t.StepInstruction(False)
-    if stepType == StepType.INSTRUCTION_OVER:
-      t.StepInstruction(True)
-    elif stepType == StepType.INTO:
-      t.StepInto()
-    elif stepType == StepType.OVER:
-      t.StepOver()
-    elif stepType == StepType.OUT:
-      t.StepOut()
-
-    self.processPendingEvents(self.eventDelayStep, True)
-
-  def doSelect(self, command, args):
-    """ Like doCommand, but suppress output when "select" is the first argument."""
-    a = args.split(' ')
-    return self.doCommand(command, args, "select" != a[0], True)
-
-  def doProcess(self, args):
-    """ Handle 'process' command. If 'launch' is requested, use doLaunch() instead
-        of the command interpreter to start the inferior process.
-    """
-    a = args.split(' ')
-    if len(args) == 0 or (len(a) > 0 and a[0] != 'launch'):
-      self.doCommand("process", args)
-      #self.ui.update(self.target, "", self)
+def state_type_to_str(enum):
+    """Returns the stateType string given an enum."""
+    if enum == lldb.eStateInvalid:
+        return "invalid"
+    elif enum == lldb.eStateUnloaded:
+        return "unloaded"
+    elif enum == lldb.eStateConnected:
+        return "connected"
+    elif enum == lldb.eStateAttaching:
+        return "attaching"
+    elif enum == lldb.eStateLaunching:
+        return "launching"
+    elif enum == lldb.eStateStopped:
+        return "stopped"
+    elif enum == lldb.eStateRunning:
+        return "running"
+    elif enum == lldb.eStateStepping:
+        return "stepping"
+    elif enum == lldb.eStateCrashed:
+        return "crashed"
+    elif enum == lldb.eStateDetached:
+        return "detached"
+    elif enum == lldb.eStateExited:
+        return "exited"
+    elif enum == lldb.eStateSuspended:
+        return "suspended"
     else:
-      self.doLaunch('-s' not in args, "")
+        raise Exception("Unknown StateType enum")
 
-  def doAttach(self, process_name):
-    """ Handle process attach.  """
-    error = lldb.SBError()
-    
-    self.processListener = lldb.SBListener("process_event_listener")
-    self.target = self.dbg.CreateTarget('')
-    self.process = self.target.AttachToProcessWithName(self.processListener, process_name, False, error)
-    if not error.Success():
-      sys.stderr.write("Error during attach: " + str(error))
-      return
-
-    self.ui.activate()
-    self.pid = self.process.GetProcessID()
-
-    print "Attached to %s (pid=%d)" % (process_name, self.pid)
-
-  def doDetach(self):
-    if self.process is not None and self.process.IsValid():
-      pid = self.process.GetProcessID()
-      state = state_type_to_str(self.process.GetState())
-      self.process.Detach()
-      self.processPendingEvents(self.eventDelayLaunch)
-
-  def doLaunch(self, stop_at_entry, args):
-    """ Handle process launch.  """
-    error = lldb.SBError()
-
-    fs = self.target.GetExecutable()
-    exe = os.path.join(fs.GetDirectory(), fs.GetFilename())
-    if self.process is not None and self.process.IsValid():
-      pid = self.process.GetProcessID()
-      state = state_type_to_str(self.process.GetState())
-      self.process.Destroy()
-
-    launchInfo = lldb.SBLaunchInfo(args.split(' '))
-    self.process = self.target.Launch(launchInfo, error)
-    if not error.Success():
-      sys.stderr.write("Error during launch: " + str(error))
-      return
-
-    # launch succeeded, store pid and add some event listeners
-    self.pid = self.process.GetProcessID()
-    self.processListener = lldb.SBListener("process_event_listener")
-    self.process.GetBroadcaster().AddListener(self.processListener, lldb.SBProcess.eBroadcastBitStateChanged)
 
-    print "Launched %s %s (pid=%d)" % (exe, args, self.pid)
+class StepType:
+    INSTRUCTION = 1
+    INSTRUCTION_OVER = 2
+    INTO = 3
+    OVER = 4
+    OUT = 5
 
-    if not stop_at_entry:
-      self.doContinue()
-    else:
-      self.processPendingEvents(self.eventDelayLaunch)
 
-  def doTarget(self, args):
-    """ Pass target command to interpreter, except if argument is not one of the valid options, or
-        is create, in which case try to create a target with the argument as the executable. For example:
-          target list        ==> handled by interpreter
-          target create blah ==> custom creation of target 'blah'
-          target blah        ==> also creates target blah
-    """
-    target_args = [#"create",
-                   "delete",
-                   "list",
-                   "modules",
-                   "select",
-                   "stop-hook",
-                   "symbols",
-                   "variable"]
-
-    a = args.split(' ')
-    if len(args) == 0 or (len(a) > 0 and a[0] in target_args):
-      self.doCommand("target", args)
-      return
-    elif len(a) > 1 and a[0] == "create":
-      exe = a[1]
-    elif len(a) == 1 and a[0] not in target_args:
-      exe = a[0]
-
-    err = lldb.SBError()
-    self.target = self.dbg.CreateTarget(exe, None, None, self.load_dependent_modules, err)
-    if not self.target:
-      sys.stderr.write("Error creating target %s. %s" % (str(exe), str(err)))
-      return
-
-    self.ui.activate()
-    self.ui.update(self.target, "created target %s" % str(exe), self)
-
-  def doContinue(self):
-    """ Handle 'contiue' command.
-        FIXME: switch to doCommand("continue", ...) to handle -i ignore-count param.
-    """
-    if not self.process or not self.process.IsValid():
-      sys.stderr.write("No process to continue")
-      return
-
-    self.process.Continue()
-    self.processPendingEvents(self.eventDelayContinue)
-
-  def doBreakpoint(self, args):
-    """ Handle breakpoint command with command interpreter, except if the user calls
-        "breakpoint" with no other args, in which case add a breakpoint at the line
-        under the cursor.
-    """
-    a = args.split(' ')
-    if len(args) == 0:
-      show_output = False
-
-      # User called us with no args, so toggle the bp under cursor
-      cw = vim.current.window
-      cb = vim.current.buffer
-      name = cb.name
-      line = cw.cursor[0]
-
-      # Since the UI is responsbile for placing signs at bp locations, we have to
-      # ask it if there already is one or more breakpoints at (file, line)...
-      if self.ui.haveBreakpoint(name, line):
-        bps = self.ui.getBreakpoints(name, line)
-        args = "delete %s" % " ".join([str(b.GetID()) for b in bps])
-        self.ui.deleteBreakpoints(name, line)
-      else:
-        args = "set -f %s -l %d" % (name, line)
-    else:
-      show_output = True
+class LLDBController(object):
+    """ Handles Vim and LLDB events such as commands and lldb events. """
 
-    self.doCommand("breakpoint", args, show_output)
-    return
+    # Timeouts (sec) for waiting on new events. Because vim is not multi-threaded, we are restricted to
+    # servicing LLDB events from the main UI thread. Usually, we only process events that are already
+    # sitting on the queue. But in some situations (when we are expecting an event as a result of some
+    # user interaction) we want to wait for it. The constants below set these wait period in which the
+    # Vim UI is "blocked". Lower numbers will make Vim more responsive, but LLDB will be delayed and higher
+    # numbers will mean that LLDB events are processed faster, but the Vim UI may appear less responsive at
+    # times.
+    eventDelayStep = 2
+    eventDelayLaunch = 1
+    eventDelayContinue = 1
+
+    def __init__(self):
+        """ Creates the LLDB SBDebugger object and initializes the UI class. """
+        self.target = None
+        self.process = None
+        self.load_dependent_modules = True
+
+        self.dbg = lldb.SBDebugger.Create()
+        self.commandInterpreter = self.dbg.GetCommandInterpreter()
+
+        self.ui = UI()
+
+    def completeCommand(self, a, l, p):
+        """ Returns a list of viable completions for command a with length l and cursor at p  """
+
+        assert l[0] == 'L'
+        # Remove first 'L' character that all commands start with
+        l = l[1:]
+
+        # Adjust length as string has 1 less character
+        p = int(p) - 1
+
+        result = lldb.SBStringList()
+        num = self.commandInterpreter.HandleCompletion(l, p, 1, -1, result)
+
+        if num == -1:
+            # FIXME: insert completion character... what's a completion
+            # character?
+            pass
+        elif num == -2:
+            # FIXME: replace line with result.GetStringAtIndex(0)
+            pass
+
+        if result.GetSize() > 0:
+            results = filter(None, [result.GetStringAtIndex(x)
+                                    for x in range(result.GetSize())])
+            return results
+        else:
+            return []
+
+    def doStep(self, stepType):
+        """ Perform a step command and block the UI for eventDelayStep seconds in order to process
+            events on lldb's event queue.
+            FIXME: if the step does not complete in eventDelayStep seconds, we relinquish control to
+                   the main thread to avoid the appearance of a "hang". If this happens, the UI will
+                   update whenever; usually when the user moves the cursor. This is somewhat annoying.
+        """
+        if not self.process:
+            sys.stderr.write("No process to step")
+            return
+
+        t = self.process.GetSelectedThread()
+        if stepType == StepType.INSTRUCTION:
+            t.StepInstruction(False)
+        if stepType == StepType.INSTRUCTION_OVER:
+            t.StepInstruction(True)
+        elif stepType == StepType.INTO:
+            t.StepInto()
+        elif stepType == StepType.OVER:
+            t.StepOver()
+        elif stepType == StepType.OUT:
+            t.StepOut()
+
+        self.processPendingEvents(self.eventDelayStep, True)
+
+    def doSelect(self, command, args):
+        """ Like doCommand, but suppress output when "select" is the first argument."""
+        a = args.split(' ')
+        return self.doCommand(command, args, "select" != a[0], True)
+
+    def doProcess(self, args):
+        """ Handle 'process' command. If 'launch' is requested, use doLaunch() instead
+            of the command interpreter to start the inferior process.
+        """
+        a = args.split(' ')
+        if len(args) == 0 or (len(a) > 0 and a[0] != 'launch'):
+            self.doCommand("process", args)
+            #self.ui.update(self.target, "", self)
+        else:
+            self.doLaunch('-s' not in args, "")
+
+    def doAttach(self, process_name):
+        """ Handle process attach.  """
+        error = lldb.SBError()
+
+        self.processListener = lldb.SBListener("process_event_listener")
+        self.target = self.dbg.CreateTarget('')
+        self.process = self.target.AttachToProcessWithName(
+            self.processListener, process_name, False, error)
+        if not error.Success():
+            sys.stderr.write("Error during attach: " + str(error))
+            return
+
+        self.ui.activate()
+        self.pid = self.process.GetProcessID()
+
+        print "Attached to %s (pid=%d)" % (process_name, self.pid)
+
+    def doDetach(self):
+        if self.process is not None and self.process.IsValid():
+            pid = self.process.GetProcessID()
+            state = state_type_to_str(self.process.GetState())
+            self.process.Detach()
+            self.processPendingEvents(self.eventDelayLaunch)
+
+    def doLaunch(self, stop_at_entry, args):
+        """ Handle process launch.  """
+        error = lldb.SBError()
+
+        fs = self.target.GetExecutable()
+        exe = os.path.join(fs.GetDirectory(), fs.GetFilename())
+        if self.process is not None and self.process.IsValid():
+            pid = self.process.GetProcessID()
+            state = state_type_to_str(self.process.GetState())
+            self.process.Destroy()
+
+        launchInfo = lldb.SBLaunchInfo(args.split(' '))
+        self.process = self.target.Launch(launchInfo, error)
+        if not error.Success():
+            sys.stderr.write("Error during launch: " + str(error))
+            return
+
+        # launch succeeded, store pid and add some event listeners
+        self.pid = self.process.GetProcessID()
+        self.processListener = lldb.SBListener("process_event_listener")
+        self.process.GetBroadcaster().AddListener(
+            self.processListener, lldb.SBProcess.eBroadcastBitStateChanged)
+
+        print "Launched %s %s (pid=%d)" % (exe, args, self.pid)
+
+        if not stop_at_entry:
+            self.doContinue()
+        else:
+            self.processPendingEvents(self.eventDelayLaunch)
+
+    def doTarget(self, args):
+        """ Pass target command to interpreter, except if argument is not one of the valid options, or
+            is create, in which case try to create a target with the argument as the executable. For example:
+              target list        ==> handled by interpreter
+              target create blah ==> custom creation of target 'blah'
+              target blah        ==> also creates target blah
+        """
+        target_args = [  # "create",
+            "delete",
+            "list",
+            "modules",
+            "select",
+            "stop-hook",
+            "symbols",
+            "variable"]
+
+        a = args.split(' ')
+        if len(args) == 0 or (len(a) > 0 and a[0] in target_args):
+            self.doCommand("target", args)
+            return
+        elif len(a) > 1 and a[0] == "create":
+            exe = a[1]
+        elif len(a) == 1 and a[0] not in target_args:
+            exe = a[0]
+
+        err = lldb.SBError()
+        self.target = self.dbg.CreateTarget(
+            exe, None, None, self.load_dependent_modules, err)
+        if not self.target:
+            sys.stderr.write(
+                "Error creating target %s. %s" %
+                (str(exe), str(err)))
+            return
+
+        self.ui.activate()
+        self.ui.update(self.target, "created target %s" % str(exe), self)
+
+    def doContinue(self):
+        """ Handle 'contiue' command.
+            FIXME: switch to doCommand("continue", ...) to handle -i ignore-count param.
+        """
+        if not self.process or not self.process.IsValid():
+            sys.stderr.write("No process to continue")
+            return
+
+        self.process.Continue()
+        self.processPendingEvents(self.eventDelayContinue)
+
+    def doBreakpoint(self, args):
+        """ Handle breakpoint command with command interpreter, except if the user calls
+            "breakpoint" with no other args, in which case add a breakpoint at the line
+            under the cursor.
+        """
+        a = args.split(' ')
+        if len(args) == 0:
+            show_output = False
+
+            # User called us with no args, so toggle the bp under cursor
+            cw = vim.current.window
+            cb = vim.current.buffer
+            name = cb.name
+            line = cw.cursor[0]
+
+            # Since the UI is responsbile for placing signs at bp locations, we have to
+            # ask it if there already is one or more breakpoints at (file,
+            # line)...
+            if self.ui.haveBreakpoint(name, line):
+                bps = self.ui.getBreakpoints(name, line)
+                args = "delete %s" % " ".join([str(b.GetID()) for b in bps])
+                self.ui.deleteBreakpoints(name, line)
+            else:
+                args = "set -f %s -l %d" % (name, line)
+        else:
+            show_output = True
+
+        self.doCommand("breakpoint", args, show_output)
+        return
+
+    def doRefresh(self):
+        """ process pending events and update UI on request """
+        status = self.processPendingEvents()
+
+    def doShow(self, name):
+        """ handle :Lshow <name> """
+        if not name:
+            self.ui.activate()
+            return
+
+        if self.ui.showWindow(name):
+            self.ui.update(self.target, "", self)
+
+    def doHide(self, name):
+        """ handle :Lhide <name> """
+        if self.ui.hideWindow(name):
+            self.ui.update(self.target, "", self)
+
+    def doExit(self):
+        self.dbg.Terminate()
+        self.dbg = None
+
+    def getCommandResult(self, command, command_args):
+        """ Run cmd in the command interpreter and returns (success, output) """
+        result = lldb.SBCommandReturnObject()
+        cmd = "%s %s" % (command, command_args)
+
+        self.commandInterpreter.HandleCommand(cmd, result)
+        return (result.Succeeded(), result.GetOutput()
+                if result.Succeeded() else result.GetError())
+
+    def doCommand(
+            self,
+            command,
+            command_args,
+            print_on_success=True,
+            goto_file=False):
+        """ Run cmd in interpreter and print result (success or failure) on the vim status line. """
+        (success, output) = self.getCommandResult(command, command_args)
+        if success:
+            self.ui.update(self.target, "", self, goto_file)
+            if len(output) > 0 and print_on_success:
+                print output
+        else:
+            sys.stderr.write(output)
+
+    def getCommandOutput(self, command, command_args=""):
+        """ runs cmd in the command interpreter andreturns (status, result) """
+        result = lldb.SBCommandReturnObject()
+        cmd = "%s %s" % (command, command_args)
+        self.commandInterpreter.HandleCommand(cmd, result)
+        return (result.Succeeded(), result.GetOutput()
+                if result.Succeeded() else result.GetError())
+
+    def processPendingEvents(self, wait_seconds=0, goto_file=True):
+        """ Handle any events that are queued from the inferior.
+            Blocks for at most wait_seconds, or if wait_seconds == 0,
+            process only events that are already queued.
+        """
+
+        status = None
+        num_events_handled = 0
+
+        if self.process is not None:
+            event = lldb.SBEvent()
+            old_state = self.process.GetState()
+            new_state = None
+            done = False
+            if old_state == lldb.eStateInvalid or old_state == lldb.eStateExited:
+                # Early-exit if we are in 'boring' states
+                pass
+            else:
+                while not done and self.processListener is not None:
+                    if not self.processListener.PeekAtNextEvent(event):
+                        if wait_seconds > 0:
+                            # No events on the queue, but we are allowed to wait for wait_seconds
+                            # for any events to show up.
+                            self.processListener.WaitForEvent(
+                                wait_seconds, event)
+                            new_state = lldb.SBProcess.GetStateFromEvent(event)
+
+                            num_events_handled += 1
+
+                        done = not self.processListener.PeekAtNextEvent(event)
+                    else:
+                        # An event is on the queue, process it here.
+                        self.processListener.GetNextEvent(event)
+                        new_state = lldb.SBProcess.GetStateFromEvent(event)
+
+                        # continue if stopped after attaching
+                        if old_state == lldb.eStateAttaching and new_state == lldb.eStateStopped:
+                            self.process.Continue()
+
+                        # If needed, perform any event-specific behaviour here
+                        num_events_handled += 1
+
+        if num_events_handled == 0:
+            pass
+        else:
+            if old_state == new_state:
+                status = ""
+            self.ui.update(self.target, status, self, goto_file)
 
-  def doRefresh(self):
-    """ process pending events and update UI on request """
-    status = self.processPendingEvents()
-
-  def doShow(self, name):
-    """ handle :Lshow <name> """
-    if not name:
-      self.ui.activate()
-      return
-
-    if self.ui.showWindow(name):
-      self.ui.update(self.target, "", self)
-
-  def doHide(self, name):
-    """ handle :Lhide <name> """
-    if self.ui.hideWindow(name):
-      self.ui.update(self.target, "", self)
-
-  def doExit(self):
-    self.dbg.Terminate()
-    self.dbg = None
-
-  def getCommandResult(self, command, command_args):
-    """ Run cmd in the command interpreter and returns (success, output) """
-    result = lldb.SBCommandReturnObject()
-    cmd = "%s %s" % (command, command_args)
-
-    self.commandInterpreter.HandleCommand(cmd, result)
-    return (result.Succeeded(), result.GetOutput() if result.Succeeded() else result.GetError())
-
-  def doCommand(self, command, command_args, print_on_success = True, goto_file=False):
-    """ Run cmd in interpreter and print result (success or failure) on the vim status line. """
-    (success, output) = self.getCommandResult(command, command_args)
-    if success:
-      self.ui.update(self.target, "", self, goto_file)
-      if len(output) > 0 and print_on_success:
-        print output
-    else:
-      sys.stderr.write(output)
 
-  def getCommandOutput(self, command, command_args=""):
-    """ runs cmd in the command interpreter andreturns (status, result) """
-    result = lldb.SBCommandReturnObject()
-    cmd = "%s %s" % (command, command_args)
-    self.commandInterpreter.HandleCommand(cmd, result)
-    return (result.Succeeded(), result.GetOutput() if result.Succeeded() else result.GetError())
-
-  def processPendingEvents(self, wait_seconds=0, goto_file=True):
-    """ Handle any events that are queued from the inferior.
-        Blocks for at most wait_seconds, or if wait_seconds == 0,
-        process only events that are already queued.
+def returnCompleteCommand(a, l, p):
+    """ Returns a "\n"-separated string with possible completion results
+        for command a with length l and cursor at p.
     """
+    separator = "\n"
+    results = ctrl.completeCommand(a, l, p)
+    vim.command('return "%s%s"' % (separator.join(results), separator))
 
-    status = None
-    num_events_handled = 0
-
-    if self.process is not None:
-      event = lldb.SBEvent()
-      old_state = self.process.GetState()
-      new_state = None
-      done = False
-      if old_state == lldb.eStateInvalid or old_state == lldb.eStateExited:
-        # Early-exit if we are in 'boring' states
-        pass
-      else:
-        while not done and self.processListener is not None:
-          if not self.processListener.PeekAtNextEvent(event):
-            if wait_seconds > 0:
-              # No events on the queue, but we are allowed to wait for wait_seconds
-              # for any events to show up.
-              self.processListener.WaitForEvent(wait_seconds, event)
-              new_state = lldb.SBProcess.GetStateFromEvent(event)
-
-              num_events_handled += 1
-
-            done = not self.processListener.PeekAtNextEvent(event)
-          else:
-            # An event is on the queue, process it here.
-            self.processListener.GetNextEvent(event)
-            new_state = lldb.SBProcess.GetStateFromEvent(event)
-
-            # continue if stopped after attaching
-            if old_state == lldb.eStateAttaching and new_state == lldb.eStateStopped:
-              self.process.Continue()
-
-            # If needed, perform any event-specific behaviour here
-            num_events_handled += 1
-
-    if num_events_handled == 0:
-      pass
-    else:
-      if old_state == new_state:
-        status = ""
-      self.ui.update(self.target, status, self, goto_file)
-
-
-def returnCompleteCommand(a, l, p):
-  """ Returns a "\n"-separated string with possible completion results
-      for command a with length l and cursor at p.
-  """
-  separator = "\n"
-  results = ctrl.completeCommand(a, l, p)
-  vim.command('return "%s%s"' % (separator.join(results), separator))
 
 def returnCompleteWindow(a, l, p):
-  """ Returns a "\n"-separated string with possible completion results
-      for commands that expect a window name parameter (like hide/show).
-      FIXME: connect to ctrl.ui instead of hardcoding the list here
-  """
-  separator = "\n"
-  results = ['breakpoints', 'backtrace', 'disassembly', 'locals', 'threads', 'registers']
-  vim.command('return "%s%s"' % (separator.join(results), separator))
+    """ Returns a "\n"-separated string with possible completion results
+        for commands that expect a window name parameter (like hide/show).
+        FIXME: connect to ctrl.ui instead of hardcoding the list here
+    """
+    separator = "\n"
+    results = [
+        'breakpoints',
+        'backtrace',
+        'disassembly',
+        'locals',
+        'threads',
+        'registers']
+    vim.command('return "%s%s"' % (separator.join(results), separator))
 
 global ctrl
 ctrl = LLDBController()

Modified: lldb/trunk/utils/vim-lldb/python-vim-lldb/plugin.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/vim-lldb/python-vim-lldb/plugin.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/vim-lldb/python-vim-lldb/plugin.py (original)
+++ lldb/trunk/utils/vim-lldb/python-vim-lldb/plugin.py Tue Sep  6 15:57:50 2016
@@ -1,14 +1,16 @@
 
-# Try to import all dependencies, catch and handle the error gracefully if it fails.
+# Try to import all dependencies, catch and handle the error gracefully if
+# it fails.
 
 import import_lldb
 
 try:
-  import lldb
-  import vim
+    import lldb
+    import vim
 except ImportError:
-  sys.stderr.write("Unable to load vim/lldb module. Check lldb is on the path is available (or LLDB is set) and that script is invoked inside Vim with :pyfile")
-  pass
+    sys.stderr.write(
+        "Unable to load vim/lldb module. Check lldb is on the path is available (or LLDB is set) and that script is invoked inside Vim with :pyfile")
+    pass
 else:
-  # Everthing went well, so use import to start the plugin controller 
-  from lldb_controller import *
+    # Everthing went well, so use import to start the plugin controller
+    from lldb_controller import *

Modified: lldb/trunk/utils/vim-lldb/python-vim-lldb/vim_panes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/vim-lldb/python-vim-lldb/vim_panes.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/vim-lldb/python-vim-lldb/vim_panes.py (original)
+++ lldb/trunk/utils/vim-lldb/python-vim-lldb/vim_panes.py Tue Sep  6 15:57:50 2016
@@ -6,8 +6,8 @@
 # - get_content() - returns a string with the pane contents
 #
 # Optionally, to highlight text, implement:
-# - get_highlights() - returns a map 
-# 
+# - get_highlights() - returns a map
+#
 # And call:
 # - define_highlight(unique_name, colour)
 # at some point in the constructor.
@@ -16,7 +16,7 @@
 # If the pane shows some key-value data that is in the context of a
 # single frame, inherit from FrameKeyValuePane and implement:
 # - get_frame_content(self, SBFrame frame)
-# 
+#
 #
 # If the pane presents some information that can be retrieved with
 # a simple LLDB command while the subprocess is stopped, inherit
@@ -27,12 +27,12 @@
 # Optionally, you can implement:
 # - get_selected_line()
 # to highlight a selected line and place the cursor there.
-# 
+#
 #
 # FIXME: implement WatchlistPane to displayed watched expressions
-# FIXME: define interface for interactive panes, like catching enter 
+# FIXME: define interface for interactive panes, like catching enter
 #        presses to change selected frame/thread...
-# 
+#
 
 import lldb
 import vim
@@ -44,6 +44,8 @@ import sys
 # ==============================================================
 
 # Shamelessly copy/pasted from lldbutil.py in the test suite
+
+
 def get_description(obj, option=None):
     """Calls lldb_obj.GetDescription() and returns a string, or None.
 
@@ -70,512 +72,552 @@ def get_description(obj, option=None):
     if not success:
         return None
     return stream.GetData()
- 
+
+
 def get_selected_thread(target):
-  """ Returns a tuple with (thread, error) where thread == None if error occurs """
-  process = target.GetProcess()
-  if process is None or not process.IsValid():
-    return (None, VimPane.MSG_NO_PROCESS)
-
-  thread = process.GetSelectedThread()
-  if thread is None or not thread.IsValid():
-    return (None, VimPane.MSG_NO_THREADS)
-  return (thread, "")
+    """ Returns a tuple with (thread, error) where thread == None if error occurs """
+    process = target.GetProcess()
+    if process is None or not process.IsValid():
+        return (None, VimPane.MSG_NO_PROCESS)
+
+    thread = process.GetSelectedThread()
+    if thread is None or not thread.IsValid():
+        return (None, VimPane.MSG_NO_THREADS)
+    return (thread, "")
+
 
 def get_selected_frame(target):
-  """ Returns a tuple with (frame, error) where frame == None if error occurs """
-  (thread, error) = get_selected_thread(target)
-  if thread is None:
-    return (None, error)
-
-  frame = thread.GetSelectedFrame()
-  if frame is None or not frame.IsValid():
-    return (None, VimPane.MSG_NO_FRAME)
-  return (frame, "")
+    """ Returns a tuple with (frame, error) where frame == None if error occurs """
+    (thread, error) = get_selected_thread(target)
+    if thread is None:
+        return (None, error)
+
+    frame = thread.GetSelectedFrame()
+    if frame is None or not frame.IsValid():
+        return (None, VimPane.MSG_NO_FRAME)
+    return (frame, "")
+
 
 def _cmd(cmd):
-  vim.command("call confirm('%s')" % cmd)
-  vim.command(cmd)
+    vim.command("call confirm('%s')" % cmd)
+    vim.command(cmd)
+
 
 def move_cursor(line, col=0):
-  """ moves cursor to specified line and col """
-  cw = vim.current.window
-  if cw.cursor[0] != line:
-    vim.command("execute \"normal %dgg\"" % line)
+    """ moves cursor to specified line and col """
+    cw = vim.current.window
+    if cw.cursor[0] != line:
+        vim.command("execute \"normal %dgg\"" % line)
+
 
 def winnr():
-  """ Returns currently selected window number """
-  return int(vim.eval("winnr()"))
+    """ Returns currently selected window number """
+    return int(vim.eval("winnr()"))
+
 
 def bufwinnr(name):
-  """ Returns window number corresponding with buffer name """
-  return int(vim.eval("bufwinnr('%s')" % name))
+    """ Returns window number corresponding with buffer name """
+    return int(vim.eval("bufwinnr('%s')" % name))
+
 
 def goto_window(nr):
-  """ go to window number nr"""
-  if nr != winnr():
-    vim.command(str(nr) + ' wincmd w')
+    """ go to window number nr"""
+    if nr != winnr():
+        vim.command(str(nr) + ' wincmd w')
+
 
 def goto_next_window():
-  """ go to next window. """
-  vim.command('wincmd w')
-  return (winnr(), vim.current.buffer.name)
+    """ go to next window. """
+    vim.command('wincmd w')
+    return (winnr(), vim.current.buffer.name)
+
 
 def goto_previous_window():
-  """ go to previously selected window """
-  vim.command("execute \"normal \\<c-w>p\"")
+    """ go to previously selected window """
+    vim.command("execute \"normal \\<c-w>p\"")
+
 
 def have_gui():
-  """ Returns True if vim is in a gui (Gvim/MacVim), False otherwise. """
-  return int(vim.eval("has('gui_running')")) == 1
+    """ Returns True if vim is in a gui (Gvim/MacVim), False otherwise. """
+    return int(vim.eval("has('gui_running')")) == 1
+
 
 class PaneLayout(object):
-  """ A container for a (vertical) group layout of VimPanes """
+    """ A container for a (vertical) group layout of VimPanes """
 
-  def __init__(self):
-    self.panes = {}
+    def __init__(self):
+        self.panes = {}
 
-  def havePane(self, name):
-    """ Returns true if name is a registered pane, False otherwise """
-    return name in self.panes
-
-  def prepare(self, panes = []):
-    """ Draw panes on screen. If empty list is provided, show all. """
-
-    # If we can't select a window contained in the layout, we are doing a first draw
-    first_draw = not self.selectWindow(True)
-    did_first_draw = False
-
-    # Prepare each registered pane
-    for name in self.panes:
-      if name in panes or len(panes) == 0:
-        if first_draw:
-          # First window in layout will be created with :vsp, and closed later
-          vim.command(":vsp")
-          first_draw = False
-          did_first_draw = True
-        self.panes[name].prepare()
-
-    if did_first_draw:
-      # Close the split window
-      vim.command(":q")
-
-    self.selectWindow(False)
-
-  def contains(self, bufferName = None):
-    """ Returns True if window with name bufferName is contained in the layout, False otherwise.
-        If bufferName is None, the currently selected window is checked.
-    """
-    if not bufferName:
-      bufferName = vim.current.buffer.name
+    def havePane(self, name):
+        """ Returns true if name is a registered pane, False otherwise """
+        return name in self.panes
+
+    def prepare(self, panes=[]):
+        """ Draw panes on screen. If empty list is provided, show all. """
+
+        # If we can't select a window contained in the layout, we are doing a
+        # first draw
+        first_draw = not self.selectWindow(True)
+        did_first_draw = False
+
+        # Prepare each registered pane
+        for name in self.panes:
+            if name in panes or len(panes) == 0:
+                if first_draw:
+                    # First window in layout will be created with :vsp, and
+                    # closed later
+                    vim.command(":vsp")
+                    first_draw = False
+                    did_first_draw = True
+                self.panes[name].prepare()
+
+        if did_first_draw:
+            # Close the split window
+            vim.command(":q")
+
+        self.selectWindow(False)
+
+    def contains(self, bufferName=None):
+        """ Returns True if window with name bufferName is contained in the layout, False otherwise.
+            If bufferName is None, the currently selected window is checked.
+        """
+        if not bufferName:
+            bufferName = vim.current.buffer.name
+
+        for p in self.panes:
+            if bufferName is not None and bufferName.endswith(p):
+                return True
+        return False
+
+    def selectWindow(self, select_contained=True):
+        """ Selects a window contained in the layout (if select_contained = True) and returns True.
+            If select_contained = False, a window that is not contained is selected. Returns False
+            if no group windows can be selected.
+        """
+        if select_contained == self.contains():
+            # Simple case: we are already selected
+            return True
+
+        # Otherwise, switch to next window until we find a contained window, or
+        # reach the first window again.
+        first = winnr()
+        (curnum, curname) = goto_next_window()
+
+        while not select_contained == self.contains(
+                curname) and curnum != first:
+            (curnum, curname) = goto_next_window()
+
+        return self.contains(curname) == select_contained
+
+    def hide(self, panes=[]):
+        """ Hide panes specified. If empty list provided, hide all. """
+        for name in self.panes:
+            if name in panes or len(panes) == 0:
+                self.panes[name].destroy()
+
+    def registerForUpdates(self, p):
+        self.panes[p.name] = p
+
+    def update(self, target, controller):
+        for name in self.panes:
+            self.panes[name].update(target, controller)
 
-    for p in self.panes:
-      if bufferName is not None and bufferName.endswith(p):
-        return True
-    return False
 
-  def selectWindow(self, select_contained = True):
-    """ Selects a window contained in the layout (if select_contained = True) and returns True.
-        If select_contained = False, a window that is not contained is selected. Returns False
-        if no group windows can be selected.
-    """
-    if select_contained == self.contains():
-      # Simple case: we are already selected
-      return True
-
-    # Otherwise, switch to next window until we find a contained window, or reach the first window again.
-    first = winnr()
-    (curnum, curname) = goto_next_window()
-
-    while not select_contained == self.contains(curname) and curnum != first:
-      (curnum, curname) = goto_next_window()
-
-    return self.contains(curname) == select_contained
-
-  def hide(self, panes = []):
-    """ Hide panes specified. If empty list provided, hide all. """
-    for name in self.panes:
-      if name in panes or len(panes) == 0:
-        self.panes[name].destroy()
-
-  def registerForUpdates(self, p):
-    self.panes[p.name] = p
-
-  def update(self, target, controller):
-    for name in self.panes:
-      self.panes[name].update(target, controller)
+class VimPane(object):
+    """ A generic base class for a pane that displays stuff """
+    CHANGED_VALUE_HIGHLIGHT_NAME_GUI = 'ColorColumn'
+    CHANGED_VALUE_HIGHLIGHT_NAME_TERM = 'lldb_changed'
+    CHANGED_VALUE_HIGHLIGHT_COLOUR_TERM = 'darkred'
+
+    SELECTED_HIGHLIGHT_NAME_GUI = 'Cursor'
+    SELECTED_HIGHLIGHT_NAME_TERM = 'lldb_selected'
+    SELECTED_HIGHLIGHT_COLOUR_TERM = 'darkblue'
+
+    MSG_NO_TARGET = "Target does not exist."
+    MSG_NO_PROCESS = "Process does not exist."
+    MSG_NO_THREADS = "No valid threads."
+    MSG_NO_FRAME = "No valid frame."
+
+    # list of defined highlights, so we avoid re-defining them
+    highlightTypes = []
+
+    def __init__(self, owner, name, open_below=False, height=3):
+        self.owner = owner
+        self.name = name
+        self.buffer = None
+        self.maxHeight = 20
+        self.openBelow = open_below
+        self.height = height
+        self.owner.registerForUpdates(self)
+
+    def isPrepared(self):
+        """ check window is OK """
+        if self.buffer is None or len(
+                dir(self.buffer)) == 0 or bufwinnr(self.name) == -1:
+            return False
+        return True
 
+    def prepare(self, method='new'):
+        """ check window is OK, if not then create """
+        if not self.isPrepared():
+            self.create(method)
+
+    def on_create(self):
+        pass
+
+    def destroy(self):
+        """ destroy window """
+        if self.buffer is None or len(dir(self.buffer)) == 0:
+            return
+        vim.command('bdelete ' + self.name)
+
+    def create(self, method):
+        """ create window """
+
+        if method != 'edit':
+            belowcmd = "below" if self.openBelow else ""
+            vim.command('silent %s %s %s' % (belowcmd, method, self.name))
+        else:
+            vim.command('silent %s %s' % (method, self.name))
+
+        self.window = vim.current.window
+
+        # Set LLDB pane options
+        vim.command("setlocal buftype=nofile")  # Don't try to open a file
+        vim.command("setlocal noswapfile")     # Don't use a swap file
+        vim.command("set nonumber")            # Don't display line numbers
+        # vim.command("set nowrap")              # Don't wrap text
+
+        # Save some parameters and reference to buffer
+        self.buffer = vim.current.buffer
+        self.width = int(vim.eval("winwidth(0)"))
+        self.height = int(vim.eval("winheight(0)"))
+
+        self.on_create()
+        goto_previous_window()
+
+    def update(self, target, controller):
+        """ updates buffer contents """
+        self.target = target
+        if not self.isPrepared():
+            # Window is hidden, or otherwise not ready for an update
+            return
+
+        original_cursor = self.window.cursor
+
+        # Select pane
+        goto_window(bufwinnr(self.name))
+
+        # Clean and update content, and apply any highlights.
+        self.clean()
+
+        if self.write(self.get_content(target, controller)):
+            self.apply_highlights()
+
+            cursor = self.get_selected_line()
+            if cursor is None:
+                # Place the cursor at its original position in the window
+                cursor_line = min(original_cursor[0], len(self.buffer))
+                cursor_col = min(
+                    original_cursor[1], len(
+                        self.buffer[
+                            cursor_line - 1]))
+            else:
+                # Place the cursor at the location requested by a VimPane
+                # implementation
+                cursor_line = min(cursor, len(self.buffer))
+                cursor_col = self.window.cursor[1]
+
+            self.window.cursor = (cursor_line, cursor_col)
+
+        goto_previous_window()
+
+    def get_selected_line(self):
+        """ Returns the line number to move the cursor to, or None to leave
+            it where the user last left it.
+            Subclasses implement this to define custom behaviour.
+        """
+        return None
 
-class VimPane(object):
-  """ A generic base class for a pane that displays stuff """
-  CHANGED_VALUE_HIGHLIGHT_NAME_GUI = 'ColorColumn'
-  CHANGED_VALUE_HIGHLIGHT_NAME_TERM = 'lldb_changed'
-  CHANGED_VALUE_HIGHLIGHT_COLOUR_TERM = 'darkred'
-
-  SELECTED_HIGHLIGHT_NAME_GUI = 'Cursor'
-  SELECTED_HIGHLIGHT_NAME_TERM = 'lldb_selected'
-  SELECTED_HIGHLIGHT_COLOUR_TERM = 'darkblue'
-
-  MSG_NO_TARGET = "Target does not exist."
-  MSG_NO_PROCESS = "Process does not exist."
-  MSG_NO_THREADS = "No valid threads."
-  MSG_NO_FRAME = "No valid frame."
-
-  # list of defined highlights, so we avoid re-defining them
-  highlightTypes = []
-
-  def __init__(self, owner, name, open_below=False, height=3):
-    self.owner = owner
-    self.name = name
-    self.buffer = None
-    self.maxHeight = 20
-    self.openBelow = open_below
-    self.height = height
-    self.owner.registerForUpdates(self)
-
-  def isPrepared(self):
-    """ check window is OK """
-    if self.buffer == None or len(dir(self.buffer)) == 0 or bufwinnr(self.name) == -1:
-      return False
-    return True
-
-  def prepare(self, method = 'new'):
-    """ check window is OK, if not then create """
-    if not self.isPrepared():
-      self.create(method)
-
-  def on_create(self):
-    pass
-
-  def destroy(self):
-    """ destroy window """
-    if self.buffer == None or len(dir(self.buffer)) == 0:
-      return
-    vim.command('bdelete ' + self.name)
-
-  def create(self, method):
-    """ create window """
-
-    if method != 'edit':
-      belowcmd = "below" if self.openBelow else ""
-      vim.command('silent %s %s %s' % (belowcmd, method, self.name))
-    else:
-      vim.command('silent %s %s' % (method, self.name))
+    def apply_highlights(self):
+        """ Highlights each set of lines in  each highlight group """
+        highlights = self.get_highlights()
+        for highlightType in highlights:
+            lines = highlights[highlightType]
+            if len(lines) == 0:
+                continue
+
+            cmd = 'match %s /' % highlightType
+            lines = ['\%' + '%d' % line + 'l' for line in lines]
+            cmd += '\\|'.join(lines)
+            cmd += '/'
+            vim.command(cmd)
+
+    def define_highlight(self, name, colour):
+        """ Defines highlihght """
+        if name in VimPane.highlightTypes:
+            # highlight already defined
+            return
+
+        vim.command(
+            "highlight %s ctermbg=%s guibg=%s" %
+            (name, colour, colour))
+        VimPane.highlightTypes.append(name)
+
+    def write(self, msg):
+        """ replace buffer with msg"""
+        self.prepare()
+
+        msg = str(msg.encode("utf-8", "replace")).split('\n')
+        try:
+            self.buffer.append(msg)
+            vim.command("execute \"normal ggdd\"")
+        except vim.error:
+            # cannot update window; happens when vim is exiting.
+            return False
 
-    self.window = vim.current.window
-  
-    # Set LLDB pane options
-    vim.command("setlocal buftype=nofile") # Don't try to open a file
-    vim.command("setlocal noswapfile")     # Don't use a swap file
-    vim.command("set nonumber")            # Don't display line numbers
-    #vim.command("set nowrap")              # Don't wrap text
-
-    # Save some parameters and reference to buffer
-    self.buffer = vim.current.buffer
-    self.width  = int( vim.eval("winwidth(0)")  )
-    self.height = int( vim.eval("winheight(0)") )
-
-    self.on_create()
-    goto_previous_window()
-
-  def update(self, target, controller):
-    """ updates buffer contents """
-    self.target = target
-    if not self.isPrepared():
-      # Window is hidden, or otherwise not ready for an update
-      return
-
-    original_cursor = self.window.cursor
-
-    # Select pane
-    goto_window(bufwinnr(self.name))
-
-    # Clean and update content, and apply any highlights.
-    self.clean()
-
-    if self.write(self.get_content(target, controller)):
-      self.apply_highlights()
-
-      cursor = self.get_selected_line()
-      if cursor is None:
-        # Place the cursor at its original position in the window
-        cursor_line = min(original_cursor[0], len(self.buffer))
-        cursor_col = min(original_cursor[1], len(self.buffer[cursor_line - 1]))
-      else:
-        # Place the cursor at the location requested by a VimPane implementation
-        cursor_line = min(cursor, len(self.buffer))
-        cursor_col = self.window.cursor[1]
-
-      self.window.cursor = (cursor_line, cursor_col)
-
-    goto_previous_window()
-
-  def get_selected_line(self):
-    """ Returns the line number to move the cursor to, or None to leave
-        it where the user last left it.
-        Subclasses implement this to define custom behaviour.
-    """
-    return None
+        move_cursor(1, 0)
+        return True
 
-  def apply_highlights(self):
-    """ Highlights each set of lines in  each highlight group """
-    highlights = self.get_highlights()
-    for highlightType in highlights:
-      lines = highlights[highlightType]
-      if len(lines) == 0:
-        continue
-
-      cmd = 'match %s /' % highlightType
-      lines = ['\%' + '%d' % line + 'l' for line in lines]
-      cmd += '\\|'.join(lines)
-      cmd += '/'
-      vim.command(cmd)
-
-  def define_highlight(self, name, colour):
-    """ Defines highlihght """
-    if name in VimPane.highlightTypes:
-      # highlight already defined
-      return
-
-    vim.command("highlight %s ctermbg=%s guibg=%s" % (name, colour, colour))
-    VimPane.highlightTypes.append(name)
-
-  def write(self, msg):
-    """ replace buffer with msg"""
-    self.prepare()
-
-    msg = str(msg.encode("utf-8", "replace")).split('\n')
-    try:
-      self.buffer.append(msg)
-      vim.command("execute \"normal ggdd\"")
-    except vim.error:
-      # cannot update window; happens when vim is exiting.
-      return False
-
-    move_cursor(1, 0)
-    return True
-
-  def clean(self):
-    """ clean all datas in buffer """
-    self.prepare()
-    vim.command(':%d')
-    #self.buffer[:] = None
-
-  def get_content(self, target, controller):
-    """ subclasses implement this to provide pane content """
-    assert(0 and "pane subclass must implement this")
-    pass
-
-  def get_highlights(self):
-    """ Subclasses implement this to provide pane highlights.
-        This function is expected to return a map of:
-          { highlight_name ==> [line_number, ...], ... }
-    """
-    return {}
+    def clean(self):
+        """ clean all datas in buffer """
+        self.prepare()
+        vim.command(':%d')
+        #self.buffer[:] = None
+
+    def get_content(self, target, controller):
+        """ subclasses implement this to provide pane content """
+        assert(0 and "pane subclass must implement this")
+        pass
+
+    def get_highlights(self):
+        """ Subclasses implement this to provide pane highlights.
+            This function is expected to return a map of:
+              { highlight_name ==> [line_number, ...], ... }
+        """
+        return {}
 
 
 class FrameKeyValuePane(VimPane):
-  def __init__(self, owner, name, open_below):
-    """ Initialize parent, define member variables, choose which highlight
-        to use based on whether or not we have a gui (MacVim/Gvim).
-    """
 
-    VimPane.__init__(self, owner, name, open_below)
+    def __init__(self, owner, name, open_below):
+        """ Initialize parent, define member variables, choose which highlight
+            to use based on whether or not we have a gui (MacVim/Gvim).
+        """
+
+        VimPane.__init__(self, owner, name, open_below)
+
+        # Map-of-maps key/value history { frame --> { variable_name,
+        # variable_value } }
+        self.frameValues = {}
+
+        if have_gui():
+            self.changedHighlight = VimPane.CHANGED_VALUE_HIGHLIGHT_NAME_GUI
+        else:
+            self.changedHighlight = VimPane.CHANGED_VALUE_HIGHLIGHT_NAME_TERM
+            self.define_highlight(VimPane.CHANGED_VALUE_HIGHLIGHT_NAME_TERM,
+                                  VimPane.CHANGED_VALUE_HIGHLIGHT_COLOUR_TERM)
+
+    def format_pair(self, key, value, changed=False):
+        """ Formats a key/value pair. Appends a '*' if changed == True """
+        marker = '*' if changed else ' '
+        return "%s %s = %s\n" % (marker, key, value)
+
+    def get_content(self, target, controller):
+        """ Get content for a frame-aware pane. Also builds the list of lines that
+            need highlighting (i.e. changed values.)
+        """
+        if target is None or not target.IsValid():
+            return VimPane.MSG_NO_TARGET
+
+        self.changedLines = []
+
+        (frame, err) = get_selected_frame(target)
+        if frame is None:
+            return err
+
+        output = get_description(frame)
+        lineNum = 1
+
+        # Retrieve the last values displayed for this frame
+        frameId = get_description(frame.GetBlock())
+        if frameId in self.frameValues:
+            frameOldValues = self.frameValues[frameId]
+        else:
+            frameOldValues = {}
+
+        # Read the frame variables
+        vals = self.get_frame_content(frame)
+        for (key, value) in vals:
+            lineNum += 1
+            if len(frameOldValues) == 0 or (
+                    key in frameOldValues and frameOldValues[key] == value):
+                output += self.format_pair(key, value)
+            else:
+                output += self.format_pair(key, value, True)
+                self.changedLines.append(lineNum)
+
+        # Save values as oldValues
+        newValues = {}
+        for (key, value) in vals:
+            newValues[key] = value
+        self.frameValues[frameId] = newValues
+
+        return output
+
+    def get_highlights(self):
+        ret = {}
+        ret[self.changedHighlight] = self.changedLines
+        return ret
 
-    # Map-of-maps key/value history { frame --> { variable_name, variable_value } }
-    self.frameValues = {}
 
-    if have_gui():
-      self.changedHighlight = VimPane.CHANGED_VALUE_HIGHLIGHT_NAME_GUI
-    else:
-      self.changedHighlight = VimPane.CHANGED_VALUE_HIGHLIGHT_NAME_TERM
-      self.define_highlight(VimPane.CHANGED_VALUE_HIGHLIGHT_NAME_TERM,
-                            VimPane.CHANGED_VALUE_HIGHLIGHT_COLOUR_TERM)
- 
-  def format_pair(self, key, value, changed = False):
-    """ Formats a key/value pair. Appends a '*' if changed == True """
-    marker = '*' if changed else ' '
-    return "%s %s = %s\n" % (marker, key, value)
-
-  def get_content(self, target, controller):
-    """ Get content for a frame-aware pane. Also builds the list of lines that
-        need highlighting (i.e. changed values.)
-    """
-    if target is None or not target.IsValid():
-      return VimPane.MSG_NO_TARGET
-
-    self.changedLines = []
+class LocalsPane(FrameKeyValuePane):
+    """ Pane that displays local variables """
 
-    (frame, err) = get_selected_frame(target)
-    if frame is None:
-      return err
-
-    output = get_description(frame)
-    lineNum = 1
-
-    # Retrieve the last values displayed for this frame
-    frameId = get_description(frame.GetBlock())
-    if frameId in self.frameValues:
-      frameOldValues = self.frameValues[frameId]
-    else:
-      frameOldValues = {}
+    def __init__(self, owner, name='locals'):
+        FrameKeyValuePane.__init__(self, owner, name, open_below=True)
 
-    # Read the frame variables
-    vals = self.get_frame_content(frame)
-    for (key, value) in vals:
-      lineNum += 1
-      if len(frameOldValues) == 0 or (key in frameOldValues and frameOldValues[key] == value):
-        output += self.format_pair(key, value)
-      else:
-        output += self.format_pair(key, value, True)
-        self.changedLines.append(lineNum)
-      
-    # Save values as oldValues
-    newValues = {}
-    for (key, value) in vals:
-      newValues[key] = value
-    self.frameValues[frameId] = newValues
-
-    return output
-
-  def get_highlights(self):
-    ret = {}
-    ret[self.changedHighlight] = self.changedLines
-    return ret
+        # FIXME: allow users to customize display of args/locals/statics/scope
+        self.arguments = True
+        self.show_locals = True
+        self.show_statics = True
+        self.show_in_scope_only = True
+
+    def format_variable(self, var):
+        """ Returns a Tuple of strings "(Type) Name", "Value" for SBValue var """
+        val = var.GetValue()
+        if val is None:
+            # If the value is too big, SBValue.GetValue() returns None; replace
+            # with ...
+            val = "..."
+
+        return ("(%s) %s" % (var.GetTypeName(), var.GetName()), "%s" % val)
+
+    def get_frame_content(self, frame):
+        """ Returns list of key-value pairs of local variables in frame """
+        vals = frame.GetVariables(self.arguments,
+                                  self.show_locals,
+                                  self.show_statics,
+                                  self.show_in_scope_only)
+        return [self.format_variable(x) for x in vals]
 
-class LocalsPane(FrameKeyValuePane):
-  """ Pane that displays local variables """
-  def __init__(self, owner, name = 'locals'):
-    FrameKeyValuePane.__init__(self, owner, name, open_below=True)
-    
-    # FIXME: allow users to customize display of args/locals/statics/scope
-    self.arguments = True
-    self.show_locals = True
-    self.show_statics = True
-    self.show_in_scope_only = True
-
-  def format_variable(self, var):
-    """ Returns a Tuple of strings "(Type) Name", "Value" for SBValue var """
-    val = var.GetValue()
-    if val is None:
-      # If the value is too big, SBValue.GetValue() returns None; replace with ...
-      val = "..."
-
-    return ("(%s) %s" % (var.GetTypeName(), var.GetName()), "%s" % val)
-
-  def get_frame_content(self, frame):
-    """ Returns list of key-value pairs of local variables in frame """
-    vals = frame.GetVariables(self.arguments,
-                                   self.show_locals,
-                                   self.show_statics,
-                                   self.show_in_scope_only)
-    return [self.format_variable(x) for x in vals]
 
 class RegistersPane(FrameKeyValuePane):
-  """ Pane that displays the contents of registers """
-  def __init__(self, owner, name = 'registers'):
-    FrameKeyValuePane.__init__(self, owner, name, open_below=True)
-
-  def format_register(self, reg):
-    """ Returns a tuple of strings ("name", "value") for SBRegister reg. """
-    name = reg.GetName()
-    val = reg.GetValue()
-    if val is None:
-      val = "..."
-    return (name, val.strip())
-
-  def get_frame_content(self, frame):
-    """ Returns a list of key-value pairs ("name", "value") of registers in frame """
-
-    result = []
-    for register_sets in frame.GetRegisters():
-      # hack the register group name into the list of registers...
-      result.append((" = = %s =" % register_sets.GetName(), ""))
-
-      for reg in register_sets:
-        result.append(self.format_register(reg))
-    return result
+    """ Pane that displays the contents of registers """
+
+    def __init__(self, owner, name='registers'):
+        FrameKeyValuePane.__init__(self, owner, name, open_below=True)
+
+    def format_register(self, reg):
+        """ Returns a tuple of strings ("name", "value") for SBRegister reg. """
+        name = reg.GetName()
+        val = reg.GetValue()
+        if val is None:
+            val = "..."
+        return (name, val.strip())
+
+    def get_frame_content(self, frame):
+        """ Returns a list of key-value pairs ("name", "value") of registers in frame """
+
+        result = []
+        for register_sets in frame.GetRegisters():
+            # hack the register group name into the list of registers...
+            result.append((" = = %s =" % register_sets.GetName(), ""))
+
+            for reg in register_sets:
+                result.append(self.format_register(reg))
+        return result
+
 
 class CommandPane(VimPane):
-  """ Pane that displays the output of an LLDB command """
-  def __init__(self, owner, name, open_below, process_required=True):
-    VimPane.__init__(self, owner, name, open_below)
-    self.process_required = process_required
-
-  def setCommand(self, command, args = ""):
-    self.command = command
-    self.args = args
-
-  def get_content(self, target, controller):
-    output = ""
-    if not target:
-      output = VimPane.MSG_NO_TARGET
-    elif self.process_required and not target.GetProcess():
-      output = VimPane.MSG_NO_PROCESS
-    else:
-      (success, output) = controller.getCommandOutput(self.command, self.args)
-    return output
+    """ Pane that displays the output of an LLDB command """
+
+    def __init__(self, owner, name, open_below, process_required=True):
+        VimPane.__init__(self, owner, name, open_below)
+        self.process_required = process_required
+
+    def setCommand(self, command, args=""):
+        self.command = command
+        self.args = args
+
+    def get_content(self, target, controller):
+        output = ""
+        if not target:
+            output = VimPane.MSG_NO_TARGET
+        elif self.process_required and not target.GetProcess():
+            output = VimPane.MSG_NO_PROCESS
+        else:
+            (success, output) = controller.getCommandOutput(
+                self.command, self.args)
+        return output
+
 
 class StoppedCommandPane(CommandPane):
-  """ Pane that displays the output of an LLDB command when the process is
-      stopped; otherwise displays process status. This class also implements
-      highlighting for a single line (to show a single-line selected entity.)
-  """
-  def __init__(self, owner, name, open_below):
-    """ Initialize parent and define highlight to use for selected line. """
-    CommandPane.__init__(self, owner, name, open_below)
-    if have_gui():
-      self.selectedHighlight = VimPane.SELECTED_HIGHLIGHT_NAME_GUI
-    else:
-      self.selectedHighlight = VimPane.SELECTED_HIGHLIGHT_NAME_TERM
-      self.define_highlight(VimPane.SELECTED_HIGHLIGHT_NAME_TERM,
-                            VimPane.SELECTED_HIGHLIGHT_COLOUR_TERM)
- 
-  def get_content(self, target, controller):
-    """ Returns the output of a command that relies on the process being stopped.
-        If the process is not in 'stopped' state, the process status is returned.
-    """
-    output = ""
-    if not target or not target.IsValid():
-      output = VimPane.MSG_NO_TARGET
-    elif not target.GetProcess() or not target.GetProcess().IsValid():
-      output = VimPane.MSG_NO_PROCESS
-    elif target.GetProcess().GetState() == lldb.eStateStopped:
-      (success, output) = controller.getCommandOutput(self.command, self.args)
-    else:
-      (success, output) = controller.getCommandOutput("process", "status")
-    return output
+    """ Pane that displays the output of an LLDB command when the process is
+        stopped; otherwise displays process status. This class also implements
+        highlighting for a single line (to show a single-line selected entity.)
+    """
+
+    def __init__(self, owner, name, open_below):
+        """ Initialize parent and define highlight to use for selected line. """
+        CommandPane.__init__(self, owner, name, open_below)
+        if have_gui():
+            self.selectedHighlight = VimPane.SELECTED_HIGHLIGHT_NAME_GUI
+        else:
+            self.selectedHighlight = VimPane.SELECTED_HIGHLIGHT_NAME_TERM
+            self.define_highlight(VimPane.SELECTED_HIGHLIGHT_NAME_TERM,
+                                  VimPane.SELECTED_HIGHLIGHT_COLOUR_TERM)
+
+    def get_content(self, target, controller):
+        """ Returns the output of a command that relies on the process being stopped.
+            If the process is not in 'stopped' state, the process status is returned.
+        """
+        output = ""
+        if not target or not target.IsValid():
+            output = VimPane.MSG_NO_TARGET
+        elif not target.GetProcess() or not target.GetProcess().IsValid():
+            output = VimPane.MSG_NO_PROCESS
+        elif target.GetProcess().GetState() == lldb.eStateStopped:
+            (success, output) = controller.getCommandOutput(
+                self.command, self.args)
+        else:
+            (success, output) = controller.getCommandOutput("process", "status")
+        return output
+
+    def get_highlights(self):
+        """ Highlight the line under the cursor. Users moving the cursor has
+            no effect on the selected line.
+        """
+        ret = {}
+        line = self.get_selected_line()
+        if line is not None:
+            ret[self.selectedHighlight] = [line]
+            return ret
+        return ret
+
+    def get_selected_line(self):
+        """ Subclasses implement this to control where the cursor (and selected highlight)
+            is placed.
+        """
+        return None
 
-  def get_highlights(self):
-    """ Highlight the line under the cursor. Users moving the cursor has
-        no effect on the selected line.
-    """
-    ret = {}
-    line = self.get_selected_line()
-    if line is not None:
-      ret[self.selectedHighlight] = [line]
-      return ret
-    return ret
-
-  def get_selected_line(self):
-    """ Subclasses implement this to control where the cursor (and selected highlight)
-        is placed.
-    """
-    return None
 
 class DisassemblyPane(CommandPane):
-  """ Pane that displays disassembly around PC """
-  def __init__(self, owner, name = 'disassembly'):
-    CommandPane.__init__(self, owner, name, open_below=True)
+    """ Pane that displays disassembly around PC """
+
+    def __init__(self, owner, name='disassembly'):
+        CommandPane.__init__(self, owner, name, open_below=True)
+
+        # FIXME: let users customize the number of instructions to disassemble
+        self.setCommand("disassemble", "-c %d -p" % self.maxHeight)
 
-    # FIXME: let users customize the number of instructions to disassemble
-    self.setCommand("disassemble", "-c %d -p" % self.maxHeight)
 
 class ThreadPane(StoppedCommandPane):
-  """ Pane that displays threads list """
-  def __init__(self, owner, name = 'threads'):
-    StoppedCommandPane.__init__(self, owner, name, open_below=False)
-    self.setCommand("thread", "list")
+    """ Pane that displays threads list """
+
+    def __init__(self, owner, name='threads'):
+        StoppedCommandPane.__init__(self, owner, name, open_below=False)
+        self.setCommand("thread", "list")
 
 # FIXME: the function below assumes threads are listed in sequential order,
 #        which turns out to not be the case. Highlighting of selected thread
@@ -592,27 +634,36 @@ class ThreadPane(StoppedCommandPane):
 #    else:
 #      return thread.GetIndexID() + 1
 
+
 class BacktracePane(StoppedCommandPane):
-  """ Pane that displays backtrace """
-  def __init__(self, owner, name = 'backtrace'):
-    StoppedCommandPane.__init__(self, owner, name, open_below=False)
-    self.setCommand("bt", "")
+    """ Pane that displays backtrace """
 
+    def __init__(self, owner, name='backtrace'):
+        StoppedCommandPane.__init__(self, owner, name, open_below=False)
+        self.setCommand("bt", "")
+
+    def get_selected_line(self):
+        """ Returns the line number in the buffer with the selected frame.
+            Formula: selected_line = selected_frame_id + 2
+            FIXME: the above formula hack does not work when the function return
+                   value is printed in the bt window; the wrong line is highlighted.
+        """
+
+        (frame, err) = get_selected_frame(self.target)
+        if frame is None:
+            return None
+        else:
+            return frame.GetFrameID() + 2
 
-  def get_selected_line(self):
-    """ Returns the line number in the buffer with the selected frame. 
-        Formula: selected_line = selected_frame_id + 2
-        FIXME: the above formula hack does not work when the function return
-               value is printed in the bt window; the wrong line is highlighted.
-    """
-
-    (frame, err) = get_selected_frame(self.target)
-    if frame is None:
-      return None
-    else:
-      return frame.GetFrameID() + 2
 
 class BreakpointsPane(CommandPane):
-  def __init__(self, owner, name = 'breakpoints'):
-    super(BreakpointsPane, self).__init__(owner, name, open_below=False, process_required=False)
-    self.setCommand("breakpoint", "list")
+
+    def __init__(self, owner, name='breakpoints'):
+        super(
+            BreakpointsPane,
+            self).__init__(
+            owner,
+            name,
+            open_below=False,
+            process_required=False)
+        self.setCommand("breakpoint", "list")

Modified: lldb/trunk/utils/vim-lldb/python-vim-lldb/vim_signs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/vim-lldb/python-vim-lldb/vim_signs.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/vim-lldb/python-vim-lldb/vim_signs.py (original)
+++ lldb/trunk/utils/vim-lldb/python-vim-lldb/vim_signs.py Tue Sep  6 15:57:50 2016
@@ -3,71 +3,79 @@
 
 import vim
 
+
 class VimSign(object):
-  SIGN_TEXT_BREAKPOINT_RESOLVED = "B>"
-  SIGN_TEXT_BREAKPOINT_UNRESOLVED = "b>"
-  SIGN_TEXT_PC = "->"
-  SIGN_HIGHLIGHT_COLOUR_PC = 'darkblue'
-
-  # unique sign id (for ':[sign/highlight] define)
-  sign_id = 1
-
-  # unique name id (for ':sign place')
-  name_id = 1
-
-  # Map of {(sign_text, highlight_colour) --> sign_name}
-  defined_signs = {}
-
-  def __init__(self, sign_text, buffer, line_number, highlight_colour=None):
-    """ Define the sign and highlight (if applicable) and show the sign. """
-
-    # Get the sign name, either by defining it, or looking it up in the map of defined signs
-    key = (sign_text, highlight_colour)
-    if not key in VimSign.defined_signs:
-      name = self.define(sign_text, highlight_colour)
-    else:
-      name = VimSign.defined_signs[key]
-    
-    self.show(name, buffer.number, line_number)
-    pass
-
-  def define(self, sign_text, highlight_colour):
-    """ Defines sign and highlight (if highlight_colour is not None). """
-    sign_name = "sign%d" % VimSign.name_id
-    if highlight_colour is None:
-      vim.command("sign define %s text=%s" % (sign_name, sign_text))
-    else:
-      self.highlight_name = "highlight%d" % VimSign.name_id
-      vim.command("highlight %s ctermbg=%s guibg=%s" % (self.highlight_name,
-                                                        highlight_colour,
-                                                        highlight_colour))
-      vim.command("sign define %s text=%s linehl=%s texthl=%s" % (sign_name,
-                                                                  sign_text,
-                                                                  self.highlight_name,
-                                                                  self.highlight_name))
-    VimSign.defined_signs[(sign_text, highlight_colour)] = sign_name
-    VimSign.name_id += 1
-    return sign_name
- 
-
-  def show(self, name, buffer_number, line_number):
-    self.id = VimSign.sign_id
-    VimSign.sign_id += 1
-    vim.command("sign place %d name=%s line=%d buffer=%s" % (self.id, name, line_number, buffer_number))
-    pass
-
-  def hide(self):
-    vim.command("sign unplace %d" % self.id)
-    pass
+    SIGN_TEXT_BREAKPOINT_RESOLVED = "B>"
+    SIGN_TEXT_BREAKPOINT_UNRESOLVED = "b>"
+    SIGN_TEXT_PC = "->"
+    SIGN_HIGHLIGHT_COLOUR_PC = 'darkblue'
+
+    # unique sign id (for ':[sign/highlight] define)
+    sign_id = 1
+
+    # unique name id (for ':sign place')
+    name_id = 1
+
+    # Map of {(sign_text, highlight_colour) --> sign_name}
+    defined_signs = {}
+
+    def __init__(self, sign_text, buffer, line_number, highlight_colour=None):
+        """ Define the sign and highlight (if applicable) and show the sign. """
+
+        # Get the sign name, either by defining it, or looking it up in the map
+        # of defined signs
+        key = (sign_text, highlight_colour)
+        if key not in VimSign.defined_signs:
+            name = self.define(sign_text, highlight_colour)
+        else:
+            name = VimSign.defined_signs[key]
+
+        self.show(name, buffer.number, line_number)
+        pass
+
+    def define(self, sign_text, highlight_colour):
+        """ Defines sign and highlight (if highlight_colour is not None). """
+        sign_name = "sign%d" % VimSign.name_id
+        if highlight_colour is None:
+            vim.command("sign define %s text=%s" % (sign_name, sign_text))
+        else:
+            self.highlight_name = "highlight%d" % VimSign.name_id
+            vim.command(
+                "highlight %s ctermbg=%s guibg=%s" %
+                (self.highlight_name, highlight_colour, highlight_colour))
+            vim.command(
+                "sign define %s text=%s linehl=%s texthl=%s" %
+                (sign_name, sign_text, self.highlight_name, self.highlight_name))
+        VimSign.defined_signs[(sign_text, highlight_colour)] = sign_name
+        VimSign.name_id += 1
+        return sign_name
+
+    def show(self, name, buffer_number, line_number):
+        self.id = VimSign.sign_id
+        VimSign.sign_id += 1
+        vim.command("sign place %d name=%s line=%d buffer=%s" %
+                    (self.id, name, line_number, buffer_number))
+        pass
+
+    def hide(self):
+        vim.command("sign unplace %d" % self.id)
+        pass
+
 
 class BreakpointSign(VimSign):
-  def __init__(self, buffer, line_number, is_resolved):
-    txt = VimSign.SIGN_TEXT_BREAKPOINT_RESOLVED if is_resolved else VimSign.SIGN_TEXT_BREAKPOINT_UNRESOLVED
-    super(BreakpointSign, self).__init__(txt, buffer, line_number)
+
+    def __init__(self, buffer, line_number, is_resolved):
+        txt = VimSign.SIGN_TEXT_BREAKPOINT_RESOLVED if is_resolved else VimSign.SIGN_TEXT_BREAKPOINT_UNRESOLVED
+        super(BreakpointSign, self).__init__(txt, buffer, line_number)
+
 
 class PCSign(VimSign):
-  def __init__(self, buffer, line_number, is_selected_thread):
-    super(PCSign, self).__init__(VimSign.SIGN_TEXT_PC,
-                                 buffer,
-                                 line_number,
-                                 VimSign.SIGN_HIGHLIGHT_COLOUR_PC if is_selected_thread else None)
+
+    def __init__(self, buffer, line_number, is_selected_thread):
+        super(
+            PCSign,
+            self).__init__(
+            VimSign.SIGN_TEXT_PC,
+            buffer,
+            line_number,
+            VimSign.SIGN_HIGHLIGHT_COLOUR_PC if is_selected_thread else None)

Modified: lldb/trunk/utils/vim-lldb/python-vim-lldb/vim_ui.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/vim-lldb/python-vim-lldb/vim_ui.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/utils/vim-lldb/python-vim-lldb/vim_ui.py (original)
+++ lldb/trunk/utils/vim-lldb/python-vim-lldb/vim_ui.py Tue Sep  6 15:57:50 2016
@@ -1,235 +1,255 @@
 
 # LLDB UI state in the Vim user interface.
 
-import os, re, sys
+import os
+import re
+import sys
 import lldb
 import vim
 from vim_panes import *
 from vim_signs import *
 
+
 def is_same_file(a, b):
-  """ returns true if paths a and b are the same file """
-  a = os.path.realpath(a)
-  b = os.path.realpath(b)
-  return a in b or b in a
+    """ returns true if paths a and b are the same file """
+    a = os.path.realpath(a)
+    b = os.path.realpath(b)
+    return a in b or b in a
 
-class UI:
-  def __init__(self):
-    """ Declare UI state variables """
 
-    # Default panes to display
-    self.defaultPanes = ['breakpoints', 'backtrace', 'locals', 'threads', 'registers', 'disassembly']
+class UI:
 
-    # map of tuples (filename, line) --> SBBreakpoint
-    self.markedBreakpoints = {}
+    def __init__(self):
+        """ Declare UI state variables """
 
-    # Currently shown signs
-    self.breakpointSigns = {}
-    self.pcSigns = []
-
-    # Container for panes
-    self.paneCol = PaneLayout()
-
-    # All possible LLDB panes
-    self.backtracePane = BacktracePane(self.paneCol)
-    self.threadPane = ThreadPane(self.paneCol)
-    self.disassemblyPane = DisassemblyPane(self.paneCol)
-    self.localsPane = LocalsPane(self.paneCol)
-    self.registersPane = RegistersPane(self.paneCol)
-    self.breakPane = BreakpointsPane(self.paneCol)
-
-  def activate(self):
-    """ Activate UI: display default set of panes """
-    self.paneCol.prepare(self.defaultPanes)
-
-  def get_user_buffers(self, filter_name=None):
-    """ Returns a list of buffers that are not a part of the LLDB UI. That is, they
-        are not contained in the PaneLayout object self.paneCol.
-    """
-    ret = []
-    for w in vim.windows:
-      b = w.buffer
-      if not self.paneCol.contains(b.name):
-        if filter_name is None or filter_name in b.name:
-          ret.append(b) 
-    return ret
-
-  def update_pc(self, process, buffers, goto_file):
-    """ Place the PC sign on the PC location of each thread's selected frame """
-
-    def GetPCSourceLocation(thread):
-      """ Returns a tuple (thread_index, file, line, column) that represents where
-          the PC sign should be placed for a thread.
-      """
-
-      frame = thread.GetSelectedFrame()
-      frame_num = frame.GetFrameID()
-      le = frame.GetLineEntry()
-      while not le.IsValid() and frame_num < thread.GetNumFrames():
-        frame_num += 1
-        le = thread.GetFrameAtIndex(frame_num).GetLineEntry()
-
-      if le.IsValid():
-        path = os.path.join(le.GetFileSpec().GetDirectory(), le.GetFileSpec().GetFilename())
-        return (thread.GetIndexID(), path, le.GetLine(), le.GetColumn())
-      return None
-
-
-    # Clear all existing PC signs
-    del_list = []
-    for sign in self.pcSigns:
-      sign.hide()
-      del_list.append(sign)
-    for sign in del_list:
-      self.pcSigns.remove(sign)
-      del sign
-
-    # Select a user (non-lldb) window 
-    if not self.paneCol.selectWindow(False):
-      # No user window found; avoid clobbering by splitting
-      vim.command(":vsp")
-
-    # Show a PC marker for each thread
-    for thread in process:
-      loc = GetPCSourceLocation(thread)
-      if not loc:
-        # no valid source locations for PCs. hide all existing PC markers
-        continue
-
-      buf = None
-      (tid, fname, line, col) = loc
-      buffers = self.get_user_buffers(fname)
-      is_selected = thread.GetIndexID() == process.GetSelectedThread().GetIndexID()
-      if len(buffers) == 1:
-        buf = buffers[0]
-        if buf != vim.current.buffer:
-          # Vim has an open buffer to the required file: select it
-          vim.command('execute ":%db"' % buf.number)
-      elif is_selected and vim.current.buffer.name not in fname and os.path.exists(fname) and goto_file:
-        # FIXME: If current buffer is modified, vim will complain when we try to switch away.
-        #        Find a way to detect if the current buffer is modified, and...warn instead?
-        vim.command('execute ":e %s"' % fname)
-        buf = vim.current.buffer
-      elif len(buffers) > 1 and goto_file:
-        #FIXME: multiple open buffers match PC location
-        continue
-      else:
-        continue
-
-      self.pcSigns.append(PCSign(buf, line, is_selected))
-
-      if is_selected and goto_file:
-        # if the selected file has a PC marker, move the cursor there too
-        curname = vim.current.buffer.name
-        if curname is not None and is_same_file(curname, fname):
-          move_cursor(line, 0)
-        elif move_cursor:
-          print "FIXME: not sure where to move cursor because %s != %s " % (vim.current.buffer.name, fname)
-
-  def update_breakpoints(self, target, buffers):
-    """ Decorates buffer with signs corresponding to breakpoints in target. """
-
-    def GetBreakpointLocations(bp):
-      """ Returns a list of tuples (resolved, filename, line) where a breakpoint was resolved. """
-      if not bp.IsValid():
-        sys.stderr.write("breakpoint is invalid, no locations")
-        return []
-
-      ret = []
-      numLocs = bp.GetNumLocations()
-      for i in range(numLocs):
-        loc = bp.GetLocationAtIndex(i)
-        desc = get_description(loc, lldb.eDescriptionLevelFull)
-        match = re.search('at\ ([^:]+):([\d]+)', desc)
-        try:
-          lineNum = int(match.group(2).strip())
-          ret.append((loc.IsResolved(), match.group(1), lineNum))
-        except ValueError as e:
-          sys.stderr.write("unable to parse breakpoint location line number: '%s'" % match.group(2))
-          sys.stderr.write(str(e))
-
-      return ret
-
-
-    if target is None or not target.IsValid():
-      return
-
-    needed_bps = {}
-    for bp_index in range(target.GetNumBreakpoints()):
-      bp = target.GetBreakpointAtIndex(bp_index)
-      locations = GetBreakpointLocations(bp)
-      for (is_resolved, file, line) in GetBreakpointLocations(bp):
-        for buf in buffers:
-          if file in buf.name:
-            needed_bps[(buf, line, is_resolved)] = bp
-
-    # Hide any signs that correspond with disabled breakpoints
-    del_list = []
-    for (b, l, r) in self.breakpointSigns:
-      if (b, l, r) not in needed_bps:
-        self.breakpointSigns[(b, l, r)].hide()
-        del_list.append((b, l, r))
-    for d in del_list:
-      del self.breakpointSigns[d]
-      
-    # Show any signs for new breakpoints
-    for (b, l, r) in needed_bps:
-      bp = needed_bps[(b, l, r)]
-      if self.haveBreakpoint(b.name, l):
-        self.markedBreakpoints[(b.name, l)].append(bp)
-      else:
-        self.markedBreakpoints[(b.name, l)] = [bp]
-
-      if (b, l, r) not in self.breakpointSigns:
-        s = BreakpointSign(b, l, r)
-        self.breakpointSigns[(b, l, r)] = s
-
-  def update(self, target, status, controller, goto_file=False):
-    """ Updates debugger info panels and breakpoint/pc marks and prints
-        status to the vim status line. If goto_file is True, the user's
-        cursor is moved to the source PC location in the selected frame.
-    """
-
-    self.paneCol.update(target, controller)
-    self.update_breakpoints(target, self.get_user_buffers())
-
-    if target is not None and target.IsValid():
-      process = target.GetProcess()
-      if process is not None and process.IsValid():
-        self.update_pc(process, self.get_user_buffers, goto_file)
-
-    if status is not None and len(status) > 0:
-      print status 
-
-  def haveBreakpoint(self, file, line):
-    """ Returns True if we have a breakpoint at file:line, False otherwise  """
-    return (file, line) in self.markedBreakpoints
-
-  def getBreakpoints(self, fname, line):
-    """ Returns the LLDB SBBreakpoint object at fname:line """
-    if self.haveBreakpoint(fname, line):
-      return self.markedBreakpoints[(fname, line)]
-    else:
-      return None
-
-  def deleteBreakpoints(self, name, line):
-    del self.markedBreakpoints[(name, line)]
-
-  def showWindow(self, name):
-    """ Shows (un-hides) window pane specified by name """
-    if not self.paneCol.havePane(name):
-      sys.stderr.write("unknown window: %s" % name)
-      return False
-    self.paneCol.prepare([name])
-    return True
-
-  def hideWindow(self, name):
-    """ Hides window pane specified by name """
-    if not self.paneCol.havePane(name):
-      sys.stderr.write("unknown window: %s" % name)
-      return False
-    self.paneCol.hide([name])
-    return True
+        # Default panes to display
+        self.defaultPanes = [
+            'breakpoints',
+            'backtrace',
+            'locals',
+            'threads',
+            'registers',
+            'disassembly']
+
+        # map of tuples (filename, line) --> SBBreakpoint
+        self.markedBreakpoints = {}
+
+        # Currently shown signs
+        self.breakpointSigns = {}
+        self.pcSigns = []
+
+        # Container for panes
+        self.paneCol = PaneLayout()
+
+        # All possible LLDB panes
+        self.backtracePane = BacktracePane(self.paneCol)
+        self.threadPane = ThreadPane(self.paneCol)
+        self.disassemblyPane = DisassemblyPane(self.paneCol)
+        self.localsPane = LocalsPane(self.paneCol)
+        self.registersPane = RegistersPane(self.paneCol)
+        self.breakPane = BreakpointsPane(self.paneCol)
+
+    def activate(self):
+        """ Activate UI: display default set of panes """
+        self.paneCol.prepare(self.defaultPanes)
+
+    def get_user_buffers(self, filter_name=None):
+        """ Returns a list of buffers that are not a part of the LLDB UI. That is, they
+            are not contained in the PaneLayout object self.paneCol.
+        """
+        ret = []
+        for w in vim.windows:
+            b = w.buffer
+            if not self.paneCol.contains(b.name):
+                if filter_name is None or filter_name in b.name:
+                    ret.append(b)
+        return ret
+
+    def update_pc(self, process, buffers, goto_file):
+        """ Place the PC sign on the PC location of each thread's selected frame """
+
+        def GetPCSourceLocation(thread):
+            """ Returns a tuple (thread_index, file, line, column) that represents where
+                the PC sign should be placed for a thread.
+            """
+
+            frame = thread.GetSelectedFrame()
+            frame_num = frame.GetFrameID()
+            le = frame.GetLineEntry()
+            while not le.IsValid() and frame_num < thread.GetNumFrames():
+                frame_num += 1
+                le = thread.GetFrameAtIndex(frame_num).GetLineEntry()
+
+            if le.IsValid():
+                path = os.path.join(
+                    le.GetFileSpec().GetDirectory(),
+                    le.GetFileSpec().GetFilename())
+                return (
+                    thread.GetIndexID(),
+                    path,
+                    le.GetLine(),
+                    le.GetColumn())
+            return None
+
+        # Clear all existing PC signs
+        del_list = []
+        for sign in self.pcSigns:
+            sign.hide()
+            del_list.append(sign)
+        for sign in del_list:
+            self.pcSigns.remove(sign)
+            del sign
+
+        # Select a user (non-lldb) window
+        if not self.paneCol.selectWindow(False):
+            # No user window found; avoid clobbering by splitting
+            vim.command(":vsp")
+
+        # Show a PC marker for each thread
+        for thread in process:
+            loc = GetPCSourceLocation(thread)
+            if not loc:
+                # no valid source locations for PCs. hide all existing PC
+                # markers
+                continue
+
+            buf = None
+            (tid, fname, line, col) = loc
+            buffers = self.get_user_buffers(fname)
+            is_selected = thread.GetIndexID() == process.GetSelectedThread().GetIndexID()
+            if len(buffers) == 1:
+                buf = buffers[0]
+                if buf != vim.current.buffer:
+                    # Vim has an open buffer to the required file: select it
+                    vim.command('execute ":%db"' % buf.number)
+            elif is_selected and vim.current.buffer.name not in fname and os.path.exists(fname) and goto_file:
+                # FIXME: If current buffer is modified, vim will complain when we try to switch away.
+                # Find a way to detect if the current buffer is modified,
+                # and...warn instead?
+                vim.command('execute ":e %s"' % fname)
+                buf = vim.current.buffer
+            elif len(buffers) > 1 and goto_file:
+                # FIXME: multiple open buffers match PC location
+                continue
+            else:
+                continue
+
+            self.pcSigns.append(PCSign(buf, line, is_selected))
+
+            if is_selected and goto_file:
+                # if the selected file has a PC marker, move the cursor there
+                # too
+                curname = vim.current.buffer.name
+                if curname is not None and is_same_file(curname, fname):
+                    move_cursor(line, 0)
+                elif move_cursor:
+                    print "FIXME: not sure where to move cursor because %s != %s " % (vim.current.buffer.name, fname)
+
+    def update_breakpoints(self, target, buffers):
+        """ Decorates buffer with signs corresponding to breakpoints in target. """
+
+        def GetBreakpointLocations(bp):
+            """ Returns a list of tuples (resolved, filename, line) where a breakpoint was resolved. """
+            if not bp.IsValid():
+                sys.stderr.write("breakpoint is invalid, no locations")
+                return []
+
+            ret = []
+            numLocs = bp.GetNumLocations()
+            for i in range(numLocs):
+                loc = bp.GetLocationAtIndex(i)
+                desc = get_description(loc, lldb.eDescriptionLevelFull)
+                match = re.search('at\ ([^:]+):([\d]+)', desc)
+                try:
+                    lineNum = int(match.group(2).strip())
+                    ret.append((loc.IsResolved(), match.group(1), lineNum))
+                except ValueError as e:
+                    sys.stderr.write(
+                        "unable to parse breakpoint location line number: '%s'" %
+                        match.group(2))
+                    sys.stderr.write(str(e))
+
+            return ret
+
+        if target is None or not target.IsValid():
+            return
+
+        needed_bps = {}
+        for bp_index in range(target.GetNumBreakpoints()):
+            bp = target.GetBreakpointAtIndex(bp_index)
+            locations = GetBreakpointLocations(bp)
+            for (is_resolved, file, line) in GetBreakpointLocations(bp):
+                for buf in buffers:
+                    if file in buf.name:
+                        needed_bps[(buf, line, is_resolved)] = bp
+
+        # Hide any signs that correspond with disabled breakpoints
+        del_list = []
+        for (b, l, r) in self.breakpointSigns:
+            if (b, l, r) not in needed_bps:
+                self.breakpointSigns[(b, l, r)].hide()
+                del_list.append((b, l, r))
+        for d in del_list:
+            del self.breakpointSigns[d]
+
+        # Show any signs for new breakpoints
+        for (b, l, r) in needed_bps:
+            bp = needed_bps[(b, l, r)]
+            if self.haveBreakpoint(b.name, l):
+                self.markedBreakpoints[(b.name, l)].append(bp)
+            else:
+                self.markedBreakpoints[(b.name, l)] = [bp]
+
+            if (b, l, r) not in self.breakpointSigns:
+                s = BreakpointSign(b, l, r)
+                self.breakpointSigns[(b, l, r)] = s
+
+    def update(self, target, status, controller, goto_file=False):
+        """ Updates debugger info panels and breakpoint/pc marks and prints
+            status to the vim status line. If goto_file is True, the user's
+            cursor is moved to the source PC location in the selected frame.
+        """
+
+        self.paneCol.update(target, controller)
+        self.update_breakpoints(target, self.get_user_buffers())
+
+        if target is not None and target.IsValid():
+            process = target.GetProcess()
+            if process is not None and process.IsValid():
+                self.update_pc(process, self.get_user_buffers, goto_file)
+
+        if status is not None and len(status) > 0:
+            print status
+
+    def haveBreakpoint(self, file, line):
+        """ Returns True if we have a breakpoint at file:line, False otherwise  """
+        return (file, line) in self.markedBreakpoints
+
+    def getBreakpoints(self, fname, line):
+        """ Returns the LLDB SBBreakpoint object at fname:line """
+        if self.haveBreakpoint(fname, line):
+            return self.markedBreakpoints[(fname, line)]
+        else:
+            return None
+
+    def deleteBreakpoints(self, name, line):
+        del self.markedBreakpoints[(name, line)]
+
+    def showWindow(self, name):
+        """ Shows (un-hides) window pane specified by name """
+        if not self.paneCol.havePane(name):
+            sys.stderr.write("unknown window: %s" % name)
+            return False
+        self.paneCol.prepare([name])
+        return True
+
+    def hideWindow(self, name):
+        """ Hides window pane specified by name """
+        if not self.paneCol.havePane(name):
+            sys.stderr.write("unknown window: %s" % name)
+            return False
+        self.paneCol.hide([name])
+        return True
 
 global ui
 ui = UI()




More information about the lldb-commits mailing list