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