Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow step through code #7250

Closed
sadovsf opened this issue Mar 29, 2021 · 5 comments
Closed

Slow step through code #7250

sadovsf opened this issue Mar 29, 2021 · 5 comments

Comments

@sadovsf
Copy link

sadovsf commented Mar 29, 2021

Type: Debugger
Stepping through code (step over, step in etc...) when debugging codebase with big amount of threads (in my case it is around 20 active threads) each step takes few seconds as it reloads all callstacks from all threads. This makes debugging painfully slow to the point that its faster to spam around debug messages and build new executable.

Describe the bug

  • OS and Version: macOS Big Sur
  • VS Code Version: 1.54.3
  • C/C++ Extension Version: 1.1.3
@WardenGnaw
Copy link
Member

Duplicate of #7240

@sadovsf
Copy link
Author

sadovsf commented Mar 29, 2021

Thank you for resolving this. Just note that in my case vs code does not freeze or something. I can see call stacks being loaded one by one. It just takes roughly 0.5s per thread to do step over which adds up quite quickly. If you still think it's same issue (could be) ignore this.

@WardenGnaw
Copy link
Member

We appreciate any issues opened to help us keep track and prioritize issues. There is a known slowness with lldb-mi. However, The VSCode C++ Extension does not directly work on lldb or lldb-mi. We use and build lldb-mi from the lldb-mi repository and publish it.

We build the debug adapter MIEngine to communicate with lldb-mi, but that will be in the OpenDebugAD7 process.

If memory usage is high for the lldb-mi process, this is directly related to LLDB itself which you can report bugs to https://bugs.llvm.org/

You can capture and send trace files to help them investigate performance issues. Here is a tutorial on how to capture a trace file but for cpptools and cpptools-srv. You will want to capture the trace on lldb-mi.

@sadovsf
Copy link
Author

sadovsf commented Mar 30, 2021

I did capture some informations, hope it helps further. At least to a point so i can be sure and report issue to lldb-mi itself:

CPU

cpp -> 15-20%
cpp-srv -> 3-5%
LLDB-mi -> 10-15%

Memory

cpp –> 264MB
cpp-srv -> 139MB
LLDB-mi -> ~2GB (Huge project, big AAA simulator game with own engine)

image

@sadovsf
Copy link
Author

sadovsf commented Mar 30, 2021

This will probably not help you explicitly but just to add as much info as possible, here is hot path for lldb-mi:

  70  15654.0  lldb-mi (1419) :0
  69  14567.0  Main Thread  0xda5d :0
  68 libdyld.dylib 14501.0  start
  67 lldb-mi 14501.0  main
  66 lldb-mi 14501.0  CMIDriverMgr::DriverMainLoop()
  65 lldb-mi 14501.0  CMIDriver::DoMainLoop()
  64 lldb-mi 14495.0  CMIDriver::InterpretCommand(CMIUtilString const&)
  63 lldb-mi 14494.0  CMIDriver::InterpretCommandThisDriver(CMIUtilString const&, bool&)
  62 lldb-mi 14488.0  CMIDriver::ExecuteCommand(SMICmdData const&)
  61 lldb-mi 14488.0  CMICmdMgr::CmdExecute(SMICmdData const&)
  60 lldb-mi 14488.0  CMICmdInvoker::CmdExecute(CMICmdBase&)
  59 lldb-mi 14444.0  CMICmdCmdThreadInfo::Execute()
  58 lldb-mi 14433.0  CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo(SMICmdData const&, lldb::SBThread const&, CMICmnLLDBDebugSessionInfo::ThreadInfoFormat_e, CMICmnMIValueTuple&)
  57 lldb-mi 14415.0  CMICmnLLDBDebugSessionInfo::GetThreadFrames(SMICmdData const&, unsigned int, CMICmnLLDBDebugSessionInfo::FrameInfoFormat_e, CMIUtilString&)
  56 lldb-mi 14176.0  CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo(lldb::SBThread const&, unsigned int, CMICmnLLDBDebugSessionInfo::FrameInfoFormat_e, CMICmnMIValueTuple&)
  55 lldb-mi 13583.0  CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo(lldb::SBFrame const&, unsigned int, CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e, CMICmnMIValueList&, unsigned int, bool)
  54 lldb-mi 13445.0  CMICmnLLDBDebugSessionInfo::MIResponseForVariableInfoInternal(CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e, CMICmnMIValueList&, lldb::SBValueList const&, unsigned int, bool, bool)
  53 LLDB 13273.0  lldb::SBValue::GetName()
  52 LLDB 13272.0  lldb::SBValue::GetSP(ValueLocker&) const
  51 LLDB 13270.0  ValueImpl::GetSP(lldb_private::ProcessRunLock::ProcessRunLocker&, std::__1::unique_lock<std::__1::recursive_mutex>&, lldb_private::Status&)
  50 LLDB 13260.0  lldb_private::ValueObject::GetSyntheticValue(bool)
  49 LLDB 13260.0  lldb_private::ValueObject::CalculateSyntheticValue(bool)
  48 LLDB 13259.0  lldb_private::ValueObject::UpdateFormatsIfNeeded()
  47 LLDB 13238.0  lldb_private::ValueObject::MaybeCalculateCompleteType()
  46 LLDB 13125.0  lldb_private::ValueObjectDynamicValue::GetCompilerTypeImpl()
  45 LLDB 13125.0  lldb_private::ValueObject::UpdateValueIfNeeded(bool)
  44 LLDB 13121.0  lldb_private::ValueObjectDynamicValue::UpdateValue()
  43 LLDB 12842.0  lldb_private::AppleObjCRuntimeV2::GetDynamicTypeAndAddress(lldb_private::ValueObject&, lldb::DynamicValueType, lldb_private::TypeAndOrName&, lldb_private::Address&, lldb_private::Value::ValueType&)
  42 LLDB 12839.0  lldb_private::ObjCLanguageRuntime::GetNonKVOClassDescriptor(lldb_private::ValueObject&)
  41 LLDB 12837.0  lldb_private::AppleObjCRuntimeV2::GetClassDescriptor(lldb_private::ValueObject&)
  40 LLDB 12813.0  lldb_private::Target::EvaluateExpression(llvm::StringRef, lldb_private::ExecutionContextScope*, lldb_private::SharingPtr<lldb_private::ValueObject>&, lldb_private::EvaluateExpressionOptions const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, lldb_private::ValueObject*)
  39 LLDB 12811.0  lldb_private::UserExpression::Evaluate(lldb_private::ExecutionContext&, lldb_private::EvaluateExpressionOptions const&, llvm::StringRef, llvm::StringRef, lldb_private::SharingPtr<lldb_private::ValueObject>&, lldb_private::Status&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::shared_ptr<lldb_private::Module>*, lldb_private::ValueObject*)
  38 LLDB 8902.0  lldb_private::ClangUserExpression::Parse(lldb_private::DiagnosticManager&, lldb_private::ExecutionContext&, lldb_private::ExecutionPolicy, bool, bool)
  37 LLDB 4632.0  lldb_private::ClangExpressionParser::ParseInternal(lldb_private::DiagnosticManager&, clang::CodeCompleteConsumer*, unsigned int, unsigned int)
  36 LLDB 4389.0  clang::ParseAST(clang::Sema&, bool, bool)
  35 LLDB 3984.0  clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
  34 LLDB 3980.0  clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*)
  33 LLDB 3951.0  clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier)
  32 LLDB 3951.0  clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier)
  31 LLDB 3932.0  clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
  30 LLDB 3921.0  clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
  29 LLDB 3909.0  clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&)
  28 LLDB 3904.0  clang::Parser::ParseCompoundStatementBody(bool)
  27 LLDB 3900.0  clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
  26 LLDB 3900.0  clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
  25 LLDB 3900.0  clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext)
  24 LLDB 3888.0  clang::Parser::ParseExpression(clang::Parser::TypeCastState)
  23 LLDB 3888.0  clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
  22 LLDB 3888.0  clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState, bool)
  21 LLDB 3888.0  clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&)
  20 LLDB 3874.0  clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState, bool)
  19 LLDB 3851.0  clang::Parser::TryAnnotateTypeOrScopeToken()
  18 LLDB 3848.0  clang::Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(clang::CXXScopeSpec&, bool)
  17 LLDB 3848.0  clang::Sema::getTypeName(clang::IdentifierInfo const&, clang::SourceLocation, clang::Scope*, clang::CXXScopeSpec*, bool, bool, clang::OpaquePtr<clang::QualType>, bool, bool, bool, clang::IdentifierInfo**)
  16 LLDB 3848.0  clang::Sema::LookupName(clang::LookupResult&, clang::Scope*, bool)
  15 LLDB 3848.0  clang::Sema::CppLookupName(clang::LookupResult&, clang::Scope*)
  14 LLDB 3848.0  LookupDirect(clang::Sema&, clang::LookupResult&, clang::DeclContext const*)
  13 LLDB 3848.0  clang::DeclContext::lookup(clang::DeclarationName) const
  12 LLDB 3848.0  lldb_private::ClangASTSource::FindExternalVisibleDeclsByName(clang::DeclContext const*, clang::DeclarationName)
  11 LLDB 3846.0  lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(lldb_private::NameSearchContext&)
  10 LLDB 2732.0  lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(lldb_private::NameSearchContext&, std::__1::shared_ptr<lldb_private::Module>, lldb_private::CompilerDeclContext&, unsigned int)
   9 LLDB 1255.0  lldb_private::ClangExpressionDeclMap::LookupFunction(lldb_private::NameSearchContext&, std::__1::shared_ptr<lldb_private::Module>, lldb_private::ConstString, lldb_private::CompilerDeclContext&, unsigned int)
   8 LLDB 1240.0  lldb_private::ModuleList::FindFunctions(lldb_private::ConstString, lldb::FunctionNameType, bool, bool, lldb_private::SymbolContextList&) const
   7 LLDB 1239.0  lldb_private::Module::FindFunctions(lldb_private::ConstString, lldb_private::CompilerDeclContext const*, lldb::FunctionNameType, bool, bool, lldb_private::SymbolContextList&)
   6 LLDB 983.0  SymbolFileDWARFDebugMap::FindFunctions(lldb_private::ConstString, lldb_private::CompilerDeclContext const*, lldb::FunctionNameType, bool, lldb_private::SymbolContextList&)
   5 LLDB 978.0  SymbolFileDWARFDebugMap::ForEachSymbolFile(std::__1::function<bool (SymbolFileDWARF*)>)
   4 LLDB 758.0  std::__1::__function::__func<SymbolFileDWARFDebugMap::FindFunctions(lldb_private::ConstString, lldb_private::CompilerDeclContext const*, lldb::FunctionNameType, bool, lldb_private::SymbolContextList&)::$_3, std::__1::allocator<SymbolFileDWARFDebugMap::FindFunctions(lldb_private::ConstString, lldb_private::CompilerDeclContext const*, lldb::FunctionNameType, bool, lldb_private::SymbolContextList&)::$_3>, bool (SymbolFileDWARF*)>::operator()(SymbolFileDWARF*&&)
   3 LLDB 753.0  SymbolFileDWARF::FindFunctions(lldb_private::ConstString, lldb_private::CompilerDeclContext const*, lldb::FunctionNameType, bool, lldb_private::SymbolContextList&)
   2 LLDB 324.0  lldb_private::ManualDWARFIndex::GetFunctions(lldb_private::ConstString, SymbolFileDWARF&, lldb_private::CompilerDeclContext const&, unsigned int, std::__1::vector<DWARFDIE, std::__1::allocator<DWARFDIE> >&)
   1 LLDB 309.0  NameToDIE::Find(lldb_private::ConstString, std::__1::vector<DIERef, std::__1::allocator<DIERef> >&) const
   0 LLDB 305.0  lldb_private::UniqueCStringMap<DIERef>::GetValues(lldb_private::ConstString, std::__1::vector<DIERef, std::__1::allocator<DIERef> >&) const

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants