[all-commits] [llvm/llvm-project] 0b6975: [trace][intel-pt] Implement trace start and trace ...

walter erquinigo via All-commits all-commits at lists.llvm.org
Tue Mar 30 17:31:55 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0b69756110db444282c40ea16929186b2910c3b1
      https://github.com/llvm/llvm-project/commit/0b69756110db444282c40ea16929186b2910c3b1
  Author: Walter Erquinigo <a20012251 at gmail.com>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M lldb/docs/lldb-gdb-remote.txt
    M lldb/include/lldb/Core/PluginManager.h
    M lldb/include/lldb/Host/common/NativeProcessProtocol.h
    M lldb/include/lldb/Target/Process.h
    M lldb/include/lldb/Target/ProcessTrace.h
    M lldb/include/lldb/Target/StopInfo.h
    M lldb/include/lldb/Target/Target.h
    A lldb/include/lldb/Target/ThreadPostMortemTrace.h
    R lldb/include/lldb/Target/ThreadTrace.h
    M lldb/include/lldb/Target/Trace.h
    M lldb/include/lldb/Target/TraceSessionFileParser.h
    M lldb/include/lldb/Utility/StringExtractorGDBRemote.h
    A lldb/include/lldb/Utility/TraceGDBRemotePackets.h
    A lldb/include/lldb/Utility/TraceIntelPTGDBRemotePackets.h
    M lldb/include/lldb/Utility/TraceOptions.h
    M lldb/include/lldb/lldb-enumerations.h
    M lldb/include/lldb/lldb-forward.h
    M lldb/include/lldb/lldb-private-interfaces.h
    M lldb/source/API/SBThread.cpp
    M lldb/source/API/SBTrace.cpp
    M lldb/source/Commands/CommandObjectProcess.cpp
    M lldb/source/Commands/CommandObjectThread.cpp
    M lldb/source/Commands/CommandObjectThreadUtil.cpp
    M lldb/source/Commands/CommandObjectThreadUtil.h
    M lldb/source/Commands/CommandObjectTrace.cpp
    M lldb/source/Commands/CommandObjectTrace.h
    M lldb/source/Core/PluginManager.cpp
    M lldb/source/Interpreter/CommandInterpreter.cpp
    M lldb/source/Plugins/Process/Linux/CMakeLists.txt
    A lldb/source/Plugins/Process/Linux/IntelPTManager.cpp
    A lldb/source/Plugins/Process/Linux/IntelPTManager.h
    M lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
    M lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
    M lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
    M lldb/source/Plugins/Process/Linux/NativeThreadLinux.h
    R lldb/source/Plugins/Process/Linux/ProcessorTrace.cpp
    R lldb/source/Plugins/Process/Linux/ProcessorTrace.h
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
    M lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    M lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
    M lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
    M lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.h
    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/IntelPTDecoder.cpp
    M lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.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/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/forward-declarations.h
    M lldb/source/Target/CMakeLists.txt
    M lldb/source/Target/Process.cpp
    M lldb/source/Target/ProcessTrace.cpp
    M lldb/source/Target/StopInfo.cpp
    M lldb/source/Target/Target.cpp
    M lldb/source/Target/Thread.cpp
    A lldb/source/Target/ThreadPostMortemTrace.cpp
    R lldb/source/Target/ThreadTrace.cpp
    M lldb/source/Target/Trace.cpp
    M lldb/source/Target/TraceSessionFileParser.cpp
    M lldb/source/Utility/CMakeLists.txt
    M lldb/source/Utility/StringExtractorGDBRemote.cpp
    A lldb/source/Utility/TraceGDBRemotePackets.cpp
    A lldb/source/Utility/TraceIntelPTGDBRemotePackets.cpp
    R lldb/source/Utility/TraceOptions.cpp
    M lldb/test/API/commands/trace/TestTraceLoad.py
    M lldb/test/API/commands/trace/TestTraceSchema.py
    M lldb/test/API/commands/trace/TestTraceStartStop.py
    M lldb/test/API/commands/trace/intelpt-trace-multi-file/multi-file-no-ld.json
    M lldb/test/API/commands/trace/intelpt-trace/trace.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_2threads.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_bad.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_bad2.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_bad3.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_bad4.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_bad5.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_bad_image.json
    M lldb/test/API/commands/trace/intelpt-trace/trace_wrong_cpu.json
    A lldb/test/API/commands/trace/multiple-threads/Makefile
    A lldb/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py
    A lldb/test/API/commands/trace/multiple-threads/main.cpp
    M lldb/tools/lldb-vscode/JSONUtils.cpp
    M lldb/tools/lldb-vscode/LLDBUtils.cpp
    M lldb/unittests/Process/Linux/CMakeLists.txt
    A lldb/unittests/Process/Linux/IntelPTManagerTests.cpp
    R lldb/unittests/Process/Linux/ProcessorTraceTest.cpp
    M lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

  Log Message:
  -----------
  [trace][intel-pt] Implement trace start and trace stop

This implements the interactive trace start and stop methods.

This diff ended up being much larger than I anticipated because, by doing it, I found that I had implemented in the beginning many things in a non optimal way. In any case, the code is much better now.

There's a lot of boilerplate code due to the gdb-remote protocol, but the main changes are:

- New tracing packets: jLLDBTraceStop, jLLDBTraceStart, jLLDBTraceGetBinaryData. The gdb-remote packet definitions are quite comprehensive.
- Implementation of the "process trace start|stop" and "thread trace start|stop" commands.
- Implementaiton of an API in Trace.h to interact with live traces.
- Created an IntelPTDecoder for live threads, that use the debugger's stop id as checkpoint for its internal cache.
- Added a functionality to stop the process in case "process tracing" is enabled and a new thread can't traced.
- Added tests

I have some ideas to unify the code paths for post mortem and live threads, but I'll do that in another diff.

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




More information about the All-commits mailing list