[LLDB] Move Trace-specific classes into separate library
authorAlex Langford <apl@fb.com>
Wed, 7 Jul 2021 18:51:16 +0000 (11:51 -0700)
committerAlex Langford <apl@fb.com>
Wed, 21 Jul 2021 20:28:34 +0000 (13:28 -0700)
These two classes, TraceSessionFileParser and ThreadPostMortemTrace,
seem to be useful primarily for tracing. Currently it looks like
intel-pt is the sole user of these, but that other tracing plugins could
be written in the future that take advantage of these. Unfortunately
with them in Target, there is a dependency on PluginProcessUtility. I'd
like to sever that dependency, so I moved them into a `TraceCommon`
plugin.

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

lldb/include/lldb/lldb-forward.h
lldb/source/Plugins/Trace/CMakeLists.txt
lldb/source/Plugins/Trace/common/CMakeLists.txt [new file with mode: 0644]
lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.cpp [moved from lldb/source/Target/ThreadPostMortemTrace.cpp with 96% similarity]
lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.h [moved from lldb/include/lldb/Target/ThreadPostMortemTrace.h with 100% similarity]
lldb/source/Plugins/Trace/common/TraceSessionFileParser.cpp [moved from lldb/source/Target/TraceSessionFileParser.cpp with 98% similarity]
lldb/source/Plugins/Trace/common/TraceSessionFileParser.h [moved from lldb/include/lldb/Target/TraceSessionFileParser.h with 99% similarity]
lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
lldb/source/Target/CMakeLists.txt
lldb/source/Target/Trace.cpp

index 452dbff..2206f57 100644 (file)
@@ -230,7 +230,6 @@ class ThreadSpec;
 class ThreadPostMortemTrace;
 class Trace;
 class TraceCursor;
-class TraceSessionFileParser;
 class Type;
 class TypeAndOrName;
 class TypeCategoryImpl;
index edbb5f1..955f88c 100644 (file)
@@ -1,5 +1,7 @@
 option(LLDB_BUILD_INTEL_PT "Enable Building of Intel(R) Processor Trace Tool" OFF)
 
+add_subdirectory(common)
+
 if (LLDB_BUILD_INTEL_PT)
   add_subdirectory(intel-pt)
 endif()
diff --git a/lldb/source/Plugins/Trace/common/CMakeLists.txt b/lldb/source/Plugins/Trace/common/CMakeLists.txt
new file mode 100644 (file)
index 0000000..604ddb6
--- /dev/null
@@ -0,0 +1,8 @@
+add_lldb_library(lldbPluginTraceCommon
+  ThreadPostMortemTrace.cpp
+  TraceSessionFileParser.cpp
+
+  LINK_LIBS
+    lldbCore
+    lldbTarget
+  )
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "lldb/Target/ThreadPostMortemTrace.h"
+#include "ThreadPostMortemTrace.h"
 
 #include <memory>
 
@@ -6,7 +6,8 @@
 //
 //===----------------------------------------------------------------------===/
 
-#include "lldb/Target/TraceSessionFileParser.h"
+#include "TraceSessionFileParser.h"
+#include "ThreadPostMortemTrace.h"
 
 #include <sstream>
 
@@ -14,7 +15,6 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
-#include "lldb/Target/ThreadPostMortemTrace.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -11,7 +11,7 @@
 
 #include "llvm/Support/JSON.h"
 
-#include "lldb/Target/ThreadPostMortemTrace.h"
+#include "ThreadPostMortemTrace.h"
 
 namespace lldb_private {
 
index 5b58a57..7ecc9b7 100644 (file)
@@ -25,6 +25,7 @@ add_lldb_library(lldbPluginTraceIntelPT PLUGIN
     lldbCore
     lldbSymbol
     lldbTarget
+    lldbPluginTraceCommon
     ${LIBIPT_LIBRARY}
   LINK_COMPONENTS
     Support
index 3875bc9..da026f5 100644 (file)
@@ -66,11 +66,9 @@ add_lldb_library(lldbTarget
   ThreadPlanTracer.cpp
   ThreadPlanStack.cpp
   ThreadSpec.cpp
-  ThreadPostMortemTrace.cpp
   Trace.cpp
   TraceCursor.cpp
   TraceInstructionDumper.cpp
-  TraceSessionFileParser.cpp
   UnixSignals.cpp
   UnwindAssembly.cpp
   UnwindLLDB.cpp
index f55346f..827f326 100644 (file)
@@ -17,7 +17,6 @@
 #include "lldb/Target/Process.h"
 #include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/Thread.h"
-#include "lldb/Target/ThreadPostMortemTrace.h"
 #include "lldb/Utility/Stream.h"
 
 using namespace lldb;