Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:42

0001 //===-- SBTarget.h ----------------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_API_SBTARGET_H
0010 #define LLDB_API_SBTARGET_H
0011 
0012 #include "lldb/API/SBAddress.h"
0013 #include "lldb/API/SBAttachInfo.h"
0014 #include "lldb/API/SBBreakpoint.h"
0015 #include "lldb/API/SBBroadcaster.h"
0016 #include "lldb/API/SBDefines.h"
0017 #include "lldb/API/SBFileSpec.h"
0018 #include "lldb/API/SBFileSpecList.h"
0019 #include "lldb/API/SBLaunchInfo.h"
0020 #include "lldb/API/SBStatisticsOptions.h"
0021 #include "lldb/API/SBSymbolContextList.h"
0022 #include "lldb/API/SBType.h"
0023 #include "lldb/API/SBValue.h"
0024 #include "lldb/API/SBWatchpoint.h"
0025 #include "lldb/API/SBWatchpointOptions.h"
0026 
0027 namespace lldb_private {
0028 namespace python {
0029 class SWIGBridge;
0030 }
0031 } // namespace lldb_private
0032 
0033 namespace lldb {
0034 
0035 class SBPlatform;
0036 
0037 class LLDB_API SBTarget {
0038 public:
0039   // Broadcaster bits.
0040   enum {
0041     eBroadcastBitBreakpointChanged = (1 << 0),
0042     eBroadcastBitModulesLoaded = (1 << 1),
0043     eBroadcastBitModulesUnloaded = (1 << 2),
0044     eBroadcastBitWatchpointChanged = (1 << 3),
0045     eBroadcastBitSymbolsLoaded = (1 << 4),
0046     eBroadcastBitSymbolsChanged = (1 << 5),
0047   };
0048 
0049   // Constructors
0050   SBTarget();
0051 
0052   SBTarget(const lldb::SBTarget &rhs);
0053 
0054   // Destructor
0055   ~SBTarget();
0056 
0057   const lldb::SBTarget &operator=(const lldb::SBTarget &rhs);
0058 
0059   explicit operator bool() const;
0060 
0061   bool IsValid() const;
0062 
0063   static bool EventIsTargetEvent(const lldb::SBEvent &event);
0064 
0065   static lldb::SBTarget GetTargetFromEvent(const lldb::SBEvent &event);
0066 
0067   static uint32_t GetNumModulesFromEvent(const lldb::SBEvent &event);
0068 
0069   static lldb::SBModule GetModuleAtIndexFromEvent(const uint32_t idx,
0070                                                   const lldb::SBEvent &event);
0071 
0072   static const char *GetBroadcasterClassName();
0073 
0074   lldb::SBProcess GetProcess();
0075 
0076   /// Sets whether we should collect statistics on lldb or not.
0077   ///
0078   /// \param[in] v
0079   ///     A boolean to control the collection.
0080   void SetCollectingStats(bool v);
0081 
0082   /// Returns whether statistics collection are enabled.
0083   ///
0084   /// \return
0085   ///     true if statistics are currently being collected, false
0086   ///     otherwise.
0087   bool GetCollectingStats();
0088 
0089   /// Returns a dump of the collected statistics.
0090   ///
0091   /// \return
0092   ///     A SBStructuredData with the statistics collected.
0093   lldb::SBStructuredData GetStatistics();
0094 
0095   /// Returns a dump of the collected statistics.
0096   ///
0097   /// \param[in] options
0098   ///   An objects object that contains all options for the statistics dumping.
0099   ///
0100   /// \return
0101   ///     A SBStructuredData with the statistics collected.
0102   lldb::SBStructuredData GetStatistics(SBStatisticsOptions options);
0103 
0104   /// Reset the statistics collected for this target.
0105   /// This includes clearing symbol table and debug info parsing/index time for
0106   /// all modules, breakpoint resolve time and target statistics.
0107   void ResetStatistics();
0108 
0109   /// Return the platform object associated with the target.
0110   ///
0111   /// After return, the platform object should be checked for
0112   /// validity.
0113   ///
0114   /// \return
0115   ///     A platform object.
0116   lldb::SBPlatform GetPlatform();
0117 
0118   /// Return the environment variables that would be used to launch a new
0119   /// process.
0120   ///
0121   /// \return
0122   ///     An lldb::SBEnvironment object which is a copy of the target's
0123   ///     environment.
0124 
0125   SBEnvironment GetEnvironment();
0126 
0127   /// Install any binaries that need to be installed.
0128   ///
0129   /// This function does nothing when debugging on the host system.
0130   /// When connected to remote platforms, the target's main executable
0131   /// and any modules that have their remote install path set will be
0132   /// installed on the remote platform. If the main executable doesn't
0133   /// have an install location set, it will be installed in the remote
0134   /// platform's working directory.
0135   ///
0136   /// \return
0137   ///     An error describing anything that went wrong during
0138   ///     installation.
0139   SBError Install();
0140 
0141   /// Launch a new process.
0142   ///
0143   /// Launch a new process by spawning a new process using the
0144   /// target object's executable module's file as the file to launch.
0145   /// Arguments are given in \a argv, and the environment variables
0146   /// are in \a envp. Standard input and output files can be
0147   /// optionally re-directed to \a stdin_path, \a stdout_path, and
0148   /// \a stderr_path.
0149   ///
0150   /// \param[in] listener
0151   ///     An optional listener that will receive all process events.
0152   ///     If \a listener is valid then \a listener will listen to all
0153   ///     process events. If not valid, then this target's debugger
0154   ///     (SBTarget::GetDebugger()) will listen to all process events.
0155   ///
0156   /// \param[in] argv
0157   ///     The argument array.
0158   ///
0159   /// \param[in] envp
0160   ///     The environment array. If this is null, the default
0161   ///     environment values (provided through `settings set
0162   ///     target.env-vars`) will be used.
0163   ///
0164   /// \param[in] stdin_path
0165   ///     The path to use when re-directing the STDIN of the new
0166   ///     process. If all stdXX_path arguments are nullptr, a pseudo
0167   ///     terminal will be used.
0168   ///
0169   /// \param[in] stdout_path
0170   ///     The path to use when re-directing the STDOUT of the new
0171   ///     process. If all stdXX_path arguments are nullptr, a pseudo
0172   ///     terminal will be used.
0173   ///
0174   /// \param[in] stderr_path
0175   ///     The path to use when re-directing the STDERR of the new
0176   ///     process. If all stdXX_path arguments are nullptr, a pseudo
0177   ///     terminal will be used.
0178   ///
0179   /// \param[in] working_directory
0180   ///     The working directory to have the child process run in
0181   ///
0182   /// \param[in] launch_flags
0183   ///     Some launch options specified by logical OR'ing
0184   ///     lldb::LaunchFlags enumeration values together.
0185   ///
0186   /// \param[in] stop_at_entry
0187   ///     If false do not stop the inferior at the entry point.
0188   ///
0189   /// \param[out] error
0190   ///     An error object. Contains the reason if there is some failure.
0191   ///
0192   /// \return
0193   ///      A process object for the newly created process.
0194   lldb::SBProcess Launch(SBListener &listener, char const **argv,
0195                          char const **envp, const char *stdin_path,
0196                          const char *stdout_path, const char *stderr_path,
0197                          const char *working_directory,
0198                          uint32_t launch_flags, // See LaunchFlags
0199                          bool stop_at_entry, lldb::SBError &error);
0200 
0201   SBProcess LoadCore(const char *core_file);
0202   SBProcess LoadCore(const char *core_file, lldb::SBError &error);
0203 
0204   /// Launch a new process with sensible defaults.
0205   ///
0206   /// \param[in] argv
0207   ///     The argument array.
0208   ///
0209   /// \param[in] envp
0210   ///     The environment array. If this isn't provided, the default
0211   ///     environment values (provided through `settings set
0212   ///     target.env-vars`) will be used.
0213   ///
0214   /// \param[in] working_directory
0215   ///     The working directory to have the child process run in
0216   ///
0217   /// Default: listener
0218   ///     Set to the target's debugger (SBTarget::GetDebugger())
0219   ///
0220   /// Default: launch_flags
0221   ///     Empty launch flags
0222   ///
0223   /// Default: stdin_path
0224   /// Default: stdout_path
0225   /// Default: stderr_path
0226   ///     A pseudo terminal will be used.
0227   ///
0228   /// \return
0229   ///      A process object for the newly created process.
0230   SBProcess LaunchSimple(const char **argv, const char **envp,
0231                          const char *working_directory);
0232 
0233   SBProcess Launch(SBLaunchInfo &launch_info, SBError &error);
0234 
0235   SBProcess Attach(SBAttachInfo &attach_info, SBError &error);
0236 
0237   /// Attach to process with pid.
0238   ///
0239   /// \param[in] listener
0240   ///     An optional listener that will receive all process events.
0241   ///     If \a listener is valid then \a listener will listen to all
0242   ///     process events. If not valid, then this target's debugger
0243   ///     (SBTarget::GetDebugger()) will listen to all process events.
0244   ///
0245   /// \param[in] pid
0246   ///     The process ID to attach to.
0247   ///
0248   /// \param[out] error
0249   ///     An error explaining what went wrong if attach fails.
0250   ///
0251   /// \return
0252   ///      A process object for the attached process.
0253   lldb::SBProcess AttachToProcessWithID(SBListener &listener, lldb::pid_t pid,
0254                                         lldb::SBError &error);
0255 
0256   /// Attach to process with name.
0257   ///
0258   /// \param[in] listener
0259   ///     An optional listener that will receive all process events.
0260   ///     If \a listener is valid then \a listener will listen to all
0261   ///     process events. If not valid, then this target's debugger
0262   ///     (SBTarget::GetDebugger()) will listen to all process events.
0263   ///
0264   /// \param[in] name
0265   ///     Basename of process to attach to.
0266   ///
0267   /// \param[in] wait_for
0268   ///     If true wait for a new instance of 'name' to be launched.
0269   ///
0270   /// \param[out] error
0271   ///     An error explaining what went wrong if attach fails.
0272   ///
0273   /// \return
0274   ///      A process object for the attached process.
0275   lldb::SBProcess AttachToProcessWithName(SBListener &listener,
0276                                           const char *name, bool wait_for,
0277                                           lldb::SBError &error);
0278 
0279   /// Connect to a remote debug server with url.
0280   ///
0281   /// \param[in] listener
0282   ///     An optional listener that will receive all process events.
0283   ///     If \a listener is valid then \a listener will listen to all
0284   ///     process events. If not valid, then this target's debugger
0285   ///     (SBTarget::GetDebugger()) will listen to all process events.
0286   ///
0287   /// \param[in] url
0288   ///     The url to connect to, e.g., 'connect://localhost:12345'.
0289   ///
0290   /// \param[in] plugin_name
0291   ///     The plugin name to be used; can be nullptr.
0292   ///
0293   /// \param[out] error
0294   ///     An error explaining what went wrong if the connect fails.
0295   ///
0296   /// \return
0297   ///      A process object for the connected process.
0298   lldb::SBProcess ConnectRemote(SBListener &listener, const char *url,
0299                                 const char *plugin_name, SBError &error);
0300 
0301   lldb::SBFileSpec GetExecutable();
0302 
0303   // Append the path mapping (from -> to) to the target's paths mapping list.
0304   void AppendImageSearchPath(const char *from, const char *to,
0305                              lldb::SBError &error);
0306 
0307   bool AddModule(lldb::SBModule &module);
0308 
0309   lldb::SBModule AddModule(const char *path, const char *triple,
0310                            const char *uuid);
0311 
0312   lldb::SBModule AddModule(const char *path, const char *triple,
0313                            const char *uuid_cstr, const char *symfile);
0314 
0315   lldb::SBModule AddModule(const SBModuleSpec &module_spec);
0316 
0317   uint32_t GetNumModules() const;
0318 
0319   lldb::SBModule GetModuleAtIndex(uint32_t idx);
0320 
0321   bool RemoveModule(lldb::SBModule module);
0322 
0323   lldb::SBDebugger GetDebugger() const;
0324 
0325   lldb::SBModule FindModule(const lldb::SBFileSpec &file_spec);
0326 
0327   /// Find compile units related to *this target and passed source
0328   /// file.
0329   ///
0330   /// \param[in] sb_file_spec
0331   ///     A lldb::SBFileSpec object that contains source file
0332   ///     specification.
0333   ///
0334   /// \return
0335   ///     A lldb::SBSymbolContextList that gets filled in with all of
0336   ///     the symbol contexts for all the matches.
0337   lldb::SBSymbolContextList
0338   FindCompileUnits(const lldb::SBFileSpec &sb_file_spec);
0339 
0340   lldb::ByteOrder GetByteOrder();
0341 
0342   uint32_t GetAddressByteSize();
0343 
0344   const char *GetTriple();
0345   
0346   const char *GetABIName();
0347 
0348   const char *GetLabel() const;
0349 
0350   SBError SetLabel(const char *label);
0351 
0352   /// Architecture data byte width accessor
0353   ///
0354   /// \return
0355   /// The size in 8-bit (host) bytes of a minimum addressable
0356   /// unit from the Architecture's data bus
0357   uint32_t GetDataByteSize();
0358 
0359   /// Architecture code byte width accessor
0360   ///
0361   /// \return
0362   /// The size in 8-bit (host) bytes of a minimum addressable
0363   /// unit from the Architecture's code bus
0364   uint32_t GetCodeByteSize();
0365 
0366   /// Gets the target.max-children-count value
0367   /// It should be used to limit the number of
0368   /// children of large data structures to be displayed.
0369   uint32_t GetMaximumNumberOfChildrenToDisplay() const;
0370 
0371   /// Set the base load address for a module section.
0372   ///
0373   /// \param[in] section
0374   ///     The section whose base load address will be set within this
0375   ///     target.
0376   ///
0377   /// \param[in] section_base_addr
0378   ///     The base address for the section.
0379   ///
0380   /// \return
0381   ///      An error to indicate success, fail, and any reason for
0382   ///     failure.
0383   lldb::SBError SetSectionLoadAddress(lldb::SBSection section,
0384                                       lldb::addr_t section_base_addr);
0385 
0386   /// Clear the base load address for a module section.
0387   ///
0388   /// \param[in] section
0389   ///     The section whose base load address will be cleared within
0390   ///     this target.
0391   ///
0392   /// \return
0393   ///      An error to indicate success, fail, and any reason for
0394   ///     failure.
0395   lldb::SBError ClearSectionLoadAddress(lldb::SBSection section);
0396 
0397 #ifndef SWIG
0398   /// Slide all file addresses for all module sections so that \a module
0399   /// appears to loaded at these slide addresses.
0400   ///
0401   /// When you need all sections within a module to be loaded at a
0402   /// rigid slide from the addresses found in the module object file,
0403   /// this function will allow you to easily and quickly slide all
0404   /// module sections.
0405   ///
0406   /// \param[in] module
0407   ///     The module to load.
0408   ///
0409   /// \param[in] sections_offset
0410   ///     An offset that will be applied to all section file addresses
0411   ///     (the virtual addresses found in the object file itself).
0412   ///
0413   /// \return
0414   ///     An error to indicate success, fail, and any reason for
0415   ///     failure.
0416   LLDB_DEPRECATED_FIXME("Use SetModuleLoadAddress(lldb::SBModule, uint64_t)",
0417                         "SetModuleLoadAddress(lldb::SBModule, uint64_t)")
0418   lldb::SBError SetModuleLoadAddress(lldb::SBModule module,
0419                                      int64_t sections_offset);
0420 #endif
0421 
0422   /// Slide all file addresses for all module sections so that \a module
0423   /// appears to loaded at these slide addresses.
0424   ///
0425   /// When you need all sections within a module to be loaded at a
0426   /// rigid slide from the addresses found in the module object file,
0427   /// this function will allow you to easily and quickly slide all
0428   /// module sections.
0429   ///
0430   /// \param[in] module
0431   ///     The module to load.
0432   ///
0433   /// \param[in] sections_offset
0434   ///     An offset that will be applied to all section file addresses
0435   ///     (the virtual addresses found in the object file itself).
0436   ///
0437   /// \return
0438   ///     An error to indicate success, fail, and any reason for
0439   ///     failure.
0440   lldb::SBError SetModuleLoadAddress(lldb::SBModule module,
0441                                      uint64_t sections_offset);
0442 
0443   /// Clear the section base load addresses for all sections in a module.
0444   ///
0445   /// \param[in] module
0446   ///     The module to unload.
0447   ///
0448   /// \return
0449   ///     An error to indicate success, fail, and any reason for
0450   ///     failure.
0451   lldb::SBError ClearModuleLoadAddress(lldb::SBModule module);
0452 
0453   /// Find functions by name.
0454   ///
0455   /// \param[in] name
0456   ///     The name of the function we are looking for.
0457   ///
0458   /// \param[in] name_type_mask
0459   ///     A logical OR of one or more FunctionNameType enum bits that
0460   ///     indicate what kind of names should be used when doing the
0461   ///     lookup. Bits include fully qualified names, base names,
0462   ///     C++ methods, or ObjC selectors.
0463   ///     See FunctionNameType for more details.
0464   ///
0465   /// \return
0466   ///     A lldb::SBSymbolContextList that gets filled in with all of
0467   ///     the symbol contexts for all the matches.
0468   lldb::SBSymbolContextList
0469   FindFunctions(const char *name,
0470                 uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
0471 
0472   /// Find global and static variables by name.
0473   ///
0474   /// \param[in] name
0475   ///     The name of the global or static variable we are looking
0476   ///     for.
0477   ///
0478   /// \param[in] max_matches
0479   ///     Allow the number of matches to be limited to \a max_matches.
0480   ///
0481   /// \return
0482   ///     A list of matched variables in an SBValueList.
0483   lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches);
0484 
0485   /// Find the first global (or static) variable by name.
0486   ///
0487   /// \param[in] name
0488   ///     The name of the global or static variable we are looking
0489   ///     for.
0490   ///
0491   /// \return
0492   ///     An SBValue that gets filled in with the found variable (if any).
0493   lldb::SBValue FindFirstGlobalVariable(const char *name);
0494 
0495   /// Find global and static variables by pattern.
0496   ///
0497   /// \param[in] name
0498   ///     The pattern to search for global or static variables
0499   ///
0500   /// \param[in] max_matches
0501   ///     Allow the number of matches to be limited to \a max_matches.
0502   ///
0503   /// \param[in] matchtype
0504   ///     The match type to use.
0505   ///
0506   /// \return
0507   ///     A list of matched variables in an SBValueList.
0508   lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches,
0509                                         MatchType matchtype);
0510 
0511   /// Find global functions by their name with pattern matching.
0512   ///
0513   /// \param[in] name
0514   ///     The pattern to search for global or static variables
0515   ///
0516   /// \param[in] max_matches
0517   ///     Allow the number of matches to be limited to \a max_matches.
0518   ///
0519   /// \param[in] matchtype
0520   ///     The match type to use.
0521   ///
0522   /// \return
0523   ///     A list of matched variables in an SBValueList.
0524   lldb::SBSymbolContextList FindGlobalFunctions(const char *name,
0525                                                 uint32_t max_matches,
0526                                                 MatchType matchtype);
0527 
0528   void Clear();
0529 
0530   /// Resolve a current file address into a section offset address.
0531   ///
0532   /// \param[in] file_addr
0533   ///     The file address to resolve.
0534   ///
0535   /// \return
0536   ///     An SBAddress which will be valid if...
0537   lldb::SBAddress ResolveFileAddress(lldb::addr_t file_addr);
0538 
0539   /// Resolve a current load address into a section offset address.
0540   ///
0541   /// \param[in] vm_addr
0542   ///     A virtual address from the current process state that is to
0543   ///     be translated into a section offset address.
0544   ///
0545   /// \return
0546   ///     An SBAddress which will be valid if \a vm_addr was
0547   ///     successfully resolved into a section offset address, or an
0548   ///     invalid SBAddress if \a vm_addr doesn't resolve to a section
0549   ///     in a module.
0550   lldb::SBAddress ResolveLoadAddress(lldb::addr_t vm_addr);
0551 
0552   /// Resolve a current load address into a section offset address
0553   /// using the process stop ID to identify a time in the past.
0554   ///
0555   /// \param[in] stop_id
0556   ///     Each time a process stops, the process stop ID integer gets
0557   ///     incremented. These stop IDs are used to identify past times
0558   ///     and can be used in history objects as a cheap way to store
0559   ///     the time at which the sample was taken. Specifying
0560   ///     UINT32_MAX will always resolve the address using the
0561   ///     currently loaded sections.
0562   ///
0563   /// \param[in] vm_addr
0564   ///     A virtual address from the current process state that is to
0565   ///     be translated into a section offset address.
0566   ///
0567   /// \return
0568   ///     An SBAddress which will be valid if \a vm_addr was
0569   ///     successfully resolved into a section offset address, or an
0570   ///     invalid SBAddress if \a vm_addr doesn't resolve to a section
0571   ///     in a module.
0572   lldb::SBAddress ResolvePastLoadAddress(uint32_t stop_id,
0573                                          lldb::addr_t vm_addr);
0574 
0575   SBSymbolContext ResolveSymbolContextForAddress(const SBAddress &addr,
0576                                                  uint32_t resolve_scope);
0577 
0578   /// Read target memory. If a target process is running then memory
0579   /// is read from here. Otherwise the memory is read from the object
0580   /// files. For a target whose bytes are sized as a multiple of host
0581   /// bytes, the data read back will preserve the target's byte order.
0582   ///
0583   /// \param[in] addr
0584   ///     A target address to read from.
0585   ///
0586   /// \param[out] buf
0587   ///     The buffer to read memory into.
0588   ///
0589   /// \param[in] size
0590   ///     The maximum number of host bytes to read in the buffer passed
0591   ///     into this call
0592   ///
0593   /// \param[out] error
0594   ///     Status information is written here if the memory read fails.
0595   ///
0596   /// \return
0597   ///     The amount of data read in host bytes.
0598   size_t ReadMemory(const SBAddress addr, void *buf, size_t size,
0599                     lldb::SBError &error);
0600 
0601   lldb::SBBreakpoint BreakpointCreateByLocation(const char *file,
0602                                                 uint32_t line);
0603 
0604   lldb::SBBreakpoint
0605   BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line);
0606 
0607   lldb::SBBreakpoint
0608   BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
0609                              lldb::addr_t offset);
0610 
0611   lldb::SBBreakpoint
0612   BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
0613                              lldb::addr_t offset, SBFileSpecList &module_list);
0614 
0615   lldb::SBBreakpoint
0616   BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
0617                              uint32_t column, lldb::addr_t offset,
0618                              SBFileSpecList &module_list);
0619 
0620   lldb::SBBreakpoint
0621   BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
0622                              uint32_t column, lldb::addr_t offset,
0623                              SBFileSpecList &module_list,
0624                              bool move_to_nearest_code);
0625 
0626   lldb::SBBreakpoint BreakpointCreateByName(const char *symbol_name,
0627                                             const char *module_name = nullptr);
0628 
0629   // This version uses name_type_mask = eFunctionNameTypeAuto
0630   lldb::SBBreakpoint
0631   BreakpointCreateByName(const char *symbol_name,
0632                          const SBFileSpecList &module_list,
0633                          const SBFileSpecList &comp_unit_list);
0634 
0635   lldb::SBBreakpoint BreakpointCreateByName(
0636       const char *symbol_name,
0637       uint32_t
0638           name_type_mask, // Logical OR one or more FunctionNameType enum bits
0639       const SBFileSpecList &module_list,
0640       const SBFileSpecList &comp_unit_list);
0641 
0642   lldb::SBBreakpoint BreakpointCreateByName(
0643       const char *symbol_name,
0644       uint32_t
0645           name_type_mask, // Logical OR one or more FunctionNameType enum bits
0646       lldb::LanguageType symbol_language,
0647       const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
0648 
0649 #ifdef SWIG
0650   lldb::SBBreakpoint BreakpointCreateByNames(
0651       const char **symbol_name, uint32_t num_names,
0652       uint32_t
0653           name_type_mask, // Logical OR one or more FunctionNameType enum bits
0654       const SBFileSpecList &module_list,
0655       const SBFileSpecList &comp_unit_list);
0656 
0657   lldb::SBBreakpoint BreakpointCreateByNames(
0658       const char **symbol_name, uint32_t num_names,
0659       uint32_t
0660           name_type_mask, // Logical OR one or more FunctionNameType enum bits
0661       lldb::LanguageType symbol_language,
0662       const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
0663 
0664   lldb::SBBreakpoint BreakpointCreateByNames(
0665       const char **symbol_name, uint32_t num_names,
0666       uint32_t
0667           name_type_mask, // Logical OR one or more FunctionNameType enum bits
0668       lldb::LanguageType symbol_language,
0669       lldb::addr_t offset, const SBFileSpecList &module_list,
0670       const SBFileSpecList &comp_unit_list);
0671 #else
0672   lldb::SBBreakpoint BreakpointCreateByNames(
0673       const char *symbol_name[], uint32_t num_names,
0674       uint32_t
0675           name_type_mask, // Logical OR one or more FunctionNameType enum bits
0676       const SBFileSpecList &module_list,
0677       const SBFileSpecList &comp_unit_list);
0678 
0679   lldb::SBBreakpoint BreakpointCreateByNames(
0680       const char *symbol_name[], uint32_t num_names,
0681       uint32_t
0682           name_type_mask, // Logical OR one or more FunctionNameType enum bits
0683       lldb::LanguageType symbol_language,
0684       const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
0685 
0686   lldb::SBBreakpoint BreakpointCreateByNames(
0687       const char *symbol_name[], uint32_t num_names,
0688       uint32_t
0689           name_type_mask, // Logical OR one or more FunctionNameType enum bits
0690       lldb::LanguageType symbol_language,
0691       lldb::addr_t offset, const SBFileSpecList &module_list,
0692       const SBFileSpecList &comp_unit_list);
0693 #endif
0694 
0695   lldb::SBBreakpoint BreakpointCreateByRegex(const char *symbol_name_regex,
0696                                              const char *module_name = nullptr);
0697 
0698   lldb::SBBreakpoint
0699   BreakpointCreateByRegex(const char *symbol_name_regex,
0700                           const SBFileSpecList &module_list,
0701                           const SBFileSpecList &comp_unit_list);
0702 
0703   lldb::SBBreakpoint BreakpointCreateByRegex(
0704       const char *symbol_name_regex, lldb::LanguageType symbol_language,
0705       const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
0706 
0707   lldb::SBBreakpoint
0708   BreakpointCreateBySourceRegex(const char *source_regex,
0709                                 const SBFileSpec &source_file,
0710                                 const char *module_name = nullptr);
0711 
0712   lldb::SBBreakpoint
0713   BreakpointCreateBySourceRegex(const char *source_regex,
0714                                 const SBFileSpecList &module_list,
0715                                 const SBFileSpecList &source_file);
0716 
0717   lldb::SBBreakpoint BreakpointCreateBySourceRegex(
0718       const char *source_regex, const SBFileSpecList &module_list,
0719       const SBFileSpecList &source_file, const SBStringList &func_names);
0720 
0721   lldb::SBBreakpoint BreakpointCreateForException(lldb::LanguageType language,
0722                                                   bool catch_bp, bool throw_bp);
0723 
0724   lldb::SBBreakpoint BreakpointCreateByAddress(addr_t address);
0725 
0726   lldb::SBBreakpoint BreakpointCreateBySBAddress(SBAddress &address);
0727 
0728   /// Create a breakpoint using a scripted resolver.
0729   ///
0730   /// \param[in] class_name
0731   ///    This is the name of the class that implements a scripted resolver.
0732   ///
0733   /// \param[in] extra_args
0734   ///    This is an SBStructuredData object that will get passed to the
0735   ///    constructor of the class in class_name.  You can use this to
0736   ///    reuse the same class, parametrizing with entries from this
0737   ///    dictionary.
0738   ///
0739   /// \param module_list
0740   ///    If this is non-empty, this will be used as the module filter in the
0741   ///    SearchFilter created for this breakpoint.
0742   ///
0743   /// \param file_list
0744   ///    If this is non-empty, this will be used as the comp unit filter in the
0745   ///    SearchFilter created for this breakpoint.
0746   ///
0747   /// \return
0748   ///     An SBBreakpoint that will set locations based on the logic in the
0749   ///     resolver's search callback.
0750   lldb::SBBreakpoint BreakpointCreateFromScript(
0751       const char *class_name,
0752       SBStructuredData &extra_args,
0753       const SBFileSpecList &module_list,
0754       const SBFileSpecList &file_list,
0755       bool request_hardware = false);
0756 
0757   /// Read breakpoints from source_file and return the newly created
0758   /// breakpoints in bkpt_list.
0759   ///
0760   /// \param[in] source_file
0761   ///    The file from which to read the breakpoints.
0762   ///
0763   /// \param[out] new_bps
0764   ///    A list of the newly created breakpoints.
0765   ///
0766   /// \return
0767   ///     An SBError detailing any errors in reading in the breakpoints.
0768   lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file,
0769                                           SBBreakpointList &new_bps);
0770 
0771   /// Read breakpoints from source_file and return the newly created
0772   /// breakpoints in bkpt_list.
0773   ///
0774   /// \param[in] source_file
0775   ///    The file from which to read the breakpoints.
0776   ///
0777   /// \param[in] matching_names
0778   ///    Only read in breakpoints whose names match one of the names in this
0779   ///    list.
0780   ///
0781   /// \param[out] new_bps
0782   ///    A list of the newly created breakpoints.
0783   ///
0784   /// \return
0785   ///     An SBError detailing any errors in reading in the breakpoints.
0786   lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file,
0787                                           SBStringList &matching_names,
0788                                           SBBreakpointList &new_bps);
0789 
0790   /// Write breakpoints to dest_file.
0791   ///
0792   /// \param[in] dest_file
0793   ///    The file to which to write the breakpoints.
0794   ///
0795   /// \return
0796   ///     An SBError detailing any errors in writing in the breakpoints.
0797   lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file);
0798 
0799   /// Write breakpoints listed in bkpt_list to dest_file.
0800   ///
0801   /// \param[in] dest_file
0802   ///    The file to which to write the breakpoints.
0803   ///
0804   /// \param[in] bkpt_list
0805   ///    Only write breakpoints from this list.
0806   ///
0807   /// \param[in] append
0808   ///    If \b true, append the breakpoints in bkpt_list to the others
0809   ///    serialized in dest_file.  If dest_file doesn't exist, then a new
0810   ///    file will be created and the breakpoints in bkpt_list written to it.
0811   ///
0812   /// \return
0813   ///     An SBError detailing any errors in writing in the breakpoints.
0814   lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file,
0815                                        SBBreakpointList &bkpt_list,
0816                                        bool append = false);
0817 
0818   uint32_t GetNumBreakpoints() const;
0819 
0820   lldb::SBBreakpoint GetBreakpointAtIndex(uint32_t idx) const;
0821 
0822   bool BreakpointDelete(break_id_t break_id);
0823 
0824   lldb::SBBreakpoint FindBreakpointByID(break_id_t break_id);
0825 
0826   // Finds all breakpoints by name, returning the list in bkpt_list.  Returns
0827   // false if the name is not a valid breakpoint name, true otherwise.
0828   bool FindBreakpointsByName(const char *name, SBBreakpointList &bkpt_list);
0829 
0830   void GetBreakpointNames(SBStringList &names);
0831 
0832   void DeleteBreakpointName(const char *name);
0833 
0834   bool EnableAllBreakpoints();
0835 
0836   bool DisableAllBreakpoints();
0837 
0838   bool DeleteAllBreakpoints();
0839 
0840   uint32_t GetNumWatchpoints() const;
0841 
0842   lldb::SBWatchpoint GetWatchpointAtIndex(uint32_t idx) const;
0843 
0844   bool DeleteWatchpoint(lldb::watch_id_t watch_id);
0845 
0846   lldb::SBWatchpoint FindWatchpointByID(lldb::watch_id_t watch_id);
0847 
0848   LLDB_DEPRECATED("WatchAddress deprecated, use WatchpointCreateByAddress")
0849   lldb::SBWatchpoint WatchAddress(lldb::addr_t addr, size_t size, bool read,
0850                                   bool modify, SBError &error);
0851 
0852   lldb::SBWatchpoint
0853   WatchpointCreateByAddress(lldb::addr_t addr, size_t size,
0854                             lldb::SBWatchpointOptions options, SBError &error);
0855 
0856   bool EnableAllWatchpoints();
0857 
0858   bool DisableAllWatchpoints();
0859 
0860   bool DeleteAllWatchpoints();
0861 
0862   lldb::SBBroadcaster GetBroadcaster() const;
0863 
0864   lldb::SBType FindFirstType(const char *type);
0865 
0866   lldb::SBTypeList FindTypes(const char *type);
0867 
0868   lldb::SBType GetBasicType(lldb::BasicType type);
0869 
0870   lldb::SBValue CreateValueFromAddress(const char *name, lldb::SBAddress addr,
0871                                        lldb::SBType type);
0872 
0873   lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data,
0874                                     lldb::SBType type);
0875 
0876   lldb::SBValue CreateValueFromExpression(const char *name, const char *expr);
0877 
0878   SBSourceManager GetSourceManager();
0879 
0880   lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr,
0881                                            uint32_t count);
0882 
0883   lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr,
0884                                            uint32_t count,
0885                                            const char *flavor_string);
0886 
0887   lldb::SBInstructionList ReadInstructions(lldb::SBAddress start_addr,
0888                                            lldb::SBAddress end_addr,
0889                                            const char *flavor_string);
0890 
0891   lldb::SBInstructionList GetInstructions(lldb::SBAddress base_addr,
0892                                           const void *buf, size_t size);
0893 
0894   // The "WithFlavor" is necessary to keep SWIG from getting confused about
0895   // overloaded arguments when using the buf + size -> Python Object magic.
0896 
0897   lldb::SBInstructionList GetInstructionsWithFlavor(lldb::SBAddress base_addr,
0898                                                     const char *flavor_string,
0899                                                     const void *buf,
0900                                                     size_t size);
0901 
0902 #ifndef SWIG
0903   lldb::SBInstructionList GetInstructions(lldb::addr_t base_addr,
0904                                           const void *buf, size_t size);
0905   lldb::SBInstructionList GetInstructionsWithFlavor(lldb::addr_t base_addr,
0906                                                     const char *flavor_string,
0907                                                     const void *buf,
0908                                                     size_t size);
0909 #endif
0910 
0911   lldb::SBSymbolContextList FindSymbols(const char *name,
0912                                         lldb::SymbolType type = eSymbolTypeAny);
0913 
0914   bool operator==(const lldb::SBTarget &rhs) const;
0915 
0916   bool operator!=(const lldb::SBTarget &rhs) const;
0917 
0918   bool GetDescription(lldb::SBStream &description,
0919                       lldb::DescriptionLevel description_level);
0920 
0921   lldb::SBValue EvaluateExpression(const char *expr);
0922 
0923   lldb::SBValue EvaluateExpression(const char *expr,
0924                                    const SBExpressionOptions &options);
0925 
0926   lldb::addr_t GetStackRedZoneSize();
0927 
0928   bool IsLoaded(const lldb::SBModule &module) const;
0929 
0930   lldb::SBLaunchInfo GetLaunchInfo() const;
0931 
0932   void SetLaunchInfo(const lldb::SBLaunchInfo &launch_info);
0933 
0934   /// Get a \a SBTrace object the can manage the processor trace information of
0935   /// this target.
0936   ///
0937   /// \return
0938   ///   The trace object. The returned SBTrace object might not be valid, so it
0939   ///   should be checked with a call to "bool SBTrace::IsValid()".
0940   lldb::SBTrace GetTrace();
0941 
0942   /// Create a \a Trace object for the current target using the using the
0943   /// default supported tracing technology for this process.
0944   ///
0945   /// \param[out] error
0946   ///     An error if a Trace already exists or the trace couldn't be created.
0947   lldb::SBTrace CreateTrace(SBError &error);
0948 
0949 protected:
0950   friend class SBAddress;
0951   friend class SBAddressRange;
0952   friend class SBBlock;
0953   friend class SBBreakpoint;
0954   friend class SBBreakpointList;
0955   friend class SBBreakpointNameImpl;
0956   friend class SBDebugger;
0957   friend class SBExecutionContext;
0958   friend class SBFrame;
0959   friend class SBFunction;
0960   friend class SBInstruction;
0961   friend class SBModule;
0962   friend class SBPlatform;
0963   friend class SBProcess;
0964   friend class SBSection;
0965   friend class SBSourceManager;
0966   friend class SBSymbol;
0967   friend class SBTypeStaticField;
0968   friend class SBValue;
0969   friend class SBVariablesOptions;
0970 
0971   friend class lldb_private::python::SWIGBridge;
0972 
0973   // Constructors are private, use static Target::Create function to create an
0974   // instance of this class.
0975 
0976   SBTarget(const lldb::TargetSP &target_sp);
0977 
0978   lldb::TargetSP GetSP() const;
0979 
0980   void SetSP(const lldb::TargetSP &target_sp);
0981 
0982 private:
0983   lldb::TargetSP m_opaque_sp;
0984 };
0985 
0986 } // namespace lldb
0987 
0988 #endif // LLDB_API_SBTARGET_H