bulbazord created this revision. bulbazord added reviewers: wallace, clayborg. Herald added a subscriber: mgorny. bulbazord requested review of this revision. Herald added a project: LLDB.
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. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D105649 Files: lldb/include/lldb/Target/ThreadPostMortemTrace.h lldb/include/lldb/Target/TraceSessionFileParser.h lldb/include/lldb/lldb-forward.h lldb/source/Plugins/Trace/CMakeLists.txt 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 lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt lldb/source/Target/CMakeLists.txt lldb/source/Target/ThreadPostMortemTrace.cpp lldb/source/Target/Trace.cpp lldb/source/Target/TraceSessionFileParser.cpp
Index: lldb/source/Target/Trace.cpp =================================================================== --- lldb/source/Target/Trace.cpp +++ 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; Index: lldb/source/Target/CMakeLists.txt =================================================================== --- lldb/source/Target/CMakeLists.txt +++ lldb/source/Target/CMakeLists.txt @@ -66,10 +66,8 @@ ThreadPlanTracer.cpp ThreadPlanStack.cpp ThreadSpec.cpp - ThreadPostMortemTrace.cpp Trace.cpp TraceCursor.cpp - TraceSessionFileParser.cpp UnixSignals.cpp UnwindAssembly.cpp UnwindLLDB.cpp Index: lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt =================================================================== --- lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt +++ lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt @@ -24,6 +24,7 @@ lldbCore lldbSymbol lldbTarget + lldbPluginTraceCommon ${LIBIPT_LIBRARY} LINK_COMPONENTS Support Index: lldb/source/Plugins/Trace/common/TraceSessionFileParser.h =================================================================== --- lldb/source/Plugins/Trace/common/TraceSessionFileParser.h +++ 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 { Index: lldb/source/Plugins/Trace/common/TraceSessionFileParser.cpp =================================================================== --- lldb/source/Plugins/Trace/common/TraceSessionFileParser.cpp +++ 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; Index: lldb/include/lldb/Target/ThreadPostMortemTrace.h =================================================================== --- /dev/null +++ lldb/include/lldb/Target/ThreadPostMortemTrace.h @@ -1,60 +0,0 @@ -//===-- ThreadPostMortemTrace.h ---------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef LLDB_TARGET_THREADPOSTMORTEMTRACE_H -#define LLDB_TARGET_THREADPOSTMORTEMTRACE_H - -#include "lldb/Target/Thread.h" - -namespace lldb_private { - -/// \class ThreadPostMortemTrace ThreadPostMortemTrace.h -/// -/// Thread implementation used for representing threads gotten from trace -/// session files, which are similar to threads from core files. -/// -/// See \a TraceSessionFileParser for more information regarding trace session -/// files. -class ThreadPostMortemTrace : public Thread { -public: - /// \param[in] process - /// The process who owns this thread. - /// - /// \param[in] tid - /// The tid of this thread. - /// - /// \param[in] trace_file - /// The file that contains the list of instructions that were traced when - /// this thread was being executed. - ThreadPostMortemTrace(Process &process, lldb::tid_t tid, - const FileSpec &trace_file) - : Thread(process, tid), m_trace_file(trace_file) {} - - void RefreshStateAfterStop() override; - - lldb::RegisterContextSP GetRegisterContext() override; - - lldb::RegisterContextSP - CreateRegisterContextForFrame(StackFrame *frame) override; - - /// \return - /// The trace file of this thread. - const FileSpec &GetTraceFile() const; - -protected: - bool CalculateStopInfo() override; - - lldb::RegisterContextSP m_thread_reg_ctx_sp; - -private: - FileSpec m_trace_file; -}; - -} // namespace lldb_private - -#endif // LLDB_TARGET_THREADPOSTMORTEMTRACE_H Index: lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.cpp =================================================================== --- lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.cpp +++ lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Target/ThreadPostMortemTrace.h" +#include "ThreadPostMortemTrace.h" #include <memory> Index: lldb/source/Plugins/Trace/common/CMakeLists.txt =================================================================== --- /dev/null +++ lldb/source/Plugins/Trace/common/CMakeLists.txt @@ -0,0 +1,8 @@ +add_lldb_library(lldbPluginTraceCommon + ThreadPostMortemTrace.cpp + TraceSessionFileParser.cpp + + LINK_LIBS + lldbCore + lldbTarget + ) Index: lldb/source/Plugins/Trace/CMakeLists.txt =================================================================== --- lldb/source/Plugins/Trace/CMakeLists.txt +++ 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() Index: lldb/include/lldb/lldb-forward.h =================================================================== --- lldb/include/lldb/lldb-forward.h +++ lldb/include/lldb/lldb-forward.h @@ -230,7 +230,6 @@ class ThreadPostMortemTrace; class Trace; class TraceCursor; -class TraceSessionFileParser; class Type; class TypeAndOrName; class TypeCategoryImpl;
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits