LLDB mainline
SBDebugger.h
Go to the documentation of this file.
1//===-- SBDebugger.h --------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_API_SBDEBUGGER_H
10#define LLDB_API_SBDEBUGGER_H
11
12#include <cstdio>
13
14#include "lldb/API/SBDefines.h"
15#include "lldb/API/SBPlatform.h"
17
18namespace lldb_private {
21namespace python {
22class SWIGBridge;
23}
24} // namespace lldb_private
25
26namespace lldb {
27
28#ifndef SWIG
30public:
33
35 unsigned long (*callback)(void *, lldb::SBInputReader *,
37 char const *, unsigned long),
38 void *a, lldb::InputReaderGranularity b, char const *c,
39 char const *d, bool e);
40 void SetIsDone(bool);
41 bool IsActive() const;
42};
43#endif
44
46public:
47 /// Broadcast bit definitions for the SBDebugger.
59
60 /// Default constructor creates an invalid SBDebugger instance.
61 SBDebugger();
62
63 SBDebugger(const lldb::SBDebugger &rhs);
64
66
67 /// Get the broadcaster class name.
68 static const char *GetBroadcasterClass();
69
70 /// Check if a specific language is supported by LLDB.
71 static bool SupportsLanguage(lldb::LanguageType language);
72
73 /// Get the broadcaster that allows subscribing to events from this
74 /// debugger.
76
77 /// Get progress data from a SBEvent whose type is eBroadcastBitProgress.
78 ///
79 /// \param [in] event
80 /// The event to extract the progress information from.
81 ///
82 /// \param [out] progress_id
83 /// The unique integer identifier for the progress to report.
84 ///
85 /// \param [out] completed
86 /// The amount of work completed. If \a completed is zero, then this event
87 /// is a progress started event. If \a completed is equal to \a total, then
88 /// this event is a progress end event. Otherwise completed indicates the
89 /// current progress update.
90 ///
91 /// \param [out] total
92 /// The total amount of work units that need to be completed. If this value
93 /// is UINT64_MAX, then an indeterminate progress indicator should be
94 /// displayed.
95 ///
96 /// \param [out] is_debugger_specific
97 /// Set to true if this progress is specific to this debugger only. Many
98 /// progress events are not specific to a debugger instance, like any
99 /// progress events for loading information in modules since LLDB has a
100 /// global module cache that all debuggers use.
101 ///
102 /// \return The message for the progress. If the returned value is NULL, then
103 /// \a event was not a eBroadcastBitProgress event.
104#ifdef SWIG
105 static const char *GetProgressFromEvent(const lldb::SBEvent &event,
106 uint64_t &OUTPUT,
107 uint64_t &OUTPUT, uint64_t &OUTPUT,
108 bool &OUTPUT);
109#else
110 static const char *GetProgressFromEvent(const lldb::SBEvent &event,
111 uint64_t &progress_id,
112 uint64_t &completed, uint64_t &total,
113 bool &is_debugger_specific);
114#endif
115
116 /// Get progress data from an event.
119
120 /// Get diagnostic information from an event.
123
124 /// Assignment operator.
126
127 /// Initialize LLDB and its subsystems.
128 ///
129 /// This function should be called before any other LLDB functions. It
130 /// initializes all required subsystems for proper LLDB functionality.
131 static void Initialize();
132
133 /// Initialize the LLDB debugger subsystem with error handling.
134 ///
135 /// Similar to Initialize(), but returns an error if initialization fails.
137
138 /// InitializeWithErrorHandling() with options. LLDB is left uninitialized if
139 /// one cannot be honored.
141
142 /// Configure LLDB to print a stack trace when it crashes.
143 static void PrintStackTraceOnError();
144
145 /// Configure LLDB to print diagnostic information when it crashes.
146 static void PrintDiagnosticsOnError();
147
148 /// Terminate LLDB and its subsystems.
149 ///
150 /// This should be called when LLDB is no longer needed.
151 static void Terminate();
152
153 /// Create a new debugger instance (deprecated).
154 LLDB_DEPRECATED_FIXME("Use one of the other Create variants", "Create(bool)")
155 static lldb::SBDebugger Create();
156
157 /// Create a new debugger instance.
158 ///
159 /// If source_init_files is true, the debugger will source .lldbinit files
160 /// from the home directory and current directory.
161 static lldb::SBDebugger Create(bool source_init_files);
162
163 /// Create a new debugger instance with a custom log handler and user data
164 /// passed to the log callback.
165 ///
166 /// If source_init_files is true, the debugger will source .lldbinit files
167 /// from the home directory and current directory.
168 static lldb::SBDebugger Create(bool source_init_files,
169 lldb::LogOutputCallback log_callback,
170 void *baton);
171
172 /// Destroy a debugger instance.
173 static void Destroy(lldb::SBDebugger &debugger);
174
175 /// Notify the debugger that system memory pressure has been detected.
176 ///
177 /// This can be used to free up memory resources by clearing caches.
178 static void MemoryPressureDetected();
179
180 /// Check if this is a valid SBDebugger object.
181 explicit operator bool() const;
182
183 /// Check if this is a valid SBDebugger object.
184 bool IsValid() const;
185
186 /// Clear this debugger instance.
187 ///
188 /// This will close all IO handlers and reset the debugger to its initial
189 /// state.
190 void Clear();
191
192 /// Get debugger settings as structured data.
193 ///
194 /// Client can specify empty string or null to get all settings.
195 ///
196 /// Example usages:
197 /// \code
198 /// lldb::SBStructuredData settings = debugger.GetSetting();
199 /// lldb::SBStructuredData settings = debugger.GetSetting(nullptr);
200 /// lldb::SBStructuredData settings = debugger.GetSetting("");
201 /// lldb::SBStructuredData settings = debugger.GetSetting("target.arg0");
202 /// lldb::SBStructuredData settings = debugger.GetSetting("target");
203 /// \endcode
204 lldb::SBStructuredData GetSetting(const char *setting = nullptr);
205
206 /// Set whether the debugger should run in asynchronous mode.
207 ///
208 /// When in asynchronous mode, events are processed on a background thread.
209 void SetAsync(bool b);
210
211 /// Get whether the debugger is running in asynchronous mode.
212 bool GetAsync();
213
214 /// Set whether to skip loading .lldbinit files.
215 void SkipLLDBInitFiles(bool b);
216
217 /// Set whether to skip loading application-specific .lldbinit files.
218 void SkipAppInitFiles(bool b);
219
220#ifndef SWIG
221 /// Set the input file handle for the debugger.
222 void SetInputFileHandle(FILE *f, bool transfer_ownership);
223
224 /// Set the output file handle for the debugger.
225 void SetOutputFileHandle(FILE *f, bool transfer_ownership);
226
227 /// Set the error file handle for the debugger.
228 void SetErrorFileHandle(FILE *f, bool transfer_ownership);
229#endif
230
231#ifndef SWIG
232 /// Get the input file handle for the debugger.
233 FILE *GetInputFileHandle();
234
235 /// Get the output file handle for the debugger.
236 FILE *GetOutputFileHandle();
237
238 /// Get the error file handle for the debugger.
239 FILE *GetErrorFileHandle();
240#endif
241
242 /// Set the input from a string.
243 SBError SetInputString(const char *data);
244
245 /// Set the input file for the debugger.
247
248 /// Set the output file for the debugger.
250
251 /// Set the error file for the debugger.
253
254 /// Set the input file for the debugger using a FileSP.
256
257 /// Set the output file for the debugger using a FileSP.
259
260 /// Set the error file for the debugger using a FileSP.
262
263 /// Get the input file for the debugger.
265
266 /// Get the output file for the debugger.
268
269 /// Get the error file for the debugger.
271
272 /// Save the current terminal state.
273 ///
274 /// This should be called before modifying terminal settings.
276
277 /// Restore the previously saved terminal state.
279
280 /// Get the command interpreter for this debugger.
282
283 /// Execute a command in the command interpreter.
284 void HandleCommand(const char *command);
285
286 /// Request an interrupt of the current operation.
287 void RequestInterrupt();
288
289 /// Cancel a previously requested interrupt.
291
292 /// Check if an interrupt has been requested.
293 bool InterruptRequested();
294
295 /// Get the listener associated with this debugger.
297
298#ifndef SWIG
299 /// Handle a process event (deprecated).
301 "Use HandleProcessEvent(const SBProcess &, const SBEvent &, SBFile, "
302 "SBFile) or HandleProcessEvent(const SBProcess &, const SBEvent &, "
303 "FileSP, FileSP)",
304 "HandleProcessEvent(const SBProcess &, const SBEvent &, SBFile, SBFile)")
305 void HandleProcessEvent(const lldb::SBProcess &process,
306 const lldb::SBEvent &event, FILE *out, FILE *err);
307#endif
308
309 /// Handle a process event.
311 const lldb::SBEvent &event, SBFile out, SBFile err);
312
313#ifdef SWIG
314 /// Handle a process event using FileSP objects.
315 void HandleProcessEvent(const lldb::SBProcess &process,
316 const lldb::SBEvent &event, FileSP BORROWED, FileSP BORROWED);
317#else
318 /// Handle a process event using FileSP objects.
320 const lldb::SBEvent &event, FileSP out, FileSP err);
321#endif
322
323 /// Create a target with the specified parameters.
324 lldb::SBTarget CreateTarget(const char *filename, const char *target_triple,
325 const char *platform_name,
326 bool add_dependent_modules, lldb::SBError &error);
327
328 /// Create a target with the specified file and target triple.
330 const char *target_triple);
331
332 /// Create a target with the specified file and architecture.
333 lldb::SBTarget CreateTargetWithFileAndArch(const char *filename,
334 const char *archname);
335
336 /// Create a target with the specified file.
337 lldb::SBTarget CreateTarget(const char *filename);
338
339 /// Get the dummy target.
340 ///
341 /// The dummy target is used when no target is available.
343
344#ifndef SWIG
345 /// Dispatch telemetry data from client to server.
346 ///
347 /// This is used to send telemetry data from the client to the server if
348 /// client-telemetry is enabled. If not enabled, the data is ignored.
350#endif
351
352 /// Delete a target from the debugger.
353 bool DeleteTarget(lldb::SBTarget &target);
354
355 /// Get a target by index.
356 lldb::SBTarget GetTargetAtIndex(uint32_t idx);
357
358 /// Get the index of a target.
359 uint32_t GetIndexOfTarget(lldb::SBTarget target);
360
361 /// Find a target with the specified process ID.
363
364 /// Find a target with the specified file and architecture.
365 lldb::SBTarget FindTargetWithFileAndArch(const char *filename,
366 const char *arch);
367
368 /// Find a target with the specified unique ID.
370
371 /// Get the number of targets in the debugger.
372 uint32_t GetNumTargets();
373
374 /// Get the currently selected target.
376
377 /// Set the selected target.
378 void SetSelectedTarget(SBTarget &target);
379
380 /// Get the selected platform.
382
383 /// Set the selected platform.
385
386 /// Get the number of currently active platforms.
387 uint32_t GetNumPlatforms();
388
389 /// Get one of the currently active platforms.
391
392 /// Get the number of available platforms.
393 ///
394 /// The return value should match the number of entries output by the
395 /// "platform list" command.
396 uint32_t GetNumAvailablePlatforms();
397
398 /// Get information about the available platform at the given index as
399 /// structured data.
401
402 /// Get the source manager for this debugger.
404
405 /// Set the current platform by name.
406 lldb::SBError SetCurrentPlatform(const char *platform_name);
407
408 /// Set the SDK root for the current platform.
409 bool SetCurrentPlatformSDKRoot(const char *sysroot);
410
411 /// Set whether to use an external editor.
412 bool SetUseExternalEditor(bool input);
413
414 /// Get whether an external editor is being used.
416
417 /// Set whether to use color in output.
418 bool SetUseColor(bool use_color);
419
420 /// Get whether color is being used in output.
421 bool GetUseColor() const;
422
423 /// Set whether to show inline diagnostics.
424 bool SetShowInlineDiagnostics(bool b);
425
426 /// Set whether to use the source cache.
427 bool SetUseSourceCache(bool use_source_cache);
428
429 /// Get whether the source cache is being used.
430 bool GetUseSourceCache() const;
431
432 /// Get the default architecture.
433 static bool GetDefaultArchitecture(char *arch_name, size_t arch_name_len);
434
435 /// Set the default architecture.
436 static bool SetDefaultArchitecture(const char *arch_name);
437
438 /// Get the scripting language by name.
439 lldb::ScriptLanguage GetScriptingLanguage(const char *script_language_name);
440
441 /// Get information about a script interpreter as structured data.
443
444 /// Get the LLDB version string. Plugins can augment this string. To
445 /// get the full string, call this after SBDebugger::Initialize().
446 static const char *GetVersionString();
447
448 /// Convert a state type to a string.
449 static const char *StateAsCString(lldb::StateType state);
450
451 /// Get the build configuration as structured data.
453
454 /// Check if a state is a running state.
455 static bool StateIsRunningState(lldb::StateType state);
456
457 /// Check if a state is a stopped state.
458 static bool StateIsStoppedState(lldb::StateType state);
459
460 /// Enable logging for a specific channel and category.
461 bool EnableLog(const char *channel, const char **categories);
462
463 /// Set a callback for log output.
464 void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton);
465
466 /// Set a callback for when the debugger is destroyed (deprecated).
467 LLDB_DEPRECATED_FIXME("Use AddDestroyCallback and RemoveDestroyCallback",
468 "AddDestroyCallback")
469 void SetDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback,
470 void *baton);
471
472 /// Add a callback for when the debugger is destroyed. Returns a token that
473 /// can be used to remove the callback.
476 void *baton);
477
478 /// Remove a destroy callback.
480
481#ifndef SWIG
482 /// Dispatch input to the debugger (deprecated).
483 LLDB_DEPRECATED_FIXME("Use DispatchInput(const void *, size_t)",
484 "DispatchInput(const void *, size_t)")
485 void DispatchInput(void *baton, const void *data, size_t data_len);
486#endif
487
488 /// Dispatch input to the debugger.
489 void DispatchInput(const void *data, size_t data_len);
490
491 /// Interrupt the current input dispatch.
493
494 /// Signal end-of-file to the current input dispatch.
496
497#ifndef SWIG
498 /// Push an input reader onto the IO handler stack.
500#endif
501
502 /// Get the instance name of this debugger.
503 const char *GetInstanceName();
504
505 /// Find a debugger by ID. Returns an invalid debugger if not found.
506 static SBDebugger FindDebuggerWithID(int id);
507
508 /// Set an internal variable.
509 static lldb::SBError SetInternalVariable(const char *var_name,
510 const char *value,
511 const char *debugger_instance_name);
512
513 /// Get the value of an internal variable.
514 static lldb::SBStringList
515 GetInternalVariableValue(const char *var_name,
516 const char *debugger_instance_name);
517
518 /// Get a description of this debugger.
519 bool GetDescription(lldb::SBStream &description);
520
521 /// Get the terminal width.
522 uint32_t GetTerminalWidth() const;
523
524 /// Set the terminal width.
525 LLDB_DEPRECATED_FIXME("Use SetTerminalDimensions",
526 "SetTerminalDimensions(uint32_t, uint32_t)")
527 void SetTerminalWidth(uint32_t term_width);
528
529 /// Get the terminal height.
530 uint32_t GetTerminalHeight() const;
531
532 /// Set the terminal height.
533 LLDB_DEPRECATED_FIXME("Use SetTerminalDimensions",
534 "SetTerminalDimensions(uint32_t, uint32_t)")
535 void SetTerminalHeight(uint32_t term_height);
536
537 /// Set the terminal width and height together. Prefer this over the
538 /// single-axis setters when both are known, e.g. when handling a resize.
539 void SetTerminalDimensions(uint32_t term_width, uint32_t term_height);
540
541 /// Get the unique ID of this debugger.
543
544 /// Get the command prompt string.
545 const char *GetPrompt() const;
546
547 /// Set the command prompt string.
548 void SetPrompt(const char *prompt);
549
550 /// Get the path to the reproducer.
551 const char *GetReproducerPath() const;
552
553 /// Get the current scripting language.
555
556 /// Set the current scripting language.
557 void SetScriptLanguage(lldb::ScriptLanguage script_lang);
558
559 /// Get the current REPL language.
561
562 /// Set the current REPL language.
563 void SetREPLLanguage(lldb::LanguageType repl_lang);
564
565 /// Get whether to close input on EOF (deprecated).
566 LLDB_DEPRECATED("SBDebugger::GetCloseInputOnEOF() is deprecated.")
567 bool GetCloseInputOnEOF() const;
568
569 /// Set whether to close input on EOF (deprecated).
570 LLDB_DEPRECATED("SBDebugger::SetCloseInputOnEOF() is deprecated.")
571 void SetCloseInputOnEOF(bool b);
572
573 /// Get a type category by name.
574 SBTypeCategory GetCategory(const char *category_name);
575
576 /// Get a type category by language.
578
579 /// Create a new type category.
580 SBTypeCategory CreateCategory(const char *category_name);
581
582 /// Delete a type category.
583 bool DeleteCategory(const char *category_name);
584
585 /// Get the number of type categories.
586 uint32_t GetNumCategories();
587
588 /// Get a type category by index.
589 SBTypeCategory GetCategoryAtIndex(uint32_t index);
590
591 /// Get the default type category.
593
594 /// Get the format for a type.
596
597 /// Get the summary for a type.
599
600 /// Get the filter for a type.
602
603 /// Get the synthetic for a type.
605
606 /// Clear collected statistics for targets belonging to this debugger.
607 ///
608 /// This includes clearing symbol table and debug info parsing/index time for
609 /// all modules, breakpoint resolve time, and target statistics.
610 void ResetStatistics();
611
612#ifndef SWIG
613 /// Run the command interpreter.
614 ///
615 /// \param[in] auto_handle_events
616 /// If true, automatically handle resulting events. This takes precedence
617 /// and overrides the corresponding option in
618 /// SBCommandInterpreterRunOptions.
619 ///
620 /// \param[in] spawn_thread
621 /// If true, start a new thread for IO handling. This takes precedence and
622 /// overrides the corresponding option in SBCommandInterpreterRunOptions.
623 void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread);
624#endif
625
626 /// Run the command interpreter with options.
627 ///
628 /// \param[in] auto_handle_events
629 /// If true, automatically handle resulting events. This takes precedence
630 /// and overrides the corresponding option in
631 /// SBCommandInterpreterRunOptions.
632 ///
633 /// \param[in] spawn_thread
634 /// If true, start a new thread for IO handling. This takes precedence and
635 /// overrides the corresponding option in SBCommandInterpreterRunOptions.
636 ///
637 /// \param[in] options
638 /// Parameter collection of type SBCommandInterpreterRunOptions.
639 ///
640 /// \param[out] num_errors
641 /// The number of errors.
642 ///
643 /// \param[out] quit_requested
644 /// Whether a quit was requested.
645 ///
646 /// \param[out] stopped_for_crash
647 /// Whether the interpreter stopped for a crash.
648#ifdef SWIG
649 %apply int& INOUT { int& num_errors };
650 %apply bool& INOUT { bool& quit_requested };
651 %apply bool& INOUT { bool& stopped_for_crash };
652#endif
653 void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread,
654 SBCommandInterpreterRunOptions &options,
655 int &num_errors, bool &quit_requested,
656 bool &stopped_for_crash);
657
658#ifndef SWIG
659 /// Run the command interpreter with options and return a result object.
661 RunCommandInterpreter(const SBCommandInterpreterRunOptions &options);
662#endif
663
664 /// Run a REPL (Read-Eval-Print Loop) for the specified language.
665 SBError RunREPL(lldb::LanguageType language, const char *repl_options);
666
667 /// Load a trace from a trace description file.
668 ///
669 /// This will create Targets, Processes and Threads based on the contents of
670 /// the file.
671 ///
672 /// \param[out] error
673 /// An error if the trace could not be created.
674 ///
675 /// \param[in] trace_description_file
676 /// The file containing the necessary information to load the trace.
677 ///
678 /// \return
679 /// An SBTrace object representing the loaded trace.
680 SBTrace LoadTraceFromFile(SBError &error,
681 const SBFileSpec &trace_description_file);
682
683protected:
688
689 SBDebugger(const lldb::DebuggerSP &debugger_sp);
690
691private:
693 friend class SBInputReader;
694 friend class SBListener;
695 friend class SBProcess;
696 friend class SBSourceManager;
697 friend class SBStructuredData;
698 friend class SBPlatform;
699 friend class SBTarget;
700 friend class SBTrace;
701 friend class SBProgress;
702
704
705 void reset(const lldb::DebuggerSP &debugger_sp);
706
708
710
711 const lldb::DebuggerSP &get_sp() const;
712
714
715}; // class SBDebugger
716
717} // namespace lldb
718
719#endif // LLDB_API_SBDEBUGGER_H
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_API
Definition SBDefines.h:28
#define LLDB_DEPRECATED_FIXME(MSG, FIX)
Definition SBDefines.h:39
#define LLDB_DEPRECATED(MSG)
Definition SBDefines.h:38
static lldb::SBError SetInternalVariable(const char *var_name, const char *value, const char *debugger_instance_name)
Set an internal variable.
bool DeleteCategory(const char *category_name)
Delete a type category.
lldb::LanguageType GetREPLLanguage() const
Get the current REPL language.
lldb::SBTarget GetTargetAtIndex(uint32_t idx)
Get a target by index.
lldb::SBTarget CreateTarget(const char *filename, const char *target_triple, const char *platform_name, bool add_dependent_modules, lldb::SBError &error)
Create a target with the specified parameters.
FLAGS_ANONYMOUS_ENUM()
Broadcast bit definitions for the SBDebugger.
Definition SBDebugger.h:48
SBTypeFilter GetFilterForType(SBTypeNameSpecifier type_name_spec)
Get the filter for a type.
bool DeleteTarget(lldb::SBTarget &target)
Delete a target from the debugger.
void SkipAppInitFiles(bool b)
Set whether to skip loading application-specific .lldbinit files.
lldb::SBDebugger & operator=(const lldb::SBDebugger &rhs)
Assignment operator.
static void Terminate()
Terminate LLDB and its subsystems.
lldb::SBPlatform GetPlatformAtIndex(uint32_t idx)
Get one of the currently active platforms.
void SkipLLDBInitFiles(bool b)
Set whether to skip loading .lldbinit files.
void SetAsync(bool b)
Set whether the debugger should run in asynchronous mode.
const void * data
Definition SBDebugger.h:485
bool SetUseExternalEditor(bool input)
Set whether to use an external editor.
bool GetCloseInputOnEOF() const
Get whether to close input on EOF (deprecated).
static bool GetDefaultArchitecture(char *arch_name, size_t arch_name_len)
Get the default architecture.
static void MemoryPressureDetected()
Notify the debugger that system memory pressure has been detected.
void SetPrompt(const char *prompt)
Set the command prompt string.
bool GetDescription(lldb::SBStream &description)
Get a description of this debugger.
void DispatchInput(const void *data, size_t data_len)
Dispatch input to the debugger.
friend class SBStructuredData
Definition SBDebugger.h:697
bool GetUseExternalEditor()
Get whether an external editor is being used.
static void PrintStackTraceOnError()
Configure LLDB to print a stack trace when it crashes.
static lldb::SBDebugger Create()
Create a new debugger instance (deprecated).
void SetInputFileHandle(FILE *f, bool transfer_ownership)
Set the input file handle for the debugger.
void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread)
Run the command interpreter.
static const char * GetVersionString()
Get the LLDB version string.
lldb_private::Debugger & ref() const
lldb::SBStructuredData GetSetting(const char *setting=nullptr)
Get debugger settings as structured data.
const void size_t data_len
Definition SBDebugger.h:485
const char * GetReproducerPath() const
Get the path to the reproducer.
void SetOutputFileHandle(FILE *f, bool transfer_ownership)
Set the output file handle for the debugger.
static lldb::SBError InitializeWithErrorHandling()
Initialize the LLDB debugger subsystem with error handling.
friend class SBProcess
Definition SBDebugger.h:695
SBTypeSummary GetSummaryForType(SBTypeNameSpecifier type_name_spec)
Get the summary for a type.
void HandleCommand(const char *command)
Execute a command in the command interpreter.
lldb::SBCommandInterpreter GetCommandInterpreter()
Get the command interpreter for this debugger.
SBFile GetInputFile()
Get the input file for the debugger.
const char * GetPrompt() const
Get the command prompt string.
void SetTerminalDimensions(uint32_t term_width, uint32_t term_height)
Set the terminal width and height together.
friend class SBInputReader
Definition SBDebugger.h:693
LLDB_DEPRECATED_FIXME("Use DispatchInput(const void *, size_t)", "DispatchInput(const void *, size_t)") void DispatchInput(void *baton
Dispatch input to the debugger (deprecated).
bool SetUseColor(bool use_color)
Set whether to use color in output.
bool GetAsync()
Get whether the debugger is running in asynchronous mode.
const lldb::DebuggerSP & get_sp() const
static bool StateIsRunningState(lldb::StateType state)
Check if a state is a running state.
SBError SetErrorFile(SBFile file)
Set the error file for the debugger.
bool SetUseSourceCache(bool use_source_cache)
Set whether to use the source cache.
uint32_t GetNumCategories()
Get the number of type categories.
static lldb::SBStringList GetInternalVariableValue(const char *var_name, const char *debugger_instance_name)
Get the value of an internal variable.
friend class SBTarget
Definition SBDebugger.h:699
void Clear()
Clear this debugger instance.
SBTypeFormat GetFormatForType(SBTypeNameSpecifier type_name_spec)
Get the format for a type.
bool GetUseColor() const
Get whether color is being used in output.
static bool SupportsLanguage(lldb::LanguageType language)
Check if a specific language is supported by LLDB.
lldb::SBListener GetListener()
Get the listener associated with this debugger.
void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton)
Set a callback for log output.
lldb::DebuggerSP m_opaque_sp
Definition SBDebugger.h:713
lldb::ScriptLanguage GetScriptLanguage() const
Get the current scripting language.
LLDB_DEPRECATED_FIXME("Use AddDestroyCallback and RemoveDestroyCallback", "AddDestroyCallback") void SetDestroyCallback(lldb lldb::callback_token_t AddDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, void *baton)
Set a callback for when the debugger is destroyed (deprecated).
void SetScriptLanguage(lldb::ScriptLanguage script_lang)
Set the current scripting language.
uint32_t GetNumAvailablePlatforms()
Get the number of available platforms.
lldb::SBTarget FindTargetWithLLDBProcess(const lldb::ProcessSP &processSP)
friend class SBListener
Definition SBDebugger.h:694
SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier type_name_spec)
Get the synthetic for a type.
void DispatchClientTelemetry(const lldb::SBStructuredData &data)
Dispatch telemetry data from client to server.
SBTypeCategory GetCategoryAtIndex(uint32_t index)
Get a type category by index.
lldb::SBPlatform GetSelectedPlatform()
Get the selected platform.
static const char * GetBroadcasterClass()
Get the broadcaster class name.
lldb::SBTarget CreateTargetWithFileAndArch(const char *filename, const char *archname)
Create a target with the specified file and architecture.
void HandleProcessEvent(const lldb::SBProcess &process, const lldb::SBEvent &event, FileSP out, FileSP err)
Handle a process event using FileSP objects.
bool IsValid() const
Check if this is a valid SBDebugger object.
static void Initialize()
Initialize LLDB and its subsystems.
static bool StateIsStoppedState(lldb::StateType state)
Check if a state is a stopped state.
lldb::SBError SetCurrentPlatform(const char *platform_name)
Set the current platform by name.
lldb::SBSourceManager GetSourceManager()
Get the source manager for this debugger.
SBTypeCategory GetCategory(const char *category_name)
Get a type category by name.
void ResetStatistics()
Clear collected statistics for targets belonging to this debugger.
void SetREPLLanguage(lldb::LanguageType repl_lang)
Set the current REPL language.
SBStructuredData GetScriptInterpreterInfo(ScriptLanguage language)
Get information about a script interpreter as structured data.
static SBDebugger FindDebuggerWithID(int id)
Find a debugger by ID. Returns an invalid debugger if not found.
bool SetShowInlineDiagnostics(bool b)
Set whether to show inline diagnostics.
friend class SBTrace
Definition SBDebugger.h:700
uint32_t GetNumPlatforms()
Get the number of currently active platforms.
void DispatchInputEndOfFile()
Signal end-of-file to the current input dispatch.
uint32_t GetTerminalWidth() const
Get the terminal width.
bool InterruptRequested()
Check if an interrupt has been requested.
lldb::SBTarget FindTargetWithFileAndArch(const char *filename, const char *arch)
Find a target with the specified file and architecture.
static lldb::SBStructuredData GetProgressDataFromEvent(const lldb::SBEvent &event)
Get progress data from an event.
static const char * StateAsCString(lldb::StateType state)
Convert a state type to a string.
void PushInputReader(lldb::SBInputReader &reader)
Push an input reader onto the IO handler stack.
static const char * GetProgressFromEvent(const lldb::SBEvent &event, uint64_t &progress_id, uint64_t &completed, uint64_t &total, bool &is_debugger_specific)
Get progress data from a SBEvent whose type is eBroadcastBitProgress.
lldb::SBTarget GetDummyTarget()
Get the dummy target.
bool EnableLog(const char *channel, const char **categories)
Enable logging for a specific channel and category.
static bool SetDefaultArchitecture(const char *arch_name)
Set the default architecture.
lldb_private::Debugger * get() const
void RestoreInputTerminalState()
Restore the previously saved terminal state.
SBFile GetOutputFile()
Get the output file for the debugger.
lldb::SBBroadcaster GetBroadcaster()
Get the broadcaster that allows subscribing to events from this debugger.
void SetSelectedTarget(SBTarget &target)
Set the selected target.
SBTypeCategory GetDefaultCategory()
Get the default type category.
bool GetUseSourceCache() const
Get whether the source cache is being used.
LLDB_DEPRECATED_FIXME("Use SetTerminalDimensions", "SetTerminalDimensions(uint32_t, uint32_t)") void SetTerminalWidth(uint32_t term_width)
Set the terminal width.
SBFile GetErrorFile()
Get the error file for the debugger.
uint32_t GetTerminalHeight() const
Get the terminal height.
LLDB_DEPRECATED_FIXME("Use HandleProcessEvent(const SBProcess &, const SBEvent &, SBFile, " "SBFile) or HandleProcessEvent(const SBProcess &, const SBEvent &, " "FileSP, FileSP)", "HandleProcessEvent(const SBProcess &, const SBEvent &, SBFile, SBFile)") void HandleProcessEvent(const lldb voi HandleProcessEvent)(const lldb::SBProcess &process, const lldb::SBEvent &event, SBFile out, SBFile err)
Handle a process event (deprecated).
Definition SBDebugger.h:310
lldb::SBStructuredData GetAvailablePlatformInfoAtIndex(uint32_t idx)
Get information about the available platform at the given index as structured data.
static SBStructuredData GetBuildConfiguration()
Get the build configuration as structured data.
SBTypeCategory CreateCategory(const char *category_name)
Create a new type category.
bool SetCurrentPlatformSDKRoot(const char *sysroot)
Set the SDK root for the current platform.
void SetErrorFileHandle(FILE *f, bool transfer_ownership)
Set the error file handle for the debugger.
void CancelInterruptRequest()
Cancel a previously requested interrupt.
uint32_t GetNumTargets()
Get the number of targets in the debugger.
FILE * GetInputFileHandle()
Get the input file handle for the debugger.
SBError SetInputFile(SBFile file)
Set the input file for the debugger.
void DispatchInputInterrupt()
Interrupt the current input dispatch.
SBError SetInputString(const char *data)
Set the input from a string.
uint32_t GetIndexOfTarget(lldb::SBTarget target)
Get the index of a target.
SBError SetOutputFile(SBFile file)
Set the output file for the debugger.
lldb::SBTarget GetSelectedTarget()
Get the currently selected target.
void SaveInputTerminalState()
Save the current terminal state.
FILE * GetErrorFileHandle()
Get the error file handle for the debugger.
friend class SBProgress
Definition SBDebugger.h:701
void SetSelectedPlatform(lldb::SBPlatform &platform)
Set the selected platform.
friend class SBSourceManager
Definition SBDebugger.h:696
void reset(const lldb::DebuggerSP &debugger_sp)
friend class SBPlatform
Definition SBDebugger.h:698
FILE * GetOutputFileHandle()
Get the output file handle for the debugger.
const char * GetInstanceName()
Get the instance name of this debugger.
lldb::SBTarget FindTargetWithProcessID(lldb::pid_t pid)
Find a target with the specified process ID.
static void PrintDiagnosticsOnError()
Configure LLDB to print diagnostic information when it crashes.
void SetCloseInputOnEOF(bool b)
Set whether to close input on EOF (deprecated).
friend class SBCommandInterpreter
Definition SBDebugger.h:692
lldb::user_id_t GetID()
Get the unique ID of this debugger.
lldb::SBTarget CreateTargetWithFileAndTargetTriple(const char *filename, const char *target_triple)
Create a target with the specified file and target triple.
SBDebugger()
Default constructor creates an invalid SBDebugger instance.
bool RemoveDestroyCallback(lldb::callback_token_t token)
Remove a destroy callback.
static lldb::SBStructuredData GetDiagnosticFromEvent(const lldb::SBEvent &event)
Get diagnostic information from an event.
lldb::ScriptLanguage GetScriptingLanguage(const char *script_language_name)
Get the scripting language by name.
lldb::SBTarget FindTargetByGloballyUniqueID(lldb::user_id_t id) const
Find a target with the specified unique ID.
static void Destroy(lldb::SBDebugger &debugger)
Destroy a debugger instance.
void RequestInterrupt()
Request an interrupt of the current operation.
Options for SBDebugger::Initialize. They apply to the whole process.
SBError Initialize(lldb::SBDebugger &sb_debugger, unsigned long(*callback)(void *, lldb::SBInputReader *, lldb::InputReaderAction, char const *, unsigned long), void *a, lldb::InputReaderGranularity b, char const *c, char const *d, bool e)
bool IsActive() const
A class to manage flag bits.
Definition Debugger.h:106
Unwraps the opaque internal object held by an SB (public API) instance, for scripting-language plugin...
A class that represents a running process on the host machine.
ScriptLanguage
Script interpreter types.
@ eBroadcastBitProgressCategory
Deprecated.
@ eBroadcastBitExternalProgress
@ eBroadcastBitProgress
@ eBroadcastBitExternalProgressCategory
Deprecated.
StateType
Process and Thread States.
LanguageType
Programming language type.
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Debugger > DebuggerSP
uint64_t pid_t
Definition lldb-types.h:84
int32_t callback_token_t
Definition lldb-types.h:82
class LLDB_API SBTrace
Definition SBDefines.h:122
uint64_t user_id_t
Definition lldb-types.h:83
void(* SBDebuggerDestroyCallback)(lldb::user_id_t debugger_id, void *baton)
Definition SBDefines.h:149
void(* LogOutputCallback)(const char *, void *baton)
Definition lldb-types.h:73
class LLDB_API SBError
Definition SBDefines.h:70
std::shared_ptr< lldb_private::File > FileSP
class LLDB_API SBCommandInterpreterRunResult
Definition SBDefines.h:60
InputReaderGranularity
Token size/granularities for Input Readers.