LLDB mainline
SBTarget.h
Go to the documentation of this file.
1//===-- SBTarget.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_SBTARGET_H
10#define LLDB_API_SBTARGET_H
11
12#include "lldb/API/SBAddress.h"
16#include "lldb/API/SBDefines.h"
17#include "lldb/API/SBFileSpec.h"
21#include "lldb/API/SBType.h"
22#include "lldb/API/SBValue.h"
24
25namespace lldb {
26
27class SBPlatform;
28
30public:
31 // Broadcaster bits.
32 enum {
33 eBroadcastBitBreakpointChanged = (1 << 0),
34 eBroadcastBitModulesLoaded = (1 << 1),
35 eBroadcastBitModulesUnloaded = (1 << 2),
36 eBroadcastBitWatchpointChanged = (1 << 3),
37 eBroadcastBitSymbolsLoaded = (1 << 4)
38 };
39
40 // Constructors
41 SBTarget();
42
43 SBTarget(const lldb::SBTarget &rhs);
44
45#ifndef SWIG
46 SBTarget(const lldb::TargetSP &target_sp);
47#endif
48
49 // Destructor
51
52 const lldb::SBTarget &operator=(const lldb::SBTarget &rhs);
53
54 explicit operator bool() const;
55
56 bool IsValid() const;
57
58 static bool EventIsTargetEvent(const lldb::SBEvent &event);
59
60 static lldb::SBTarget GetTargetFromEvent(const lldb::SBEvent &event);
61
62 static uint32_t GetNumModulesFromEvent(const lldb::SBEvent &event);
63
64 static lldb::SBModule GetModuleAtIndexFromEvent(const uint32_t idx,
65 const lldb::SBEvent &event);
66
67 static const char *GetBroadcasterClassName();
68
69 lldb::SBProcess GetProcess();
70
71 /// Sets whether we should collect statistics on lldb or not.
72 ///
73 /// \param[in] v
74 /// A boolean to control the collection.
75 void SetCollectingStats(bool v);
76
77 /// Returns whether statistics collection are enabled.
78 ///
79 /// \return
80 /// true if statistics are currently being collected, false
81 /// otherwise.
82 bool GetCollectingStats();
83
84 /// Returns a dump of the collected statistics.
85 ///
86 /// \return
87 /// A SBStructuredData with the statistics collected.
88 lldb::SBStructuredData GetStatistics();
89
90 /// Return the platform object associated with the target.
91 ///
92 /// After return, the platform object should be checked for
93 /// validity.
94 ///
95 /// \return
96 /// A platform object.
97 lldb::SBPlatform GetPlatform();
98
99 /// Return the environment variables that would be used to launch a new
100 /// process.
101 ///
102 /// \return
103 /// An lldb::SBEnvironment object which is a copy of the target's
104 /// environment.
105
106 SBEnvironment GetEnvironment();
107
108 /// Install any binaries that need to be installed.
109 ///
110 /// This function does nothing when debugging on the host system.
111 /// When connected to remote platforms, the target's main executable
112 /// and any modules that have their remote install path set will be
113 /// installed on the remote platform. If the main executable doesn't
114 /// have an install location set, it will be installed in the remote
115 /// platform's working directory.
116 ///
117 /// \return
118 /// An error describing anything that went wrong during
119 /// installation.
120 SBError Install();
121
122 /// Launch a new process.
123 ///
124 /// Launch a new process by spawning a new process using the
125 /// target object's executable module's file as the file to launch.
126 /// Arguments are given in \a argv, and the environment variables
127 /// are in \a envp. Standard input and output files can be
128 /// optionally re-directed to \a stdin_path, \a stdout_path, and
129 /// \a stderr_path.
130 ///
131 /// \param[in] listener
132 /// An optional listener that will receive all process events.
133 /// If \a listener is valid then \a listener will listen to all
134 /// process events. If not valid, then this target's debugger
135 /// (SBTarget::GetDebugger()) will listen to all process events.
136 ///
137 /// \param[in] argv
138 /// The argument array.
139 ///
140 /// \param[in] envp
141 /// The environment array. If this is null, the default
142 /// environment values (provided through `settings set
143 /// target.env-vars`) will be used.
144 ///
145 /// \param[in] stdin_path
146 /// The path to use when re-directing the STDIN of the new
147 /// process. If all stdXX_path arguments are nullptr, a pseudo
148 /// terminal will be used.
149 ///
150 /// \param[in] stdout_path
151 /// The path to use when re-directing the STDOUT of the new
152 /// process. If all stdXX_path arguments are nullptr, a pseudo
153 /// terminal will be used.
154 ///
155 /// \param[in] stderr_path
156 /// The path to use when re-directing the STDERR of the new
157 /// process. If all stdXX_path arguments are nullptr, a pseudo
158 /// terminal will be used.
159 ///
160 /// \param[in] working_directory
161 /// The working directory to have the child process run in
162 ///
163 /// \param[in] launch_flags
164 /// Some launch options specified by logical OR'ing
165 /// lldb::LaunchFlags enumeration values together.
166 ///
167 /// \param[in] stop_at_entry
168 /// If false do not stop the inferior at the entry point.
169 ///
170 /// \param[out] error
171 /// An error object. Contains the reason if there is some failure.
172 ///
173 /// \return
174 /// A process object for the newly created process.
175 lldb::SBProcess Launch(SBListener &listener, char const **argv,
176 char const **envp, const char *stdin_path,
177 const char *stdout_path, const char *stderr_path,
178 const char *working_directory,
179 uint32_t launch_flags, // See LaunchFlags
180 bool stop_at_entry, lldb::SBError &error);
181
182 SBProcess LoadCore(const char *core_file);
183 SBProcess LoadCore(const char *core_file, lldb::SBError &error);
184
185 /// Launch a new process with sensible defaults.
186 ///
187 /// \param[in] argv
188 /// The argument array.
189 ///
190 /// \param[in] envp
191 /// The environment array. If this isn't provided, the default
192 /// environment values (provided through `settings set
193 /// target.env-vars`) will be used.
194 ///
195 /// \param[in] working_directory
196 /// The working directory to have the child process run in
197 ///
198 /// Default: listener
199 /// Set to the target's debugger (SBTarget::GetDebugger())
200 ///
201 /// Default: launch_flags
202 /// Empty launch flags
203 ///
204 /// Default: stdin_path
205 /// Default: stdout_path
206 /// Default: stderr_path
207 /// A pseudo terminal will be used.
208 ///
209 /// \return
210 /// A process object for the newly created process.
211 SBProcess LaunchSimple(const char **argv, const char **envp,
212 const char *working_directory);
213
214 SBProcess Launch(SBLaunchInfo &launch_info, SBError &error);
215
216 SBProcess Attach(SBAttachInfo &attach_info, SBError &error);
217
218 /// Attach to process with pid.
219 ///
220 /// \param[in] listener
221 /// An optional listener that will receive all process events.
222 /// If \a listener is valid then \a listener will listen to all
223 /// process events. If not valid, then this target's debugger
224 /// (SBTarget::GetDebugger()) will listen to all process events.
225 ///
226 /// \param[in] pid
227 /// The process ID to attach to.
228 ///
229 /// \param[out] error
230 /// An error explaining what went wrong if attach fails.
231 ///
232 /// \return
233 /// A process object for the attached process.
234 lldb::SBProcess AttachToProcessWithID(SBListener &listener, lldb::pid_t pid,
236
237 /// Attach to process with name.
238 ///
239 /// \param[in] listener
240 /// An optional listener that will receive all process events.
241 /// If \a listener is valid then \a listener will listen to all
242 /// process events. If not valid, then this target's debugger
243 /// (SBTarget::GetDebugger()) will listen to all process events.
244 ///
245 /// \param[in] name
246 /// Basename of process to attach to.
247 ///
248 /// \param[in] wait_for
249 /// If true wait for a new instance of 'name' to be launched.
250 ///
251 /// \param[out] error
252 /// An error explaining what went wrong if attach fails.
253 ///
254 /// \return
255 /// A process object for the attached process.
256 lldb::SBProcess AttachToProcessWithName(SBListener &listener,
257 const char *name, bool wait_for,
259
260 /// Connect to a remote debug server with url.
261 ///
262 /// \param[in] listener
263 /// An optional listener that will receive all process events.
264 /// If \a listener is valid then \a listener will listen to all
265 /// process events. If not valid, then this target's debugger
266 /// (SBTarget::GetDebugger()) will listen to all process events.
267 ///
268 /// \param[in] url
269 /// The url to connect to, e.g., 'connect://localhost:12345'.
270 ///
271 /// \param[in] plugin_name
272 /// The plugin name to be used; can be nullptr.
273 ///
274 /// \param[out] error
275 /// An error explaining what went wrong if the connect fails.
276 ///
277 /// \return
278 /// A process object for the connected process.
279 lldb::SBProcess ConnectRemote(SBListener &listener, const char *url,
280 const char *plugin_name, SBError &error);
281
282 lldb::SBFileSpec GetExecutable();
283
284 // Append the path mapping (from -> to) to the target's paths mapping list.
285 void AppendImageSearchPath(const char *from, const char *to,
287
288 bool AddModule(lldb::SBModule &module);
289
290 lldb::SBModule AddModule(const char *path, const char *triple,
291 const char *uuid);
292
293 lldb::SBModule AddModule(const char *path, const char *triple,
294 const char *uuid_cstr, const char *symfile);
295
296 lldb::SBModule AddModule(const SBModuleSpec &module_spec);
297
298 uint32_t GetNumModules() const;
299
300 lldb::SBModule GetModuleAtIndex(uint32_t idx);
301
302 bool RemoveModule(lldb::SBModule module);
303
304 lldb::SBDebugger GetDebugger() const;
305
306 lldb::SBModule FindModule(const lldb::SBFileSpec &file_spec);
307
308 /// Find compile units related to *this target and passed source
309 /// file.
310 ///
311 /// \param[in] sb_file_spec
312 /// A lldb::SBFileSpec object that contains source file
313 /// specification.
314 ///
315 /// \return
316 /// A lldb::SBSymbolContextList that gets filled in with all of
317 /// the symbol contexts for all the matches.
319 FindCompileUnits(const lldb::SBFileSpec &sb_file_spec);
320
321 lldb::ByteOrder GetByteOrder();
322
323 uint32_t GetAddressByteSize();
324
325 const char *GetTriple();
326
327 const char *GetABIName();
328
329 /// Architecture data byte width accessor
330 ///
331 /// \return
332 /// The size in 8-bit (host) bytes of a minimum addressable
333 /// unit from the Architecture's data bus
334 uint32_t GetDataByteSize();
335
336 /// Architecture code byte width accessor
337 ///
338 /// \return
339 /// The size in 8-bit (host) bytes of a minimum addressable
340 /// unit from the Architecture's code bus
341 uint32_t GetCodeByteSize();
342
343 /// Gets the target.max-children-count value
344 /// It should be used to limit the number of
345 /// children of large data structures to be displayed.
346 uint32_t GetMaximumNumberOfChildrenToDisplay() const;
347
348 /// Set the base load address for a module section.
349 ///
350 /// \param[in] section
351 /// The section whose base load address will be set within this
352 /// target.
353 ///
354 /// \param[in] section_base_addr
355 /// The base address for the section.
356 ///
357 /// \return
358 /// An error to indicate success, fail, and any reason for
359 /// failure.
360 lldb::SBError SetSectionLoadAddress(lldb::SBSection section,
361 lldb::addr_t section_base_addr);
362
363 /// Clear the base load address for a module section.
364 ///
365 /// \param[in] section
366 /// The section whose base load address will be cleared within
367 /// this target.
368 ///
369 /// \return
370 /// An error to indicate success, fail, and any reason for
371 /// failure.
372 lldb::SBError ClearSectionLoadAddress(lldb::SBSection section);
373
374 /// Slide all file addresses for all module sections so that \a module
375 /// appears to loaded at these slide addresses.
376 ///
377 /// When you need all sections within a module to be loaded at a
378 /// rigid slide from the addresses found in the module object file,
379 /// this function will allow you to easily and quickly slide all
380 /// module sections.
381 ///
382 /// \param[in] module
383 /// The module to load.
384 ///
385 /// \param[in] sections_offset
386 /// An offset that will be applied to all section file addresses
387 /// (the virtual addresses found in the object file itself).
388 ///
389 /// \return
390 /// An error to indicate success, fail, and any reason for
391 /// failure.
392 lldb::SBError SetModuleLoadAddress(lldb::SBModule module,
393 int64_t sections_offset);
394
395 /// Clear the section base load addresses for all sections in a module.
396 ///
397 /// \param[in] module
398 /// The module to unload.
399 ///
400 /// \return
401 /// An error to indicate success, fail, and any reason for
402 /// failure.
403 lldb::SBError ClearModuleLoadAddress(lldb::SBModule module);
404
405 /// Find functions by name.
406 ///
407 /// \param[in] name
408 /// The name of the function we are looking for.
409 ///
410 /// \param[in] name_type_mask
411 /// A logical OR of one or more FunctionNameType enum bits that
412 /// indicate what kind of names should be used when doing the
413 /// lookup. Bits include fully qualified names, base names,
414 /// C++ methods, or ObjC selectors.
415 /// See FunctionNameType for more details.
416 ///
417 /// \return
418 /// A lldb::SBSymbolContextList that gets filled in with all of
419 /// the symbol contexts for all the matches.
421 FindFunctions(const char *name,
422 uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
423
424 /// Find global and static variables by name.
425 ///
426 /// \param[in] name
427 /// The name of the global or static variable we are looking
428 /// for.
429 ///
430 /// \param[in] max_matches
431 /// Allow the number of matches to be limited to \a max_matches.
432 ///
433 /// \return
434 /// A list of matched variables in an SBValueList.
435 lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches);
436
437 /// Find the first global (or static) variable by name.
438 ///
439 /// \param[in] name
440 /// The name of the global or static variable we are looking
441 /// for.
442 ///
443 /// \return
444 /// An SBValue that gets filled in with the found variable (if any).
445 lldb::SBValue FindFirstGlobalVariable(const char *name);
446
447 /// Find global and static variables by pattern.
448 ///
449 /// \param[in] name
450 /// The pattern to search for global or static variables
451 ///
452 /// \param[in] max_matches
453 /// Allow the number of matches to be limited to \a max_matches.
454 ///
455 /// \param[in] matchtype
456 /// The match type to use.
457 ///
458 /// \return
459 /// A list of matched variables in an SBValueList.
460 lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches,
461 MatchType matchtype);
462
463 /// Find global functions by their name with pattern matching.
464 ///
465 /// \param[in] name
466 /// The pattern to search for global or static variables
467 ///
468 /// \param[in] max_matches
469 /// Allow the number of matches to be limited to \a max_matches.
470 ///
471 /// \param[in] matchtype
472 /// The match type to use.
473 ///
474 /// \return
475 /// A list of matched variables in an SBValueList.
476 lldb::SBSymbolContextList FindGlobalFunctions(const char *name,
477 uint32_t max_matches,
478 MatchType matchtype);
479
480 void Clear();
481
482 /// Resolve a current file address into a section offset address.
483 ///
484 /// \param[in] file_addr
485 /// The file address to resolve.
486 ///
487 /// \return
488 /// An SBAddress which will be valid if...
489 lldb::SBAddress ResolveFileAddress(lldb::addr_t file_addr);
490
491 /// Resolve a current load address into a section offset address.
492 ///
493 /// \param[in] vm_addr
494 /// A virtual address from the current process state that is to
495 /// be translated into a section offset address.
496 ///
497 /// \return
498 /// An SBAddress which will be valid if \a vm_addr was
499 /// successfully resolved into a section offset address, or an
500 /// invalid SBAddress if \a vm_addr doesn't resolve to a section
501 /// in a module.
503
504 /// Resolve a current load address into a section offset address
505 /// using the process stop ID to identify a time in the past.
506 ///
507 /// \param[in] stop_id
508 /// Each time a process stops, the process stop ID integer gets
509 /// incremented. These stop IDs are used to identify past times
510 /// and can be used in history objects as a cheap way to store
511 /// the time at which the sample was taken. Specifying
512 /// UINT32_MAX will always resolve the address using the
513 /// currently loaded sections.
514 ///
515 /// \param[in] vm_addr
516 /// A virtual address from the current process state that is to
517 /// be translated into a section offset address.
518 ///
519 /// \return
520 /// An SBAddress which will be valid if \a vm_addr was
521 /// successfully resolved into a section offset address, or an
522 /// invalid SBAddress if \a vm_addr doesn't resolve to a section
523 /// in a module.
524 lldb::SBAddress ResolvePastLoadAddress(uint32_t stop_id,
525 lldb::addr_t vm_addr);
526
527 SBSymbolContext ResolveSymbolContextForAddress(const SBAddress &addr,
528 uint32_t resolve_scope);
529
530 /// Read target memory. If a target process is running then memory
531 /// is read from here. Otherwise the memory is read from the object
532 /// files. For a target whose bytes are sized as a multiple of host
533 /// bytes, the data read back will preserve the target's byte order.
534 ///
535 /// \param[in] addr
536 /// A target address to read from.
537 ///
538 /// \param[out] buf
539 /// The buffer to read memory into.
540 ///
541 /// \param[in] size
542 /// The maximum number of host bytes to read in the buffer passed
543 /// into this call
544 ///
545 /// \param[out] error
546 /// Status information is written here if the memory read fails.
547 ///
548 /// \return
549 /// The amount of data read in host bytes.
550 size_t ReadMemory(const SBAddress addr, void *buf, size_t size,
552
553 lldb::SBBreakpoint BreakpointCreateByLocation(const char *file,
554 uint32_t line);
555
557 BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line);
558
560 BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
561 lldb::addr_t offset);
562
564 BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
565 lldb::addr_t offset, SBFileSpecList &module_list);
566
568 BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
569 uint32_t column, lldb::addr_t offset,
570 SBFileSpecList &module_list);
571
573 BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
574 uint32_t column, lldb::addr_t offset,
575 SBFileSpecList &module_list,
576 bool move_to_nearest_code);
577
578 lldb::SBBreakpoint BreakpointCreateByName(const char *symbol_name,
579 const char *module_name = nullptr);
580
581 // This version uses name_type_mask = eFunctionNameTypeAuto
583 BreakpointCreateByName(const char *symbol_name,
584 const SBFileSpecList &module_list,
585 const SBFileSpecList &comp_unit_list);
586
587 lldb::SBBreakpoint BreakpointCreateByName(
588 const char *symbol_name,
590 name_type_mask, // Logical OR one or more FunctionNameType enum bits
591 const SBFileSpecList &module_list,
592 const SBFileSpecList &comp_unit_list);
593
594 lldb::SBBreakpoint BreakpointCreateByName(
595 const char *symbol_name,
597 name_type_mask, // Logical OR one or more FunctionNameType enum bits
598 lldb::LanguageType symbol_language,
599 const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
600
601#ifdef SWIG
602 lldb::SBBreakpoint BreakpointCreateByNames(
603 const char **symbol_name, uint32_t num_names,
605 name_type_mask, // Logical OR one or more FunctionNameType enum bits
606 const SBFileSpecList &module_list,
607 const SBFileSpecList &comp_unit_list);
608
609 lldb::SBBreakpoint BreakpointCreateByNames(
610 const char **symbol_name, uint32_t num_names,
612 name_type_mask, // Logical OR one or more FunctionNameType enum bits
613 lldb::LanguageType symbol_language,
614 const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
615
616 lldb::SBBreakpoint BreakpointCreateByNames(
617 const char **symbol_name, uint32_t num_names,
619 name_type_mask, // Logical OR one or more FunctionNameType enum bits
620 lldb::LanguageType symbol_language,
621 lldb::addr_t offset, const SBFileSpecList &module_list,
622 const SBFileSpecList &comp_unit_list);
623#else
624 lldb::SBBreakpoint BreakpointCreateByNames(
625 const char *symbol_name[], uint32_t num_names,
627 name_type_mask, // Logical OR one or more FunctionNameType enum bits
628 const SBFileSpecList &module_list,
629 const SBFileSpecList &comp_unit_list);
630
631 lldb::SBBreakpoint BreakpointCreateByNames(
632 const char *symbol_name[], uint32_t num_names,
634 name_type_mask, // Logical OR one or more FunctionNameType enum bits
635 lldb::LanguageType symbol_language,
636 const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
637
638 lldb::SBBreakpoint BreakpointCreateByNames(
639 const char *symbol_name[], uint32_t num_names,
641 name_type_mask, // Logical OR one or more FunctionNameType enum bits
642 lldb::LanguageType symbol_language,
643 lldb::addr_t offset, const SBFileSpecList &module_list,
644 const SBFileSpecList &comp_unit_list);
645#endif
646
647 lldb::SBBreakpoint BreakpointCreateByRegex(const char *symbol_name_regex,
648 const char *module_name = nullptr);
649
651 BreakpointCreateByRegex(const char *symbol_name_regex,
652 const SBFileSpecList &module_list,
653 const SBFileSpecList &comp_unit_list);
654
655 lldb::SBBreakpoint BreakpointCreateByRegex(
656 const char *symbol_name_regex, lldb::LanguageType symbol_language,
657 const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
658
660 BreakpointCreateBySourceRegex(const char *source_regex,
661 const SBFileSpec &source_file,
662 const char *module_name = nullptr);
663
665 BreakpointCreateBySourceRegex(const char *source_regex,
666 const SBFileSpecList &module_list,
667 const SBFileSpecList &source_file);
668
669 lldb::SBBreakpoint BreakpointCreateBySourceRegex(
670 const char *source_regex, const SBFileSpecList &module_list,
671 const SBFileSpecList &source_file, const SBStringList &func_names);
672
673 lldb::SBBreakpoint BreakpointCreateForException(lldb::LanguageType language,
674 bool catch_bp, bool throw_bp);
675
676 lldb::SBBreakpoint BreakpointCreateByAddress(addr_t address);
677
678 lldb::SBBreakpoint BreakpointCreateBySBAddress(SBAddress &address);
679
680 /// Create a breakpoint using a scripted resolver.
681 ///
682 /// \param[in] class_name
683 /// This is the name of the class that implements a scripted resolver.
684 ///
685 /// \param[in] extra_args
686 /// This is an SBStructuredData object that will get passed to the
687 /// constructor of the class in class_name. You can use this to
688 /// reuse the same class, parametrizing with entries from this
689 /// dictionary.
690 ///
691 /// \param module_list
692 /// If this is non-empty, this will be used as the module filter in the
693 /// SearchFilter created for this breakpoint.
694 ///
695 /// \param file_list
696 /// If this is non-empty, this will be used as the comp unit filter in the
697 /// SearchFilter created for this breakpoint.
698 ///
699 /// \return
700 /// An SBBreakpoint that will set locations based on the logic in the
701 /// resolver's search callback.
702 lldb::SBBreakpoint BreakpointCreateFromScript(
703 const char *class_name,
704 SBStructuredData &extra_args,
705 const SBFileSpecList &module_list,
706 const SBFileSpecList &file_list,
707 bool request_hardware = false);
708
709 /// Read breakpoints from source_file and return the newly created
710 /// breakpoints in bkpt_list.
711 ///
712 /// \param[in] source_file
713 /// The file from which to read the breakpoints.
714 ///
715 /// \param[out] new_bps
716 /// A list of the newly created breakpoints.
717 ///
718 /// \return
719 /// An SBError detailing any errors in reading in the breakpoints.
720 lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file,
721 SBBreakpointList &new_bps);
722
723 /// Read breakpoints from source_file and return the newly created
724 /// breakpoints in bkpt_list.
725 ///
726 /// \param[in] source_file
727 /// The file from which to read the breakpoints.
728 ///
729 /// \param[in] matching_names
730 /// Only read in breakpoints whose names match one of the names in this
731 /// list.
732 ///
733 /// \param[out] new_bps
734 /// A list of the newly created breakpoints.
735 ///
736 /// \return
737 /// An SBError detailing any errors in reading in the breakpoints.
738 lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file,
739 SBStringList &matching_names,
740 SBBreakpointList &new_bps);
741
742 /// Write breakpoints to dest_file.
743 ///
744 /// \param[in] dest_file
745 /// The file to which to write the breakpoints.
746 ///
747 /// \return
748 /// An SBError detailing any errors in writing in the breakpoints.
749 lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file);
750
751 /// Write breakpoints listed in bkpt_list to dest_file.
752 ///
753 /// \param[in] dest_file
754 /// The file to which to write the breakpoints.
755 ///
756 /// \param[in] bkpt_list
757 /// Only write breakpoints from this list.
758 ///
759 /// \param[in] append
760 /// If \b true, append the breakpoints in bkpt_list to the others
761 /// serialized in dest_file. If dest_file doesn't exist, then a new
762 /// file will be created and the breakpoints in bkpt_list written to it.
763 ///
764 /// \return
765 /// An SBError detailing any errors in writing in the breakpoints.
766 lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file,
767 SBBreakpointList &bkpt_list,
768 bool append = false);
769
770 uint32_t GetNumBreakpoints() const;
771
772 lldb::SBBreakpoint GetBreakpointAtIndex(uint32_t idx) const;
773
774 bool BreakpointDelete(break_id_t break_id);
775
776 lldb::SBBreakpoint FindBreakpointByID(break_id_t break_id);
777
778 // Finds all breakpoints by name, returning the list in bkpt_list. Returns
779 // false if the name is not a valid breakpoint name, true otherwise.
780 bool FindBreakpointsByName(const char *name, SBBreakpointList &bkpt_list);
781
782 void GetBreakpointNames(SBStringList &names);
783
784 void DeleteBreakpointName(const char *name);
785
786 bool EnableAllBreakpoints();
787
788 bool DisableAllBreakpoints();
789
790 bool DeleteAllBreakpoints();
791
792 uint32_t GetNumWatchpoints() const;
793
794 lldb::SBWatchpoint GetWatchpointAtIndex(uint32_t idx) const;
795
796 bool DeleteWatchpoint(lldb::watch_id_t watch_id);
797
798 lldb::SBWatchpoint FindWatchpointByID(lldb::watch_id_t watch_id);
799
800 lldb::SBWatchpoint WatchAddress(lldb::addr_t addr, size_t size, bool read,
801 bool write, SBError &error);
802
803 bool EnableAllWatchpoints();
804
805 bool DisableAllWatchpoints();
806
807 bool DeleteAllWatchpoints();
808
809 lldb::SBBroadcaster GetBroadcaster() const;
810
811 lldb::SBType FindFirstType(const char *type);
812
813 lldb::SBTypeList FindTypes(const char *type);
814
815 lldb::SBType GetBasicType(lldb::BasicType type);
816
817 lldb::SBValue CreateValueFromAddress(const char *name, lldb::SBAddress addr,
818 lldb::SBType type);
819
820 lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data,
821 lldb::SBType type);
822
823 lldb::SBValue CreateValueFromExpression(const char *name, const char *expr);
824
825 SBSourceManager GetSourceManager();
826
827 lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr,
828 uint32_t count);
829
830 lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr,
831 uint32_t count,
832 const char *flavor_string);
833
834 lldb::SBInstructionList GetInstructions(lldb::SBAddress base_addr,
835 const void *buf, size_t size);
836
837 // The "WithFlavor" is necessary to keep SWIG from getting confused about
838 // overloaded arguments when using the buf + size -> Python Object magic.
839
840 lldb::SBInstructionList GetInstructionsWithFlavor(lldb::SBAddress base_addr,
841 const char *flavor_string,
842 const void *buf,
843 size_t size);
844
845#ifndef SWIG
846 lldb::SBInstructionList GetInstructions(lldb::addr_t base_addr,
847 const void *buf, size_t size);
848 lldb::SBInstructionList GetInstructionsWithFlavor(lldb::addr_t base_addr,
849 const char *flavor_string,
850 const void *buf,
851 size_t size);
852#endif
853
854 lldb::SBSymbolContextList FindSymbols(const char *name,
855 lldb::SymbolType type = eSymbolTypeAny);
856
857 bool operator==(const lldb::SBTarget &rhs) const;
858
859 bool operator!=(const lldb::SBTarget &rhs) const;
860
861 bool GetDescription(lldb::SBStream &description,
862 lldb::DescriptionLevel description_level);
863
864 lldb::SBValue EvaluateExpression(const char *expr);
865
866 lldb::SBValue EvaluateExpression(const char *expr,
867 const SBExpressionOptions &options);
868
869 lldb::addr_t GetStackRedZoneSize();
870
871 bool IsLoaded(const lldb::SBModule &module) const;
872
873 lldb::SBLaunchInfo GetLaunchInfo() const;
874
875 void SetLaunchInfo(const lldb::SBLaunchInfo &launch_info);
876
877 /// Get a \a SBTrace object the can manage the processor trace information of
878 /// this target.
879 ///
880 /// \return
881 /// The trace object. The returned SBTrace object might not be valid, so it
882 /// should be checked with a call to "bool SBTrace::IsValid()".
883 lldb::SBTrace GetTrace();
884
885 /// Create a \a Trace object for the current target using the using the
886 /// default supported tracing technology for this process.
887 ///
888 /// \param[out] error
889 /// An error if a Trace already exists or the trace couldn't be created.
890 lldb::SBTrace CreateTrace(SBError &error);
891
892protected:
893 friend class SBAddress;
894 friend class SBBlock;
895 friend class SBBreakpointList;
897 friend class SBDebugger;
898 friend class SBExecutionContext;
899 friend class SBFunction;
900 friend class SBInstruction;
901 friend class SBModule;
902 friend class SBPlatform;
903 friend class SBProcess;
904 friend class SBSection;
905 friend class SBSourceManager;
906 friend class SBSymbol;
907 friend class SBValue;
908 friend class SBVariablesOptions;
909
910 // Constructors are private, use static Target::Create function to create an
911 // instance of this class.
912
913 lldb::TargetSP GetSP() const;
914
915 void SetSP(const lldb::TargetSP &target_sp);
916
917private:
918 lldb::TargetSP m_opaque_sp;
919};
920
921} // namespace lldb
922
923#endif // LLDB_API_SBTARGET_H
static llvm::raw_ostream & error(Stream &strm)
bool operator!=(const DWARFBaseDIE &lhs, const DWARFBaseDIE &rhs)
bool operator==(const DWARFBaseDIE &lhs, const DWARFBaseDIE &rhs)
static std::optional< lldb::addr_t > ResolveLoadAddress(ExecutionContext *exe_ctx, lldb::ModuleSP &module_sp, Status *error_ptr, const char *dw_op_type, lldb::addr_t file_addr, Address &so_addr, bool check_sectionoffset=false)
Helper function to move common code used to resolve a file address and turn into a load address.
#define LLDB_API
Definition: SBDefines.h:26
SBTarget(const lldb::TargetSP &target_sp)
lldb::TargetSP m_opaque_sp
Definition: SBTarget.h:918
Definition: SBAddress.h:15
MatchType
String matching algorithm used by SBTarget.
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
LanguageType
Programming language type.
int32_t break_id_t
Definition: lldb-types.h:84
SymbolType
Symbol types.
uint64_t pid_t
Definition: lldb-types.h:81
ByteOrder
Byte ordering definitions.
int32_t watch_id_t
Definition: lldb-types.h:85
uint64_t addr_t
Definition: lldb-types.h:79