LLDB API Documentation

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