[Lldb-commits] [PATCH] D107669: Create "process trace save" command

hanbing wang via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 6 14:48:52 PDT 2021


hanbingwang created this revision.
hanbingwang added reviewers: wallace, clayborg.
Herald added subscribers: dang, mgorny.
hanbingwang requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

added new command "process trace save -d <directory>".
-it only support Intel-pt right now.
-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.

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:
./bin/lldb-dotest -p TestTraceSave


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107669

Files:
  lldb/include/lldb/Target/Trace.h
  lldb/source/Commands/CommandObjectProcess.cpp
  lldb/source/Commands/Options.td
  lldb/source/Plugins/Trace/common/CMakeLists.txt
  lldb/source/Plugins/Trace/common/TraceJSONStructs.cpp
  lldb/source/Plugins/Trace/common/TraceJSONStructs.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/Plugins/Trace/intel-pt/IntelPTDecoder.cpp
  lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.h
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPTOptions.td
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.h
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileSaver.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileSaver.h
  lldb/test/API/commands/trace/TestTraceSave.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107669.364888.patch
Type: text/x-patch
Size: 47985 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210806/b80e8515/attachment-0001.bin>


More information about the lldb-commits mailing list