[all-commits] [llvm/llvm-project] 1f56f7: [trace][intelpt] Support system-wide tracing [7] -...
walter erquinigo via All-commits
all-commits at lists.llvm.org
Wed Jun 15 12:08:15 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1f56f7fc16bcb9966d508e462e0f408080fdb362
https://github.com/llvm/llvm-project/commit/1f56f7fc16bcb9966d508e462e0f408080fdb362
Author: Walter Erquinigo <wallace at fb.com>
Date: 2022-06-15 (Wed, 15 Jun 2022)
Changed paths:
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/IntelPTPerThreadProcessTrace.cpp
M lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.h
A lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h
M lldb/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py
Log Message:
-----------
[trace][intelpt] Support system-wide tracing [7] - Create a base IntelPTProcessTrace class
We have two different "process trace" implementations: per thread and per core. As a way to simplify the collector who uses both, I'm creating a base abstract class that is used by these implementations. This effectively simplify a good chunk of code.
Differential Revision: https://reviews.llvm.org/D125503
Commit: 5a92632dc477fcd42d912b2c781cc406e6d073f6
https://github.com/llvm/llvm-project/commit/5a92632dc477fcd42d912b2c781cc406e6d073f6
Author: Walter Erquinigo <wallace at fb.com>
Date: 2022-06-15 (Wed, 15 Jun 2022)
Changed paths:
M lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
Log Message:
-----------
[trace][intelpt] Support system-wide tracing [8] - Improve the single buffer perf_event configuration
We were setting some events to be written in the data buffer of the
perf_event, but we don't need that.
Besides that, we don't need the data buffer to be larger than 1, so we
can reduce its size.
Differential Revision: https://reviews.llvm.org/D125850
Commit: a758205951d3a1eb60bdb65146ab23e8567f30a7
https://github.com/llvm/llvm-project/commit/a758205951d3a1eb60bdb65146ab23e8567f30a7
Author: Walter Erquinigo <wallace at fb.com>
Date: 2022-06-15 (Wed, 15 Jun 2022)
Changed paths:
M lldb/docs/lldb-gdb-remote.txt
M lldb/include/lldb/Host/common/NativeProcessProtocol.h
M lldb/include/lldb/Utility/TraceIntelPTGDBRemotePackets.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/IntelPTProcessTrace.h
M lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
M lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h
M lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
M lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.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
M lldb/source/Utility/TraceIntelPTGDBRemotePackets.cpp
M lldb/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py
Log Message:
-----------
[trace][intelpt] Support system-wide tracing [9] - Collect and return context switch traces
- Add collection of context switches per cpu grouped with the per-cpu intel pt traces.
- Move the state handling from the interl pt trace class to the PerfEvent one.
- Add support for stopping and enabling perf event groups.
- Return context switch entries as part of the jLLDBTraceGetState response.
- Move the triggers of whenever the process stopped or resumed. Now the will-resume notification is in a better location, which will ensure that we'll capture the instructions that will be executed.
- Remove IntelPTSingleBufferTraceUP. The unique pointer was useless.
- Add unit tests
Differential Revision: https://reviews.llvm.org/D125897
Commit: 1f2d49a8e7636a11cc4660a779dce81770943bf5
https://github.com/llvm/llvm-project/commit/1f2d49a8e7636a11cc4660a779dce81770943bf5
Author: Walter Erquinigo <wallace at fb.com>
Date: 2022-06-15 (Wed, 15 Jun 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/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/IntelPTPerThreadProcessTrace.cpp
M lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.h
M lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h
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/PerfTests.cpp
Log Message:
-----------
[trace][intelpt] Support system-wide tracing [10] - Return warnings and tsc information from lldb-server.
- Add a warnings field in the jLLDBGetState response, for warnings to be delivered to the client for troubleshooting. This removes the need to silently log lldb-server's llvm::Errors and not expose them easily to the user
- Simplify the tscPerfZeroConversion struct and schema. It used to extend a base abstract class, but I'm doubting that we'll ever add other conversion mechanisms because all modern kernels support perf zero. It is also the one who is supposed to work with the timestamps produced by the context switch trace, so expecting it is imperative.
- Force tsc collection for cpu tracing.
- Add a test checking that tscPerfZeroConversion is returned by the GetState request
- Add a pre-check for cpu tracing that makes sure that perf zero values are available.
Differential Revision: https://reviews.llvm.org/D125932
Commit: a0a46473c3df488c9ea63988595cea0bd0521fb4
https://github.com/llvm/llvm-project/commit/a0a46473c3df488c9ea63988595cea0bd0521fb4
Author: Walter Erquinigo <wallace at fb.com>
Date: 2022-06-15 (Wed, 15 Jun 2022)
Changed paths:
M lldb/include/lldb/Target/Trace.h
M lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
M lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
M lldb/source/Target/Trace.cpp
Log Message:
-----------
[trace][intelpt] Support system-wide tracing [11] - Read warnings and perf conversion in the client
- Add logging for when the live state of the process is refreshed
- Move error handling of the live state refreshing to Trace from TraceIntelPT. This allows refreshing to fail either at the plug-in level or at the base class level. The error is cached and it can be gotten every time RefreshLiveProcessState is invoked.
- Allow DoRefreshLiveProcessState to handle plugin-specific parameters.
- Add some encapsulation to prevent TraceIntelPT from accessing variables belonging to Trace.
Test done via logging:
```
(lldb) b main
Breakpoint 1: where = a.out`main + 20 at main.cpp:27:20, address = 0x00000000004023d9
(lldb) r
Process 2359706 launched: '/home/wallace/a.out' (x86_64)
Process 2359706 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x00000000004023d9 a.out`main at main.cpp:27:20
24 };
25
26 int main() {
-> 27 std::vector<int> vvv;
28 for (int i = 0; i < 100000; i++)
29 vvv.push_back(i);
30
(lldb) process trace start (lldb) log enable lldb target -F(lldb) n
Process 2359706 stopped
* thread #1, name = 'a.out', stop reason = step over
frame #0: 0x00000000004023e8 a.out`main at main.cpp:28:12
25
26 int main() {
27 std::vector<int> vvv;
-> 28 for (int i = 0; i < 100000; i++)
29 vvv.push_back(i);
30
31 std::deque<int> dq1 = {1, 2, 3};
(lldb) thread trace dump instructions -c 2 -t Trace.cpp:RefreshLiveProcessState Trace::RefreshLiveProcessState invoked
TraceIntelPT.cpp:DoRefreshLiveProcessState TraceIntelPT found tsc conversion information
thread #1: tid = 2359706
a.out`std::vector<int, std::allocator<int>>::vector() + 26 at stl_vector.h:395:19
54: [tsc=unavailable] 0x0000000000403a7c retq
```
See the logging lines at the end of the dump. They indicate that refreshing happened and that perf conversion information was found.
Differential Revision: https://reviews.llvm.org/D125943
Compare: https://github.com/llvm/llvm-project/compare/bc1f24332af3...a0a46473c3df
More information about the All-commits
mailing list