[all-commits] [llvm/llvm-project] e5140a: Fix dap stacktrace perf issue (#104874)

jeffreytan81 via All-commits all-commits at lists.llvm.org
Thu Aug 22 11:30:55 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e5140aed275fe60b83188143f39011d5c0ee5bb0
      https://github.com/llvm/llvm-project/commit/e5140aed275fe60b83188143f39011d5c0ee5bb0
  Author: jeffreytan81 <jeffreytan at meta.com>
  Date:   2024-08-22 (Thu, 22 Aug 2024)

  Changed paths:
    M lldb/tools/lldb-dap/DAP.cpp
    M lldb/tools/lldb-dap/DAP.h
    M lldb/tools/lldb-dap/lldb-dap.cpp

  Log Message:
  -----------
  Fix dap stacktrace perf issue (#104874)

We have got several customer reporting of slow stepping over the past
year in VSCode.
Profiling shows the slow stepping is caused by `stackTrace` request
which can take around 1 second for certain targets. Since VSCode sends
`stackTrace` during each stop event, the slow `stackTrace` request would
slow down stepping in VSCode. Below is the hot path:

```
               |--68.75%--lldb_dap::DAP::HandleObject(llvm::json::Object const&)
               |          |
               |          |--57.70%--(anonymous namespace)::request_stackTrace(llvm::json::Object const&)
               |          |          |
               |          |          |--54.43%--lldb::SBThread::GetCurrentExceptionBacktrace()
               |          |          |          lldb_private::Thread::GetCurrentExceptionBacktrace()
               |          |          |          lldb_private::Thread::GetCurrentException()
               |          |          |          lldb_private::ItaniumABILanguageRuntime::GetExceptionObjectForThread(std::shared_ptr<lldb_private::Thread>)
               |          |          |          |
               |          |          |          |--53.43%--lldb_private::FunctionCaller::ExecuteFunction(lldb_private::ExecutionContext&, unsigned long*, lldb_private::EvaluateExpressionOptions const&, lldb_private::DiagnosticManager&, lldb_private::Value&)
               |          |          |          |          |
               |          |          |          |          |--25.23%--lldb_private::FunctionCaller::InsertFunction(lldb_private::ExecutionContext&, unsigned long&, lldb_private::DiagnosticManager&)
               |          |          |          |          |          |
               |          |          |          |          |          |--24.56%--lldb_private::FunctionCaller::WriteFunctionWrapper(lldb_private::ExecutionContext&, lldb_private::DiagnosticManager&)
               |          |          |          |          |          |          |
               |          |          |          |          |          |          |--19.73%--lldb_private::ExpressionParser::PrepareForExecution(unsigned long&, unsigned long&, std::shared_ptr<lldb_private::IRExecutionUnit>&, lldb_private::ExecutionContext&, bool&, lldb_private::ExecutionPolicy)
               |          |          |          |          |          |          |          lldb_private::ClangExpressionParser::DoPrepareForExecution(unsigned long&, unsigned long&, std::shared_ptr<lldb_private::IRExecutionUnit>&, lldb_private::ExecutionContext&, bool&, lldb_private::ExecutionPolicy)
               |          |          |          |          |          |          |          lldb_private::IRExecutionUnit::GetRunnableInfo(lldb_private::Status&, unsigned long&, unsigned long&)
               |          |          |          |          |          |          |          |
```

The hot path is added by https://reviews.llvm.org/D156465 which should
at least be disabled for Linux. Note: I am seeing similar performance
hot path on Mac.

This PR hides the feature behind `enableDisplayExtendedBacktrace` option
which needs to be enabled on-demand.

---------

Co-authored-by: jeffreytan81 <jeffreytan at fb.com>



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