[all-commits] [llvm/llvm-project] 602497: [trace] [intel pt] Create a "process trace save" c...

walter erquinigo via All-commits all-commits at lists.llvm.org
Fri Aug 27 09:34:32 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 602497d672ca66f3f0e59adca35f00199f266810
      https://github.com/llvm/llvm-project/commit/602497d672ca66f3f0e59adca35f00199f266810
  Author: Walter Erquinigo <wallace at fb.com>
  Date:   2021-08-27 (Fri, 27 Aug 2021)

  Changed paths:
    M lldb/include/lldb/Target/Trace.h
    M lldb/source/Commands/CommandObjectProcess.cpp
    M lldb/source/Commands/Options.td
    M lldb/source/Plugins/Trace/common/CMakeLists.txt
    A lldb/source/Plugins/Trace/common/TraceJSONStructs.cpp
    A lldb/source/Plugins/Trace/common/TraceJSONStructs.h
    M lldb/source/Plugins/Trace/common/TraceSessionFileParser.cpp
    M lldb/source/Plugins/Trace/common/TraceSessionFileParser.h
    A lldb/source/Plugins/Trace/common/TraceSessionSaver.cpp
    A lldb/source/Plugins/Trace/common/TraceSessionSaver.h
    M lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
    A lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
    A lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTOptions.td
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.h
    A lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionSaver.cpp
    A lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionSaver.h
    A lldb/test/API/commands/trace/TestTraceSave.py

  Log Message:
  -----------
  [trace] [intel pt] Create a "process trace save" command

added new command "process trace save -d <directory>".
-it saves a JSON file as <directory>/trace.json, with the main properties of the trace session.
-it saves binary Intel-pt trace as <directory>/thread_id.trace; each file saves each thread.
-it saves modules to the directory <directory>/modules .
-it only works for live process and it only support Intel-pt right now.

Example:
```
b main
run
process trace start
n
process trace save -d /tmp/mytrace
```
A file named trace.json and xxx.trace should be generated in /tmp/mytrace. To load the trace that was just saved:
```
trace load /tmp/mytrace
thread trace dump instructions
```
You should see the instructions of the trace got printed.

To run a test:
```
cd ~/llvm-sand/build/Release/fbcode-x86_64/toolchain
ninja lldb-dotest
./bin/lldb-dotest -p TestTraceSave
```

Reviewed By: wallace

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




More information about the All-commits mailing list