[Lldb-commits] [PATCH] D34625: Move StructuredData from Core to Utility

2017-06-27 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL306394: Move StructuredData from Core to Utility (authored 
by labath).

Changed prior to commit:
  https://reviews.llvm.org/D34625?vs=103976=104127#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34625

Files:
  lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
  lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
  lldb/trunk/include/lldb/Core/Event.h
  lldb/trunk/include/lldb/Core/SearchFilter.h
  lldb/trunk/include/lldb/Core/StructuredData.h
  lldb/trunk/include/lldb/Core/StructuredDataImpl.h
  lldb/trunk/include/lldb/Core/TraceOptions.h
  lldb/trunk/include/lldb/DataFormatters/TypeSummary.h
  lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h
  lldb/trunk/include/lldb/Host/XML.h
  lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
  lldb/trunk/include/lldb/Target/InstrumentationRuntime.h
  lldb/trunk/include/lldb/Target/InstrumentationRuntimeStopInfo.h
  lldb/trunk/include/lldb/Target/Process.h
  lldb/trunk/include/lldb/Target/StopInfo.h
  lldb/trunk/include/lldb/Target/StructuredDataPlugin.h
  lldb/trunk/include/lldb/Target/SystemRuntime.h
  lldb/trunk/include/lldb/Target/Thread.h
  lldb/trunk/include/lldb/Target/ThreadPlanPython.h
  lldb/trunk/include/lldb/Target/ThreadSpec.h
  lldb/trunk/include/lldb/Utility/JSON.h
  lldb/trunk/include/lldb/Utility/StructuredData.h
  lldb/trunk/source/API/SBStructuredData.cpp
  lldb/trunk/source/API/SBThread.cpp
  lldb/trunk/source/API/SBThreadPlan.cpp
  lldb/trunk/source/Core/CMakeLists.txt
  lldb/trunk/source/Core/FormatEntity.cpp
  lldb/trunk/source/Core/StructuredData.cpp
  lldb/trunk/source/Host/macosx/Host.mm
  lldb/trunk/source/Host/windows/Host.cpp
  lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h
  lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
  lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
  lldb/trunk/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h
  
lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h
  lldb/trunk/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h
  lldb/trunk/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h
  lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
  lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
  lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt
  lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.h
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
  lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h
  lldb/trunk/source/Target/Platform.cpp
  lldb/trunk/source/Target/ThreadSpec.cpp
  lldb/trunk/source/Utility/CMakeLists.txt
  lldb/trunk/source/Utility/JSON.cpp
  lldb/trunk/source/Utility/StructuredData.cpp
  lldb/trunk/unittests/Core/CMakeLists.txt
  lldb/trunk/unittests/Core/StructuredDataTest.cpp
  lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
  lldb/trunk/unittests/Utility/CMakeLists.txt
  lldb/trunk/unittests/Utility/Inputs/StructuredData-basic.json
  lldb/trunk/unittests/Utility/StructuredDataTest.cpp
  lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.cpp

Index: lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -12,10 +12,10 @@
 
 #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h"
 #include "lldb/Core/ModuleSpec.h"
-#include "lldb/Core/StructuredData.h"
 #include "lldb/Core/TraceOptions.h"
 #include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Utility/DataBuffer.h"
+#include "lldb/Utility/StructuredData.h"
 #include "lldb/lldb-enumerations.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Testing/Support/Error.h"
Index: lldb/trunk/unittests/Utility/CMakeLists.txt
===
--- lldb/trunk/unittests/Utility/CMakeLists.txt
+++ lldb/trunk/unittests/Utility/CMakeLists.txt
@@ -6,6 +6,7 @@
   NameMatchesTest.cpp
   StatusTest.cpp
   StringExtractorTest.cpp
+  StructuredDataTest.cpp
   TaskPoolTest.cpp
   TildeExpressionResolverTest.cpp
   TimeoutTest.cpp
@@ -18,3 +19,7 @@
   LINK_COMPONENTS
 Support
   )
+
+add_unittest_inputs(UtilityTests
+  StructuredData-basic.json
+  )
Index: 

[Lldb-commits] [PATCH] D34625: Move StructuredData from Core to Utility

2017-06-26 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 103976.
labath added a comment.
Herald added a subscriber: emaste.

Well, PluginProcessPOSIX does not seem to be using anything from Core directly,
although I doubt that is thanks to this patch. It will be a long time before
anything stops depending on Core (my goal here is to do it for Host, but even
that is a long way off).


https://reviews.llvm.org/D34625

Files:
  include/lldb/Breakpoint/Breakpoint.h
  include/lldb/Breakpoint/BreakpointOptions.h
  include/lldb/Core/Event.h
  include/lldb/Core/SearchFilter.h
  include/lldb/Core/StructuredData.h
  include/lldb/Core/StructuredDataImpl.h
  include/lldb/Core/TraceOptions.h
  include/lldb/DataFormatters/TypeSummary.h
  include/lldb/DataFormatters/TypeSynthetic.h
  include/lldb/Host/XML.h
  include/lldb/Interpreter/ScriptInterpreter.h
  include/lldb/Target/InstrumentationRuntime.h
  include/lldb/Target/InstrumentationRuntimeStopInfo.h
  include/lldb/Target/Process.h
  include/lldb/Target/StopInfo.h
  include/lldb/Target/StructuredDataPlugin.h
  include/lldb/Target/SystemRuntime.h
  include/lldb/Target/Thread.h
  include/lldb/Target/ThreadPlanPython.h
  include/lldb/Utility/JSON.h
  include/lldb/Utility/StructuredData.h
  source/API/SBStructuredData.cpp
  source/API/SBThread.cpp
  source/API/SBThreadPlan.cpp
  source/Core/CMakeLists.txt
  source/Core/FormatEntity.cpp
  source/Core/StructuredData.cpp
  source/Host/macosx/Host.mm
  source/Host/windows/Host.cpp
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
  source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h
  
source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h
  source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h
  source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h
  source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
  source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
  source/Plugins/Process/POSIX/CMakeLists.txt
  source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  source/Plugins/Process/Utility/DynamicRegisterInfo.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h
  source/Target/Platform.cpp
  source/Target/ThreadSpec.cpp
  source/Utility/CMakeLists.txt
  source/Utility/JSON.cpp
  source/Utility/StructuredData.cpp
  unittests/Core/CMakeLists.txt
  unittests/Core/StructuredDataTest.cpp
  unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
  unittests/Utility/CMakeLists.txt
  unittests/Utility/Inputs/StructuredData-basic.json
  unittests/Utility/StructuredDataTest.cpp
  unittests/tools/lldb-server/tests/MessageObjects.cpp

Index: unittests/tools/lldb-server/tests/MessageObjects.cpp
===
--- unittests/tools/lldb-server/tests/MessageObjects.cpp
+++ unittests/tools/lldb-server/tests/MessageObjects.cpp
@@ -8,7 +8,7 @@
 //===--===//
 
 #include "MessageObjects.h"
-#include "lldb/Core/StructuredData.h"
+#include "lldb/Utility/StructuredData.h"
 #include "llvm/ADT/StringExtras.h"
 #include "gtest/gtest.h"
 
Index: unittests/Utility/StructuredDataTest.cpp
===
--- /dev/null
+++ unittests/Utility/StructuredDataTest.cpp
@@ -0,0 +1,68 @@
+//===-- StructuredDataTest.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/StructuredData.h"
+#include "llvm/Support/Path.h"
+
+extern const char *TestMainArgv0;
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace {
+
+class StructuredDataTest : public testing::Test {
+public:
+  static void SetUpTestCase() {
+s_inputs_folder = llvm::sys::path::parent_path(TestMainArgv0);
+llvm::sys::path::append(s_inputs_folder, "Inputs");
+  }
+
+protected:
+  static llvm::SmallString<128> s_inputs_folder;
+};
+}
+
+llvm::SmallString<128> StructuredDataTest::s_inputs_folder;
+
+TEST_F(StructuredDataTest, StringDump) {
+  std::pair TestCases[] = {
+{ R"(asdfg)", R"("asdfg")" },
+{ R"(as"df)", R"("as\"df")" },
+{ R"(as\df)", R"("as\\df")" },
+  };
+  

Re: [Lldb-commits] [PATCH] D34625: Move StructuredData from Core to Utility

2017-06-26 Thread Zachary Turner via lldb-commits
Can you run the analyze deps script before and after this patch, and update
the cmake files if any deps are no longer necessary?
On Mon, Jun 26, 2017 at 8:24 AM Pavel Labath via Phabricator <
revi...@reviews.llvm.org> wrote:

> labath created this revision.
> Herald added subscribers: mgorny, kubamracek.
>
> It had a dependency on StringConvert and file reading code, which is not
> in Utility. I've replaced that code by equivalent llvm operations.
>
> I've added a unit test to demonstrate that parsing a file still works.
>
>
> https://reviews.llvm.org/D34625
>
> Files:
>   include/lldb/Breakpoint/Breakpoint.h
>   include/lldb/Breakpoint/BreakpointOptions.h
>   include/lldb/Core/Event.h
>   include/lldb/Core/SearchFilter.h
>   include/lldb/Core/StructuredData.h
>   include/lldb/Core/StructuredDataImpl.h
>   include/lldb/Core/TraceOptions.h
>   include/lldb/DataFormatters/TypeSummary.h
>   include/lldb/DataFormatters/TypeSynthetic.h
>   include/lldb/Host/XML.h
>   include/lldb/Interpreter/ScriptInterpreter.h
>   include/lldb/Target/InstrumentationRuntime.h
>   include/lldb/Target/InstrumentationRuntimeStopInfo.h
>   include/lldb/Target/Process.h
>   include/lldb/Target/StopInfo.h
>   include/lldb/Target/StructuredDataPlugin.h
>   include/lldb/Target/SystemRuntime.h
>   include/lldb/Target/Thread.h
>   include/lldb/Target/ThreadPlanPython.h
>   include/lldb/Utility/JSON.h
>   include/lldb/Utility/StructuredData.h
>   source/API/SBStructuredData.cpp
>   source/API/SBThread.cpp
>   source/API/SBThreadPlan.cpp
>   source/Core/CMakeLists.txt
>   source/Core/FormatEntity.cpp
>   source/Core/StructuredData.cpp
>   source/Host/macosx/Host.mm
>   source/Host/windows/Host.cpp
>   source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h
>   source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
>   source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
>   source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h
>
> source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h
>   source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h
>   source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h
>   source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
>   source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
>   source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
>   source/Plugins/Process/Utility/DynamicRegisterInfo.h
>   source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
>
> source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
>   source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
>   source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
>   source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
>   source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h
>   source/Target/Platform.cpp
>   source/Target/ThreadSpec.cpp
>   source/Utility/CMakeLists.txt
>   source/Utility/JSON.cpp
>   source/Utility/StructuredData.cpp
>   unittests/Core/CMakeLists.txt
>   unittests/Core/StructuredDataTest.cpp
>   unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
>   unittests/Utility/CMakeLists.txt
>   unittests/Utility/Inputs/StructuredData-basic.json
>   unittests/Utility/StructuredDataTest.cpp
>   unittests/tools/lldb-server/tests/MessageObjects.cpp
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D34625: Move StructuredData from Core to Utility

2017-06-26 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
Herald added subscribers: mgorny, kubamracek.

It had a dependency on StringConvert and file reading code, which is not
in Utility. I've replaced that code by equivalent llvm operations.

I've added a unit test to demonstrate that parsing a file still works.


https://reviews.llvm.org/D34625

Files:
  include/lldb/Breakpoint/Breakpoint.h
  include/lldb/Breakpoint/BreakpointOptions.h
  include/lldb/Core/Event.h
  include/lldb/Core/SearchFilter.h
  include/lldb/Core/StructuredData.h
  include/lldb/Core/StructuredDataImpl.h
  include/lldb/Core/TraceOptions.h
  include/lldb/DataFormatters/TypeSummary.h
  include/lldb/DataFormatters/TypeSynthetic.h
  include/lldb/Host/XML.h
  include/lldb/Interpreter/ScriptInterpreter.h
  include/lldb/Target/InstrumentationRuntime.h
  include/lldb/Target/InstrumentationRuntimeStopInfo.h
  include/lldb/Target/Process.h
  include/lldb/Target/StopInfo.h
  include/lldb/Target/StructuredDataPlugin.h
  include/lldb/Target/SystemRuntime.h
  include/lldb/Target/Thread.h
  include/lldb/Target/ThreadPlanPython.h
  include/lldb/Utility/JSON.h
  include/lldb/Utility/StructuredData.h
  source/API/SBStructuredData.cpp
  source/API/SBThread.cpp
  source/API/SBThreadPlan.cpp
  source/Core/CMakeLists.txt
  source/Core/FormatEntity.cpp
  source/Core/StructuredData.cpp
  source/Host/macosx/Host.mm
  source/Host/windows/Host.cpp
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
  source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h
  
source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h
  source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h
  source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h
  source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
  source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
  source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  source/Plugins/Process/Utility/DynamicRegisterInfo.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h
  source/Target/Platform.cpp
  source/Target/ThreadSpec.cpp
  source/Utility/CMakeLists.txt
  source/Utility/JSON.cpp
  source/Utility/StructuredData.cpp
  unittests/Core/CMakeLists.txt
  unittests/Core/StructuredDataTest.cpp
  unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
  unittests/Utility/CMakeLists.txt
  unittests/Utility/Inputs/StructuredData-basic.json
  unittests/Utility/StructuredDataTest.cpp
  unittests/tools/lldb-server/tests/MessageObjects.cpp

Index: unittests/tools/lldb-server/tests/MessageObjects.cpp
===
--- unittests/tools/lldb-server/tests/MessageObjects.cpp
+++ unittests/tools/lldb-server/tests/MessageObjects.cpp
@@ -8,7 +8,7 @@
 //===--===//
 
 #include "MessageObjects.h"
-#include "lldb/Core/StructuredData.h"
+#include "lldb/Utility/StructuredData.h"
 #include "llvm/ADT/StringExtras.h"
 #include "gtest/gtest.h"
 
Index: unittests/Utility/StructuredDataTest.cpp
===
--- /dev/null
+++ unittests/Utility/StructuredDataTest.cpp
@@ -0,0 +1,68 @@
+//===-- StructuredDataTest.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/StructuredData.h"
+#include "llvm/Support/Path.h"
+
+extern const char *TestMainArgv0;
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace {
+
+class StructuredDataTest : public testing::Test {
+public:
+  static void SetUpTestCase() {
+s_inputs_folder = llvm::sys::path::parent_path(TestMainArgv0);
+llvm::sys::path::append(s_inputs_folder, "Inputs");
+  }
+
+protected:
+  static llvm::SmallString<128> s_inputs_folder;
+};
+}
+
+llvm::SmallString<128> StructuredDataTest::s_inputs_folder;
+
+TEST_F(StructuredDataTest, StringDump) {
+  std::pair TestCases[] = {
+{ R"(asdfg)", R"("asdfg")" },
+{ R"(as"df)", R"("as\"df")" },
+{ R"(as\df)", R"("as\\df")" },
+  };
+  for(auto P : TestCases) {
+StreamString S;
+const bool pretty_print = false;
+