[all-commits] [llvm/llvm-project] 782e0c: [lldb] Fix intel trace plugin tests (#133826)

David Peixotto via All-commits all-commits at lists.llvm.org
Tue Apr 1 12:56:02 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 782e0cef762c1346396eb7dd75462f842be350e3
      https://github.com/llvm/llvm-project/commit/782e0cef762c1346396eb7dd75462f842be350e3
  Author: David Peixotto <peix at meta.com>
  Date:   2025-04-01 (Tue, 01 Apr 2025)

  Changed paths:
    M lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py
    M lldb/source/Target/ProcessTrace.cpp
    M lldb/test/API/commands/trace/TestTraceDumpFunctionCalls.py
    M lldb/test/API/commands/trace/TestTraceEvents.py
    M lldb/test/API/commands/trace/TestTraceSave.py
    M lldb/test/API/commands/trace/TestTraceStartStop.py
    M lldb/test/API/commands/trace/TestTraceTSC.py
    M lldb/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py
    M lldb/unittests/Process/CMakeLists.txt
    A lldb/unittests/Process/ProcessTraceTest.cpp

  Log Message:
  -----------
  [lldb] Fix intel trace plugin tests (#133826)

The tests for the

[intel-pt](https://github.com/llvm/llvm-project/blob/348374028970c956f2e49ab7553b495d7408ccd9/lldb/docs/use/intel_pt.rst)
trace plugin were failing for multiple reasons.

On machines where tracing is supported many of the tests were crashing
because of a nullptr dereference. It looks like the `core_file`
parameter in `ProcessTrace::CreateInstance` was once ignored, but was
changed to always being dereferenced. This caused the tests to fail even
when tracing was supported.

On machines where tracing is not supported we would still run tests that
attempt to take a trace. These would obviously fail because the required
hardware is not present. Note that some of the tests simply read
serialized json as trace files which does not require any special
hardware.

This PR fixes these two issues by guarding the pointer dereference and
then skipping unsupported tests on machines. With these changes the
trace tests pass on both types of machines.

We also add a new unit test to validate that a process can be created
with a nullptr core_file through the generic process trace plugin path.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list