[all-commits] [llvm/llvm-project] 1f4971: [trace][intelpt] Support system-wide tracing [4] -...

walter erquinigo via All-commits all-commits at lists.llvm.org
Tue May 17 12:47:11 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1f49714d3e19502753fcea7ad8378a194222328f
      https://github.com/llvm/llvm-project/commit/1f49714d3e19502753fcea7ad8378a194222328f
  Author: Walter Erquinigo <wallace at fb.com>
  Date:   2022-05-17 (Tue, 17 May 2022)

  Changed paths:
    M lldb/docs/lldb-gdb-remote.txt
    M lldb/include/lldb/Utility/TraceGDBRemotePackets.h
    M lldb/include/lldb/Utility/TraceIntelPTGDBRemotePackets.h
    M lldb/include/lldb/lldb-types.h
    M lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py
    M lldb/source/Plugins/Process/Linux/CMakeLists.txt
    M lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTCollector.h
    A lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
    A lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
    M lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h
    M lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
    M lldb/source/Plugins/Process/Linux/Perf.cpp
    M lldb/source/Plugins/Process/Linux/Perf.h
    M lldb/source/Plugins/Process/Linux/Procfs.cpp
    M lldb/source/Plugins/Process/Linux/Procfs.h
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
    M lldb/source/Plugins/Trace/intel-pt/TraceIntelPTOptions.td
    M lldb/source/Target/Trace.cpp
    M lldb/source/Utility/TraceGDBRemotePackets.cpp
    M lldb/source/Utility/TraceIntelPTGDBRemotePackets.cpp
    M lldb/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py
    M lldb/unittests/Process/Linux/ProcfsTests.cpp

  Log Message:
  -----------
  [trace][intelpt] Support system-wide tracing [4] - Support per core tracing on lldb-server

This diffs implements per-core tracing on lldb-server. It also includes tests that ensure that tracing can be initiated from the client and that the jLLDBGetState ppacket returns the list of trace buffers per core.

This doesn't include any decoder changes.

Finally, this makes some little changes here and there improving the existing code.

A specific piece of code that can't reliably be tested is when tracing
per core fails due to permissions. In this case we add a
troubleshooting message and this is the manual test:

```
/proc/sys/kernel/perf_event_paranoid set to 1

(lldb) process trace start --per-core-tracing                                         error: perf event syscall failed: Permission denied
 You might need that /proc/sys/kernel/perf_event_paranoid has a value of 0 or -1.
``

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


  Commit: 1637545f689b8c4ef888ca385de75982a6a932e3
      https://github.com/llvm/llvm-project/commit/1637545f689b8c4ef888ca385de75982a6a932e3
  Author: Walter Erquinigo <wallace at fb.com>
  Date:   2022-05-17 (Tue, 17 May 2022)

  Changed paths:
    M lldb/include/lldb/Host/common/NativeProcessProtocol.h
    M lldb/source/Host/common/NativeProcessProtocol.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTCollector.h
    M lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
    M lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h
    M lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
    M lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
    M lldb/source/Plugins/Process/Linux/Perf.cpp
    M lldb/source/Plugins/Process/Linux/Perf.h

  Log Message:
  -----------
  [trace][intelpt] Support system-wide tracing [5] - Disable/enable per-core tracing based on the process state

When tracing on per-core mode, we are tracing all processes, which means
that after hitting a breakpoint, our process will stop running (thus
producing no more tracing data) but other processes will continue
writing to our trace buffers. This causes a big data loss for our trace.
As a way to remediate this, I'm adding some logic to pause and unpause
tracing based on the target's state. The earlier we do it the better,
however, I'm not adding the trigger at the earliest possible point for
simplicity of this diff. Later we can improve that part.

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


  Commit: 1188faa7ab4b005e3ee28f30055de2f76e210eb8
      https://github.com/llvm/llvm-project/commit/1188faa7ab4b005e3ee28f30055de2f76e210eb8
  Author: Walter Erquinigo <wallace at fb.com>
  Date:   2022-05-17 (Tue, 17 May 2022)

  Changed paths:
    M lldb/include/lldb/Utility/TraceGDBRemotePackets.h
    M lldb/source/Plugins/Process/Linux/CMakeLists.txt
    M lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
    M lldb/source/Plugins/Process/Linux/IntelPTCollector.h
    A lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp
    A lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.h
    A lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
    A lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.h

  Log Message:
  -----------
  [trace][intelpt] Support system-wide tracing [6] - Break IntelPTCollector into smaller files and minor refactor

IntelPTCollector is very big and has 3 classes in it. It's actually cleaner if each one has its own file. This also gives more visibility to the developer about the different kinds of "tracers" that we have.

Besides that, I'm now restricting the creation of the BinaryData chunks to GetState() instead of having it in different places, which is not very clean, because the gdb-remote protocol should be as restricted as possible.

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


Compare: https://github.com/llvm/llvm-project/compare/8d53f2fc0d9f...1188faa7ab4b


More information about the All-commits mailing list