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  const char *GetABIName();
326 
327  /// Architecture data byte width accessor
328  ///
329  /// \return
330  /// The size in 8-bit (host) bytes of a minimum addressable
331  /// unit from the Architecture's data bus
332  uint32_t GetDataByteSize();
333 
334  /// Architecture code byte width accessor
335  ///
336  /// \return
337  /// The size in 8-bit (host) bytes of a minimum addressable
338  /// unit from the Architecture's code bus
339  uint32_t GetCodeByteSize();
340 
341  /// Gets the target.max-children-count value
342  /// It should be used to limit the number of
343  /// children of large data structures to be displayed.
344  uint32_t GetMaximumNumberOfChildrenToDisplay() const;
345 
346  /// Set the base load address for a module section.
347  ///
348  /// \param[in] section
349  /// The section whose base load address will be set within this
350  /// target.
351  ///
352  /// \param[in] section_base_addr
353  /// The base address for the section.
354  ///
355  /// \return
356  /// An error to indicate success, fail, and any reason for
357  /// failure.
358  lldb::SBError SetSectionLoadAddress(lldb::SBSection section,
359  lldb::addr_t section_base_addr);
360 
361  /// Clear the base load address for a module section.
362  ///
363  /// \param[in] section
364  /// The section whose base load address will be cleared within
365  /// this target.
366  ///
367  /// \return
368  /// An error to indicate success, fail, and any reason for
369  /// failure.
370  lldb::SBError ClearSectionLoadAddress(lldb::SBSection section);
371 
372  /// Slide all file addresses for all module sections so that \a module
373  /// appears to loaded at these slide addresses.
374  ///
375  /// When you need all sections within a module to be loaded at a
376  /// rigid slide from the addresses found in the module object file,
377  /// this function will allow you to easily and quickly slide all
378  /// module sections.
379  ///
380  /// \param[in] module
381  /// The module to load.
382  ///
383  /// \param[in] sections_offset
384  /// An offset that will be applied to all section file addresses
385  /// (the virtual addresses found in the object file itself).
386  ///
387  /// \return
388  /// An error to indicate success, fail, and any reason for
389  /// failure.
390  lldb::SBError SetModuleLoadAddress(lldb::SBModule module,
391  int64_t sections_offset);
392 
393  /// Clear the section base load addresses for all sections in a module.
394  ///
395  /// \param[in] module
396  /// The module to unload.
397  ///
398  /// \return
399  /// An error to indicate success, fail, and any reason for
400  /// failure.
401  lldb::SBError ClearModuleLoadAddress(lldb::SBModule module);
402 
403  /// Find functions by name.
404  ///
405  /// \param[in] name
406  /// The name of the function we are looking for.
407  ///
408  /// \param[in] name_type_mask
409  /// A logical OR of one or more FunctionNameType enum bits that
410  /// indicate what kind of names should be used when doing the
411  /// lookup. Bits include fully qualified names, base names,
412  /// C++ methods, or ObjC selectors.
413  /// See FunctionNameType for more details.
414  ///
415  /// \return
416  /// A lldb::SBSymbolContextList that gets filled in with all of
417  /// the symbol contexts for all the matches.
419  FindFunctions(const char *name,
420  uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
421 
422  /// Find global and static variables by name.
423  ///
424  /// \param[in] name
425  /// The name of the global or static variable we are looking
426  /// for.
427  ///
428  /// \param[in] max_matches
429  /// Allow the number of matches to be limited to \a max_matches.
430  ///
431  /// \return
432  /// A list of matched variables in an SBValueList.
433  lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches);
434 
435  /// Find the first global (or static) variable by name.
436  ///
437  /// \param[in] name
438  /// The name of the global or static variable we are looking
439  /// for.
440  ///
441  /// \return
442  /// An SBValue that gets filled in with the found variable (if any).
443  lldb::SBValue FindFirstGlobalVariable(const char *name);
444 
445  /// Find global and static variables by pattern.
446  ///
447  /// \param[in] name
448  /// The pattern to search for global or static variables
449  ///
450  /// \param[in] max_matches
451  /// Allow the number of matches to be limited to \a max_matches.
452  ///
453  /// \param[in] matchtype
454  /// The match type to use.
455  ///
456  /// \return
457  /// A list of matched variables in an SBValueList.
458  lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches,
459  MatchType matchtype);
460 
461  /// Find global functions by their name with pattern matching.
462  ///
463  /// \param[in] name
464  /// The pattern to search for global or static variables
465  ///
466  /// \param[in] max_matches
467  /// Allow the number of matches to be limited to \a max_matches.
468  ///
469  /// \param[in] matchtype
470  /// The match type to use.
471  ///
472  /// \return
473  /// A list of matched variables in an SBValueList.
474  lldb::SBSymbolContextList FindGlobalFunctions(const char *name,
475  uint32_t max_matches,
476  MatchType matchtype);
477 
478  void Clear();
479 
480  /// Resolve a current file address into a section offset address.
481  ///
482  /// \param[in] file_addr
483  /// The file address to resolve.
484  ///
485  /// \return
486  /// An SBAddress which will be valid if...
487  lldb::SBAddress ResolveFileAddress(lldb::addr_t file_addr);
488 
489  /// Resolve a current load address into a section offset address.
490  ///
491  /// \param[in] vm_addr
492  /// A virtual address from the current process state that is to
493  /// be translated into a section offset address.
494  ///
495  /// \return
496  /// An SBAddress which will be valid if \a vm_addr was
497  /// successfully resolved into a section offset address, or an
498  /// invalid SBAddress if \a vm_addr doesn't resolve to a section
499  /// in a module.
501 
502  /// Resolve a current load address into a section offset address
503  /// using the process stop ID to identify a time in the past.
504  ///
505  /// \param[in] stop_id
506  /// Each time a process stops, the process stop ID integer gets
507  /// incremented. These stop IDs are used to identify past times
508  /// and can be used in history objects as a cheap way to store
509  /// the time at which the sample was taken. Specifying
510  /// UINT32_MAX will always resolve the address using the
511  /// currently loaded sections.
512  ///
513  /// \param[in] vm_addr
514  /// A virtual address from the current process state that is to
515  /// be translated into a section offset address.
516  ///
517  /// \return
518  /// An SBAddress which will be valid if \a vm_addr was
519  /// successfully resolved into a section offset address, or an
520  /// invalid SBAddress if \a vm_addr doesn't resolve to a section
521  /// in a module.
522  lldb::SBAddress ResolvePastLoadAddress(uint32_t stop_id,
523  lldb::addr_t vm_addr);
524 
525  SBSymbolContext ResolveSymbolContextForAddress(const SBAddress &addr,
526  uint32_t resolve_scope);
527 
528  /// Read target memory. If a target process is running then memory
529  /// is read from here. Otherwise the memory is read from the object
530  /// files. For a target whose bytes are sized as a multiple of host
531  /// bytes, the data read back will preserve the target's byte order.
532  ///
533  /// \param[in] addr
534  /// A target address to read from.
535  ///
536  /// \param[out] buf
537  /// The buffer to read memory into.
538  ///
539  /// \param[in] size
540  /// The maximum number of host bytes to read in the buffer passed
541  /// into this call
542  ///
543  /// \param[out] error
544  /// Status information is written here if the memory read fails.
545  ///
546  /// \return
547  /// The amount of data read in host bytes.
548  size_t ReadMemory(const SBAddress addr, void *buf, size_t size,
550 
551  lldb::SBBreakpoint BreakpointCreateByLocation(const char *file,
552  uint32_t line);
553 
555  BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line);
556 
558  BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
559  lldb::addr_t offset);
560 
562  BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
563  lldb::addr_t offset, SBFileSpecList &module_list);
564 
566  BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
567  uint32_t column, lldb::addr_t offset,
568  SBFileSpecList &module_list);
569 
571  BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
572  uint32_t column, lldb::addr_t offset,
573  SBFileSpecList &module_list,
574  bool move_to_nearest_code);
575 
576  lldb::SBBreakpoint BreakpointCreateByName(const char *symbol_name,
577  const char *module_name = nullptr);
578 
579  // This version uses name_type_mask = eFunctionNameTypeAuto
581  BreakpointCreateByName(const char *symbol_name,
582  const SBFileSpecList &module_list,
583  const SBFileSpecList &comp_unit_list);
584 
585  lldb::SBBreakpoint BreakpointCreateByName(
586  const char *symbol_name,
587  uint32_t
588  name_type_mask, // Logical OR one or more FunctionNameType enum bits
589  const SBFileSpecList &module_list,
590  const SBFileSpecList &comp_unit_list);
591 
592  lldb::SBBreakpoint BreakpointCreateByName(
593  const char *symbol_name,
594  uint32_t
595  name_type_mask, // Logical OR one or more FunctionNameType enum bits
596  lldb::LanguageType symbol_language,
597  const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
598 
599  lldb::SBBreakpoint BreakpointCreateByNames(
600  const char *symbol_name[], uint32_t num_names,
601  uint32_t
602  name_type_mask, // Logical OR one or more FunctionNameType enum bits
603  const SBFileSpecList &module_list,
604  const SBFileSpecList &comp_unit_list);
605 
606  lldb::SBBreakpoint BreakpointCreateByNames(
607  const char *symbol_name[], uint32_t num_names,
608  uint32_t
609  name_type_mask, // Logical OR one or more FunctionNameType enum bits
610  lldb::LanguageType symbol_language,
611  const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
612 
613  lldb::SBBreakpoint BreakpointCreateByNames(
614  const char *symbol_name[], uint32_t num_names,
615  uint32_t
616  name_type_mask, // Logical OR one or more FunctionNameType enum bits
617  lldb::LanguageType symbol_language,
618  lldb::addr_t offset, const SBFileSpecList &module_list,
619  const SBFileSpecList &comp_unit_list);
620 
621  lldb::SBBreakpoint BreakpointCreateByRegex(const char *symbol_name_regex,
622  const char *module_name = nullptr);
623 
625  BreakpointCreateByRegex(const char *symbol_name_regex,
626  const SBFileSpecList &module_list,
627  const SBFileSpecList &comp_unit_list);
628 
629  lldb::SBBreakpoint BreakpointCreateByRegex(
630  const char *symbol_name_regex, lldb::LanguageType symbol_language,
631  const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
632 
634  BreakpointCreateBySourceRegex(const char *source_regex,
635  const SBFileSpec &source_file,
636  const char *module_name = nullptr);
637 
639  BreakpointCreateBySourceRegex(const char *source_regex,
640  const SBFileSpecList &module_list,
641  const SBFileSpecList &source_file);
642 
643  lldb::SBBreakpoint BreakpointCreateBySourceRegex(
644  const char *source_regex, const SBFileSpecList &module_list,
645  const SBFileSpecList &source_file, const SBStringList &func_names);
646 
647  lldb::SBBreakpoint BreakpointCreateForException(lldb::LanguageType language,
648  bool catch_bp, bool throw_bp);
649 
650  lldb::SBBreakpoint BreakpointCreateByAddress(addr_t address);
651 
652  lldb::SBBreakpoint BreakpointCreateBySBAddress(SBAddress &address);
653 
654  /// Create a breakpoint using a scripted resolver.
655  ///
656  /// \param[in] class_name
657  /// This is the name of the class that implements a scripted resolver.
658  ///
659  /// \param[in] extra_args
660  /// This is an SBStructuredData object that will get passed to the
661  /// constructor of the class in class_name. You can use this to
662  /// reuse the same class, parametrizing with entries from this
663  /// dictionary.
664  ///
665  /// \param module_list
666  /// If this is non-empty, this will be used as the module filter in the
667  /// SearchFilter created for this breakpoint.
668  ///
669  /// \param file_list
670  /// If this is non-empty, this will be used as the comp unit filter in the
671  /// SearchFilter created for this breakpoint.
672  ///
673  /// \return
674  /// An SBBreakpoint that will set locations based on the logic in the
675  /// resolver's search callback.
676  lldb::SBBreakpoint BreakpointCreateFromScript(
677  const char *class_name,
678  SBStructuredData &extra_args,
679  const SBFileSpecList &module_list,
680  const SBFileSpecList &file_list,
681  bool request_hardware = false);
682 
683  /// Read breakpoints from source_file and return the newly created
684  /// breakpoints in bkpt_list.
685  ///
686  /// \param[in] source_file
687  /// The file from which to read the breakpoints.
688  ///
689  /// \param[out] new_bps
690  /// A list of the newly created breakpoints.
691  ///
692  /// \return
693  /// An SBError detailing any errors in reading in the breakpoints.
694  lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file,
695  SBBreakpointList &new_bps);
696 
697  /// Read breakpoints from source_file and return the newly created
698  /// breakpoints in bkpt_list.
699  ///
700  /// \param[in] source_file
701  /// The file from which to read the breakpoints.
702  ///
703  /// \param[in] matching_names
704  /// Only read in breakpoints whose names match one of the names in this
705  /// list.
706  ///
707  /// \param[out] new_bps
708  /// A list of the newly created breakpoints.
709  ///
710  /// \return
711  /// An SBError detailing any errors in reading in the breakpoints.
712  lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file,
713  SBStringList &matching_names,
714  SBBreakpointList &new_bps);
715 
716  /// Write breakpoints to dest_file.
717  ///
718  /// \param[in] dest_file
719  /// The file to which to write the breakpoints.
720  ///
721  /// \return
722  /// An SBError detailing any errors in writing in the breakpoints.
723  lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file);
724 
725  /// Write breakpoints listed in bkpt_list to dest_file.
726  ///
727  /// \param[in] dest_file
728  /// The file to which to write the breakpoints.
729  ///
730  /// \param[in] bkpt_list
731  /// Only write breakpoints from this list.
732  ///
733  /// \param[in] append
734  /// If \b true, append the breakpoints in bkpt_list to the others
735  /// serialized in dest_file. If dest_file doesn't exist, then a new
736  /// file will be created and the breakpoints in bkpt_list written to it.
737  ///
738  /// \return
739  /// An SBError detailing any errors in writing in the breakpoints.
740  lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file,
741  SBBreakpointList &bkpt_list,
742  bool append = false);
743 
744  uint32_t GetNumBreakpoints() const;
745 
746  lldb::SBBreakpoint GetBreakpointAtIndex(uint32_t idx) const;
747 
748  bool BreakpointDelete(break_id_t break_id);
749 
750  lldb::SBBreakpoint FindBreakpointByID(break_id_t break_id);
751 
752  // Finds all breakpoints by name, returning the list in bkpt_list. Returns
753  // false if the name is not a valid breakpoint name, true otherwise.
754  bool FindBreakpointsByName(const char *name, SBBreakpointList &bkpt_list);
755 
756  void GetBreakpointNames(SBStringList &names);
757 
758  void DeleteBreakpointName(const char *name);
759 
760  bool EnableAllBreakpoints();
761 
762  bool DisableAllBreakpoints();
763 
764  bool DeleteAllBreakpoints();
765 
766  uint32_t GetNumWatchpoints() const;
767 
768  lldb::SBWatchpoint GetWatchpointAtIndex(uint32_t idx) const;
769 
770  bool DeleteWatchpoint(lldb::watch_id_t watch_id);
771 
772  lldb::SBWatchpoint FindWatchpointByID(lldb::watch_id_t watch_id);
773 
774  lldb::SBWatchpoint WatchAddress(lldb::addr_t addr, size_t size, bool read,
775  bool write, SBError &error);
776 
777  bool EnableAllWatchpoints();
778 
779  bool DisableAllWatchpoints();
780 
781  bool DeleteAllWatchpoints();
782 
783  lldb::SBBroadcaster GetBroadcaster() const;
784 
785  lldb::SBType FindFirstType(const char *type);
786 
787  lldb::SBTypeList FindTypes(const char *type);
788 
789  lldb::SBType GetBasicType(lldb::BasicType type);
790 
791  lldb::SBValue CreateValueFromAddress(const char *name, lldb::SBAddress addr,
792  lldb::SBType type);
793 
794  lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data,
795  lldb::SBType type);
796 
797  lldb::SBValue CreateValueFromExpression(const char *name, const char *expr);
798 
799  SBSourceManager GetSourceManager();
800 
801  lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr,
802  uint32_t count);
803 
804  lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr,
805  uint32_t count,
806  const char *flavor_string);
807 
808  lldb::SBInstructionList GetInstructions(lldb::SBAddress base_addr,
809  const void *buf, size_t size);
810 
811  // The "WithFlavor" is necessary to keep SWIG from getting confused about
812  // overloaded arguments when using the buf + size -> Python Object magic.
813 
814  lldb::SBInstructionList GetInstructionsWithFlavor(lldb::SBAddress base_addr,
815  const char *flavor_string,
816  const void *buf,
817  size_t size);
818 
819  lldb::SBInstructionList GetInstructions(lldb::addr_t base_addr,
820  const void *buf, size_t size);
821 
822  lldb::SBInstructionList GetInstructionsWithFlavor(lldb::addr_t base_addr,
823  const char *flavor_string,
824  const void *buf,
825  size_t size);
826 
827  lldb::SBSymbolContextList FindSymbols(const char *name,
829 
830  bool operator==(const lldb::SBTarget &rhs) const;
831 
832  bool operator!=(const lldb::SBTarget &rhs) const;
833 
834  bool GetDescription(lldb::SBStream &description,
835  lldb::DescriptionLevel description_level);
836 
837  lldb::SBValue EvaluateExpression(const char *expr);
838 
839  lldb::SBValue EvaluateExpression(const char *expr,
840  const SBExpressionOptions &options);
841 
842  lldb::addr_t GetStackRedZoneSize();
843 
844  bool IsLoaded(const lldb::SBModule &module) const;
845 
846  lldb::SBLaunchInfo GetLaunchInfo() const;
847 
848  void SetLaunchInfo(const lldb::SBLaunchInfo &launch_info);
849 
850  /// Get a \a SBTrace object the can manage the processor trace information of
851  /// this target.
852  ///
853  /// \return
854  /// The trace object. The returned SBTrace object might not be valid, so it
855  /// should be checked with a call to "bool SBTrace::IsValid()".
856  lldb::SBTrace GetTrace();
857 
858  /// Create a \a Trace object for the current target using the using the
859  /// default supported tracing technology for this process.
860  ///
861  /// \param[out] error
862  /// An error if a Trace already exists or the trace couldn't be created.
863  lldb::SBTrace CreateTrace(SBError &error);
864 
865 protected:
866  friend class SBAddress;
867  friend class SBBlock;
868  friend class SBBreakpointList;
869  friend class SBBreakpointNameImpl;
870  friend class SBDebugger;
871  friend class SBExecutionContext;
872  friend class SBFunction;
873  friend class SBInstruction;
874  friend class SBModule;
875  friend class SBPlatform;
876  friend class SBProcess;
877  friend class SBSection;
878  friend class SBSourceManager;
879  friend class SBSymbol;
880  friend class SBValue;
881  friend class SBVariablesOptions;
882 
883  // Constructors are private, use static Target::Create function to create an
884  // instance of this class.
885 
886  lldb::TargetSP GetSP() const;
887 
888  void SetSP(const lldb::TargetSP &target_sp);
889 
890 private:
891  lldb::TargetSP m_opaque_sp;
892 };
893 
894 } // namespace lldb
895 
896 #endif // LLDB_API_SBTARGET_H
lldb::SBValueList
Definition: SBValueList.h:18
lldb::SBStringList
Definition: SBStringList.h:16
lldb::SBLaunchInfo
Definition: SBLaunchInfo.h:23
lldb::SBVariablesOptions
Definition: SBVariablesOptions.h:19
lldb::SBModuleSpec
Definition: SBModuleSpec.h:17
SBDefines.h
lldb::MatchType
MatchType
String matching algorithm used by SBTarget.
Definition: lldb-enumerations.h:1039
SBLaunchInfo.h
lldb::SBError
Definition: SBError.h:20
lldb::SBValue
Definition: SBValue.h:21
SBFileSpecList.h
lldb::SBSymbol
Definition: SBSymbol.h:19
lldb::SBSymbolContextList
Definition: SBSymbolContextList.h:17
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb::SBEvent
Definition: SBEvent.h:21
lldb::SBProcess
Definition: SBProcess.h:23
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb::BasicType
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
Definition: lldb-enumerations.h:747
SBWatchpoint.h
SBSymbolContextList.h
lldb::SBExecutionContext
Definition: SBExecutionContext.h:20
lldb::SBInstructionList
Definition: SBInstructionList.h:18
lldb::SBTrace
Definition: SBTrace.h:17
lldb::SBTarget
Definition: SBTarget.h:29
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb::eSymbolTypeAny
@ eSymbolTypeAny
Definition: lldb-enumerations.h:619
lldb::SBDebugger
Definition: SBDebugger.h:34
SBFileSpec.h
lldb::SBBlock
Definition: SBBlock.h:19
lldb::break_id_t
int32_t break_id_t
Definition: lldb-types.h:88
SBBroadcaster.h
SBAttachInfo.h
lldb::operator==
bool LLDB_API operator==(const SBAddress &lhs, const SBAddress &rhs)
Definition: SBAddress.cpp:60
lldb::SBFunction
Definition: SBFunction.h:18
lldb::SBEnvironment
Definition: SBEnvironment.h:16
lldb::SBSection
Definition: SBSection.h:17
lldb::watch_id_t
int32_t watch_id_t
Definition: lldb-types.h:89
lldb::SBBreakpointNameImpl
Definition: SBBreakpointName.cpp:35
lldb::SymbolType
SymbolType
Symbol types.
Definition: lldb-enumerations.h:618
lldb::SBBreakpointList
Definition: SBBreakpoint.h:159
SBAddress.h
lldb_private::operator!=
bool operator!=(const Address &lhs, const Address &rhs)
Definition: Address.cpp:1022
lldb::SBType
Definition: SBType.h:104
SBType.h
lldb::SBTypeList
Definition: SBType.h:243
lldb::SBWatchpoint
Definition: SBWatchpoint.h:16
lldb::SBExpressionOptions
Definition: SBExpressionOptions.h:18
lldb::SBListener
Definition: SBListener.h:16
lldb::SBSymbolContext
Definition: SBSymbolContext.h:22
uint32_t
lldb::SBTarget::m_opaque_sp
lldb::TargetSP m_opaque_sp
Definition: SBTarget.h:891
lldb::SBStructuredData
Definition: SBStructuredData.h:17
lldb::SBBreakpoint
Definition: SBBreakpoint.h:18
lldb::pid_t
uint64_t pid_t
Definition: lldb-types.h:85
ResolveLoadAddress
static llvm::Optional< lldb::addr_t > ResolveLoadAddress(ExecutionContext *exe_ctx, lldb::ModuleSP &module_sp, Status *error_ptr, const char *dw_op_type, lldb::addr_t file_addr, Address &so_addr, bool check_sectionoffset=false)
Helper function to move common code used to resolve a file address and turn into a load address.
Definition: DWARFExpression.cpp:962
lldb::SBTarget
class LLDB_API SBTarget
Definition: SBDefines.h:86
lldb::SBModule
Definition: SBModule.h:20
lldb::SBData
Definition: SBData.h:20
SBValue.h
lldb::SBInstruction
Definition: SBInstruction.h:24
lldb::SBFileSpec
Definition: SBFileSpec.h:16
lldb::SBAddress
Definition: SBAddress.h:17
lldb::SBBroadcaster
Definition: SBBroadcaster.h:16
lldb::SBStream
Definition: SBStream.h:18
lldb::SBPlatform
Definition: SBPlatform.h:93
lldb::SBAttachInfo
Definition: SBAttachInfo.h:18
lldb
Definition: SBAddress.h:15
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207
lldb::SBFileSpecList
Definition: SBFileSpecList.h:17
SBBreakpoint.h
lldb::ByteOrder
ByteOrder
Byte ordering definitions.
Definition: lldb-enumerations.h:138
LLDB_API
#define LLDB_API
Definition: SBDefines.h:26
lldb::SBSourceManager
Definition: SBSourceManager.h:18