From 8e6b31c3952b366fc3fa0da8e3df7fc09fa65b05 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Wed, 7 Jul 2021 11:51:16 -0700 Subject: [PATCH] [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 --- lldb/include/lldb/lldb-forward.h | 1 - lldb/source/Plugins/Trace/CMakeLists.txt | 2 ++ lldb/source/Plugins/Trace/common/CMakeLists.txt | 8 ++++++++ .../{Target => Plugins/Trace/common}/ThreadPostMortemTrace.cpp | 2 +- .../Plugins/Trace/common}/ThreadPostMortemTrace.h | 0 .../{Target => Plugins/Trace/common}/TraceSessionFileParser.cpp | 4 ++-- .../Plugins/Trace/common}/TraceSessionFileParser.h | 2 +- lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt | 1 + lldb/source/Target/CMakeLists.txt | 2 -- lldb/source/Target/Trace.cpp | 1 - 10 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 lldb/source/Plugins/Trace/common/CMakeLists.txt rename lldb/source/{Target => Plugins/Trace/common}/ThreadPostMortemTrace.cpp (96%) rename lldb/{include/lldb/Target => source/Plugins/Trace/common}/ThreadPostMortemTrace.h (100%) rename lldb/source/{Target => Plugins/Trace/common}/TraceSessionFileParser.cpp (98%) rename lldb/{include/lldb/Target => source/Plugins/Trace/common}/TraceSessionFileParser.h (99%) diff --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h index 452dbff..2206f57 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 edbb5f1..955f88c 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 0000000..604ddb6 --- /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 f8eb3e4..45d6f3b 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 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 006d74b..c88ad9d 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 @@ -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 68abc7d..6abaffc 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 5b58a570..7ecc9b7 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 3875bc9..da026f5 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 f55346f..827f326 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; -- 2.7.4