[Lldb-commits] [lldb] [lldb] Fix Intel PT plugin compile errors (PR #77252)

Walter Erquinigo via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 8 13:17:10 PST 2024


walter-erquinigo wrote:

> At least one test fails: `./bin/lldb -o 'trace load -v /llvm/lldb/test/API/commands/trace/intelpt-trace/trace_2threads.json'` crashes with an assertion failure on TraceIntelPTBundleLoader.cpp:127 (`*process_sp` is a null pointer dereference).
> 
> Do you know why `process_sp` would be null in this case? I added some extra assertions and it looks like `target_sp->m_process_sp` is null after the call to `ProcessTrace::CreateInstance` on line 111.

It seems that the issue is that we still need to make `Target::m_process_sp` point to the newly created process...

So, let's give something else a try:

Return that code to its original form

```
ProcessSP process_sp = target_sp->CreateProcess(
    /*listener*/ nullptr, "trace",
    /*crash_file*/ nullptr,
    /*can_connect*/ false);
```

If that passes the test, then there's nothing else to do and we are good to go.
If that doesn't work, then we need to additional add the line `LLDB_PLUGIN_DEFINE(ProcessTrace)` before any function declaration in the ProcessTrace.cpp file. That `LLDB_PLUGIN_DEFINE` define will register the ProcessTrace process plugin with that "trace", which will be searchable by `target_sp->CreateProcess`, who is looking for a trace process called "trace".

https://github.com/llvm/llvm-project/pull/77252


More information about the lldb-commits mailing list