diff --git a/lldb/bindings/headers.swig b/lldb/bindings/headers.swig index c0dde905f986b..5e7c54d1eb839 100644 --- a/lldb/bindings/headers.swig +++ b/lldb/bindings/headers.swig @@ -52,6 +52,7 @@ #include "lldb/API/SBProcess.h" #include "lldb/API/SBProcessInfo.h" #include "lldb/API/SBProcessInfoList.h" +#include "lldb/API/SBProgress.h" #include "lldb/API/SBQueue.h" #include "lldb/API/SBQueueItem.h" #include "lldb/API/SBReproducer.h" diff --git a/lldb/bindings/interface/SBProgressDocstrings.i b/lldb/bindings/interface/SBProgressDocstrings.i new file mode 100644 index 0000000000000..2997fe619fcc7 --- /dev/null +++ b/lldb/bindings/interface/SBProgressDocstrings.i @@ -0,0 +1,14 @@ +%feature("docstring", +"A Progress indicator helper class. + +Any potentially long running sections of code in LLDB should report +progress so that clients are aware of delays that might appear during +debugging. Delays commonly include indexing debug information, parsing +symbol tables for object files, downloading symbols from remote +repositories, and many more things. + +The Progress class helps make sure that progress is correctly reported +and will always send an initial progress update, updates when +Progress::Increment() is called, and also will make sure that a progress +completed update is reported even if the user doesn't explicitly cause one +to be sent.") lldb::SBProgress; diff --git a/lldb/bindings/interfaces.swig b/lldb/bindings/interfaces.swig index 8a6fed95f0b72..08df9a1a8d539 100644 --- a/lldb/bindings/interfaces.swig +++ b/lldb/bindings/interfaces.swig @@ -54,6 +54,7 @@ %include "./interface/SBPlatformDocstrings.i" %include "./interface/SBProcessDocstrings.i" %include "./interface/SBProcessInfoDocstrings.i" +%include "./interface/SBProgressDocstrings.i" %include "./interface/SBQueueDocstrings.i" %include "./interface/SBQueueItemDocstrings.i" %include "./interface/SBReproducerDocstrings.i" @@ -133,6 +134,7 @@ %include "lldb/API/SBProcess.h" %include "lldb/API/SBProcessInfo.h" %include "lldb/API/SBProcessInfoList.h" +%include "lldb/API/SBProgress.h" %include "lldb/API/SBQueue.h" %include "lldb/API/SBQueueItem.h" %include "lldb/API/SBReproducer.h" diff --git a/lldb/bindings/python/static-binding/LLDBWrapPython.cpp b/lldb/bindings/python/static-binding/LLDBWrapPython.cpp index 699ef18ad06da..6bf72350d2546 100644 --- a/lldb/bindings/python/static-binding/LLDBWrapPython.cpp +++ b/lldb/bindings/python/static-binding/LLDBWrapPython.cpp @@ -3258,206 +3258,207 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { #define SWIGTYPE_p_lldb__SBProcess swig_types[51] #define SWIGTYPE_p_lldb__SBProcessInfo swig_types[52] #define SWIGTYPE_p_lldb__SBProcessInfoList swig_types[53] -#define SWIGTYPE_p_lldb__SBQueue swig_types[54] -#define SWIGTYPE_p_lldb__SBQueueItem swig_types[55] -#define SWIGTYPE_p_lldb__SBReproducer swig_types[56] -#define SWIGTYPE_p_lldb__SBSaveCoreOptions swig_types[57] -#define SWIGTYPE_p_lldb__SBScriptObject swig_types[58] -#define SWIGTYPE_p_lldb__SBSection swig_types[59] -#define SWIGTYPE_p_lldb__SBSourceManager swig_types[60] -#define SWIGTYPE_p_lldb__SBStatisticsOptions swig_types[61] -#define SWIGTYPE_p_lldb__SBStream swig_types[62] -#define SWIGTYPE_p_lldb__SBStringList swig_types[63] -#define SWIGTYPE_p_lldb__SBStructuredData swig_types[64] -#define SWIGTYPE_p_lldb__SBSymbol swig_types[65] -#define SWIGTYPE_p_lldb__SBSymbolContext swig_types[66] -#define SWIGTYPE_p_lldb__SBSymbolContextList swig_types[67] -#define SWIGTYPE_p_lldb__SBTarget swig_types[68] -#define SWIGTYPE_p_lldb__SBThread swig_types[69] -#define SWIGTYPE_p_lldb__SBThreadCollection swig_types[70] -#define SWIGTYPE_p_lldb__SBThreadPlan swig_types[71] -#define SWIGTYPE_p_lldb__SBTrace swig_types[72] -#define SWIGTYPE_p_lldb__SBTraceCursor swig_types[73] -#define SWIGTYPE_p_lldb__SBType swig_types[74] -#define SWIGTYPE_p_lldb__SBTypeCategory swig_types[75] -#define SWIGTYPE_p_lldb__SBTypeEnumMember swig_types[76] -#define SWIGTYPE_p_lldb__SBTypeEnumMemberList swig_types[77] -#define SWIGTYPE_p_lldb__SBTypeFilter swig_types[78] -#define SWIGTYPE_p_lldb__SBTypeFormat swig_types[79] -#define SWIGTYPE_p_lldb__SBTypeList swig_types[80] -#define SWIGTYPE_p_lldb__SBTypeMember swig_types[81] -#define SWIGTYPE_p_lldb__SBTypeMemberFunction swig_types[82] -#define SWIGTYPE_p_lldb__SBTypeNameSpecifier swig_types[83] -#define SWIGTYPE_p_lldb__SBTypeStaticField swig_types[84] -#define SWIGTYPE_p_lldb__SBTypeSummary swig_types[85] -#define SWIGTYPE_p_lldb__SBTypeSummaryOptions swig_types[86] -#define SWIGTYPE_p_lldb__SBTypeSynthetic swig_types[87] -#define SWIGTYPE_p_lldb__SBUnixSignals swig_types[88] -#define SWIGTYPE_p_lldb__SBValue swig_types[89] -#define SWIGTYPE_p_lldb__SBValueList swig_types[90] -#define SWIGTYPE_p_lldb__SBVariablesOptions swig_types[91] -#define SWIGTYPE_p_lldb__SBWatchpoint swig_types[92] -#define SWIGTYPE_p_lldb__SBWatchpointOptions swig_types[93] -#define SWIGTYPE_p_long_double swig_types[94] -#define SWIGTYPE_p_long_long swig_types[95] -#define SWIGTYPE_p_p_void swig_types[96] -#define SWIGTYPE_p_pthread_rwlock_t swig_types[97] -#define SWIGTYPE_p_pthread_t swig_types[98] -#define SWIGTYPE_p_short swig_types[99] -#define SWIGTYPE_p_signed_char swig_types[100] -#define SWIGTYPE_p_size_t swig_types[101] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ABI_t swig_types[102] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Baton_t swig_types[103] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Block_t swig_types[104] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__BreakpointLocation_t swig_types[105] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__BreakpointPrecondition_t swig_types[106] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__BreakpointResolver_t swig_types[107] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__BreakpointSite_t swig_types[108] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Breakpoint_t swig_types[109] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__BroadcasterManager_t swig_types[110] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Broadcaster_t swig_types[111] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__CommandObject_t swig_types[112] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__CompileUnit_t swig_types[113] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Connection_t swig_types[114] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__DataBuffer_t swig_types[115] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__DataExtractor_t swig_types[116] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Debugger_t swig_types[117] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Disassembler_t swig_types[118] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__EventDataStructuredData_t swig_types[119] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__EventData_t swig_types[120] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Event_t swig_types[121] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ExecutionContextRef_t swig_types[122] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ExpressionVariable_t swig_types[123] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__File_t swig_types[124] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__FormatEntity__Entry_t swig_types[125] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__FuncUnwinders_t swig_types[126] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Function_t swig_types[127] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__IOHandler_t swig_types[128] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__IOObject_t swig_types[129] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__IRExecutionUnit_t swig_types[130] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__InlineFunctionInfo_t swig_types[131] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Instruction_t swig_types[132] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__InstrumentationRuntime_t swig_types[133] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__JITLoader_t swig_types[134] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__LanguageRuntime_t swig_types[135] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Listener_t swig_types[136] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__MemoryHistory_t swig_types[137] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__MemoryRegionInfo_t swig_types[138] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Module_t swig_types[139] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ObjectContainer_t swig_types[140] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ObjectFileJITDelegate_t swig_types[141] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ObjectFile_t swig_types[142] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__OperatingSystemInterface_t swig_types[143] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__OptionValueProperties_t swig_types[144] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__OptionValue_t swig_types[145] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Platform_t swig_types[146] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ProcessAttachInfo_t swig_types[147] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ProcessLaunchInfo_t swig_types[148] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Process_t swig_types[149] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__QueueItem_t swig_types[150] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Queue_t swig_types[151] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__REPL_t swig_types[152] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__RecognizedStackFrame_t swig_types[153] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__RegisterCheckpoint_t swig_types[154] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__RegisterContext_t swig_types[155] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__RegisterTypeBuilder_t swig_types[156] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__RegularExpression_t swig_types[157] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ScriptInterpreter_t swig_types[158] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ScriptSummaryFormat_t swig_types[159] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ScriptedMetadata_t swig_types[160] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ScriptedSyntheticChildren_t swig_types[161] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ScriptedThreadInterface_t swig_types[162] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ScriptedThreadPlanInterface_t swig_types[163] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__SearchFilter_t swig_types[164] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__SectionLoadList_t swig_types[165] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Section_t swig_types[166] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__StackFrameList_t swig_types[167] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__StackFrameRecognizer_t swig_types[168] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__StackFrame_t swig_types[169] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__StopInfo_t swig_types[170] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__StreamFile_t swig_types[171] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Stream_t swig_types[172] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__StringSummaryFormat_t swig_types[173] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__StructuredDataPlugin_t swig_types[174] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__SupportFile_t swig_types[175] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__SymbolContextSpecifier_t swig_types[176] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__SymbolFileType_t swig_types[177] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__SyntheticChildrenFrontEnd_t swig_types[178] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__SyntheticChildren_t swig_types[179] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Target_t swig_types[180] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ThreadCollection_t swig_types[181] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ThreadPlanTracer_t swig_types[182] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ThreadPlan_t swig_types[183] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ThreadPostMortemTrace_t swig_types[184] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Thread_t swig_types[185] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TraceCursor_t swig_types[186] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Trace_t swig_types[187] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeCategoryImpl_t swig_types[188] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeEnumMemberImpl_t swig_types[189] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeFilterImpl_t swig_types[190] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeFormatImpl_t swig_types[191] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeImpl_t swig_types[192] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeMemberFunctionImpl_t swig_types[193] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeNameSpecifierImpl_t swig_types[194] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeSummaryImpl_t swig_types[195] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeSummaryOptions_t swig_types[196] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeSystemClang_t swig_types[197] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeSystem_t swig_types[198] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Type_t swig_types[199] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__UnixSignals_t swig_types[200] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__UnwindAssembly_t swig_types[201] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__UnwindPlan_t swig_types[202] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__UserExpression_t swig_types[203] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ValueObjectList_t swig_types[204] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ValueObject_t swig_types[205] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Value_t swig_types[206] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__VariableList_t swig_types[207] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Variable_t swig_types[208] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__WatchpointResource_t swig_types[209] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Watchpoint_t swig_types[210] -#define SWIGTYPE_p_std__shared_ptrT_lldb_private__WritableDataBuffer_t swig_types[211] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__AddressRange_t swig_types[212] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__DynamicCheckerFunctions_t swig_types[213] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__DynamicLoader_t swig_types[214] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__File_t swig_types[215] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__JITLoaderList_t swig_types[216] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__MemoryRegionInfo_t swig_types[217] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__OperatingSystem_t swig_types[218] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__ScriptedPlatformInterface_t swig_types[219] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__ScriptedProcessInterface_t swig_types[220] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__SectionList_t swig_types[221] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__SourceManager_t swig_types[222] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__StackFrameRecognizerManager_t swig_types[223] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__StructuredDataImpl_t swig_types[224] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__SymbolVendor_t swig_types[225] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__SystemRuntime_t swig_types[226] -#define SWIGTYPE_p_std__unique_ptrT_lldb_private__TraceExporter_t swig_types[227] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__BreakpointLocation_t swig_types[228] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Breakpoint_t swig_types[229] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__BroadcasterManager_t swig_types[230] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Debugger_t swig_types[231] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Listener_t swig_types[232] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Module_t swig_types[233] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__ObjectFileJITDelegate_t swig_types[234] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__OptionValue_t swig_types[235] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Process_t swig_types[236] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Queue_t swig_types[237] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Section_t swig_types[238] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__StackFrame_t swig_types[239] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__StructuredDataPlugin_t swig_types[240] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Target_t swig_types[241] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__ThreadPlan_t swig_types[242] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Thread_t swig_types[243] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__TypeSystem_t swig_types[244] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Type_t swig_types[245] -#define SWIGTYPE_p_std__weak_ptrT_lldb_private__UnixSignals_t swig_types[246] -#define SWIGTYPE_p_unsigned_char swig_types[247] -#define SWIGTYPE_p_unsigned_int swig_types[248] -#define SWIGTYPE_p_unsigned_long_long swig_types[249] -#define SWIGTYPE_p_unsigned_short swig_types[250] -#define SWIGTYPE_p_void swig_types[251] -static swig_type_info *swig_types[253]; -static swig_module_info swig_module = {swig_types, 252, 0, 0, 0, 0}; +#define SWIGTYPE_p_lldb__SBProgress swig_types[54] +#define SWIGTYPE_p_lldb__SBQueue swig_types[55] +#define SWIGTYPE_p_lldb__SBQueueItem swig_types[56] +#define SWIGTYPE_p_lldb__SBReproducer swig_types[57] +#define SWIGTYPE_p_lldb__SBSaveCoreOptions swig_types[58] +#define SWIGTYPE_p_lldb__SBScriptObject swig_types[59] +#define SWIGTYPE_p_lldb__SBSection swig_types[60] +#define SWIGTYPE_p_lldb__SBSourceManager swig_types[61] +#define SWIGTYPE_p_lldb__SBStatisticsOptions swig_types[62] +#define SWIGTYPE_p_lldb__SBStream swig_types[63] +#define SWIGTYPE_p_lldb__SBStringList swig_types[64] +#define SWIGTYPE_p_lldb__SBStructuredData swig_types[65] +#define SWIGTYPE_p_lldb__SBSymbol swig_types[66] +#define SWIGTYPE_p_lldb__SBSymbolContext swig_types[67] +#define SWIGTYPE_p_lldb__SBSymbolContextList swig_types[68] +#define SWIGTYPE_p_lldb__SBTarget swig_types[69] +#define SWIGTYPE_p_lldb__SBThread swig_types[70] +#define SWIGTYPE_p_lldb__SBThreadCollection swig_types[71] +#define SWIGTYPE_p_lldb__SBThreadPlan swig_types[72] +#define SWIGTYPE_p_lldb__SBTrace swig_types[73] +#define SWIGTYPE_p_lldb__SBTraceCursor swig_types[74] +#define SWIGTYPE_p_lldb__SBType swig_types[75] +#define SWIGTYPE_p_lldb__SBTypeCategory swig_types[76] +#define SWIGTYPE_p_lldb__SBTypeEnumMember swig_types[77] +#define SWIGTYPE_p_lldb__SBTypeEnumMemberList swig_types[78] +#define SWIGTYPE_p_lldb__SBTypeFilter swig_types[79] +#define SWIGTYPE_p_lldb__SBTypeFormat swig_types[80] +#define SWIGTYPE_p_lldb__SBTypeList swig_types[81] +#define SWIGTYPE_p_lldb__SBTypeMember swig_types[82] +#define SWIGTYPE_p_lldb__SBTypeMemberFunction swig_types[83] +#define SWIGTYPE_p_lldb__SBTypeNameSpecifier swig_types[84] +#define SWIGTYPE_p_lldb__SBTypeStaticField swig_types[85] +#define SWIGTYPE_p_lldb__SBTypeSummary swig_types[86] +#define SWIGTYPE_p_lldb__SBTypeSummaryOptions swig_types[87] +#define SWIGTYPE_p_lldb__SBTypeSynthetic swig_types[88] +#define SWIGTYPE_p_lldb__SBUnixSignals swig_types[89] +#define SWIGTYPE_p_lldb__SBValue swig_types[90] +#define SWIGTYPE_p_lldb__SBValueList swig_types[91] +#define SWIGTYPE_p_lldb__SBVariablesOptions swig_types[92] +#define SWIGTYPE_p_lldb__SBWatchpoint swig_types[93] +#define SWIGTYPE_p_lldb__SBWatchpointOptions swig_types[94] +#define SWIGTYPE_p_long_double swig_types[95] +#define SWIGTYPE_p_long_long swig_types[96] +#define SWIGTYPE_p_p_void swig_types[97] +#define SWIGTYPE_p_pthread_rwlock_t swig_types[98] +#define SWIGTYPE_p_pthread_t swig_types[99] +#define SWIGTYPE_p_short swig_types[100] +#define SWIGTYPE_p_signed_char swig_types[101] +#define SWIGTYPE_p_size_t swig_types[102] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ABI_t swig_types[103] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Baton_t swig_types[104] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Block_t swig_types[105] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__BreakpointLocation_t swig_types[106] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__BreakpointPrecondition_t swig_types[107] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__BreakpointResolver_t swig_types[108] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__BreakpointSite_t swig_types[109] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Breakpoint_t swig_types[110] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__BroadcasterManager_t swig_types[111] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Broadcaster_t swig_types[112] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__CommandObject_t swig_types[113] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__CompileUnit_t swig_types[114] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Connection_t swig_types[115] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__DataBuffer_t swig_types[116] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__DataExtractor_t swig_types[117] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Debugger_t swig_types[118] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Disassembler_t swig_types[119] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__EventDataStructuredData_t swig_types[120] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__EventData_t swig_types[121] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Event_t swig_types[122] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ExecutionContextRef_t swig_types[123] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ExpressionVariable_t swig_types[124] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__File_t swig_types[125] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__FormatEntity__Entry_t swig_types[126] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__FuncUnwinders_t swig_types[127] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Function_t swig_types[128] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__IOHandler_t swig_types[129] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__IOObject_t swig_types[130] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__IRExecutionUnit_t swig_types[131] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__InlineFunctionInfo_t swig_types[132] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Instruction_t swig_types[133] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__InstrumentationRuntime_t swig_types[134] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__JITLoader_t swig_types[135] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__LanguageRuntime_t swig_types[136] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Listener_t swig_types[137] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__MemoryHistory_t swig_types[138] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__MemoryRegionInfo_t swig_types[139] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Module_t swig_types[140] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ObjectContainer_t swig_types[141] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ObjectFileJITDelegate_t swig_types[142] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ObjectFile_t swig_types[143] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__OperatingSystemInterface_t swig_types[144] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__OptionValueProperties_t swig_types[145] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__OptionValue_t swig_types[146] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Platform_t swig_types[147] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ProcessAttachInfo_t swig_types[148] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ProcessLaunchInfo_t swig_types[149] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Process_t swig_types[150] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__QueueItem_t swig_types[151] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Queue_t swig_types[152] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__REPL_t swig_types[153] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__RecognizedStackFrame_t swig_types[154] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__RegisterCheckpoint_t swig_types[155] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__RegisterContext_t swig_types[156] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__RegisterTypeBuilder_t swig_types[157] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__RegularExpression_t swig_types[158] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ScriptInterpreter_t swig_types[159] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ScriptSummaryFormat_t swig_types[160] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ScriptedMetadata_t swig_types[161] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ScriptedSyntheticChildren_t swig_types[162] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ScriptedThreadInterface_t swig_types[163] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ScriptedThreadPlanInterface_t swig_types[164] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__SearchFilter_t swig_types[165] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__SectionLoadList_t swig_types[166] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Section_t swig_types[167] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__StackFrameList_t swig_types[168] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__StackFrameRecognizer_t swig_types[169] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__StackFrame_t swig_types[170] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__StopInfo_t swig_types[171] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__StreamFile_t swig_types[172] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Stream_t swig_types[173] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__StringSummaryFormat_t swig_types[174] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__StructuredDataPlugin_t swig_types[175] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__SupportFile_t swig_types[176] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__SymbolContextSpecifier_t swig_types[177] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__SymbolFileType_t swig_types[178] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__SyntheticChildrenFrontEnd_t swig_types[179] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__SyntheticChildren_t swig_types[180] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Target_t swig_types[181] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ThreadCollection_t swig_types[182] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ThreadPlanTracer_t swig_types[183] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ThreadPlan_t swig_types[184] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ThreadPostMortemTrace_t swig_types[185] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Thread_t swig_types[186] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TraceCursor_t swig_types[187] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Trace_t swig_types[188] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeCategoryImpl_t swig_types[189] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeEnumMemberImpl_t swig_types[190] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeFilterImpl_t swig_types[191] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeFormatImpl_t swig_types[192] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeImpl_t swig_types[193] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeMemberFunctionImpl_t swig_types[194] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeNameSpecifierImpl_t swig_types[195] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeSummaryImpl_t swig_types[196] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeSummaryOptions_t swig_types[197] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeSystemClang_t swig_types[198] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__TypeSystem_t swig_types[199] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Type_t swig_types[200] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__UnixSignals_t swig_types[201] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__UnwindAssembly_t swig_types[202] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__UnwindPlan_t swig_types[203] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__UserExpression_t swig_types[204] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ValueObjectList_t swig_types[205] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__ValueObject_t swig_types[206] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Value_t swig_types[207] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__VariableList_t swig_types[208] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Variable_t swig_types[209] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__WatchpointResource_t swig_types[210] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__Watchpoint_t swig_types[211] +#define SWIGTYPE_p_std__shared_ptrT_lldb_private__WritableDataBuffer_t swig_types[212] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__AddressRange_t swig_types[213] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__DynamicCheckerFunctions_t swig_types[214] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__DynamicLoader_t swig_types[215] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__File_t swig_types[216] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__JITLoaderList_t swig_types[217] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__MemoryRegionInfo_t swig_types[218] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__OperatingSystem_t swig_types[219] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__ScriptedPlatformInterface_t swig_types[220] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__ScriptedProcessInterface_t swig_types[221] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__SectionList_t swig_types[222] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__SourceManager_t swig_types[223] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__StackFrameRecognizerManager_t swig_types[224] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__StructuredDataImpl_t swig_types[225] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__SymbolVendor_t swig_types[226] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__SystemRuntime_t swig_types[227] +#define SWIGTYPE_p_std__unique_ptrT_lldb_private__TraceExporter_t swig_types[228] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__BreakpointLocation_t swig_types[229] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Breakpoint_t swig_types[230] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__BroadcasterManager_t swig_types[231] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Debugger_t swig_types[232] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Listener_t swig_types[233] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Module_t swig_types[234] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__ObjectFileJITDelegate_t swig_types[235] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__OptionValue_t swig_types[236] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Process_t swig_types[237] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Queue_t swig_types[238] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Section_t swig_types[239] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__StackFrame_t swig_types[240] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__StructuredDataPlugin_t swig_types[241] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Target_t swig_types[242] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__ThreadPlan_t swig_types[243] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Thread_t swig_types[244] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__TypeSystem_t swig_types[245] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__Type_t swig_types[246] +#define SWIGTYPE_p_std__weak_ptrT_lldb_private__UnixSignals_t swig_types[247] +#define SWIGTYPE_p_unsigned_char swig_types[248] +#define SWIGTYPE_p_unsigned_int swig_types[249] +#define SWIGTYPE_p_unsigned_long_long swig_types[250] +#define SWIGTYPE_p_unsigned_short swig_types[251] +#define SWIGTYPE_p_void swig_types[252] +static swig_type_info *swig_types[254]; +static swig_module_info swig_module = {swig_types, 253, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) @@ -3705,6 +3706,7 @@ template <> bool SetNumberFromPyObject(double &number, PyObject *obj) { #include "lldb/API/SBProcess.h" #include "lldb/API/SBProcessInfo.h" #include "lldb/API/SBProcessInfoList.h" +#include "lldb/API/SBProgress.h" #include "lldb/API/SBQueue.h" #include "lldb/API/SBQueueItem.h" #include "lldb/API/SBReproducer.h" @@ -57473,6 +57475,341 @@ SWIGINTERN PyObject *SBProcessInfoList_swiginit(PyObject *SWIGUNUSEDPARM(self), return SWIG_Python_InitShadowInstance(args); } +SWIGINTERN PyObject *_wrap_new_SBProgress__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + lldb::SBDebugger *arg3 = 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + lldb::SBProgress *result = 0 ; + + (void)self; + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_SBProgress" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_SBProgress" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_lldb__SBDebugger, 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_SBProgress" "', argument " "3"" of type '" "lldb::SBDebugger &""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_NullReferenceError, "invalid null reference " "in method '" "new_SBProgress" "', argument " "3"" of type '" "lldb::SBDebugger &""'"); + } + arg3 = reinterpret_cast< lldb::SBDebugger * >(argp3); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (lldb::SBProgress *)new lldb::SBProgress((char const *)arg1,(char const *)arg2,*arg3); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_lldb__SBProgress, SWIG_POINTER_NEW | 0 ); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_SBProgress__SWIG_1(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + uint64_t arg3 ; + lldb::SBDebugger *arg4 = 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + unsigned long long val3 ; + int ecode3 = 0 ; + void *argp4 = 0 ; + int res4 = 0 ; + lldb::SBProgress *result = 0 ; + + (void)self; + if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_SBProgress" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_SBProgress" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + ecode3 = SWIG_AsVal_unsigned_SS_long_SS_long(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_SBProgress" "', argument " "3"" of type '" "uint64_t""'"); + } + arg3 = static_cast< uint64_t >(val3); + res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_lldb__SBDebugger, 0 ); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_SBProgress" "', argument " "4"" of type '" "lldb::SBDebugger &""'"); + } + if (!argp4) { + SWIG_exception_fail(SWIG_NullReferenceError, "invalid null reference " "in method '" "new_SBProgress" "', argument " "4"" of type '" "lldb::SBDebugger &""'"); + } + arg4 = reinterpret_cast< lldb::SBDebugger * >(argp4); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (lldb::SBProgress *)new lldb::SBProgress((char const *)arg1,(char const *)arg2,arg3,*arg4); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_lldb__SBProgress, SWIG_POINTER_NEW | 0 ); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_SBProgress(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[5] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_SBProgress", 0, 4, argv))) SWIG_fail; + --argc; + if (argc == 3) { + int _v = 0; + int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_lldb__SBDebugger, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_SBProgress__SWIG_0(self, argc, argv); + } + } + } + } + if (argc == 4) { + int _v = 0; + int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_unsigned_SS_long_SS_long(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_lldb__SBDebugger, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_SBProgress__SWIG_1(self, argc, argv); + } + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_SBProgress'.\n" + " Possible C/C++ prototypes are:\n" + " lldb::SBProgress::SBProgress(char const *,char const *,lldb::SBDebugger &)\n" + " lldb::SBProgress::SBProgress(char const *,char const *,uint64_t,lldb::SBDebugger &)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_delete_SBProgress(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + lldb::SBProgress *arg1 = (lldb::SBProgress *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + + (void)self; + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_lldb__SBProgress, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SBProgress" "', argument " "1"" of type '" "lldb::SBProgress *""'"); + } + arg1 = reinterpret_cast< lldb::SBProgress * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + delete arg1; + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SBProgress_Increment__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + lldb::SBProgress *arg1 = (lldb::SBProgress *) 0 ; + uint64_t arg2 ; + char *arg3 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + unsigned long long val2 ; + int ecode2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + + (void)self; + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_lldb__SBProgress, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SBProgress_Increment" "', argument " "1"" of type '" "lldb::SBProgress *""'"); + } + arg1 = reinterpret_cast< lldb::SBProgress * >(argp1); + ecode2 = SWIG_AsVal_unsigned_SS_long_SS_long(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SBProgress_Increment" "', argument " "2"" of type '" "uint64_t""'"); + } + arg2 = static_cast< uint64_t >(val2); + res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SBProgress_Increment" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + (arg1)->Increment(arg2,(char const *)arg3); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_Py_Void(); + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SBProgress_Increment__SWIG_1(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + lldb::SBProgress *arg1 = (lldb::SBProgress *) 0 ; + uint64_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + unsigned long long val2 ; + int ecode2 = 0 ; + + (void)self; + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_lldb__SBProgress, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SBProgress_Increment" "', argument " "1"" of type '" "lldb::SBProgress *""'"); + } + arg1 = reinterpret_cast< lldb::SBProgress * >(argp1); + ecode2 = SWIG_AsVal_unsigned_SS_long_SS_long(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SBProgress_Increment" "', argument " "2"" of type '" "uint64_t""'"); + } + arg2 = static_cast< uint64_t >(val2); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + (arg1)->Increment(arg2); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SBProgress_Increment(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "SBProgress_Increment", 0, 3, argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v = 0; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_lldb__SBProgress, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_unsigned_SS_long_SS_long(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_SBProgress_Increment__SWIG_1(self, argc, argv); + } + } + } + if (argc == 3) { + int _v = 0; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_lldb__SBProgress, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_unsigned_SS_long_SS_long(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_SBProgress_Increment__SWIG_0(self, argc, argv); + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'SBProgress_Increment'.\n" + " Possible C/C++ prototypes are:\n" + " lldb::SBProgress::Increment(uint64_t,char const *)\n" + " lldb::SBProgress::Increment(uint64_t)\n"); + return 0; +} + + +SWIGINTERN PyObject *SBProgress_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj = NULL; + if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_lldb__SBProgress, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *SBProgress_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + SWIGINTERN PyObject *_wrap_new_SBQueue__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { PyObject *resultobj = 0; lldb::SBQueue *result = 0 ; @@ -97859,6 +98196,14 @@ static PyMethodDef SwigMethods[] = { { "SBProcessInfoList_Clear", _wrap_SBProcessInfoList_Clear, METH_O, "SBProcessInfoList_Clear(SBProcessInfoList self)"}, { "SBProcessInfoList_swigregister", SBProcessInfoList_swigregister, METH_O, NULL}, { "SBProcessInfoList_swiginit", SBProcessInfoList_swiginit, METH_VARARGS, NULL}, + { "new_SBProgress", _wrap_new_SBProgress, METH_VARARGS, "\n" + "SBProgress(char const * title, char const * details, SBDebugger debugger)\n" + "new_SBProgress(char const * title, char const * details, uint64_t total_units, SBDebugger debugger) -> SBProgress\n" + ""}, + { "delete_SBProgress", _wrap_delete_SBProgress, METH_O, "delete_SBProgress(SBProgress self)"}, + { "SBProgress_Increment", _wrap_SBProgress_Increment, METH_VARARGS, "SBProgress_Increment(SBProgress self, uint64_t amount, char const * description=None)"}, + { "SBProgress_swigregister", SBProgress_swigregister, METH_O, NULL}, + { "SBProgress_swiginit", SBProgress_swiginit, METH_VARARGS, NULL}, { "new_SBQueue", _wrap_new_SBQueue, METH_VARARGS, "\n" "SBQueue()\n" "new_SBQueue(SBQueue rhs) -> SBQueue\n" @@ -100553,6 +100898,7 @@ static swig_type_info _swigt__p_lldb__SBPlatformShellCommand = {"_p_lldb__SBPlat static swig_type_info _swigt__p_lldb__SBProcess = {"_p_lldb__SBProcess", "lldb::SBProcess *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_lldb__SBProcessInfo = {"_p_lldb__SBProcessInfo", "lldb::SBProcessInfo *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_lldb__SBProcessInfoList = {"_p_lldb__SBProcessInfoList", "lldb::SBProcessInfoList *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_lldb__SBProgress = {"_p_lldb__SBProgress", "lldb::SBProgress *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_lldb__SBQueue = {"_p_lldb__SBQueue", "lldb::SBQueue *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_lldb__SBQueueItem = {"_p_lldb__SBQueueItem", "lldb::SBQueueItem *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_lldb__SBReproducer = {"_p_lldb__SBReproducer", "lldb::SBReproducer *", 0, 0, (void*)0, 0}; @@ -100807,6 +101153,7 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_lldb__SBProcess, &_swigt__p_lldb__SBProcessInfo, &_swigt__p_lldb__SBProcessInfoList, + &_swigt__p_lldb__SBProgress, &_swigt__p_lldb__SBQueue, &_swigt__p_lldb__SBQueueItem, &_swigt__p_lldb__SBReproducer, @@ -101061,6 +101408,7 @@ static swig_cast_info _swigc__p_lldb__SBPlatformShellCommand[] = { {&_swigt__p_ static swig_cast_info _swigc__p_lldb__SBProcess[] = { {&_swigt__p_lldb__SBProcess, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_lldb__SBProcessInfo[] = { {&_swigt__p_lldb__SBProcessInfo, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_lldb__SBProcessInfoList[] = { {&_swigt__p_lldb__SBProcessInfoList, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_lldb__SBProgress[] = { {&_swigt__p_lldb__SBProgress, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_lldb__SBQueue[] = { {&_swigt__p_lldb__SBQueue, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_lldb__SBQueueItem[] = { {&_swigt__p_lldb__SBQueueItem, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_lldb__SBReproducer[] = { {&_swigt__p_lldb__SBReproducer, 0, 0, 0},{0, 0, 0, 0}}; @@ -101315,6 +101663,7 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_lldb__SBProcess, _swigc__p_lldb__SBProcessInfo, _swigc__p_lldb__SBProcessInfoList, + _swigc__p_lldb__SBProgress, _swigc__p_lldb__SBQueue, _swigc__p_lldb__SBQueueItem, _swigc__p_lldb__SBReproducer, @@ -102826,6 +103175,8 @@ SWIG_init(void) { SWIG_Python_SetConstant(d, "eBroadcastBitError",SWIG_From_int(static_cast< int >(lldb::eBroadcastBitError))); SWIG_Python_SetConstant(d, "eBroadcastSymbolChange",SWIG_From_int(static_cast< int >(lldb::eBroadcastSymbolChange))); SWIG_Python_SetConstant(d, "eBroadcastBitProgressCategory",SWIG_From_int(static_cast< int >(lldb::eBroadcastBitProgressCategory))); + SWIG_Python_SetConstant(d, "eBroadcastBitExternalProgress",SWIG_From_int(static_cast< int >(lldb::eBroadcastBitExternalProgress))); + SWIG_Python_SetConstant(d, "eBroadcastBitExternalProgressCategory",SWIG_From_int(static_cast< int >(lldb::eBroadcastBitExternalProgressCategory))); SWIG_Python_SetConstant(d, "eSeverityError",SWIG_From_int(static_cast< int >(lldb::eSeverityError))); SWIG_Python_SetConstant(d, "eSeverityWarning",SWIG_From_int(static_cast< int >(lldb::eSeverityWarning))); SWIG_Python_SetConstant(d, "eSeverityInfo",SWIG_From_int(static_cast< int >(lldb::eSeverityInfo))); @@ -102844,6 +103195,8 @@ SWIG_init(void) { SWIG_Python_SetConstant(d, "SBDebugger_eBroadcastBitWarning",SWIG_From_int(static_cast< int >(lldb::SBDebugger::eBroadcastBitWarning))); SWIG_Python_SetConstant(d, "SBDebugger_eBroadcastBitError",SWIG_From_int(static_cast< int >(lldb::SBDebugger::eBroadcastBitError))); SWIG_Python_SetConstant(d, "SBDebugger_eBroadcastBitProgressCategory",SWIG_From_int(static_cast< int >(lldb::SBDebugger::eBroadcastBitProgressCategory))); + SWIG_Python_SetConstant(d, "SBDebugger_eBroadcastBitExternalProgress",SWIG_From_int(static_cast< int >(lldb::SBDebugger::eBroadcastBitExternalProgress))); + SWIG_Python_SetConstant(d, "SBDebugger_eBroadcastBitExternalProgressCategory",SWIG_From_int(static_cast< int >(lldb::SBDebugger::eBroadcastBitExternalProgressCategory))); SWIG_Python_SetConstant(d, "eLanguageNameAda",SWIG_From_int(static_cast< int >(lldb::eLanguageNameAda))); SWIG_Python_SetConstant(d, "eLanguageNameBLISS",SWIG_From_int(static_cast< int >(lldb::eLanguageNameBLISS))); SWIG_Python_SetConstant(d, "eLanguageNameC",SWIG_From_int(static_cast< int >(lldb::eLanguageNameC))); diff --git a/lldb/bindings/python/static-binding/lldb.py b/lldb/bindings/python/static-binding/lldb.py index 7595bcdb707d1..795a2ae848607 100644 --- a/lldb/bindings/python/static-binding/lldb.py +++ b/lldb/bindings/python/static-binding/lldb.py @@ -1807,6 +1807,10 @@ def lldb_iter(obj, getsize, getelem): eBroadcastBitProgressCategory = _lldb.eBroadcastBitProgressCategory +eBroadcastBitExternalProgress = _lldb.eBroadcastBitExternalProgress + +eBroadcastBitExternalProgressCategory = _lldb.eBroadcastBitExternalProgressCategory + eSeverityError = _lldb.eSeverityError eSeverityWarning = _lldb.eSeverityWarning @@ -4652,6 +4656,10 @@ def disassemble_instructions (insts): eBroadcastBitProgressCategory = _lldb.SBDebugger_eBroadcastBitProgressCategory + eBroadcastBitExternalProgress = _lldb.SBDebugger_eBroadcastBitExternalProgress + + eBroadcastBitExternalProgressCategory = _lldb.SBDebugger_eBroadcastBitExternalProgressCategory + def __init__(self, *args): r""" @@ -9885,6 +9893,40 @@ def __iter__(self): # Register SBProcessInfoList in _lldb: _lldb.SBProcessInfoList_swigregister(SBProcessInfoList) +class SBProgress(object): + r""" + A Progress indicator helper class. + + Any potentially long running sections of code in LLDB should report + progress so that clients are aware of delays that might appear during + debugging. Delays commonly include indexing debug information, parsing + symbol tables for object files, downloading symbols from remote + repositories, and many more things. + + The Progress class helps make sure that progress is correctly reported + and will always send an initial progress update, updates when + Progress::Increment() is called, and also will make sure that a progress + completed update is reported even if the user doesn't explicitly cause one + to be sent. + """ + + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def __init__(self, *args): + r""" + __init__(SBProgress self, char const * title, char const * details, SBDebugger debugger) -> SBProgress + __init__(SBProgress self, char const * title, char const * details, uint64_t total_units, SBDebugger debugger) -> SBProgress + """ + _lldb.SBProgress_swiginit(self, _lldb.new_SBProgress(*args)) + __swig_destroy__ = _lldb.delete_SBProgress + + def Increment(self, amount, description=None): + r"""Increment(SBProgress self, uint64_t amount, char const * description=None)""" + return _lldb.SBProgress_Increment(self, amount, description) + +# Register SBProgress in _lldb: +_lldb.SBProgress_swigregister(SBProgress) class SBQueue(object): r"""Represents a libdispatch queue in the process.""" diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index 40c4e28174613..9921e36d8895e 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -42,12 +42,16 @@ class LLDB_API SBInputReader { class LLDB_API SBDebugger { public: - FLAGS_ANONYMOUS_ENUM(){ - eBroadcastBitProgress = lldb::DebuggerBroadcastBit::eBroadcastBitProgress, - eBroadcastBitWarning = lldb::DebuggerBroadcastBit::eBroadcastBitWarning, - eBroadcastBitError = lldb::DebuggerBroadcastBit::eBroadcastBitError, - eBroadcastBitProgressCategory = - lldb::DebuggerBroadcastBit::eBroadcastBitProgressCategory, + FLAGS_ANONYMOUS_ENUM() { + eBroadcastBitProgress = lldb::DebuggerBroadcastBit::eBroadcastBitProgress, + eBroadcastBitWarning = lldb::DebuggerBroadcastBit::eBroadcastBitWarning, + eBroadcastBitError = lldb::DebuggerBroadcastBit::eBroadcastBitError, + eBroadcastBitProgressCategory = + lldb::DebuggerBroadcastBit::eBroadcastBitProgressCategory, + eBroadcastBitExternalProgress = + lldb::DebuggerBroadcastBit::eBroadcastBitExternalProgress, + eBroadcastBitExternalProgressCategory = + lldb::DebuggerBroadcastBit::eBroadcastBitExternalProgressCategory, }; SBDebugger(); @@ -203,7 +207,7 @@ class LLDB_API SBDebugger { lldb::SBCommandInterpreter GetCommandInterpreter(); void HandleCommand(const char *command); - + void RequestInterrupt(); void CancelInterruptRequest(); bool InterruptRequested(); @@ -512,6 +516,7 @@ class LLDB_API SBDebugger { friend class SBPlatform; friend class SBTarget; friend class SBTrace; + friend class SBProgress; lldb::SBTarget FindTargetWithLLDBProcess(const lldb::ProcessSP &processSP); diff --git a/lldb/include/lldb/API/SBProgress.h b/lldb/include/lldb/API/SBProgress.h new file mode 100644 index 0000000000000..d2eaf0a743cb3 --- /dev/null +++ b/lldb/include/lldb/API/SBProgress.h @@ -0,0 +1,66 @@ +//===-- SBProgress.h --------------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_API_SBPROGRESS_H +#define LLDB_API_SBPROGRESS_H + +#include "lldb/API/SBDebugger.h" +#include "lldb/API/SBDefines.h" + +namespace lldb { + +/// A Progress indicator helper class. +/// +/// Any potentially long running sections of code in LLDB should report +/// progress so that clients are aware of delays that might appear during +/// debugging. Delays commonly include indexing debug information, parsing +/// symbol tables for object files, downloading symbols from remote +/// repositories, and many more things. +/// +/// The Progress class helps make sure that progress is correctly reported +/// and will always send an initial progress update, updates when +/// Progress::Increment() is called, and also will make sure that a progress +/// completed update is reported even if the user doesn't explicitly cause one +/// to be sent. +class LLDB_API SBProgress { +public: + /// Construct a progress object with a title, details and a given debugger. + /// \param title + /// The title of the progress object. + /// \param details + /// The details of the progress object. + /// \param debugger + /// The debugger for this progress object to report to. + SBProgress(const char *title, const char *details, SBDebugger &debugger); + + /// Construct a progress object with a title, details, the total units of work + /// to be done, and a given debugger. + /// \param title + /// The title of the progress object. + /// \param details + /// The details of the progress object. + /// \param total_units + /// The total number of units of work to be done. + /// \param debugger + /// The debugger for this progress object to report to. + SBProgress(const char *title, const char *details, uint64_t total_units, + SBDebugger &debugger); + + ~SBProgress(); + + void Increment(uint64_t amount, const char *description = nullptr); + +protected: + lldb_private::Progress &ref() const; + +private: + std::unique_ptr m_opaque_up; +}; // SBProgress +} // namespace lldb + +#endif // LLDB_API_SBPROGRESS_H diff --git a/lldb/include/lldb/Core/Progress.h b/lldb/include/lldb/Core/Progress.h index 421e435a9e685..5876eae717e96 100644 --- a/lldb/include/lldb/Core/Progress.h +++ b/lldb/include/lldb/Core/Progress.h @@ -10,6 +10,7 @@ #define LLDB_CORE_PROGRESS_H #include "lldb/Host/Alarm.h" +#include "lldb/Utility/Timeout.h" #include "lldb/lldb-forward.h" #include "lldb/lldb-types.h" #include "llvm/ADT/StringMap.h" @@ -58,6 +59,12 @@ namespace lldb_private { class Progress { public: + /// Enum to indicate the origin of a progress event, internal or external. + enum class Origin : uint8_t { + eInternal = 0, + eExternal = 1, + }; + /// Construct a progress object that will report information. /// /// The constructor will create a unique progress reporting object and @@ -81,7 +88,9 @@ class Progress { /// progress is to be reported only to specific debuggers. Progress(std::string title, std::string details = {}, std::optional total = std::nullopt, - lldb_private::Debugger *debugger = nullptr); + lldb_private::Debugger *debugger = nullptr, + Timeout minimum_report_time = std::nullopt, + Origin origin = Origin::eInternal); /// Destroy the progress object. /// @@ -116,26 +125,40 @@ class Progress { /// The optional debugger ID to report progress to. If this has no value /// then all debuggers will receive this event. std::optional debugger_id; + + /// The origin of the progress event, wheter it is internal or external. + Origin origin; }; private: void ReportProgress(); static std::atomic g_id; - /// More specific information about the current file being displayed in the - /// report. - std::string m_details; - /// How much work ([0...m_total]) that has been completed. - uint64_t m_completed; + /// Total amount of work, use a std::nullopt in the constructor for non /// deterministic progress. - uint64_t m_total; - std::mutex m_mutex; - /// Set to true when progress has been reported where m_completed == m_total - /// to ensure that we don't send progress updates after progress has - /// completed. - bool m_complete = false; + const uint64_t m_total; + + // Minimum amount of time between two progress reports. + const Timeout m_minimum_report_time; + /// Data needed by the debugger to broadcast a progress event. - ProgressData m_progress_data; + const ProgressData m_progress_data; + + /// How much work ([0...m_total]) that has been completed. + std::atomic m_completed = 0; + + /// Time (in nanoseconds since epoch) of the last progress report. + std::atomic m_last_report_time_ns; + + /// Guards non-const non-atomic members of the class. + std::mutex m_mutex; + + /// More specific information about the current file being displayed in the + /// report. + std::string m_details; + + /// The "completed" value of the last reported event. + std::optional m_prev_completed; }; /// A class used to group progress reports by category. This is done by using a diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 199a06a7166f6..f06993c83837f 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -1383,6 +1383,8 @@ enum DebuggerBroadcastBit { eBroadcastBitError = (1 << 2), eBroadcastSymbolChange = (1 << 3), eBroadcastBitProgressCategory = (1 << 4), + eBroadcastBitExternalProgress = (1 << 5), + eBroadcastBitExternalProgressCategory = (1 << 6), }; /// Used for expressing severity in logs and diagnostics. diff --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h index 1024501e05bca..ca630bb629cbd 100644 --- a/lldb/include/lldb/lldb-forward.h +++ b/lldb/include/lldb/lldb-forward.h @@ -230,6 +230,7 @@ class Symtab; class SyntheticChildren; class SyntheticChildrenFrontEnd; class SystemRuntime; +class Progress; class Target; class TargetList; class TargetProperties; diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt index 9042ee43f7665..175af2ba162b4 100644 --- a/lldb/source/API/CMakeLists.txt +++ b/lldb/source/API/CMakeLists.txt @@ -93,6 +93,7 @@ add_lldb_library(liblldb SHARED ${option_framework} SBModule.cpp SBModuleSpec.cpp SBPlatform.cpp + SBProgress.cpp SBProcess.cpp SBProcessInfo.cpp SBProcessInfoList.cpp diff --git a/lldb/source/API/SBProgress.cpp b/lldb/source/API/SBProgress.cpp new file mode 100644 index 0000000000000..d6ed5f0d15fc9 --- /dev/null +++ b/lldb/source/API/SBProgress.cpp @@ -0,0 +1,43 @@ +//===-- SBProgress.cpp --------------------------------------------------*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "lldb/API/SBProgress.h" +#include "lldb/Core/Progress.h" +#include "lldb/Utility/Instrumentation.h" + +using namespace lldb; + +SBProgress::SBProgress(const char *title, const char *details, + SBDebugger &debugger) { + LLDB_INSTRUMENT_VA(this, title, details, debugger); + + m_opaque_up = std::make_unique( + title, details, /*total=*/std::nullopt, debugger.get(), + /*minimum_report_time=*/std::nullopt, + lldb_private::Progress::Origin::eExternal); +} + +SBProgress::SBProgress(const char *title, const char *details, + uint64_t total_units, SBDebugger &debugger) { + LLDB_INSTRUMENT_VA(this, title, details, total_units, debugger); + + m_opaque_up = std::make_unique( + title, details, total_units, debugger.get(), + /*minimum_report_time=*/std::nullopt, + lldb_private::Progress::Origin::eExternal); +} + +SBProgress::~SBProgress() = default; + +void SBProgress::Increment(uint64_t amount, const char *description) { + LLDB_INSTRUMENT_VA(amount, description); + + m_opaque_up->Increment(amount, description); +} + +lldb_private::Progress &SBProgress::ref() const { return *m_opaque_up; } diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index feecba62eebc4..11db7363f8334 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -2004,7 +2004,8 @@ lldb::thread_result_t Debugger::DefaultEventHandler() { listener_sp->StartListeningForEvents( &m_broadcaster, lldb::eBroadcastBitProgress | lldb::eBroadcastBitWarning | lldb::eBroadcastBitError | - lldb::eBroadcastSymbolChange); + lldb::eBroadcastSymbolChange | + lldb::eBroadcastBitExternalProgress); // Let the thread that spawned us know that we have started up and that we // are now listening to all required events so no events get missed diff --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp index 27774ce7a5521..57105535399a5 100644 --- a/lldb/source/Core/Progress.cpp +++ b/lldb/source/Core/Progress.cpp @@ -11,7 +11,8 @@ #include "lldb/Core/Debugger.h" #include "lldb/Utility/StreamString.h" #include "llvm/Support/Signposts.h" - +#include +#include #include #include #include @@ -26,17 +27,20 @@ static llvm::ManagedStatic g_progress_signposts; Progress::Progress(std::string title, std::string details, std::optional total, - lldb_private::Debugger *debugger) - : m_details(details), m_completed(0), - m_total(Progress::kNonDeterministicTotal), + lldb_private::Debugger *debugger, + Timeout minimum_report_time, + Progress::Origin origin) + : m_total(total.value_or(Progress::kNonDeterministicTotal)), + m_minimum_report_time(minimum_report_time), m_progress_data{title, ++g_id, - /*m_progress_data.debugger_id=*/std::nullopt} { - if (total) - m_total = *total; - - if (debugger) - m_progress_data.debugger_id = debugger->GetID(); - + debugger ? std::optional(debugger->GetID()) + : std::nullopt, + origin}, + m_last_report_time_ns( + std::chrono::nanoseconds( + std::chrono::steady_clock::now().time_since_epoch()) + .count()), + m_details(std::move(details)) { std::lock_guard guard(m_mutex); ReportProgress(); @@ -65,29 +69,55 @@ Progress::~Progress() { void Progress::Increment(uint64_t amount, std::optional updated_detail) { - if (amount > 0) { - std::lock_guard guard(m_mutex); - if (updated_detail) - m_details = std::move(updated_detail.value()); - // Watch out for unsigned overflow and make sure we don't increment too - // much and exceed the total. - if (m_total && (amount > (m_total - m_completed))) - m_completed = m_total; - else - m_completed += amount; - ReportProgress(); + if (amount == 0) + return; + + m_completed.fetch_add(amount, std::memory_order_relaxed); + + if (m_minimum_report_time) { + using namespace std::chrono; + + nanoseconds now; + uint64_t last_report_time_ns = + m_last_report_time_ns.load(std::memory_order_relaxed); + + do { + now = steady_clock::now().time_since_epoch(); + if (now < nanoseconds(last_report_time_ns) + *m_minimum_report_time) + return; // Too little time has passed since the last report. + + } while (!m_last_report_time_ns.compare_exchange_weak( + last_report_time_ns, now.count(), std::memory_order_relaxed, + std::memory_order_relaxed)); } + + std::lock_guard guard(m_mutex); + if (updated_detail) + m_details = std::move(updated_detail.value()); + ReportProgress(); } void Progress::ReportProgress() { - if (!m_complete) { - // Make sure we only send one notification that indicates the progress is - // complete - m_complete = m_completed == m_total; - Debugger::ReportProgress(m_progress_data.progress_id, m_progress_data.title, - m_details, m_completed, m_total, - m_progress_data.debugger_id); - } + // NB: Comparisons with optional rely on the fact that std::nullopt is + // "smaller" than zero. + if (m_prev_completed >= m_total) + return; // We've reported completion already. + + uint64_t completed = + std::min(m_completed.load(std::memory_order_relaxed), m_total); + if (completed < m_prev_completed) + return; // An overflow in the m_completed counter. Just ignore these events. + + // Change the category bit if we're an internal or external progress. + uint32_t progress_category_bit = + m_progress_data.origin == Progress::Origin::eExternal + ? lldb::eBroadcastBitExternalProgress + : lldb::eBroadcastBitProgress; + + Debugger::ReportProgress(m_progress_data.progress_id, m_progress_data.title, + m_details, completed, m_total, + m_progress_data.debugger_id, progress_category_bit); + m_prev_completed = completed; } ProgressManager::ProgressManager() @@ -178,10 +208,13 @@ void ProgressManager::ReportProgress( // broadcasting to it since that bit doesn't need that information. const uint64_t completed = (type == EventType::Begin) ? 0 : Progress::kNonDeterministicTotal; + const uint32_t progress_category_bit = + progress_data.origin == Progress::Origin::eExternal + ? lldb::eBroadcastBitExternalProgressCategory + : lldb::eBroadcastBitProgressCategory; Debugger::ReportProgress(progress_data.progress_id, progress_data.title, "", completed, Progress::kNonDeterministicTotal, - progress_data.debugger_id, - lldb::eBroadcastBitProgressCategory); + progress_data.debugger_id, progress_category_bit); } void ProgressManager::Expire(llvm::StringRef key) { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp index d581d3773ab23..d92ec28594558 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp @@ -79,7 +79,8 @@ void ManualDWARFIndex::Index() { // indexing the unit, and then 8 extra entries for finalizing each index set. const uint64_t total_progress = units_to_index.size() * 2 + 8; Progress progress("Manually indexing DWARF", module_desc.GetData(), - total_progress); + total_progress, /*debugger=*/nullptr, + /*minimum_report_time=*/std::chrono::milliseconds(20)); std::vector sets(units_to_index.size()); diff --git a/lldb/test/API/python_api/sbprogress/TestSBProgress.py b/lldb/test/API/python_api/sbprogress/TestSBProgress.py new file mode 100644 index 0000000000000..c456247da80c6 --- /dev/null +++ b/lldb/test/API/python_api/sbprogress/TestSBProgress.py @@ -0,0 +1,35 @@ +"""Test the SBProgress API.""" + +import lldb +from lldbsuite.test.lldbtest import * + + +class SBProgressTestCase(TestBase): + def test_with_external_bit_set(self): + """Test SBProgress events are listened to when the external bit is set.""" + + progress = lldb.SBProgress("Test SBProgress", "Test progress", self.dbg) + listener = lldb.SBListener("Test listener") + broadcaster = self.dbg.GetBroadcaster() + broadcaster.AddListener(listener, lldb.eBroadcastBitExternalProgress) + event = lldb.SBEvent() + + expected_string = "Test progress first increment" + progress.Increment(1, expected_string) + self.assertTrue(listener.PeekAtNextEvent(event)) + stream = lldb.SBStream() + event.GetDescription(stream) + self.assertIn(expected_string, stream.GetData()) + + def test_without_external_bit_set(self): + """Test SBProgress events are not listened to on the internal progress bit.""" + + progress = lldb.SBProgress("Test SBProgress", "Test progress", self.dbg) + listener = lldb.SBListener("Test listener") + broadcaster = self.dbg.GetBroadcaster() + broadcaster.AddListener(listener, lldb.eBroadcastBitProgress) + event = lldb.SBEvent() + + expected_string = "Test progress first increment" + progress.Increment(1, expected_string) + self.assertFalse(listener.PeekAtNextEvent(event)) diff --git a/lldb/test/API/tools/lldb-dap/progress/Makefile b/lldb/test/API/tools/lldb-dap/progress/Makefile new file mode 100644 index 0000000000000..99998b20bcb05 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/progress/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/progress/Progress_emitter.py b/lldb/test/API/tools/lldb-dap/progress/Progress_emitter.py new file mode 100644 index 0000000000000..7f4055cab9ddd --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/progress/Progress_emitter.py @@ -0,0 +1,84 @@ +import inspect +import optparse +import shlex +import sys +import time + +import lldb + + +class ProgressTesterCommand: + program = "test-progress" + + @classmethod + def register_lldb_command(cls, debugger, module_name): + parser = cls.create_options() + cls.__doc__ = parser.format_help() + # Add any commands contained in this module to LLDB + command = "command script add -c %s.%s %s" % ( + module_name, + cls.__name__, + cls.program, + ) + debugger.HandleCommand(command) + print( + 'The "{0}" command has been installed, type "help {0}" or "{0} ' + '--help" for detailed help.'.format(cls.program) + ) + + @classmethod + def create_options(cls): + usage = "usage: %prog [options]" + description = "SBProgress testing tool" + # Opt parse is deprecated, but leaving this the way it is because it allows help formating + # Additionally all our commands use optparse right now, ideally we migrate them all in one go. + parser = optparse.OptionParser( + description=description, prog=cls.program, usage=usage + ) + + parser.add_option( + "--total", dest="total", help="Total to count up.", type="int" + ) + + parser.add_option( + "--seconds", + dest="seconds", + help="Total number of seconds to wait between increments", + type="int", + ) + + return parser + + def get_short_help(self): + return "Progress Tester" + + def get_long_help(self): + return self.help_string + + def __init__(self, debugger, unused): + self.parser = self.create_options() + self.help_string = self.parser.format_help() + + def __call__(self, debugger, command, exe_ctx, result): + command_args = shlex.split(command) + try: + (cmd_options, args) = self.parser.parse_args(command_args) + except: + result.SetError("option parsing failed") + return + + total = cmd_options.total + progress = lldb.SBProgress("Progress tester", "Detail", total, debugger) + + for i in range(1, total): + progress.Increment(1, f"Step {i}") + time.sleep(cmd_options.seconds) + + +def __lldb_init_module(debugger, dict): + # Register all classes that have a register_lldb_command method + for _name, cls in inspect.getmembers(sys.modules[__name__]): + if inspect.isclass(cls) and callable( + getattr(cls, "register_lldb_command", None) + ): + cls.register_lldb_command(debugger, __name__) diff --git a/lldb/test/API/tools/lldb-dap/progress/TestDAP_Progress.py b/lldb/test/API/tools/lldb-dap/progress/TestDAP_Progress.py new file mode 100755 index 0000000000000..36c0cef9c4714 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/progress/TestDAP_Progress.py @@ -0,0 +1,49 @@ +""" +Test lldb-dap output events +""" + +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +import os +import time + +import lldbdap_testcase + + +class TestDAP_progress(lldbdap_testcase.DAPTestCaseBase): + @skipIfWindows + def test_output(self): + program = self.getBuildArtifact("a.out") + self.build_and_launch(program) + progress_emitter = os.path.join(os.getcwd(), "Progress_emitter.py") + print(f"Progress emitter path: {progress_emitter}") + source = "main.cpp" + # Set breakpoint in the thread function so we can step the threads + breakpoint_ids = self.set_source_breakpoints( + source, [line_number(source, "// break here")] + ) + self.continue_to_breakpoints(breakpoint_ids) + self.dap_server.request_evaluate( + f"`command script import {progress_emitter}", context="repl" + ) + self.dap_server.request_evaluate( + "`test-progress --total 3 --seconds 1", context="repl" + ) + + self.dap_server.wait_for_event("progressEnd", 15) + # Expect at least a start, an update, and end event + # However because the underlying Progress instance is an RAII object and we can't guaruntee + # it's deterministic destruction in the python API, we verify just start and update + # otherwise this test could be flakey. + self.assertTrue(len(self.dap_server.progress_events) > 0) + start_found = False + update_found = False + for event in self.dap_server.progress_events: + event_type = event["event"] + if "progressStart" in event_type: + start_found = True + if "progressUpdate" in event_type: + update_found = True + + self.assertTrue(start_found) + self.assertTrue(update_found) diff --git a/lldb/test/API/tools/lldb-dap/progress/main.cpp b/lldb/test/API/tools/lldb-dap/progress/main.cpp new file mode 100644 index 0000000000000..3bac5d0fd6db1 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/progress/main.cpp @@ -0,0 +1,5 @@ +int main() { + char *ptr = "unused"; + // break here + return 0; +} diff --git a/lldb/tools/lldb-dap/ProgressEvent.cpp b/lldb/tools/lldb-dap/ProgressEvent.cpp index 8a660b50af120..7ed351f695e85 100644 --- a/lldb/tools/lldb-dap/ProgressEvent.cpp +++ b/lldb/tools/lldb-dap/ProgressEvent.cpp @@ -118,6 +118,9 @@ json::Value ProgressEvent::ToJSON() const { body.try_emplace("cancellable", false); } + if (m_event_type == progressUpdate) + EmplaceSafeString(body, "message", m_message); + std::string timestamp(llvm::formatv("{0:f9}", m_creation_time.count())); EmplaceSafeString(body, "timestamp", timestamp); @@ -165,10 +168,10 @@ const ProgressEvent &ProgressEventManager::GetMostRecentEvent() const { return m_last_update_event ? *m_last_update_event : m_start_event; } -void ProgressEventManager::Update(uint64_t progress_id, uint64_t completed, - uint64_t total) { +void ProgressEventManager::Update(uint64_t progress_id, llvm::StringRef message, + uint64_t completed, uint64_t total) { if (std::optional event = ProgressEvent::Create( - progress_id, std::nullopt, completed, total, &GetMostRecentEvent())) { + progress_id, message, completed, total, &GetMostRecentEvent())) { if (event->GetEventType() == progressEnd) m_finished = true; @@ -228,7 +231,7 @@ void ProgressEventReporter::Push(uint64_t progress_id, const char *message, m_unreported_start_events.push(event_manager); } } else { - it->second->Update(progress_id, completed, total); + it->second->Update(progress_id, StringRef(message), completed, total); if (it->second->Finished()) m_event_managers.erase(it); } diff --git a/lldb/tools/lldb-dap/ProgressEvent.h b/lldb/tools/lldb-dap/ProgressEvent.h index dac21977add2d..8577010f6b886 100644 --- a/lldb/tools/lldb-dap/ProgressEvent.h +++ b/lldb/tools/lldb-dap/ProgressEvent.h @@ -98,7 +98,8 @@ class ProgressEventManager { /// Receive a new progress event for the start event and try to report it if /// appropriate. - void Update(uint64_t progress_id, uint64_t completed, uint64_t total); + void Update(uint64_t progress_id, llvm::StringRef message, uint64_t completed, + uint64_t total); /// \return /// \b true if a \a progressEnd event has been notified. There's no diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp index 43bca4bdcf295..eab036c4e6cf1 100644 --- a/lldb/tools/lldb-dap/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/lldb-dap.cpp @@ -416,7 +416,8 @@ void SendStdOutStdErr(lldb::SBProcess &process) { void ProgressEventThreadFunction() { lldb::SBListener listener("lldb-dap.progress.listener"); g_dap.debugger.GetBroadcaster().AddListener( - listener, lldb::SBDebugger::eBroadcastBitProgress); + listener, lldb::SBDebugger::eBroadcastBitProgress | + lldb::SBDebugger::eBroadcastBitExternalProgress); g_dap.broadcaster.AddListener(listener, eBroadcastBitStopProgressThread); lldb::SBEvent event; bool done = false; diff --git a/lldb/unittests/Core/ProgressReportTest.cpp b/lldb/unittests/Core/ProgressReportTest.cpp index 0149b1de77add..d82a4525b778d 100644 --- a/lldb/unittests/Core/ProgressReportTest.cpp +++ b/lldb/unittests/Core/ProgressReportTest.cpp @@ -18,6 +18,7 @@ #include "gtest/gtest.h" #include #include +#include using namespace lldb; using namespace lldb_private; @@ -208,6 +209,110 @@ TEST_F(ProgressReportTest, TestReportDestructionWithPartialProgress) { EXPECT_EQ(data->GetMessage(), "Infinite progress: Report 2"); } +TEST_F(ProgressReportTest, TestFiniteOverflow) { + ListenerSP listener_sp = CreateListenerFor(lldb::eBroadcastBitProgress); + EventSP event_sp; + const ProgressEventData *data; + + // Increment the report beyond its limit and make sure we only get one + // completed event. + { + Progress progress("Finite progress", "Report 1", 10); + progress.Increment(11); + progress.Increment(47); + } + + ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + EXPECT_TRUE(data->IsFinite()); + EXPECT_EQ(data->GetCompleted(), 0); + EXPECT_EQ(data->GetTotal(), 10); + + ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + EXPECT_TRUE(data->IsFinite()); + EXPECT_EQ(data->GetCompleted(), 10); + EXPECT_EQ(data->GetTotal(), 10); + + ASSERT_FALSE(listener_sp->GetEvent(event_sp, TIMEOUT)); +} + +TEST_F(ProgressReportTest, TestNonDeterministicOverflow) { + ListenerSP listener_sp = CreateListenerFor(lldb::eBroadcastBitProgress); + EventSP event_sp; + const ProgressEventData *data; + constexpr uint64_t max_minus_1 = std::numeric_limits::max() - 1; + + // Increment the report beyond its limit and make sure we only get one + // completed event. The event which overflows the counter should be ignored. + { + Progress progress("Non deterministic progress", "Report 1"); + progress.Increment(max_minus_1); + progress.Increment(max_minus_1); + } + + ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + EXPECT_FALSE(data->IsFinite()); + EXPECT_EQ(data->GetCompleted(), 0); + EXPECT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal); + + ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + EXPECT_FALSE(data->IsFinite()); + EXPECT_EQ(data->GetCompleted(), max_minus_1); + EXPECT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal); + + ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + EXPECT_FALSE(data->IsFinite()); + EXPECT_EQ(data->GetCompleted(), Progress::kNonDeterministicTotal); + EXPECT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal); + + ASSERT_FALSE(listener_sp->GetEvent(event_sp, TIMEOUT)); +} + +TEST_F(ProgressReportTest, TestMinimumReportTime) { + ListenerSP listener_sp = CreateListenerFor(lldb::eBroadcastBitProgress); + EventSP event_sp; + const ProgressEventData *data; + + { + Progress progress("Finite progress", "Report 1", /*total=*/20, + m_debugger_sp.get(), + /*minimum_report_time=*/std::chrono::seconds(1)); + // Send 10 events in quick succession. These should not generate any events. + for (int i = 0; i < 10; ++i) + progress.Increment(); + + // Sleep, then send 10 more. This should generate one event for the first + // increment, and then another for completion. + std::this_thread::sleep_for(std::chrono::seconds(1)); + for (int i = 0; i < 10; ++i) + progress.Increment(); + } + + ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + EXPECT_TRUE(data->IsFinite()); + EXPECT_EQ(data->GetCompleted(), 0); + EXPECT_EQ(data->GetTotal(), 20); + + ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + EXPECT_TRUE(data->IsFinite()); + EXPECT_EQ(data->GetCompleted(), 11); + EXPECT_EQ(data->GetTotal(), 20); + + ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + EXPECT_TRUE(data->IsFinite()); + EXPECT_EQ(data->GetCompleted(), 20); + EXPECT_EQ(data->GetTotal(), 20); + + ASSERT_FALSE(listener_sp->GetEvent(event_sp, TIMEOUT)); +} + TEST_F(ProgressReportTest, TestProgressManager) { ListenerSP listener_sp = CreateListenerFor(lldb::eBroadcastBitProgressCategory); @@ -320,3 +425,104 @@ TEST_F(ProgressReportTest, TestProgressManagerDisjointReports) { ASSERT_FALSE(listener_sp->GetEvent(event_sp, TIMEOUT)); } + +TEST_F(ProgressReportTest, TestExternalReportCreation) { + ListenerSP listener_sp = + CreateListenerFor(lldb::eBroadcastBitExternalProgress); + EventSP event_sp; + const ProgressEventData *data; + + // Scope this for RAII on the progress objects. + // Create progress reports and check that their respective events for having + // started and ended are broadcasted. + { + Progress progress1("Progress report 1", "Starting report 1", + /*total=*/std::nullopt, /*debugger=*/nullptr, + /*minimum_report_time=*/std::chrono::seconds(0), + Progress::Origin::eExternal); + Progress progress2("Progress report 2", "Starting report 2", + /*total=*/std::nullopt, /*debugger=*/nullptr, + /*minimum_report_time=*/std::chrono::seconds(0), + Progress::Origin::eExternal); + Progress progress3("Progress report 3", "Starting report 3", + /*total=*/std::nullopt, /*debugger=*/nullptr, + /*minimum_report_time=*/std::chrono::seconds(0), + Progress::Origin::eExternal); + } + + // Start popping events from the queue, they should have been recevied + // in this order: + // Starting progress: 1, 2, 3 + // Ending progress: 3, 2, 1 + ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + + EXPECT_EQ(data->GetDetails(), "Starting report 1"); + EXPECT_FALSE(data->IsFinite()); + EXPECT_FALSE(data->GetCompleted()); + EXPECT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal); + EXPECT_EQ(data->GetMessage(), "Progress report 1: Starting report 1"); + + ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + + EXPECT_EQ(data->GetDetails(), "Starting report 2"); + EXPECT_FALSE(data->IsFinite()); + EXPECT_FALSE(data->GetCompleted()); + EXPECT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal); + EXPECT_EQ(data->GetMessage(), "Progress report 2: Starting report 2"); + + ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + + EXPECT_EQ(data->GetDetails(), "Starting report 3"); + EXPECT_FALSE(data->IsFinite()); + EXPECT_FALSE(data->GetCompleted()); + EXPECT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal); + EXPECT_EQ(data->GetMessage(), "Progress report 3: Starting report 3"); + + // Progress report objects should be destroyed at this point so + // get each report from the queue and check that they've been + // destroyed in reverse order. + ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + + EXPECT_EQ(data->GetTitle(), "Progress report 3"); + EXPECT_TRUE(data->GetCompleted()); + EXPECT_FALSE(data->IsFinite()); + EXPECT_EQ(data->GetMessage(), "Progress report 3: Starting report 3"); + + ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + + EXPECT_EQ(data->GetTitle(), "Progress report 2"); + EXPECT_TRUE(data->GetCompleted()); + EXPECT_FALSE(data->IsFinite()); + EXPECT_EQ(data->GetMessage(), "Progress report 2: Starting report 2"); + + ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT)); + data = ProgressEventData::GetEventDataFromEvent(event_sp.get()); + + EXPECT_EQ(data->GetTitle(), "Progress report 1"); + EXPECT_TRUE(data->GetCompleted()); + EXPECT_FALSE(data->IsFinite()); + EXPECT_EQ(data->GetMessage(), "Progress report 1: Starting report 1"); +} + +TEST_F(ProgressReportTest, TestExternalReportNotReceived) { + ListenerSP listener_sp = CreateListenerFor(lldb::eBroadcastBitProgress); + EventSP event_sp; + + // Scope this for RAII on the progress objects. + // Create progress reports and check that their respective events for having + // started and ended are broadcasted. + { + Progress progress1("External Progress report 1", + "Starting external report 1", + /*total=*/std::nullopt, /*debugger=*/nullptr, + /*minimum_report_time=*/std::chrono::seconds(0), + Progress::Origin::eExternal); + } + + ASSERT_FALSE(listener_sp->GetEvent(event_sp, TIMEOUT)); +}