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 /// lldb::SBStructuredData settings = debugger.GetSetting();
194 /// lldb::SBStructuredData settings = debugger.GetSetting(nullptr);
195 /// lldb::SBStructuredData settings = debugger.GetSetting("");
196 /// lldb::SBStructuredData settings = debugger.GetSetting("target.arg0");
197 /// lldb::SBStructuredData settings = debugger.GetSetting("target");
198 lldb::SBStructuredData GetSetting(const char *setting = nullptr);
199
200 /// Set whether the debugger should run in asynchronous mode.
201 ///
202 /// When in asynchronous mode, events are processed on a background thread.
203 void SetAsync(bool b);
204
205 /// Get whether the debugger is running in asynchronous mode.
206 bool GetAsync();
207
208 /// Set whether to skip loading .lldbinit files.
209 void SkipLLDBInitFiles(bool b);
210
211 /// Set whether to skip loading application-specific .lldbinit files.
212 void SkipAppInitFiles(bool b);
213
214#ifndef SWIG
215 /// Set the input file handle for the debugger.
216 void SetInputFileHandle(FILE *f, bool transfer_ownership);
217
218 /// Set the output file handle for the debugger.
219 void SetOutputFileHandle(FILE *f, bool transfer_ownership);
220
221 /// Set the error file handle for the debugger.
222 void SetErrorFileHandle(FILE *f, bool transfer_ownership);
223#endif
224
225#ifndef SWIG
226 /// Get the input file handle for the debugger.
227 FILE *GetInputFileHandle();
228
229 /// Get the output file handle for the debugger.
230 FILE *GetOutputFileHandle();
231
232 /// Get the error file handle for the debugger.
233 FILE *GetErrorFileHandle();
234#endif
235
236 /// Set the input from a string.
237 SBError SetInputString(const char *data);
238
239 /// Set the input file for the debugger.
241
242 /// Set the output file for the debugger.
244
245 /// Set the error file for the debugger.
247
248 /// Set the input file for the debugger using a FileSP.
250
251 /// Set the output file for the debugger using a FileSP.
253
254 /// Set the error file for the debugger using a FileSP.
256
257 /// Get the input file for the debugger.
259
260 /// Get the output file for the debugger.
262
263 /// Get the error file for the debugger.
265
266 /// Save the current terminal state.
267 ///
268 /// This should be called before modifying terminal settings.
270
271 /// Restore the previously saved terminal state.
273
274 /// Get the command interpreter for this debugger.
276
277 /// Execute a command in the command interpreter.
278 void HandleCommand(const char *command);
279
280 /// Request an interrupt of the current operation.
281 void RequestInterrupt();
282
283 /// Cancel a previously requested interrupt.
285
286 /// Check if an interrupt has been requested.
287 bool InterruptRequested();
288
289 /// Get the listener associated with this debugger.
291
292#ifndef SWIG
293 /// Handle a process event (deprecated).
295 "Use HandleProcessEvent(const SBProcess &, const SBEvent &, SBFile, "
296 "SBFile) or HandleProcessEvent(const SBProcess &, const SBEvent &, "
297 "FileSP, FileSP)",
298 "HandleProcessEvent(const SBProcess &, const SBEvent &, SBFile, SBFile)")
299 void HandleProcessEvent(const lldb::SBProcess &process,
300 const lldb::SBEvent &event, FILE *out, FILE *err);
301#endif
302
303 /// Handle a process event.
305 const lldb::SBEvent &event, SBFile out, SBFile err);
306
307#ifdef SWIG
308 /// Handle a process event using FileSP objects.
309 void HandleProcessEvent(const lldb::SBProcess &process,
310 const lldb::SBEvent &event, FileSP BORROWED, FileSP BORROWED);
311#else
312 /// Handle a process event using FileSP objects.
314 const lldb::SBEvent &event, FileSP out, FileSP err);
315#endif
316
317 /// Create a target with the specified parameters.
318 lldb::SBTarget CreateTarget(const char *filename, const char *target_triple,
319 const char *platform_name,
320 bool add_dependent_modules, lldb::SBError &error);
321
322 /// Create a target with the specified file and target triple.
324 const char *target_triple);
325
326 /// Create a target with the specified file and architecture.
327 lldb::SBTarget CreateTargetWithFileAndArch(const char *filename,
328 const char *archname);
329
330 /// Create a target with the specified file.
331 lldb::SBTarget CreateTarget(const char *filename);
332
333 /// Get the dummy target.
334 ///
335 /// The dummy target is used when no target is available.
337
338#ifndef SWIG
339 /// Dispatch telemetry data from client to server.
340 ///
341 /// This is used to send telemetry data from the client to the server if
342 /// client-telemetry is enabled. If not enabled, the data is ignored.
344#endif
345
346 /// Delete a target from the debugger.
347 bool DeleteTarget(lldb::SBTarget &target);
348
349 /// Get a target by index.
350 lldb::SBTarget GetTargetAtIndex(uint32_t idx);
351
352 /// Get the index of a target.
353 uint32_t GetIndexOfTarget(lldb::SBTarget target);
354
355 /// Find a target with the specified process ID.
357
358 /// Find a target with the specified file and architecture.
359 lldb::SBTarget FindTargetWithFileAndArch(const char *filename,
360 const char *arch);
361
362 /// Find a target with the specified unique ID.
364
365 /// Get the number of targets in the debugger.
366 uint32_t GetNumTargets();
367
368 /// Get the currently selected target.
370
371 /// Set the selected target.
372 void SetSelectedTarget(SBTarget &target);
373
374 /// Get the selected platform.
376
377 /// Set the selected platform.
379
380 /// Get the number of currently active platforms.
381 uint32_t GetNumPlatforms();
382
383 /// Get one of the currently active platforms.
385
386 /// Get the number of available platforms.
387 ///
388 /// The return value should match the number of entries output by the
389 /// "platform list" command.
390 uint32_t GetNumAvailablePlatforms();
391
392 /// Get information about the available platform at the given index as
393 /// structured data.
395
396 /// Get the source manager for this debugger.
398
399 /// Set the current platform by name.
400 lldb::SBError SetCurrentPlatform(const char *platform_name);
401
402 /// Set the SDK root for the current platform.
403 bool SetCurrentPlatformSDKRoot(const char *sysroot);
404
405 /// Set whether to use an external editor.
406 bool SetUseExternalEditor(bool input);
407
408 /// Get whether an external editor is being used.
410
411 /// Set whether to use color in output.
412 bool SetUseColor(bool use_color);
413
414 /// Get whether color is being used in output.
415 bool GetUseColor() const;
416
417 /// Set whether to show inline diagnostics.
418 bool SetShowInlineDiagnostics(bool b);
419
420 /// Set whether to use the source cache.
421 bool SetUseSourceCache(bool use_source_cache);
422
423 /// Get whether the source cache is being used.
424 bool GetUseSourceCache() const;
425
426 /// Get the default architecture.
427 static bool GetDefaultArchitecture(char *arch_name, size_t arch_name_len);
428
429 /// Set the default architecture.
430 static bool SetDefaultArchitecture(const char *arch_name);
431
432 /// Get the scripting language by name.
433 lldb::ScriptLanguage GetScriptingLanguage(const char *script_language_name);
434
435 /// Get information about a script interpreter as structured data.
437
438 /// Get the LLDB version string.
439 static const char *GetVersionString();
440
441 /// Convert a state type to a string.
442 static const char *StateAsCString(lldb::StateType state);
443
444 /// Get the build configuration as structured data.
446
447 /// Check if a state is a running state.
448 static bool StateIsRunningState(lldb::StateType state);
449
450 /// Check if a state is a stopped state.
451 static bool StateIsStoppedState(lldb::StateType state);
452
453 /// Enable logging for a specific channel and category.
454 bool EnableLog(const char *channel, const char **categories);
455
456 /// Set a callback for log output.
457 void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton);
458
459 /// Set a callback for when the debugger is destroyed (deprecated).
460 LLDB_DEPRECATED_FIXME("Use AddDestroyCallback and RemoveDestroyCallback",
461 "AddDestroyCallback")
462 void SetDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback,
463 void *baton);
464
465 /// Add a callback for when the debugger is destroyed. Returns a token that
466 /// can be used to remove the callback.
469 void *baton);
470
471 /// Remove a destroy callback.
473
474#ifndef SWIG
475 /// Dispatch input to the debugger (deprecated).
476 LLDB_DEPRECATED_FIXME("Use DispatchInput(const void *, size_t)",
477 "DispatchInput(const void *, size_t)")
478 void DispatchInput(void *baton, const void *data, size_t data_len);
479#endif
480
481 /// Dispatch input to the debugger.
482 void DispatchInput(const void *data, size_t data_len);
483
484 /// Interrupt the current input dispatch.
486
487 /// Signal end-of-file to the current input dispatch.
489
490#ifndef SWIG
491 /// Push an input reader onto the IO handler stack.
493#endif
494
495 /// Get the instance name of this debugger.
496 const char *GetInstanceName();
497
498 /// Find a debugger by ID. Returns an invalid debugger if not found.
499 static SBDebugger FindDebuggerWithID(int id);
500
501 /// Set an internal variable.
502 static lldb::SBError SetInternalVariable(const char *var_name,
503 const char *value,
504 const char *debugger_instance_name);
505
506 /// Get the value of an internal variable.
507 static lldb::SBStringList
508 GetInternalVariableValue(const char *var_name,
509 const char *debugger_instance_name);
510
511 /// Get a description of this debugger.
512 bool GetDescription(lldb::SBStream &description);
513
514 /// Get the terminal width.
515 uint32_t GetTerminalWidth() const;
516
517 /// Set the terminal width.
518 void SetTerminalWidth(uint32_t term_width);
519
520 /// Get the terminal height.
521 uint32_t GetTerminalHeight() const;
522
523 /// Set the terminal height.
524 void SetTerminalHeight(uint32_t term_height);
525
526 /// Get the unique ID of this debugger.
528
529 /// Get the command prompt string.
530 const char *GetPrompt() const;
531
532 /// Set the command prompt string.
533 void SetPrompt(const char *prompt);
534
535 /// Get the path to the reproducer.
536 const char *GetReproducerPath() const;
537
538 /// Get the current scripting language.
540
541 /// Set the current scripting language.
542 void SetScriptLanguage(lldb::ScriptLanguage script_lang);
543
544 /// Get the current REPL language.
546
547 /// Set the current REPL language.
548 void SetREPLLanguage(lldb::LanguageType repl_lang);
549
550 /// Get whether to close input on EOF (deprecated).
551 LLDB_DEPRECATED("SBDebugger::GetCloseInputOnEOF() is deprecated.")
552 bool GetCloseInputOnEOF() const;
553
554 /// Set whether to close input on EOF (deprecated).
555 LLDB_DEPRECATED("SBDebugger::SetCloseInputOnEOF() is deprecated.")
556 void SetCloseInputOnEOF(bool b);
557
558 /// Get a type category by name.
559 SBTypeCategory GetCategory(const char *category_name);
560
561 /// Get a type category by language.
563
564 /// Create a new type category.
565 SBTypeCategory CreateCategory(const char *category_name);
566
567 /// Delete a type category.
568 bool DeleteCategory(const char *category_name);
569
570 /// Get the number of type categories.
571 uint32_t GetNumCategories();
572
573 /// Get a type category by index.
574 SBTypeCategory GetCategoryAtIndex(uint32_t index);
575
576 /// Get the default type category.
578
579 /// Get the format for a type.
581
582 /// Get the summary for a type.
584
585 /// Get the filter for a type.
587
588 /// Get the synthetic for a type.
590
591 /// Clear collected statistics for targets belonging to this debugger.
592 ///
593 /// This includes clearing symbol table and debug info parsing/index time for
594 /// all modules, breakpoint resolve time, and target statistics.
595 void ResetStatistics();
596
597#ifndef SWIG
598 /// Run the command interpreter.
599 ///
600 /// \param[in] auto_handle_events
601 /// If true, automatically handle resulting events. This takes precedence
602 /// and overrides the corresponding option in
603 /// SBCommandInterpreterRunOptions.
604 ///
605 /// \param[in] spawn_thread
606 /// If true, start a new thread for IO handling. This takes precedence and
607 /// overrides the corresponding option in SBCommandInterpreterRunOptions.
608 void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread);
609#endif
610
611 /// Run the command interpreter with options.
612 ///
613 /// \param[in] auto_handle_events
614 /// If true, automatically handle resulting events. This takes precedence
615 /// and overrides the corresponding option in
616 /// SBCommandInterpreterRunOptions.
617 ///
618 /// \param[in] spawn_thread
619 /// If true, start a new thread for IO handling. This takes precedence and
620 /// overrides the corresponding option in SBCommandInterpreterRunOptions.
621 ///
622 /// \param[in] options
623 /// Parameter collection of type SBCommandInterpreterRunOptions.
624 ///
625 /// \param[out] num_errors
626 /// The number of errors.
627 ///
628 /// \param[out] quit_requested
629 /// Whether a quit was requested.
630 ///
631 /// \param[out] stopped_for_crash
632 /// Whether the interpreter stopped for a crash.
633#ifdef SWIG
634 %apply int& INOUT { int& num_errors };
635 %apply bool& INOUT { bool& quit_requested };
636 %apply bool& INOUT { bool& stopped_for_crash };
637#endif
638 void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread,
639 SBCommandInterpreterRunOptions &options,
640 int &num_errors, bool &quit_requested,
641 bool &stopped_for_crash);
642
643#ifndef SWIG
644 /// Run the command interpreter with options and return a result object.
646 RunCommandInterpreter(const SBCommandInterpreterRunOptions &options);
647#endif
648
649 /// Run a REPL (Read-Eval-Print Loop) for the specified language.
650 SBError RunREPL(lldb::LanguageType language, const char *repl_options);
651
652 /// Load a trace from a trace description file.
653 ///
654 /// This will create Targets, Processes and Threads based on the contents of
655 /// the file.
656 ///
657 /// \param[out] error
658 /// An error if the trace could not be created.
659 ///
660 /// \param[in] trace_description_file
661 /// The file containing the necessary information to load the trace.
662 ///
663 /// \return
664 /// An SBTrace object representing the loaded trace.
665 SBTrace LoadTraceFromFile(SBError &error,
666 const SBFileSpec &trace_description_file);
667
668protected:
670 friend class lldb_private::python::SWIGBridge;
672
673 SBDebugger(const lldb::DebuggerSP &debugger_sp);
674
675private:
677 friend class SBInputReader;
678 friend class SBListener;
679 friend class SBProcess;
680 friend class SBSourceManager;
681 friend class SBStructuredData;
682 friend class SBPlatform;
683 friend class SBTarget;
684 friend class SBTrace;
685 friend class SBProgress;
686
688
689 void reset(const lldb::DebuggerSP &debugger_sp);
690
692
694
695 const lldb::DebuggerSP &get_sp() const;
696
698
699}; // class SBDebugger
700
701} // namespace lldb
702
703#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:478
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:681
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:478
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:679
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:677
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
lldb::SBTarget FindTargetByGloballyUniqueID(lldb::user_id_t id)
Find a target with the specified unique ID.
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:683
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:697
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:678
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:684
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:304
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:685
void SetSelectedPlatform(lldb::SBPlatform &platform)
Set the selected platform.
friend class SBSourceManager
Definition SBDebugger.h:680
void reset(const lldb::DebuggerSP &debugger_sp)
friend class SBPlatform
Definition SBDebugger.h:682
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:676
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.
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:80
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:118
uint64_t user_id_t
Definition lldb-types.h:82
void(* SBDebuggerDestroyCallback)(lldb::user_id_t debugger_id, void *baton)
Definition SBDefines.h:145
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.