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
This class will already have a process in "Process *m_live_process" member variable, so no need to pass in the process. This will be NULL if we loaded a trace from disk already, but that should be ok because it was already loaded from something on disk.