1061da546Spatrick //===-- SWIG Interface for SBDebugger ---------------------------*- C++ -*-===// 2061da546Spatrick // 3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information. 5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6061da546Spatrick // 7061da546Spatrick //===----------------------------------------------------------------------===// 8061da546Spatrick 9061da546Spatrick namespace lldb { 10061da546Spatrick 11061da546Spatrick %feature("docstring", 12061da546Spatrick "SBDebugger is the primordial object that creates SBTargets and provides 13061da546Spatrick access to them. It also manages the overall debugging experiences. 14061da546Spatrick 15be691f3bSpatrick For example (from example/disasm.py),:: 16061da546Spatrick 17061da546Spatrick import lldb 18061da546Spatrick import os 19061da546Spatrick import sys 20061da546Spatrick 21061da546Spatrick def disassemble_instructions (insts): 22061da546Spatrick for i in insts: 23061da546Spatrick print i 24061da546Spatrick 25061da546Spatrick ... 26061da546Spatrick 27061da546Spatrick # Create a new debugger instance 28061da546Spatrick debugger = lldb.SBDebugger.Create() 29061da546Spatrick 30061da546Spatrick # When we step or continue, don't return from the function until the process 31061da546Spatrick # stops. We do this by setting the async mode to false. 32061da546Spatrick debugger.SetAsync (False) 33061da546Spatrick 34061da546Spatrick # Create a target from a file and arch 35061da546Spatrick print('Creating a target for \'%s\'' % exe) 36061da546Spatrick 37061da546Spatrick target = debugger.CreateTargetWithFileAndArch (exe, lldb.LLDB_ARCH_DEFAULT) 38061da546Spatrick 39061da546Spatrick if target: 40061da546Spatrick # If the target is valid set a breakpoint at main 41061da546Spatrick main_bp = target.BreakpointCreateByName (fname, target.GetExecutable().GetFilename()); 42061da546Spatrick 43061da546Spatrick print main_bp 44061da546Spatrick 45061da546Spatrick # Launch the process. Since we specified synchronous mode, we won't return 46061da546Spatrick # from this function until we hit the breakpoint at main 47061da546Spatrick process = target.LaunchSimple (None, None, os.getcwd()) 48061da546Spatrick 49061da546Spatrick # Make sure the launch went ok 50061da546Spatrick if process: 51061da546Spatrick # Print some simple process info 52061da546Spatrick state = process.GetState () 53061da546Spatrick print process 54061da546Spatrick if state == lldb.eStateStopped: 55061da546Spatrick # Get the first thread 56061da546Spatrick thread = process.GetThreadAtIndex (0) 57061da546Spatrick if thread: 58061da546Spatrick # Print some simple thread info 59061da546Spatrick print thread 60061da546Spatrick # Get the first frame 61061da546Spatrick frame = thread.GetFrameAtIndex (0) 62061da546Spatrick if frame: 63061da546Spatrick # Print some simple frame info 64061da546Spatrick print frame 65061da546Spatrick function = frame.GetFunction() 66061da546Spatrick # See if we have debug info (a function) 67061da546Spatrick if function: 68061da546Spatrick # We do have a function, print some info for the function 69061da546Spatrick print function 70061da546Spatrick # Now get all instructions for this function and print them 71061da546Spatrick insts = function.GetInstructions(target) 72061da546Spatrick disassemble_instructions (insts) 73061da546Spatrick else: 74061da546Spatrick # See if we have a symbol in the symbol table for where we stopped 75061da546Spatrick symbol = frame.GetSymbol(); 76061da546Spatrick if symbol: 77061da546Spatrick # We do have a symbol, print some info for the symbol 78061da546Spatrick print symbol 79061da546Spatrick # Now get all instructions for this symbol and print them 80061da546Spatrick insts = symbol.GetInstructions(target) 81061da546Spatrick disassemble_instructions (insts) 82061da546Spatrick 83061da546Spatrick registerList = frame.GetRegisters() 84061da546Spatrick print('Frame registers (size of register set = %d):' % registerList.GetSize()) 85061da546Spatrick for value in registerList: 86061da546Spatrick #print value 87061da546Spatrick print('%s (number of children = %d):' % (value.GetName(), value.GetNumChildren())) 88061da546Spatrick for child in value: 89061da546Spatrick print('Name: ', child.GetName(), ' Value: ', child.GetValue()) 90061da546Spatrick 91061da546Spatrick print('Hit the breakpoint at main, enter to continue and wait for program to exit or \'Ctrl-D\'/\'quit\' to terminate the program') 92061da546Spatrick next = sys.stdin.readline() 93be691f3bSpatrick if not next or next.rstrip('\\n') == 'quit': 94061da546Spatrick print('Terminating the inferior process...') 95061da546Spatrick process.Kill() 96061da546Spatrick else: 97061da546Spatrick # Now continue to the program exit 98061da546Spatrick process.Continue() 99061da546Spatrick # When we return from the above function we will hopefully be at the 100061da546Spatrick # program exit. Print out some process info 101061da546Spatrick print process 102061da546Spatrick elif state == lldb.eStateExited: 103061da546Spatrick print('Didn\'t hit the breakpoint at main, program has exited...') 104061da546Spatrick else: 105061da546Spatrick print('Unexpected process state: %s, killing process...' % debugger.StateAsCString (state)) 106061da546Spatrick process.Kill() 107061da546Spatrick 108061da546Spatrick Sometimes you need to create an empty target that will get filled in later. The most common use for this 109061da546Spatrick is to attach to a process by name or pid where you don't know the executable up front. The most convenient way 110be691f3bSpatrick to do this is: :: 111061da546Spatrick 112061da546Spatrick target = debugger.CreateTarget('') 113061da546Spatrick error = lldb.SBError() 114061da546Spatrick process = target.AttachToProcessWithName(debugger.GetListener(), 'PROCESS_NAME', False, error) 115061da546Spatrick 116be691f3bSpatrick or the equivalent arguments for :py:class:`SBTarget.AttachToProcessWithID` .") SBDebugger; 117061da546Spatrick class SBDebugger 118061da546Spatrick { 119061da546Spatrick public: 120*f6aab3d8Srobert enum 121*f6aab3d8Srobert { 122*f6aab3d8Srobert eBroadcastBitProgress = (1 << 0), 123*f6aab3d8Srobert eBroadcastBitWarning = (1 << 1), 124*f6aab3d8Srobert eBroadcastBitError = (1 << 2), 125*f6aab3d8Srobert }; 126*f6aab3d8Srobert 127*f6aab3d8Srobert 128*f6aab3d8Srobert static const char *GetProgressFromEvent(const lldb::SBEvent &event, 129*f6aab3d8Srobert uint64_t &OUTPUT, 130*f6aab3d8Srobert uint64_t &OUTPUT, 131*f6aab3d8Srobert uint64_t &OUTPUT, 132*f6aab3d8Srobert bool &OUTPUT); 133*f6aab3d8Srobert 134*f6aab3d8Srobert static lldb::SBStructuredData GetDiagnosticFromEvent(const lldb::SBEvent &event); 135*f6aab3d8Srobert 136*f6aab3d8Srobert SBBroadcaster GetBroadcaster(); 137061da546Spatrick 138061da546Spatrick static void 139061da546Spatrick Initialize(); 140061da546Spatrick 141061da546Spatrick static SBError 142061da546Spatrick InitializeWithErrorHandling(); 143061da546Spatrick 144*f6aab3d8Srobert static void PrintStackTraceOnError(); 145*f6aab3d8Srobert 146061da546Spatrick static void 147061da546Spatrick Terminate(); 148061da546Spatrick 149061da546Spatrick static lldb::SBDebugger 150061da546Spatrick Create(); 151061da546Spatrick 152061da546Spatrick static lldb::SBDebugger 153061da546Spatrick Create(bool source_init_files); 154061da546Spatrick 155061da546Spatrick static lldb::SBDebugger 156061da546Spatrick Create(bool source_init_files, lldb::LogOutputCallback log_callback, void *baton); 157061da546Spatrick 158061da546Spatrick static void 159061da546Spatrick Destroy (lldb::SBDebugger &debugger); 160061da546Spatrick 161061da546Spatrick static void 162061da546Spatrick MemoryPressureDetected(); 163061da546Spatrick 164061da546Spatrick SBDebugger(); 165061da546Spatrick 166061da546Spatrick SBDebugger(const lldb::SBDebugger &rhs); 167061da546Spatrick 168061da546Spatrick ~SBDebugger(); 169061da546Spatrick 170061da546Spatrick bool 171061da546Spatrick IsValid() const; 172061da546Spatrick 173061da546Spatrick explicit operator bool() const; 174061da546Spatrick 175061da546Spatrick void 176061da546Spatrick Clear (); 177061da546Spatrick 178061da546Spatrick void 179061da546Spatrick SetAsync (bool b); 180061da546Spatrick 181061da546Spatrick bool 182061da546Spatrick GetAsync (); 183061da546Spatrick 184061da546Spatrick void 185061da546Spatrick SkipLLDBInitFiles (bool b); 186061da546Spatrick 187061da546Spatrick #ifdef SWIGPYTHON 188061da546Spatrick %pythoncode %{ 189061da546Spatrick def SetOutputFileHandle(self, file, transfer_ownership): 190061da546Spatrick "DEPRECATED, use SetOutputFile" 191061da546Spatrick if file is None: 192061da546Spatrick import sys 193061da546Spatrick file = sys.stdout 194061da546Spatrick self.SetOutputFile(SBFile.Create(file, borrow=True)) 195061da546Spatrick 196061da546Spatrick def SetInputFileHandle(self, file, transfer_ownership): 197061da546Spatrick "DEPRECATED, use SetInputFile" 198061da546Spatrick if file is None: 199061da546Spatrick import sys 200061da546Spatrick file = sys.stdin 201061da546Spatrick self.SetInputFile(SBFile.Create(file, borrow=True)) 202061da546Spatrick 203061da546Spatrick def SetErrorFileHandle(self, file, transfer_ownership): 204061da546Spatrick "DEPRECATED, use SetErrorFile" 205061da546Spatrick if file is None: 206061da546Spatrick import sys 207061da546Spatrick file = sys.stderr 208061da546Spatrick self.SetErrorFile(SBFile.Create(file, borrow=True)) 209061da546Spatrick %} 210061da546Spatrick #endif 211061da546Spatrick 212061da546Spatrick 213061da546Spatrick %extend { 214061da546Spatrick GetInputFileHandle()215061da546Spatrick lldb::FileSP GetInputFileHandle() { 216061da546Spatrick return self->GetInputFile().GetFile(); 217061da546Spatrick } 218061da546Spatrick GetOutputFileHandle()219061da546Spatrick lldb::FileSP GetOutputFileHandle() { 220061da546Spatrick return self->GetOutputFile().GetFile(); 221061da546Spatrick } 222061da546Spatrick GetErrorFileHandle()223061da546Spatrick lldb::FileSP GetErrorFileHandle() { 224061da546Spatrick return self->GetErrorFile().GetFile(); 225061da546Spatrick } 226061da546Spatrick } 227061da546Spatrick 228*f6aab3d8Srobert lldb::SBStructuredData GetSetting(const char *setting = nullptr); 229*f6aab3d8Srobert 230*f6aab3d8Srobert SBError 231*f6aab3d8Srobert SetInputString (const char* data); 232*f6aab3d8Srobert 233061da546Spatrick SBError 234061da546Spatrick SetInputFile (SBFile file); 235061da546Spatrick 236061da546Spatrick SBError 237061da546Spatrick SetOutputFile (SBFile file); 238061da546Spatrick 239061da546Spatrick SBError 240061da546Spatrick SetErrorFile (SBFile file); 241061da546Spatrick 242061da546Spatrick SBError 243061da546Spatrick SetInputFile (FileSP file); 244061da546Spatrick 245061da546Spatrick SBError 246061da546Spatrick SetOutputFile (FileSP file); 247061da546Spatrick 248061da546Spatrick SBError 249061da546Spatrick SetErrorFile (FileSP file); 250061da546Spatrick 251061da546Spatrick SBFile 252061da546Spatrick GetInputFile (); 253061da546Spatrick 254061da546Spatrick SBFile 255061da546Spatrick GetOutputFile (); 256061da546Spatrick 257061da546Spatrick SBFile 258061da546Spatrick GetErrorFile (); 259061da546Spatrick 260061da546Spatrick lldb::SBCommandInterpreter 261061da546Spatrick GetCommandInterpreter (); 262061da546Spatrick 263061da546Spatrick void 264061da546Spatrick HandleCommand (const char *command); 265061da546Spatrick 266061da546Spatrick lldb::SBListener 267061da546Spatrick GetListener (); 268061da546Spatrick 269061da546Spatrick void 270061da546Spatrick HandleProcessEvent (const lldb::SBProcess &process, 271061da546Spatrick const lldb::SBEvent &event, 272061da546Spatrick SBFile out, 273061da546Spatrick SBFile err); 274061da546Spatrick 275061da546Spatrick void 276061da546Spatrick HandleProcessEvent (const lldb::SBProcess &process, 277061da546Spatrick const lldb::SBEvent &event, 278061da546Spatrick FileSP BORROWED, 279061da546Spatrick FileSP BORROWED); 280061da546Spatrick 281061da546Spatrick lldb::SBTarget 282061da546Spatrick CreateTarget (const char *filename, 283061da546Spatrick const char *target_triple, 284061da546Spatrick const char *platform_name, 285061da546Spatrick bool add_dependent_modules, 286061da546Spatrick lldb::SBError& sb_error); 287061da546Spatrick 288061da546Spatrick lldb::SBTarget 289061da546Spatrick CreateTargetWithFileAndTargetTriple (const char *filename, 290061da546Spatrick const char *target_triple); 291061da546Spatrick 292061da546Spatrick lldb::SBTarget 293061da546Spatrick CreateTargetWithFileAndArch (const char *filename, 294061da546Spatrick const char *archname); 295061da546Spatrick 296061da546Spatrick lldb::SBTarget 297061da546Spatrick CreateTarget (const char *filename); 298061da546Spatrick 299061da546Spatrick %feature("docstring", 300061da546Spatrick "The dummy target holds breakpoints and breakpoint names that will prime newly created targets." 301061da546Spatrick ) GetDummyTarget; 302061da546Spatrick lldb::SBTarget GetDummyTarget(); 303061da546Spatrick 304061da546Spatrick %feature("docstring", 305061da546Spatrick "Return true if target is deleted from the target list of the debugger." 306061da546Spatrick ) DeleteTarget; 307061da546Spatrick bool 308061da546Spatrick DeleteTarget (lldb::SBTarget &target); 309061da546Spatrick 310061da546Spatrick lldb::SBTarget 311061da546Spatrick GetTargetAtIndex (uint32_t idx); 312061da546Spatrick 313061da546Spatrick uint32_t 314061da546Spatrick GetIndexOfTarget (lldb::SBTarget target); 315061da546Spatrick 316061da546Spatrick lldb::SBTarget 317061da546Spatrick FindTargetWithProcessID (pid_t pid); 318061da546Spatrick 319061da546Spatrick lldb::SBTarget 320061da546Spatrick FindTargetWithFileAndArch (const char *filename, 321061da546Spatrick const char *arch); 322061da546Spatrick 323061da546Spatrick uint32_t 324061da546Spatrick GetNumTargets (); 325061da546Spatrick 326061da546Spatrick lldb::SBTarget 327061da546Spatrick GetSelectedTarget (); 328061da546Spatrick 329061da546Spatrick void 330061da546Spatrick SetSelectedTarget (lldb::SBTarget &target); 331061da546Spatrick 332061da546Spatrick lldb::SBPlatform 333061da546Spatrick GetSelectedPlatform(); 334061da546Spatrick 335061da546Spatrick void 336061da546Spatrick SetSelectedPlatform(lldb::SBPlatform &platform); 337061da546Spatrick 338061da546Spatrick %feature("docstring", 339061da546Spatrick "Get the number of currently active platforms." 340061da546Spatrick ) GetNumPlatforms; 341061da546Spatrick uint32_t 342061da546Spatrick GetNumPlatforms (); 343061da546Spatrick 344061da546Spatrick %feature("docstring", 345061da546Spatrick "Get one of the currently active platforms." 346061da546Spatrick ) GetPlatformAtIndex; 347061da546Spatrick lldb::SBPlatform 348061da546Spatrick GetPlatformAtIndex (uint32_t idx); 349061da546Spatrick 350061da546Spatrick %feature("docstring", 351061da546Spatrick "Get the number of available platforms." 352061da546Spatrick ) GetNumAvailablePlatforms; 353061da546Spatrick uint32_t 354061da546Spatrick GetNumAvailablePlatforms (); 355061da546Spatrick 356061da546Spatrick %feature("docstring", " 357061da546Spatrick Get the name and description of one of the available platforms. 358061da546Spatrick 359061da546Spatrick @param idx Zero-based index of the platform for which info should be 360061da546Spatrick retrieved, must be less than the value returned by 361061da546Spatrick GetNumAvailablePlatforms().") GetAvailablePlatformInfoAtIndex; 362061da546Spatrick lldb::SBStructuredData 363061da546Spatrick GetAvailablePlatformInfoAtIndex (uint32_t idx); 364061da546Spatrick 365061da546Spatrick lldb::SBSourceManager 366061da546Spatrick GetSourceManager (); 367061da546Spatrick 368061da546Spatrick // REMOVE: just for a quick fix, need to expose platforms through 369061da546Spatrick // SBPlatform from this class. 370061da546Spatrick lldb::SBError 371061da546Spatrick SetCurrentPlatform (const char *platform_name); 372061da546Spatrick 373061da546Spatrick bool 374061da546Spatrick SetCurrentPlatformSDKRoot (const char *sysroot); 375061da546Spatrick 376061da546Spatrick // FIXME: Once we get the set show stuff in place, the driver won't need 377061da546Spatrick // an interface to the Set/Get UseExternalEditor. 378061da546Spatrick bool 379061da546Spatrick SetUseExternalEditor (bool input); 380061da546Spatrick 381061da546Spatrick bool 382061da546Spatrick GetUseExternalEditor (); 383061da546Spatrick 384061da546Spatrick bool 385061da546Spatrick SetUseColor (bool use_color); 386061da546Spatrick 387061da546Spatrick bool 388061da546Spatrick GetUseColor () const; 389061da546Spatrick 390061da546Spatrick static bool 391061da546Spatrick GetDefaultArchitecture (char *arch_name, size_t arch_name_len); 392061da546Spatrick 393061da546Spatrick static bool 394061da546Spatrick SetDefaultArchitecture (const char *arch_name); 395061da546Spatrick 396061da546Spatrick lldb::ScriptLanguage 397061da546Spatrick GetScriptingLanguage (const char *script_language_name); 398061da546Spatrick 399061da546Spatrick static const char * 400061da546Spatrick GetVersionString (); 401061da546Spatrick 402061da546Spatrick static const char * 403061da546Spatrick StateAsCString (lldb::StateType state); 404061da546Spatrick 405061da546Spatrick static SBStructuredData GetBuildConfiguration(); 406061da546Spatrick 407061da546Spatrick static bool 408061da546Spatrick StateIsRunningState (lldb::StateType state); 409061da546Spatrick 410061da546Spatrick static bool 411061da546Spatrick StateIsStoppedState (lldb::StateType state); 412061da546Spatrick 413061da546Spatrick bool 414061da546Spatrick EnableLog (const char *channel, const char ** types); 415061da546Spatrick 416061da546Spatrick void 417061da546Spatrick SetLoggingCallback (lldb::LogOutputCallback log_callback, void *baton); 418061da546Spatrick 419061da546Spatrick void 420061da546Spatrick DispatchInput (const void *data, size_t data_len); 421061da546Spatrick 422061da546Spatrick void 423061da546Spatrick DispatchInputInterrupt (); 424061da546Spatrick 425061da546Spatrick void 426061da546Spatrick DispatchInputEndOfFile (); 427061da546Spatrick 428061da546Spatrick const char * 429061da546Spatrick GetInstanceName (); 430061da546Spatrick 431061da546Spatrick static SBDebugger 432061da546Spatrick FindDebuggerWithID (int id); 433061da546Spatrick 434061da546Spatrick static lldb::SBError 435061da546Spatrick SetInternalVariable (const char *var_name, const char *value, const char *debugger_instance_name); 436061da546Spatrick 437061da546Spatrick static lldb::SBStringList 438061da546Spatrick GetInternalVariableValue (const char *var_name, const char *debugger_instance_name); 439061da546Spatrick 440061da546Spatrick bool 441061da546Spatrick GetDescription (lldb::SBStream &description); 442061da546Spatrick 443061da546Spatrick uint32_t 444061da546Spatrick GetTerminalWidth () const; 445061da546Spatrick 446061da546Spatrick void 447061da546Spatrick SetTerminalWidth (uint32_t term_width); 448061da546Spatrick 449061da546Spatrick lldb::user_id_t 450061da546Spatrick GetID (); 451061da546Spatrick 452061da546Spatrick const char * 453061da546Spatrick GetPrompt() const; 454061da546Spatrick 455061da546Spatrick void 456061da546Spatrick SetPrompt (const char *prompt); 457061da546Spatrick 458061da546Spatrick const char * 459061da546Spatrick GetReproducerPath() const; 460061da546Spatrick 461061da546Spatrick lldb::ScriptLanguage 462061da546Spatrick GetScriptLanguage() const; 463061da546Spatrick 464061da546Spatrick void 465061da546Spatrick SetScriptLanguage (lldb::ScriptLanguage script_lang); 466061da546Spatrick 467061da546Spatrick bool 468061da546Spatrick GetCloseInputOnEOF () const; 469061da546Spatrick 470061da546Spatrick void 471061da546Spatrick SetCloseInputOnEOF (bool b); 472061da546Spatrick 473061da546Spatrick lldb::SBTypeCategory 474061da546Spatrick GetCategory (const char* category_name); 475061da546Spatrick 476061da546Spatrick SBTypeCategory 477061da546Spatrick GetCategory (lldb::LanguageType lang_type); 478061da546Spatrick 479061da546Spatrick lldb::SBTypeCategory 480061da546Spatrick CreateCategory (const char* category_name); 481061da546Spatrick 482061da546Spatrick bool 483061da546Spatrick DeleteCategory (const char* category_name); 484061da546Spatrick 485061da546Spatrick uint32_t 486061da546Spatrick GetNumCategories (); 487061da546Spatrick 488061da546Spatrick lldb::SBTypeCategory 489061da546Spatrick GetCategoryAtIndex (uint32_t); 490061da546Spatrick 491061da546Spatrick lldb::SBTypeCategory 492061da546Spatrick GetDefaultCategory(); 493061da546Spatrick 494061da546Spatrick lldb::SBTypeFormat 495061da546Spatrick GetFormatForType (lldb::SBTypeNameSpecifier); 496061da546Spatrick 497061da546Spatrick lldb::SBTypeSummary 498061da546Spatrick GetSummaryForType (lldb::SBTypeNameSpecifier); 499061da546Spatrick 500061da546Spatrick lldb::SBTypeFilter 501061da546Spatrick GetFilterForType (lldb::SBTypeNameSpecifier); 502061da546Spatrick 503061da546Spatrick lldb::SBTypeSynthetic 504061da546Spatrick GetSyntheticForType (lldb::SBTypeNameSpecifier); 505061da546Spatrick 506*f6aab3d8Srobert SBStructuredData GetScriptInterpreterInfo(ScriptLanguage); 507*f6aab3d8Srobert 508061da546Spatrick STRING_EXTENSION(SBDebugger) 509061da546Spatrick 510061da546Spatrick %feature("docstring", 511061da546Spatrick "Launch a command interpreter session. Commands are read from standard input or 512061da546Spatrick from the input handle specified for the debugger object. Output/errors are 513061da546Spatrick similarly redirected to standard output/error or the configured handles. 514061da546Spatrick 515061da546Spatrick @param[in] auto_handle_events If true, automatically handle resulting events. 516061da546Spatrick @param[in] spawn_thread If true, start a new thread for IO handling. 517061da546Spatrick @param[in] options Parameter collection of type SBCommandInterpreterRunOptions. 518061da546Spatrick @param[in] num_errors Initial error counter. 519061da546Spatrick @param[in] quit_requested Initial quit request flag. 520061da546Spatrick @param[in] stopped_for_crash Initial crash flag. 521061da546Spatrick 522061da546Spatrick @return 523061da546Spatrick A tuple with the number of errors encountered by the interpreter, a boolean 524061da546Spatrick indicating whether quitting the interpreter was requested and another boolean 525061da546Spatrick set to True in case of a crash. 526061da546Spatrick 527be691f3bSpatrick Example: :: 528061da546Spatrick 529061da546Spatrick # Start an interactive lldb session from a script (with a valid debugger object 530061da546Spatrick # created beforehand): 531061da546Spatrick n_errors, quit_requested, has_crashed = debugger.RunCommandInterpreter(True, 532061da546Spatrick False, lldb.SBCommandInterpreterRunOptions(), 0, False, False)") RunCommandInterpreter; 533061da546Spatrick %apply int& INOUT { int& num_errors }; 534061da546Spatrick %apply bool& INOUT { bool& quit_requested }; 535061da546Spatrick %apply bool& INOUT { bool& stopped_for_crash }; 536061da546Spatrick void 537061da546Spatrick RunCommandInterpreter (bool auto_handle_events, 538061da546Spatrick bool spawn_thread, 539061da546Spatrick SBCommandInterpreterRunOptions &options, 540061da546Spatrick int &num_errors, 541061da546Spatrick bool &quit_requested, 542061da546Spatrick bool &stopped_for_crash); 543061da546Spatrick 544061da546Spatrick lldb::SBError 545061da546Spatrick RunREPL (lldb::LanguageType language, const char *repl_options); 546061da546Spatrick 547*f6aab3d8Srobert SBTrace LoadTraceFromFile(SBError &error, const SBFileSpec &trace_description_file); 548*f6aab3d8Srobert 549061da546Spatrick #ifdef SWIGPYTHON 550061da546Spatrick %pythoncode%{ 551061da546Spatrick def __iter__(self): 552061da546Spatrick '''Iterate over all targets in a lldb.SBDebugger object.''' 553061da546Spatrick return lldb_iter(self, 'GetNumTargets', 'GetTargetAtIndex') 554061da546Spatrick 555061da546Spatrick def __len__(self): 556061da546Spatrick '''Return the number of targets in a lldb.SBDebugger object.''' 557061da546Spatrick return self.GetNumTargets() 558061da546Spatrick %} 559061da546Spatrick #endif 560061da546Spatrick 561061da546Spatrick }; // class SBDebugger 562061da546Spatrick 563061da546Spatrick } // namespace lldb 564