[all-commits] [llvm/llvm-project] a7d6c3: [trace] Make events first class items in the trace...

walter erquinigo via All-commits all-commits at lists.llvm.org
Wed Jun 29 09:20:08 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a7d6c3effe93954ecad634eebbcc59fc6856c3d9
      https://github.com/llvm/llvm-project/commit/a7d6c3effe93954ecad634eebbcc59fc6856c3d9
  Author: Walter Erquinigo <wallace at fb.com>
  Date:   2022-06-29 (Wed, 29 Jun 2022)

  Changed paths:
    M lldb/include/lldb/Target/Trace.h
    M lldb/include/lldb/Target/TraceCursor.h
    A lldb/include/lldb/Target/TraceDumper.h
    R lldb/include/lldb/Target/TraceInstructionDumper.h
    M lldb/include/lldb/lldb-enumerations.h
    M lldb/source/Commands/CommandObjectThread.cpp
    M lldb/source/Commands/Options.td
    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/LibiptDecoder.cpp
    M lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
    M lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp
    M lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.h
    M lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
    M 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/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h
    M lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
    M lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
    M lldb/source/Target/CMakeLists.txt
    M lldb/source/Target/TraceCursor.cpp
    A lldb/source/Target/TraceDumper.cpp
    R lldb/source/Target/TraceInstructionDumper.cpp
    M lldb/test/API/commands/trace/TestTraceDumpInfo.py
    M lldb/test/API/commands/trace/TestTraceDumpInstructions.py
    M lldb/test/API/commands/trace/TestTraceEvents.py
    M lldb/test/API/commands/trace/TestTraceExport.py
    M lldb/test/API/commands/trace/TestTraceLoad.py
    M lldb/test/API/commands/trace/TestTraceStartStop.py
    M lldb/test/API/commands/trace/TestTraceTSC.py
    M lldb/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py

  Log Message:
  -----------
  [trace] Make events first class items in the trace cursor and rework errors

We want to include events with metadata, like context switches, and this
requires the API to handle events with payloads (e.g. information about
such context switches). Besides this, we want to support multiple
similar events between two consecutive instructions, like multiple
context switches. However, the current implementation is not good for this because
we are defining events as bitmask enums associated with specific
instructions. Thus, we need to decouple instructions from events and
make events actual items in the trace, just like instructions and
errors.

- Add accessors in the TraceCursor to know if an item is an event or not
- Modify from the TraceDumper all the way to DecodedThread to support
- Renamed the paused event to disabled.
- Improved the tsc handling logic. I was using an API for getting the tsc from libipt, but that was an overkill that should be used when not processing events manually, but as we are already processing events, we can more easily get the tscs.
event items. Fortunately this simplified many things
- As part of this refactor, I also fixed and long stating issue, which is that some non decoding errors were being inserted in the decoded thread. I changed this so that TraceIntelPT::Decode returns an error if the decoder couldn't be set up proplerly. Then, errors within a trace are actual anomalies found in between instrutions.

All test pass

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




More information about the All-commits mailing list