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