Skip to content

eval a unaviable var causing lldb crash #83829

@popoaichuiniu

Description

@popoaichuiniu

Description

if i add a var watch in current frame, when step in another method, the var will be invalid, then lldb crash

Reproduction

in xcode 16.0.0, debug a app writed by swift, hit some code, and watch a invalid var, the lldb goes crashed.

same as in codelldb, use same lldb.

this backtrace maybe can help you:
2: __sigtramp 3: __ZN5swift8importer24shouldSuppressDeclImportEPKN5clang4DeclE 4: __ZN5swift8importer21addEntryToLookupTableERNS_16SwiftLookupTableEPN5clang9NamedDeclERNS0_12NameImporterE 5: __ZN5swift8importer21addEntryToLookupTableERNS_16SwiftLookupTableEPN5clang9NamedDeclERNS0_12NameImporterE 6: __ZN5swift13ClangImporter14Implementation14loadAllMembersEPNS_4DeclEy 7: __ZNK5swift19IterableDeclContext14loadAllMembersEv 8: __ZN5swift13ClangImporter14Implementation14loadAllMembersEPNS_4DeclEy 9: __ZNK5swift19IterableDeclContext14loadAllMembersEv 10: __ZN5swift13ClangImporter14Implementation19lookupTypeDeclDWARFEN4llvm9StringRefENS_13ClangTypeKindENS2_12function_refIFvPNS_8TypeDeclEEEE 11: __ZN5swift13ClangImporter14lookupTypeDeclEN4llvm9StringRefENS_13ClangTypeKindENS1_12function_refIFvPNS_8TypeDeclEEEE 12: __ZN5swift8Demangle10ASTBuilder19createObjCClassTypeEN4llvm9StringRefE 13: __ZN5swift8Demangle11TypeDecoderINS0_10ASTBuilderEE17decodeMangledTypeEPNS0_4NodeEjb 14: __ZN5swift8Demangle18getTypeForManglingERNS_10ASTContextEN4llvm9StringRefENS_16GenericSignatureE 15: __ZN12lldb_private15SwiftASTContext19ReconstructTypeImplENS_11ConstStringE 16: __ZN12lldb_private15SwiftASTContext15ReconstructTypeENS_11ConstStringE 17: __ZN12lldb_private15SwiftASTContext12GetSwiftTypeENS_12CompilerTypeE 18: __ZNK12lldb_private19SwiftASTManipulator23GetSwiftTypeForVariableERKNS_23SwiftASTManipulatorBase12VariableInfoE 19: __ZN12lldb_private19SwiftASTManipulator31GetVarDeclForVariableInFunctionERKNS_23SwiftASTManipulatorBase12VariableInfoEPN5swift8FuncDeclE 20: __ZN12lldb_private19SwiftASTManipulator20AddExternalVariablesEN4llvm15MutableArrayRefINS_23SwiftASTManipulatorBase12VariableInfoEEE 21: __ZN12lldb_private21SwiftExpressionParser14ParseAndImportERNS_15SwiftASTContext17ScopedDiagnosticsERNSt3__13mapIPKcNS0_15SILVariableInfoENS4_4lessIS7_EENS4_9allocatorINS4_4pairIKS7_S8_EEEEEERjRNS_17DiagnosticManagerE 22: __ZN12lldb_private21SwiftExpressionParser5ParseERNS_17DiagnosticManagerEjj 23: __ZN12lldb_private19SwiftUserExpression29GetTextAndSetExpressionParserERNS_17DiagnosticManagerERNSt3__110unique_ptrINS_25SwiftExpressionSourceCodeENS3_14default_deleteIS5_EEEERNS_16ExecutionContextEPNS_21ExecutionContextScopeE 24: __ZN12lldb_private19SwiftUserExpression5ParseERNS_17DiagnosticManagerERNS_16ExecutionContextENS_15ExecutionPolicyEbb 25: __ZN12lldb_private14UserExpression8EvaluateERNS_16ExecutionContextERKNS_25EvaluateExpressionOptionsEN4llvm9StringRefES7_RNSt3__110shared_ptrINS_11ValueObjectEEERNS_6StatusEPNS8_12basic_stringIcNS8_11char_traitsIcEENS8_9allocatorIcEEEEPSA_ 26: __ZN12lldb_private6Target18EvaluateExpressionEN4llvm9StringRefEPNS_21ExecutionContextScopeERNSt3__110shared_ptrINS_11ValueObjectEEERKNS_25EvaluateExpressionOptionsEPNS5_12basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEPS7_ 27: __ZN4lldb7SBFrame18EvaluateExpressionEPKcRKNS_19SBExpressionOptionsE 28: __ZN4lldb7SBFrame18EvaluateExpressionEPKc 29: __ZL32_wrap_SBFrame_EvaluateExpressionP7_objectS0_ 30: _PyCFunction_GetFlags 31: __PyObject_Call 32: __PyEval_EvalFrameDefault 33: __PyEval_EvalFrameDefault 34: __PyFunction_Vectorcall 35: __PyEval_EvalFrameDefault 36: __PyEval_EvalFrameDefault 37: __PyFunction_Vectorcall 38: __PyEval_EvalFrameDefault 39: __PyEval_EvalFrameDefault 40: __PyEval_EvalFrameDefault 41: __PyFunction_Vectorcall 42: __PyEval_EvalFrameDefault 43: __PyEval_EvalFrameDefault 44: __PyEval_EvalFrameDefault 45: _PyEval_EvalCode 46: __PyAST_ExprAsUnicode 47: _PyCMethod_New 48: __PyEval_EvalFrameDefault 49: __PyEval_EvalFrameDefault 50: __PyEval_EvalFrameDefault 51: __PyFunction_Vectorcall 52: __PyEval_EvalFrameDefault 53: __PyEval_EvalFrameDefault 54: __PyFunction_Vectorcall 55: _PyInit__ctypes 56: <unknown> 57: <unknown> 58: codelldb::python::PythonSession::evaluate 59: codelldb::debug_session::variables::<impl codelldb::debug_session::DebugSession>::evaluate_expr_in_frame 60: codelldb::debug_session::variables::<impl codelldb::debug_session::DebugSession>::handle_evaluate_expression 61: codelldb::debug_session::variables::<impl codelldb::debug_session::DebugSession>::handle_evaluate 62: codelldb::debug_session::DebugSession::handle_request_args 63: codelldb::debug_session::DebugSession::handle_request 64: tokio::runtime::task::core::Core<T,S>::poll 65: tokio::runtime::task::harness::Harness<T,S>::poll 66: tokio::task::local::LocalSet::tick 67: <tokio::task::local::LocalSet as core::future::future::Future>::poll 68: codelldb::run_debug_session::{{closure}} 69: tokio::runtime::context::runtime::enter_runtime 70: tokio::runtime::runtime::Runtime::block_on 71: codelldb::debug_server 72: codelldb::main 73: std::sys_common::backtrace::__rust_begin_short_backtrace 74: std::rt::lang_start::{{closure}} 75: std::rt::lang_start_internal 76: _main

Expected behavior

display: invalid value

Environment

xcode 16.0.0, swift app

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions