[Lldb-commits] [lldb] 8e6b31c - [LLDB] Move Trace-specific classes into separate library
Alex Langford via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 21 13:28:42 PDT 2021
Author: Alex Langford
Date: 2021-07-21T13:28:34-07:00
New Revision: 8e6b31c3952b366fc3fa0da8e3df7fc09fa65b05
URL: https://github.com/llvm/llvm-project/commit/8e6b31c3952b366fc3fa0da8e3df7fc09fa65b05
DIFF: https://github.com/llvm/llvm-project/commit/8e6b31c3952b366fc3fa0da8e3df7fc09fa65b05.diff
LOG: [LLDB] Move Trace-specific classes into separate library
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
Added:
lldb/source/Plugins/Trace/common/CMakeLists.txt
lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.cpp
lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.h
lldb/source/Plugins/Trace/common/TraceSessionFileParser.cpp
lldb/source/Plugins/Trace/common/TraceSessionFileParser.h
Modified:
lldb/include/lldb/lldb-forward.h
lldb/source/Plugins/Trace/CMakeLists.txt
lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
lldb/source/Target/CMakeLists.txt
lldb/source/Target/Trace.cpp
Removed:
lldb/include/lldb/Target/ThreadPostMortemTrace.h
lldb/include/lldb/Target/TraceSessionFileParser.h
lldb/source/Target/ThreadPostMortemTrace.cpp
lldb/source/Target/TraceSessionFileParser.cpp
################################################################################
diff --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h
index 452dbff029b1..2206f575fb08 100644
--- a/lldb/include/lldb/lldb-forward.h
+++ b/lldb/include/lldb/lldb-forward.h
@@ -230,7 +230,6 @@ class ThreadSpec;
class ThreadPostMortemTrace;
class Trace;
class TraceCursor;
-class TraceSessionFileParser;
class Type;
class TypeAndOrName;
class TypeCategoryImpl;
diff --git a/lldb/source/Plugins/Trace/CMakeLists.txt b/lldb/source/Plugins/Trace/CMakeLists.txt
index edbb5f14b4e6..955f88cec340 100644
--- a/lldb/source/Plugins/Trace/CMakeLists.txt
+++ b/lldb/source/Plugins/Trace/CMakeLists.txt
@@ -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
index 000000000000..604ddb6233d3
--- /dev/null
+++ b/lldb/source/Plugins/Trace/common/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_lldb_library(lldbPluginTraceCommon
+ ThreadPostMortemTrace.cpp
+ TraceSessionFileParser.cpp
+
+ LINK_LIBS
+ lldbCore
+ lldbTarget
+ )
diff --git a/lldb/source/Target/ThreadPostMortemTrace.cpp b/lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.cpp
similarity index 96%
rename from lldb/source/Target/ThreadPostMortemTrace.cpp
rename to lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.cpp
index f8eb3e4f1f2d..45d6f3b0e098 100644
--- a/lldb/source/Target/ThreadPostMortemTrace.cpp
+++ b/lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Target/ThreadPostMortemTrace.h"
+#include "ThreadPostMortemTrace.h"
#include <memory>
diff --git a/lldb/include/lldb/Target/ThreadPostMortemTrace.h b/lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.h
similarity index 100%
rename from lldb/include/lldb/Target/ThreadPostMortemTrace.h
rename to lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.h
diff --git a/lldb/source/Target/TraceSessionFileParser.cpp b/lldb/source/Plugins/Trace/common/TraceSessionFileParser.cpp
similarity index 98%
rename from lldb/source/Target/TraceSessionFileParser.cpp
rename to lldb/source/Plugins/Trace/common/TraceSessionFileParser.cpp
index 006d74b28e8b..c88ad9dc6a59 100644
--- a/lldb/source/Target/TraceSessionFileParser.cpp
+++ b/lldb/source/Plugins/Trace/common/TraceSessionFileParser.cpp
@@ -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;
diff --git a/lldb/include/lldb/Target/TraceSessionFileParser.h b/lldb/source/Plugins/Trace/common/TraceSessionFileParser.h
similarity index 99%
rename from lldb/include/lldb/Target/TraceSessionFileParser.h
rename to lldb/source/Plugins/Trace/common/TraceSessionFileParser.h
index 68abc7d006d3..6abaffcecd3a 100644
--- a/lldb/include/lldb/Target/TraceSessionFileParser.h
+++ b/lldb/source/Plugins/Trace/common/TraceSessionFileParser.h
@@ -11,7 +11,7 @@
#include "llvm/Support/JSON.h"
-#include "lldb/Target/ThreadPostMortemTrace.h"
+#include "ThreadPostMortemTrace.h"
namespace lldb_private {
diff --git a/lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt b/lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
index 5b58a5703c09..7ecc9b77780b 100644
--- a/lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
+++ b/lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
@@ -25,6 +25,7 @@ add_lldb_library(lldbPluginTraceIntelPT PLUGIN
lldbCore
lldbSymbol
lldbTarget
+ lldbPluginTraceCommon
${LIBIPT_LIBRARY}
LINK_COMPONENTS
Support
diff --git a/lldb/source/Target/CMakeLists.txt b/lldb/source/Target/CMakeLists.txt
index 3875bc987dd0..da026f567d07 100644
--- a/lldb/source/Target/CMakeLists.txt
+++ b/lldb/source/Target/CMakeLists.txt
@@ -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
diff --git a/lldb/source/Target/Trace.cpp b/lldb/source/Target/Trace.cpp
index f55346fbeff7..827f3264c096 100644
--- a/lldb/source/Target/Trace.cpp
+++ b/lldb/source/Target/Trace.cpp
@@ -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;
More information about the lldb-commits
mailing list