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:
31 SBInputReader() = default;
32 ~SBInputReader() = default;
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 /// Configure LLDB to print a stack trace when it crashes.
139 static void PrintStackTraceOnError();
140
141 /// Configure LLDB to print diagnostic information when it crashes.
142 static void PrintDiagnosticsOnError();
143
144 /// Terminate LLDB and its subsystems.
145 ///
146 /// This should be called when LLDB is no longer needed.
147 static void Terminate();
148
149 /// Create a new debugger instance (deprecated).
150 LLDB_DEPRECATED_FIXME("Use one of the other Create variants", "Create(bool)")
151 static lldb::SBDebugger Create();
152
153 /// Create a new debugger instance.
154 ///
155 /// If source_init_files is true, the debugger will source .lldbinit files
156 /// from the home directory and current directory.
157 static lldb::SBDebugger Create(bool source_init_files);
158
159 /// Create a new debugger instance with a custom log handler and user data
160 /// passed to the log callback.
161 ///
162 /// If source_init_files is true, the debugger will source .lldbinit files
163 /// from the home directory and current directory.
164 static lldb::SBDebugger Create(bool source_init_files,
165 lldb::LogOutputCallback log_callback,
166 void *baton);
167
168 /// Destroy a debugger instance.
169 static void Destroy(lldb::SBDebugger &debugger);
170
171 /// Notify the debugger that system memory pressure has been detected.
172 ///
173 /// This can be used to free up memory resources by clearing caches.
174 static void MemoryPressureDetected();
175
176 /// Check if this is a valid SBDebugger object.
177 explicit operator bool() const;
178
179 /// Check if this is a valid SBDebugger object.
180 bool IsValid() const;
181
182 /// Clear this debugger instance.
183 ///
184 /// This will close all IO handlers and reset the debugger to its initial
185 /// state.
186 void Clear();
187
188 /// Get debugger settings as structured data.
189 ///
190 /// Client can specify empty string or null to get all settings.
191 ///
192 /// Example usages:
193 /// \code
194 /// lldb::SBStructuredData settings = debugger.GetSetting();
195 /// lldb::SBStructuredData settings = debugger.GetSetting(nullptr);
196 /// lldb::SBStructuredData settings = debugger.GetSetting("");
197 /// lldb::SBStructuredData settings = debugger.GetSetting("target.arg0");
198 /// lldb::SBStructuredData settings = debugger.GetSetting("target");
199 /// \endcode
200 lldb::SBStructuredData GetSetting(const char *setting = nullptr);
201
202 /// Set whether the debugger should run in asynchronous mode.
203 ///
204 /// When in asynchronous mode, events are processed on a background thread.
205 void SetAsync(bool b);
206
207 /// Get whether the debugger is running in asynchronous mode.
208 bool GetAsync();
209
210 /// Set whether to skip loading .lldbinit files.
211 void SkipLLDBInitFiles(bool b);
212
213 /// Set whether to skip loading application-specific .lldbinit files.
214 void SkipAppInitFiles(bool b);
215
216#ifndef SWIG
217 /// Set the input file handle for the debugger.
218 void SetInputFileHandle(FILE *f, bool transfer_ownership);
219
220 /// Set the output file handle for the debugger.
221 void SetOutputFileHandle(FILE *f, bool transfer_ownership);
222
223 /// Set the error file handle for the debugger.
224 void SetErrorFileHandle(FILE *f, bool transfer_ownership);
225#endif
226
227#ifndef SWIG
228 /// Get the input file handle for the debugger.
229 FILE *GetInputFileHandle();
230
231 /// Get the output file handle for the debugger.
232 FILE *GetOutputFileHandle();
233
234 /// Get the error file handle for the debugger.
235 FILE *GetErrorFileHandle();
236#endif
237
238 /// Set the input from a string.
239 SBError SetInputString(const char *data);
240
241 /// Set the input file for the debugger.
243
244 /// Set the output file for the debugger.
246
247 /// Set the error file for the debugger.
249
250 /// Set the input file for the debugger using a FileSP.
252
253 /// Set the output file for the debugger using a FileSP.
255
256 /// Set the error file for the debugger using a FileSP.
258
259 /// Get the input file for the debugger.
261
262 /// Get the output file for the debugger.
264
265 /// Get the error file for the debugger.
267
268 /// Save the current terminal state.
269 ///
270 /// This should be called before modifying terminal settings.
272
273 /// Restore the previously saved terminal state.
275
276 /// Get the command interpreter for this debugger.
278
279 /// Execute a command in the command interpreter.
280 void HandleCommand(const char *command);
281
282 /// Request an interrupt of the current operation.
283 void RequestInterrupt();
284
285 /// Cancel a previously requested interrupt.
287
288 /// Check if an interrupt has been requested.
289 bool InterruptRequested();
290
291 /// Get the listener associated with this debugger.
293
294#ifndef SWIG
295 /// Handle a process event (deprecated).
297 "Use HandleProcessEvent(const SBProcess &, const SBEvent &, SBFile, "
298 "SBFile) or HandleProcessEvent(const SBProcess &, const SBEvent &, "
299 "FileSP, FileSP)",
300 "HandleProcessEvent(const SBProcess &, const SBEvent &, SBFile, SBFile)")
301 void HandleProcessEvent(const lldb::SBProcess &process,
302 const lldb::SBEvent &event, FILE *out, FILE *err);
303#endif
304
305 /// Handle a process event.
307 const lldb::SBEvent &event, SBFile out, SBFile err);
308
309#ifdef SWIG
310 /// Handle a process event using FileSP objects.
311 void HandleProcessEvent(const lldb::SBProcess &process,
312 const lldb::SBEvent &event, FileSP BORROWED, FileSP BORROWED);
313#else
314 /// Handle a process event using FileSP objects.
316 const lldb::SBEvent &event, FileSP out, FileSP err);
317#endif
318
319 /// Create a target with the specified parameters.
320 lldb::SBTarget CreateTarget(const char *filename, const char *target_triple,
321 const char *platform_name,
322 bool add_dependent_modules, lldb::SBError &error);
323
324 /// Create a target with the specified file and target triple.
326 const char *target_triple);
327
328 /// Create a target with the specified file and architecture.
329 lldb::SBTarget CreateTargetWithFileAndArch(const char *filename,
330 const char *archname);
331
332 /// Create a target with the specified file.
333 lldb::SBTarget CreateTarget(const char *filename);
334
335 /// Get the dummy target.
336 ///
337 /// The dummy target is used when no target is available.
339
340#ifndef SWIG
341 /// Dispatch telemetry data from client to server.
342 ///
343 /// This is used to send telemetry data from the client to the server if
344 /// client-telemetry is enabled. If not enabled, the data is ignored.
346#endif
347
348 /// Delete a target from the debugger.
349 bool DeleteTarget(lldb::SBTarget &target);
350
351 /// Get a target by index.
352 lldb::SBTarget GetTargetAtIndex(uint32_t idx);
353
354 /// Get the index of a target.
355 uint32_t GetIndexOfTarget(lldb::SBTarget target);
356
357 /// Find a target with the specified process ID.
359
360 /// Find a target with the specified file and architecture.
361 lldb::SBTarget FindTargetWithFileAndArch(const char *filename,
362 const char *arch);
363
364 /// Find a target with the specified unique ID.
366
367 /// Get the number of targets in the debugger.
368 uint32_t GetNumTargets();
369
370 /// Get the currently selected target.
372
373 /// Set the selected target.
374 void SetSelectedTarget(SBTarget &target);
375
376 /// Get the selected platform.
378
379 /// Set the selected platform.
381
382 /// Get the number of currently active platforms.
383 uint32_t GetNumPlatforms();
384
385 /// Get one of the currently active platforms.
387
388 /// Get the number of available platforms.
389 ///
390 /// The return value should match the number of entries output by the
391 /// "platform list" command.
392 uint32_t GetNumAvailablePlatforms();
393
394 /// Get information about the available platform at the given index as
395 /// structured data.
397
398 /// Get the source manager for this debugger.
400
401 /// Set the current platform by name.
402 lldb::SBError SetCurrentPlatform(const char *platform_name);
403
404 /// Set the SDK root for the current platform.
405 bool SetCurrentPlatformSDKRoot(const char *sysroot);
406
407 /// Set whether to use an external editor.
408 bool SetUseExternalEditor(bool input);
409
410 /// Get whether an external editor is being used.
412
413 /// Set whether to use color in output.
414 bool SetUseColor(bool use_color);
415
416 /// Get whether color is being used in output.
417 bool GetUseColor() const;
418
419 /// Set whether to show inline diagnostics.
420 bool SetShowInlineDiagnostics(bool b);
421
422 /// Set whether to use the source cache.
423 bool SetUseSourceCache(bool use_source_cache);
424
425 /// Get whether the source cache is being used.
426 bool GetUseSourceCache() const;
427
428 /// Get the default architecture.
429 static bool GetDefaultArchitecture(char *arch_name, size_t arch_name_len);
430
431 /// Set the default architecture.
432 static bool SetDefaultArchitecture(const char *arch_name);
433
434 /// Get the scripting language by name.
435 lldb::ScriptLanguage GetScriptingLanguage(const char *script_language_name);
436
437 /// Get information about a script interpreter as structured data.
439
440 /// Get the LLDB version string.
441 static const char *GetVersionString();
442
443 /// Convert a state type to a string.
444 static const char *StateAsCString(lldb::StateType state);
445
446 /// Get the build configuration as structured data.
448
449 /// Check if a state is a running state.
450 static bool StateIsRunningState(lldb::StateType state);
451
452 /// Check if a state is a stopped state.
453 static bool StateIsStoppedState(lldb::StateType state);
454
455 /// Enable logging for a specific channel and category.
456 bool EnableLog(const char *channel, const char **categories);
457
458 /// Set a callback for log output.
459 void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton);
460
461 /// Set a callback for when the debugger is destroyed (deprecated).
462 LLDB_DEPRECATED_FIXME("Use AddDestroyCallback and RemoveDestroyCallback",
463 "AddDestroyCallback")
464 void SetDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback,
465 void *baton);
466
467 /// Add a callback for when the debugger is destroyed. Returns a token that
468 /// can be used to remove the callback.
471 void *baton);
472
473 /// Remove a destroy callback.
475
476#ifndef SWIG
477 /// Dispatch input to the debugger (deprecated).
478 LLDB_DEPRECATED_FIXME("Use DispatchInput(const void *, size_t)",
479 "DispatchInput(const void *, size_t)")
480 void DispatchInput(void *baton, const void *data, size_t data_len);
481#endif
482
483 /// Dispatch input to the debugger.
484 void DispatchInput(const void *data, size_t data_len);
485
486 /// Interrupt the current input dispatch.
488
489 /// Signal end-of-file to the current input dispatch.
491
492#ifndef SWIG
493 /// Push an input reader onto the IO handler stack.
495#endif
496
497 /// Get the instance name of this debugger.
498 const char *GetInstanceName();
499
500 /// Find a debugger by ID. Returns an invalid debugger if not found.
501 static SBDebugger FindDebuggerWithID(int id);
502
503 /// Set an internal variable.
504 static lldb::SBError SetInternalVariable(const char *var_name,
505 const char *value,
506 const char *debugger_instance_name);
507
508 /// Get the value of an internal variable.
509 static lldb::SBStringList
510 GetInternalVariableValue(const char *var_name,
511 const char *debugger_instance_name);
512
513 /// Get a description of this debugger.
514 bool GetDescription(lldb::SBStream &description);
515
516 /// Get the terminal width.
517 uint32_t GetTerminalWidth() const;
518
519 /// Set the terminal width.
520 void SetTerminalWidth(uint32_t term_width);
521
522 /// Get the terminal height.
523 uint32_t GetTerminalHeight() const;
524
525 /// Set the terminal height.
526 void SetTerminalHeight(uint32_t term_height);
527
528 /// Get the unique ID of this debugger.
530
531 /// Get the command prompt string.
532 const char *GetPrompt() const;
533
534 /// Set the command prompt string.
535 void SetPrompt(const char *prompt);
536
537 /// Get the path to the reproducer.
538 const char *GetReproducerPath() const;
539
540 /// Get the current scripting language.
542
543 /// Set the current scripting language.
544 void SetScriptLanguage(lldb::ScriptLanguage script_lang);
545
546 /// Get the current REPL language.
548
549 /// Set the current REPL language.
550 void SetREPLLanguage(lldb::LanguageType repl_lang);
551
552 /// Get whether to close input on EOF (deprecated).
553 LLDB_DEPRECATED("SBDebugger::GetCloseInputOnEOF() is deprecated.")
554 bool GetCloseInputOnEOF() const;
555
556 /// Set whether to close input on EOF (deprecated).
557 LLDB_DEPRECATED("SBDebugger::SetCloseInputOnEOF() is deprecated.")
558 void SetCloseInputOnEOF(bool b);
559
560 /// Get a type category by name.
561 SBTypeCategory GetCategory(const char *category_name);
562
563 /// Get a type category by language.
565
566 /// Create a new type category.
567 SBTypeCategory CreateCategory(const char *category_name);
568
569 /// Delete a type category.
570 bool DeleteCategory(const char *category_name);
571
572 /// Get the number of type categories.
573 uint32_t GetNumCategories();
574
575 /// Get a type category by index.
576 SBTypeCategory GetCategoryAtIndex(uint32_t index);
577
578 /// Get the default type category.
580
581 /// Get the format for a type.
583
584 /// Get the summary for a type.
586
587 /// Get the filter for a type.
589
590 /// Get the synthetic for a type.
592
593 /// Clear collected statistics for targets belonging to this debugger.
594 ///
595 /// This includes clearing symbol table and debug info parsing/index time for
596 /// all modules, breakpoint resolve time, and target statistics.
597 void ResetStatistics();
598
599#ifndef SWIG
600 /// Run the command interpreter.
601 ///
602 /// \param[in] auto_handle_events
603 /// If true, automatically handle resulting events. This takes precedence
604 /// and overrides the corresponding option in
605 /// SBCommandInterpreterRunOptions.
606 ///
607 /// \param[in] spawn_thread
608 /// If true, start a new thread for IO handling. This takes precedence and
609 /// overrides the corresponding option in SBCommandInterpreterRunOptions.
610 void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread);
611#endif
612
613 /// Run the command interpreter with options.
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 ///
624 /// \param[in] options
625 /// Parameter collection of type SBCommandInterpreterRunOptions.
626 ///
627 /// \param[out] num_errors
628 /// The number of errors.
629 ///
630 /// \param[out] quit_requested
631 /// Whether a quit was requested.
632 ///
633 /// \param[out] stopped_for_crash
634 /// Whether the interpreter stopped for a crash.
635#ifdef SWIG
636 %apply int& INOUT { int& num_errors };
637 %apply bool& INOUT { bool& quit_requested };
638 %apply bool& INOUT { bool& stopped_for_crash };
639#endif
640 void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread,
641 SBCommandInterpreterRunOptions &options,
642 int &num_errors, bool &quit_requested,
643 bool &stopped_for_crash);
644
645#ifndef SWIG
646 /// Run the command interpreter with options and return a result object.
648 RunCommandInterpreter(const SBCommandInterpreterRunOptions &options);
649#endif
650
651 /// Run a REPL (Read-Eval-Print Loop) for the specified language.
652 SBError RunREPL(lldb::LanguageType language, const char *repl_options);
653
654 /// Load a trace from a trace description file.
655 ///
656 /// This will create Targets, Processes and Threads based on the contents of
657 /// the file.
658 ///
659 /// \param[out] error
660 /// An error if the trace could not be created.
661 ///
662 /// \param[in] trace_description_file
663 /// The file containing the necessary information to load the trace.
664 ///
665 /// \return
666 /// An SBTrace object representing the loaded trace.
667 SBTrace LoadTraceFromFile(SBError &error,
668 const SBFileSpec &trace_description_file);
669
670protected:
672 friend class lldb_private::python::SWIGBridge;
674
675 SBDebugger(const lldb::DebuggerSP &debugger_sp);
676
677private:
679 friend class SBInputReader;
680 friend class SBListener;
681 friend class SBProcess;
682 friend class SBSourceManager;
683 friend class SBStructuredData;
684 friend class SBPlatform;
685 friend class SBTarget;
686 friend class SBTrace;
687 friend class SBProgress;
688
690
691 void reset(const lldb::DebuggerSP &debugger_sp);
692
694
696
697 const lldb::DebuggerSP &get_sp() const;
698
700
701}; // class SBDebugger
702
703} // namespace lldb
704
705#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:480
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:683
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:480
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:681
void SetTerminalWidth(uint32_t term_width)
Set the terminal width.
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.
friend class SBInputReader
Definition SBDebugger.h:679
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:685
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:699
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:680
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:686
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.
void SetTerminalHeight(uint32_t term_height)
Set the terminal height.
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.
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:306
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:687
void SetSelectedPlatform(lldb::SBPlatform &platform)
Set the selected platform.
friend class SBSourceManager
Definition SBDebugger.h:682
void reset(const lldb::DebuggerSP &debugger_sp)
friend class SBPlatform
Definition SBDebugger.h:684
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:678
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.
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
~SBInputReader()=default
SBInputReader()=default
A class to manage flag bits.
Definition Debugger.h:87
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:83
int32_t callback_token_t
Definition lldb-types.h:81
class LLDB_API SBTrace
Definition SBDefines.h:119
uint64_t user_id_t
Definition lldb-types.h:82
void(* SBDebuggerDestroyCallback)(lldb::user_id_t debugger_id, void *baton)
Definition SBDefines.h:146
void(* LogOutputCallback)(const char *, void *baton)
Definition lldb-types.h:73
class LLDB_API SBError
Definition SBDefines.h:69
std::shared_ptr< lldb_private::File > FileSP
class LLDB_API SBCommandInterpreterRunResult
Definition SBDefines.h:59
InputReaderGranularity
Token size/granularities for Input Readers.