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 /// Get the number of targets in the debugger.
363 uint32_t GetNumTargets();
364
365 /// Get the currently selected target.
367
368 /// Set the selected target.
369 void SetSelectedTarget(SBTarget &target);
370
371 /// Get the selected platform.
373
374 /// Set the selected platform.
376
377 /// Get the number of currently active platforms.
378 uint32_t GetNumPlatforms();
379
380 /// Get one of the currently active platforms.
382
383 /// Get the number of available platforms.
384 ///
385 /// The return value should match the number of entries output by the
386 /// "platform list" command.
387 uint32_t GetNumAvailablePlatforms();
388
389 /// Get information about the available platform at the given index as
390 /// structured data.
392
393 /// Get the source manager for this debugger.
395
396 /// Set the current platform by name.
397 lldb::SBError SetCurrentPlatform(const char *platform_name);
398
399 /// Set the SDK root for the current platform.
400 bool SetCurrentPlatformSDKRoot(const char *sysroot);
401
402 /// Set whether to use an external editor.
403 bool SetUseExternalEditor(bool input);
404
405 /// Get whether an external editor is being used.
407
408 /// Set whether to use color in output.
409 bool SetUseColor(bool use_color);
410
411 /// Get whether color is being used in output.
412 bool GetUseColor() const;
413
414 /// Set whether to show inline diagnostics.
415 bool SetShowInlineDiagnostics(bool b);
416
417 /// Set whether to use the source cache.
418 bool SetUseSourceCache(bool use_source_cache);
419
420 /// Get whether the source cache is being used.
421 bool GetUseSourceCache() const;
422
423 /// Get the default architecture.
424 static bool GetDefaultArchitecture(char *arch_name, size_t arch_name_len);
425
426 /// Set the default architecture.
427 static bool SetDefaultArchitecture(const char *arch_name);
428
429 /// Get the scripting language by name.
430 lldb::ScriptLanguage GetScriptingLanguage(const char *script_language_name);
431
432 /// Get information about a script interpreter as structured data.
434
435 /// Get the LLDB version string.
436 static const char *GetVersionString();
437
438 /// Convert a state type to a string.
439 static const char *StateAsCString(lldb::StateType state);
440
441 /// Get the build configuration as structured data.
443
444 /// Check if a state is a running state.
445 static bool StateIsRunningState(lldb::StateType state);
446
447 /// Check if a state is a stopped state.
448 static bool StateIsStoppedState(lldb::StateType state);
449
450 /// Enable logging for a specific channel and category.
451 bool EnableLog(const char *channel, const char **categories);
452
453 /// Set a callback for log output.
454 void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton);
455
456 /// Set a callback for when the debugger is destroyed (deprecated).
457 LLDB_DEPRECATED_FIXME("Use AddDestroyCallback and RemoveDestroyCallback",
458 "AddDestroyCallback")
459 void SetDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback,
460 void *baton);
461
462 /// Add a callback for when the debugger is destroyed. Returns a token that
463 /// can be used to remove the callback.
466 void *baton);
467
468 /// Remove a destroy callback.
470
471#ifndef SWIG
472 /// Dispatch input to the debugger (deprecated).
473 LLDB_DEPRECATED_FIXME("Use DispatchInput(const void *, size_t)",
474 "DispatchInput(const void *, size_t)")
475 void DispatchInput(void *baton, const void *data, size_t data_len);
476#endif
477
478 /// Dispatch input to the debugger.
479 void DispatchInput(const void *data, size_t data_len);
480
481 /// Interrupt the current input dispatch.
483
484 /// Signal end-of-file to the current input dispatch.
486
487#ifndef SWIG
488 /// Push an input reader onto the IO handler stack.
490#endif
491
492 /// Get the instance name of this debugger.
493 const char *GetInstanceName();
494
495 /// Find a debugger by ID. Returns an invalid debugger if not found.
496 static SBDebugger FindDebuggerWithID(int id);
497
498 /// Set an internal variable.
499 static lldb::SBError SetInternalVariable(const char *var_name,
500 const char *value,
501 const char *debugger_instance_name);
502
503 /// Get the value of an internal variable.
504 static lldb::SBStringList
505 GetInternalVariableValue(const char *var_name,
506 const char *debugger_instance_name);
507
508 /// Get a description of this debugger.
509 bool GetDescription(lldb::SBStream &description);
510
511 /// Get the terminal width.
512 uint32_t GetTerminalWidth() const;
513
514 /// Set the terminal width.
515 void SetTerminalWidth(uint32_t term_width);
516
517 /// Get the terminal height.
518 uint32_t GetTerminalHeight() const;
519
520 /// Set the terminal height.
521 void SetTerminalHeight(uint32_t term_height);
522
523 /// Get the unique ID of this debugger.
525
526 /// Get the command prompt string.
527 const char *GetPrompt() const;
528
529 /// Set the command prompt string.
530 void SetPrompt(const char *prompt);
531
532 /// Get the path to the reproducer.
533 const char *GetReproducerPath() const;
534
535 /// Get the current scripting language.
537
538 /// Set the current scripting language.
539 void SetScriptLanguage(lldb::ScriptLanguage script_lang);
540
541 /// Get the current REPL language.
543
544 /// Set the current REPL language.
545 void SetREPLLanguage(lldb::LanguageType repl_lang);
546
547 /// Get whether to close input on EOF (deprecated).
548 LLDB_DEPRECATED("SBDebugger::GetCloseInputOnEOF() is deprecated.")
549 bool GetCloseInputOnEOF() const;
550
551 /// Set whether to close input on EOF (deprecated).
552 LLDB_DEPRECATED("SBDebugger::SetCloseInputOnEOF() is deprecated.")
553 void SetCloseInputOnEOF(bool b);
554
555 /// Get a type category by name.
556 SBTypeCategory GetCategory(const char *category_name);
557
558 /// Get a type category by language.
560
561 /// Create a new type category.
562 SBTypeCategory CreateCategory(const char *category_name);
563
564 /// Delete a type category.
565 bool DeleteCategory(const char *category_name);
566
567 /// Get the number of type categories.
568 uint32_t GetNumCategories();
569
570 /// Get a type category by index.
571 SBTypeCategory GetCategoryAtIndex(uint32_t index);
572
573 /// Get the default type category.
575
576 /// Get the format for a type.
578
579 /// Get the summary for a type.
581
582 /// Get the filter for a type.
584
585 /// Get the synthetic for a type.
587
588 /// Clear collected statistics for targets belonging to this debugger.
589 ///
590 /// This includes clearing symbol table and debug info parsing/index time for
591 /// all modules, breakpoint resolve time, and target statistics.
592 void ResetStatistics();
593
594#ifndef SWIG
595 /// Run the command interpreter.
596 ///
597 /// \param[in] auto_handle_events
598 /// If true, automatically handle resulting events. This takes precedence
599 /// and overrides the corresponding option in
600 /// SBCommandInterpreterRunOptions.
601 ///
602 /// \param[in] spawn_thread
603 /// If true, start a new thread for IO handling. This takes precedence and
604 /// overrides the corresponding option in SBCommandInterpreterRunOptions.
605 void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread);
606#endif
607
608 /// Run the command interpreter with options.
609 ///
610 /// \param[in] auto_handle_events
611 /// If true, automatically handle resulting events. This takes precedence
612 /// and overrides the corresponding option in
613 /// SBCommandInterpreterRunOptions.
614 ///
615 /// \param[in] spawn_thread
616 /// If true, start a new thread for IO handling. This takes precedence and
617 /// overrides the corresponding option in SBCommandInterpreterRunOptions.
618 ///
619 /// \param[in] options
620 /// Parameter collection of type SBCommandInterpreterRunOptions.
621 ///
622 /// \param[out] num_errors
623 /// The number of errors.
624 ///
625 /// \param[out] quit_requested
626 /// Whether a quit was requested.
627 ///
628 /// \param[out] stopped_for_crash
629 /// Whether the interpreter stopped for a crash.
630#ifdef SWIG
631 %apply int& INOUT { int& num_errors };
632 %apply bool& INOUT { bool& quit_requested };
633 %apply bool& INOUT { bool& stopped_for_crash };
634#endif
635 void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread,
636 SBCommandInterpreterRunOptions &options,
637 int &num_errors, bool &quit_requested,
638 bool &stopped_for_crash);
639
640#ifndef SWIG
641 /// Run the command interpreter with options and return a result object.
643 RunCommandInterpreter(const SBCommandInterpreterRunOptions &options);
644#endif
645
646 /// Run a REPL (Read-Eval-Print Loop) for the specified language.
647 SBError RunREPL(lldb::LanguageType language, const char *repl_options);
648
649 /// Load a trace from a trace description file.
650 ///
651 /// This will create Targets, Processes and Threads based on the contents of
652 /// the file.
653 ///
654 /// \param[out] error
655 /// An error if the trace could not be created.
656 ///
657 /// \param[in] trace_description_file
658 /// The file containing the necessary information to load the trace.
659 ///
660 /// \return
661 /// An SBTrace object representing the loaded trace.
662 SBTrace LoadTraceFromFile(SBError &error,
663 const SBFileSpec &trace_description_file);
664
665protected:
667 friend class lldb_private::python::SWIGBridge;
669
670 SBDebugger(const lldb::DebuggerSP &debugger_sp);
671
672private:
674 friend class SBInputReader;
675 friend class SBListener;
676 friend class SBProcess;
677 friend class SBSourceManager;
678 friend class SBStructuredData;
679 friend class SBPlatform;
680 friend class SBTarget;
681 friend class SBTrace;
682 friend class SBProgress;
683
685
686 void reset(const lldb::DebuggerSP &debugger_sp);
687
689
691
692 const lldb::DebuggerSP &get_sp() const;
693
695
696}; // class SBDebugger
697
698} // namespace lldb
699
700#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:475
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:678
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:475
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:676
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:674
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:680
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:694
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:675
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:681
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:682
void SetSelectedPlatform(lldb::SBPlatform &platform)
Set the selected platform.
friend class SBSourceManager
Definition SBDebugger.h:677
void reset(const lldb::DebuggerSP &debugger_sp)
friend class SBPlatform
Definition SBDebugger.h:679
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:673
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.