HomePhabricator

Add a "Trace" plug-in to LLDB to add process trace support in stages.

Authored by Walter Erquinigo <waltermelon@fb.com> on Aug 17 2020, 5:21 PM.

Description

Add a "Trace" plug-in to LLDB to add process trace support in stages.

This is the first in a series of patches that will adds a new processor trace plug-in to LLDB.

The idea for this first patch to to add the plug-in interface with simple commands for the trace files that can "load" and "dump" the trace information. We can test the functionality and ensure people are happy with the way things are done and how things are organized before moving on to adding more functionality.

Processor trace information can be view in a few different ways:

  • post mortem where a trace is saved off that can be viewed later in the debugger
  • gathered while a process is running and allow the user to step back in time (with no variables, memory or registers) to see how each thread arrived at where it is currently stopped.

This patch attempts to start with the first solution of loading a trace file after the fact. The idea is that we will use a JSON file to load the trace information. JSON allows us to specify information about the trace like:

  • plug-in name in LLDB
  • path to trace file
  • shared library load information so we can re-create a target and symbolicate the information in the trace
  • any other info that the trace plug-in will need to be able to successfully parse the trace information
    • cpu type
    • version info
    • ???

A new "trace" command was added at the top level of the LLDB commmands:

  • "trace load"
  • "trace dump"

I did this because if we load trace information we don't need to have a process and we might end up creating a new target for the trace information that will become active. If anyone has any input on where this would be better suited, please let me know. Walter Erquinigo will end up filling in the Intel PT specific plug-in so that it works and is tested once we can agree that the direction of this patch is the correct one, so please feel free to chime in with ideas on comments!

Reviewed By: clayborg

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

Details