[all-commits] [llvm/llvm-project] b0aa70: [trace][intel pt] Implement the Intel PT cursor

walter erquinigo via All-commits all-commits at lists.llvm.org
Fri Jul 16 16:48:00 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b0aa70761b8324d0c9ebc57da58a44c9e266ce0e
      https://github.com/llvm/llvm-project/commit/b0aa70761b8324d0c9ebc57da58a44c9e266ce0e
  Author: Walter Erquinigo <wallace at fb.com>
  Date:   2021-07-16 (Fri, 16 Jul 2021)

  Changed paths:
    M lldb/include/lldb/Target/Trace.h
    M lldb/include/lldb/Target/TraceCursor.h
    A lldb/include/lldb/Target/TraceInstructionDumper.h
    M lldb/source/Commands/CommandObjectThread.cpp
    M lldb/source/Commands/Options.td
    M lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
    M lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
    M lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
    M lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.cpp
    M lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.h
    A lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
    A lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
    M lldb/source/Target/CMakeLists.txt
    M lldb/source/Target/Trace.cpp
    M lldb/source/Target/TraceCursor.cpp
    A lldb/source/Target/TraceInstructionDumper.cpp
    M lldb/test/API/commands/trace/TestTraceDumpInstructions.py
    M lldb/test/API/commands/trace/TestTraceStartStop.py
    M lldb/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py

  Log Message:
  -----------
  [trace][intel pt] Implement the Intel PT cursor

D104422 added the interface for TraceCursor, which is the main way to traverse instructions in a trace. This diff implements the corresponding cursor class for Intel PT and deletes the now obsolete code.

Besides that, the logic for the "thread trace dump instructions" was adapted to use this cursor (pretty much I ended up moving code from Trace.cpp to TraceCursor.cpp). The command by default traverses the instructions backwards, and if the user passes --forwards, then it's not forwards. More information about that is in the Options.td file.

Regarding the Intel PT cursor. All Intel PT cursors for the same thread share the same DecodedThread instance. I'm not yet implementing lazy decoding because we don't need it. That'll be for later. For the time being, the entire thread trace is decoded when the first cursor for that thread is requested.

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




More information about the All-commits mailing list