Home | History | Annotate | Download | only in interface
      1 //===-- SWIG Interface for SBTarget -----------------------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 namespace lldb {
     11 
     12 class SBLaunchInfo
     13 {
     14 public:
     15     SBLaunchInfo (const char **argv);
     16 
     17     uint32_t
     18     GetUserID();
     19 
     20     uint32_t
     21     GetGroupID();
     22 
     23     bool
     24     UserIDIsValid ();
     25 
     26     bool
     27     GroupIDIsValid ();
     28 
     29     void
     30     SetUserID (uint32_t uid);
     31 
     32     void
     33     SetGroupID (uint32_t gid);
     34 
     35     uint32_t
     36     GetNumArguments ();
     37 
     38     const char *
     39     GetArgumentAtIndex (uint32_t idx);
     40 
     41     void
     42     SetArguments (const char **argv, bool append);
     43 
     44     uint32_t
     45     GetNumEnvironmentEntries ();
     46 
     47     const char *
     48     GetEnvironmentEntryAtIndex (uint32_t idx);
     49 
     50     void
     51     SetEnvironmentEntries (const char **envp, bool append);
     52 
     53     void
     54     Clear ();
     55 
     56     const char *
     57     GetWorkingDirectory () const;
     58 
     59     void
     60     SetWorkingDirectory (const char *working_dir);
     61 
     62     uint32_t
     63     GetLaunchFlags ();
     64 
     65     void
     66     SetLaunchFlags (uint32_t flags);
     67 
     68     const char *
     69     GetProcessPluginName ();
     70 
     71     void
     72     SetProcessPluginName (const char *plugin_name);
     73 
     74     const char *
     75     GetShell ();
     76 
     77     void
     78     SetShell (const char * path);
     79 
     80     uint32_t
     81     GetResumeCount ();
     82 
     83     void
     84     SetResumeCount (uint32_t c);
     85 
     86     bool
     87     AddCloseFileAction (int fd);
     88 
     89     bool
     90     AddDuplicateFileAction (int fd, int dup_fd);
     91 
     92     bool
     93     AddOpenFileAction (int fd, const char *path, bool read, bool write);
     94 
     95     bool
     96     AddSuppressFileAction (int fd, bool read, bool write);
     97 };
     98 
     99 class SBAttachInfo
    100 {
    101 public:
    102     SBAttachInfo ();
    103 
    104     SBAttachInfo (lldb::pid_t pid);
    105 
    106     SBAttachInfo (const char *path, bool wait_for);
    107 
    108     SBAttachInfo (const lldb::SBAttachInfo &rhs);
    109 
    110     lldb::pid_t
    111     GetProcessID ();
    112 
    113     void
    114     SetProcessID (lldb::pid_t pid);
    115 
    116     void
    117     SetExecutable (const char *path);
    118 
    119     void
    120     SetExecutable (lldb::SBFileSpec exe_file);
    121 
    122     bool
    123     GetWaitForLaunch ();
    124 
    125     void
    126     SetWaitForLaunch (bool b);
    127 
    128     bool
    129     GetIgnoreExisting ();
    130 
    131     void
    132     SetIgnoreExisting (bool b);
    133 
    134     uint32_t
    135     GetResumeCount ();
    136 
    137     void
    138     SetResumeCount (uint32_t c);
    139 
    140     const char *
    141     GetProcessPluginName ();
    142 
    143     void
    144     SetProcessPluginName (const char *plugin_name);
    145 
    146     uint32_t
    147     GetUserID();
    148 
    149     uint32_t
    150     GetGroupID();
    151 
    152     bool
    153     UserIDIsValid ();
    154 
    155     bool
    156     GroupIDIsValid ();
    157 
    158     void
    159     SetUserID (uint32_t uid);
    160 
    161     void
    162     SetGroupID (uint32_t gid);
    163 
    164     uint32_t
    165     GetEffectiveUserID();
    166 
    167     uint32_t
    168     GetEffectiveGroupID();
    169 
    170     bool
    171     EffectiveUserIDIsValid ();
    172 
    173     bool
    174     EffectiveGroupIDIsValid ();
    175 
    176     void
    177     SetEffectiveUserID (uint32_t uid);
    178 
    179     void
    180     SetEffectiveGroupID (uint32_t gid);
    181 
    182     lldb::pid_t
    183     GetParentProcessID ();
    184 
    185     void
    186     SetParentProcessID (lldb::pid_t pid);
    187 
    188     bool
    189     ParentProcessIDIsValid();
    190 };
    191 
    192 
    193 %feature("docstring",
    194 "Represents the target program running under the debugger.
    195 
    196 SBTarget supports module, breakpoint, and watchpoint iterations. For example,
    197 
    198     for m in target.module_iter():
    199         print m
    200 
    201 produces:
    202 
    203 (x86_64) /Volumes/data/lldb/svn/trunk/test/python_api/lldbutil/iter/a.out
    204 (x86_64) /usr/lib/dyld
    205 (x86_64) /usr/lib/libstdc++.6.dylib
    206 (x86_64) /usr/lib/libSystem.B.dylib
    207 (x86_64) /usr/lib/system/libmathCommon.A.dylib
    208 (x86_64) /usr/lib/libSystem.B.dylib(__commpage)
    209 
    210 and,
    211 
    212     for b in target.breakpoint_iter():
    213         print b
    214 
    215 produces:
    216 
    217 SBBreakpoint: id = 1, file ='main.cpp', line = 66, locations = 1
    218 SBBreakpoint: id = 2, file ='main.cpp', line = 85, locations = 1
    219 
    220 and,
    221 
    222     for wp_loc in target.watchpoint_iter():
    223         print wp_loc
    224 
    225 produces:
    226 
    227 Watchpoint 1: addr = 0x1034ca048 size = 4 state = enabled type = rw
    228     declare @ '/Volumes/data/lldb/svn/trunk/test/python_api/watchpoint/main.c:12'
    229     hw_index = 0  hit_count = 2     ignore_count = 0"
    230 ) SBTarget;
    231 class SBTarget
    232 {
    233 public:
    234     //------------------------------------------------------------------
    235     // Broadcaster bits.
    236     //------------------------------------------------------------------
    237     enum
    238     {
    239         eBroadcastBitBreakpointChanged  = (1 << 0),
    240         eBroadcastBitModulesLoaded      = (1 << 1),
    241         eBroadcastBitModulesUnloaded    = (1 << 2),
    242         eBroadcastBitWatchpointChanged  = (1 << 3),
    243         eBroadcastBitSymbolsLoaded      = (1 << 4)
    244     };
    245 
    246     //------------------------------------------------------------------
    247     // Constructors
    248     //------------------------------------------------------------------
    249     SBTarget ();
    250 
    251     SBTarget (const lldb::SBTarget& rhs);
    252 
    253     //------------------------------------------------------------------
    254     // Destructor
    255     //------------------------------------------------------------------
    256     ~SBTarget();
    257 
    258     static const char *
    259     GetBroadcasterClassName ();
    260 
    261     bool
    262     IsValid() const;
    263 
    264     lldb::SBProcess
    265     GetProcess ();
    266 
    267     %feature("docstring", "
    268     //------------------------------------------------------------------
    269     /// Launch a new process.
    270     ///
    271     /// Launch a new process by spawning a new process using the
    272     /// target object's executable module's file as the file to launch.
    273     /// Arguments are given in \a argv, and the environment variables
    274     /// are in \a envp. Standard input and output files can be
    275     /// optionally re-directed to \a stdin_path, \a stdout_path, and
    276     /// \a stderr_path.
    277     ///
    278     /// @param[in] listener
    279     ///     An optional listener that will receive all process events.
    280     ///     If \a listener is valid then \a listener will listen to all
    281     ///     process events. If not valid, then this target's debugger
    282     ///     (SBTarget::GetDebugger()) will listen to all process events.
    283     ///
    284     /// @param[in] argv
    285     ///     The argument array.
    286     ///
    287     /// @param[in] envp
    288     ///     The environment array.
    289     ///
    290     /// @param[in] launch_flags
    291     ///     Flags to modify the launch (@see lldb::LaunchFlags)
    292     ///
    293     /// @param[in] stdin_path
    294     ///     The path to use when re-directing the STDIN of the new
    295     ///     process. If all stdXX_path arguments are NULL, a pseudo
    296     ///     terminal will be used.
    297     ///
    298     /// @param[in] stdout_path
    299     ///     The path to use when re-directing the STDOUT of the new
    300     ///     process. If all stdXX_path arguments are NULL, a pseudo
    301     ///     terminal will be used.
    302     ///
    303     /// @param[in] stderr_path
    304     ///     The path to use when re-directing the STDERR of the new
    305     ///     process. If all stdXX_path arguments are NULL, a pseudo
    306     ///     terminal will be used.
    307     ///
    308     /// @param[in] working_directory
    309     ///     The working directory to have the child process run in
    310     ///
    311     /// @param[in] launch_flags
    312     ///     Some launch options specified by logical OR'ing
    313     ///     lldb::LaunchFlags enumeration values together.
    314     ///
    315     /// @param[in] stop_at_endtry
    316     ///     If false do not stop the inferior at the entry point.
    317     ///
    318     /// @param[out]
    319     ///     An error object. Contains the reason if there is some failure.
    320     ///
    321     /// @return
    322     ///      A process object for the newly created process.
    323     //------------------------------------------------------------------
    324 
    325     For example,
    326 
    327         process = target.Launch(self.dbg.GetListener(), None, None,
    328                                 None, '/tmp/stdout.txt', None,
    329                                 None, 0, False, error)
    330 
    331     launches a new process by passing nothing for both the args and the envs
    332     and redirect the standard output of the inferior to the /tmp/stdout.txt
    333     file. It does not specify a working directory so that the debug server
    334     will use its idea of what the current working directory is for the
    335     inferior. Also, we ask the debugger not to stop the inferior at the
    336     entry point. If no breakpoint is specified for the inferior, it should
    337     run to completion if no user interaction is required.
    338     ") Launch;
    339     lldb::SBProcess
    340     Launch (SBListener &listener,
    341             char const **argv,
    342             char const **envp,
    343             const char *stdin_path,
    344             const char *stdout_path,
    345             const char *stderr_path,
    346             const char *working_directory,
    347             uint32_t launch_flags,   // See LaunchFlags
    348             bool stop_at_entry,
    349             lldb::SBError& error);
    350 
    351     %feature("docstring", "
    352     //------------------------------------------------------------------
    353     /// Launch a new process with sensible defaults.
    354     ///
    355     /// @param[in] argv
    356     ///     The argument array.
    357     ///
    358     /// @param[in] envp
    359     ///     The environment array.
    360     ///
    361     /// @param[in] working_directory
    362     ///     The working directory to have the child process run in
    363     ///
    364     /// Default: listener
    365     ///     Set to the target's debugger (SBTarget::GetDebugger())
    366     ///
    367     /// Default: launch_flags
    368     ///     Empty launch flags
    369     ///
    370     /// Default: stdin_path
    371     /// Default: stdout_path
    372     /// Default: stderr_path
    373     ///     A pseudo terminal will be used.
    374     ///
    375     /// @return
    376     ///      A process object for the newly created process.
    377     //------------------------------------------------------------------
    378 
    379     For example,
    380 
    381         process = target.LaunchSimple(['X', 'Y', 'Z'], None, os.getcwd())
    382 
    383     launches a new process by passing 'X', 'Y', 'Z' as the args to the
    384     executable.
    385     ") LaunchSimple;
    386     lldb::SBProcess
    387     LaunchSimple (const char **argv,
    388                   const char **envp,
    389                   const char *working_directory);
    390 
    391     lldb::SBProcess
    392     Launch (lldb::SBLaunchInfo &launch_info, lldb::SBError& error);
    393 
    394     %feature("docstring", "
    395     //------------------------------------------------------------------
    396     /// Load a core file
    397     ///
    398     /// @param[in] core_file
    399     ///     File path of the core dump.
    400     ///
    401     /// @return
    402     ///      A process object for the newly created core file.
    403     //------------------------------------------------------------------
    404 
    405     For example,
    406 
    407         process = target.LoadCore('./a.out.core')
    408 
    409     loads a new core file and returns the process object.
    410     ") LoadCore;
    411     lldb::SBProcess
    412     LoadCore(const char *core_file);
    413 
    414     lldb::SBProcess
    415     Attach (lldb::SBAttachInfo &attach_info, lldb::SBError& error);
    416 
    417 
    418     %feature("docstring", "
    419     //------------------------------------------------------------------
    420     /// Attach to process with pid.
    421     ///
    422     /// @param[in] listener
    423     ///     An optional listener that will receive all process events.
    424     ///     If \a listener is valid then \a listener will listen to all
    425     ///     process events. If not valid, then this target's debugger
    426     ///     (SBTarget::GetDebugger()) will listen to all process events.
    427     ///
    428     /// @param[in] pid
    429     ///     The process ID to attach to.
    430     ///
    431     /// @param[out]
    432     ///     An error explaining what went wrong if attach fails.
    433     ///
    434     /// @return
    435     ///      A process object for the attached process.
    436     //------------------------------------------------------------------
    437     ") AttachToProcessWithID;
    438     lldb::SBProcess
    439     AttachToProcessWithID (SBListener &listener,
    440                            lldb::pid_t pid,
    441                            lldb::SBError& error);
    442 
    443     %feature("docstring", "
    444     //------------------------------------------------------------------
    445     /// Attach to process with name.
    446     ///
    447     /// @param[in] listener
    448     ///     An optional listener that will receive all process events.
    449     ///     If \a listener is valid then \a listener will listen to all
    450     ///     process events. If not valid, then this target's debugger
    451     ///     (SBTarget::GetDebugger()) will listen to all process events.
    452     ///
    453     /// @param[in] name
    454     ///     Basename of process to attach to.
    455     ///
    456     /// @param[in] wait_for
    457     ///     If true wait for a new instance of 'name' to be launched.
    458     ///
    459     /// @param[out]
    460     ///     An error explaining what went wrong if attach fails.
    461     ///
    462     /// @return
    463     ///      A process object for the attached process.
    464     //------------------------------------------------------------------
    465     ") AttachToProcessWithName;
    466     lldb::SBProcess
    467     AttachToProcessWithName (SBListener &listener,
    468                              const char *name,
    469                              bool wait_for,
    470                              lldb::SBError& error);
    471 
    472     %feature("docstring", "
    473     //------------------------------------------------------------------
    474     /// Connect to a remote debug server with url.
    475     ///
    476     /// @param[in] listener
    477     ///     An optional listener that will receive all process events.
    478     ///     If \a listener is valid then \a listener will listen to all
    479     ///     process events. If not valid, then this target's debugger
    480     ///     (SBTarget::GetDebugger()) will listen to all process events.
    481     ///
    482     /// @param[in] url
    483     ///     The url to connect to, e.g., 'connect://localhost:12345'.
    484     ///
    485     /// @param[in] plugin_name
    486     ///     The plugin name to be used; can be NULL.
    487     ///
    488     /// @param[out]
    489     ///     An error explaining what went wrong if the connect fails.
    490     ///
    491     /// @return
    492     ///      A process object for the connected process.
    493     //------------------------------------------------------------------
    494     ") ConnectRemote;
    495     lldb::SBProcess
    496     ConnectRemote (SBListener &listener,
    497                    const char *url,
    498                    const char *plugin_name,
    499                    SBError& error);
    500 
    501     lldb::SBFileSpec
    502     GetExecutable ();
    503 
    504     bool
    505     AddModule (lldb::SBModule &module);
    506 
    507     lldb::SBModule
    508     AddModule (const char *path,
    509                const char *triple,
    510                const char *uuid);
    511 
    512     lldb::SBModule
    513     AddModule (const char *path,
    514                const char *triple,
    515                const char *uuid_cstr,
    516                const char *symfile);
    517 
    518     lldb::SBModule
    519     AddModule (const SBModuleSpec &module_spec);
    520 
    521     uint32_t
    522     GetNumModules () const;
    523 
    524     lldb::SBModule
    525     GetModuleAtIndex (uint32_t idx);
    526 
    527     bool
    528     RemoveModule (lldb::SBModule module);
    529 
    530     lldb::SBDebugger
    531     GetDebugger() const;
    532 
    533     lldb::SBModule
    534     FindModule (const lldb::SBFileSpec &file_spec);
    535 
    536     lldb::ByteOrder
    537     GetByteOrder ();
    538 
    539     uint32_t
    540     GetAddressByteSize();
    541 
    542     const char *
    543     GetTriple ();
    544 
    545     lldb::SBError
    546     SetSectionLoadAddress (lldb::SBSection section,
    547                            lldb::addr_t section_base_addr);
    548 
    549     lldb::SBError
    550     ClearSectionLoadAddress (lldb::SBSection section);
    551 
    552     lldb::SBError
    553     SetModuleLoadAddress (lldb::SBModule module,
    554                           int64_t sections_offset);
    555 
    556     lldb::SBError
    557     ClearModuleLoadAddress (lldb::SBModule module);
    558 
    559     %feature("docstring", "
    560     //------------------------------------------------------------------
    561     /// Find functions by name.
    562     ///
    563     /// @param[in] name
    564     ///     The name of the function we are looking for.
    565     ///
    566     /// @param[in] name_type_mask
    567     ///     A logical OR of one or more FunctionNameType enum bits that
    568     ///     indicate what kind of names should be used when doing the
    569     ///     lookup. Bits include fully qualified names, base names,
    570     ///     C++ methods, or ObjC selectors.
    571     ///     See FunctionNameType for more details.
    572     ///
    573     /// @return
    574     ///     A lldb::SBSymbolContextList that gets filled in with all of
    575     ///     the symbol contexts for all the matches.
    576     //------------------------------------------------------------------
    577     ") FindFunctions;
    578     lldb::SBSymbolContextList
    579     FindFunctions (const char *name,
    580                    uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
    581 
    582     lldb::SBType
    583     FindFirstType (const char* type);
    584 
    585     lldb::SBTypeList
    586     FindTypes (const char* type);
    587 
    588     lldb::SBType
    589     GetBasicType(lldb::BasicType type);
    590 
    591     lldb::SBSourceManager
    592     GetSourceManager ();
    593 
    594     %feature("docstring", "
    595     //------------------------------------------------------------------
    596     /// Find global and static variables by name.
    597     ///
    598     /// @param[in] name
    599     ///     The name of the global or static variable we are looking
    600     ///     for.
    601     ///
    602     /// @param[in] max_matches
    603     ///     Allow the number of matches to be limited to \a max_matches.
    604     ///
    605     /// @return
    606     ///     A list of matched variables in an SBValueList.
    607     //------------------------------------------------------------------
    608     ") FindGlobalVariables;
    609     lldb::SBValueList
    610     FindGlobalVariables (const char *name,
    611                          uint32_t max_matches);
    612 
    613      %feature("docstring", "
    614     //------------------------------------------------------------------
    615     /// Find the first global (or static) variable by name.
    616     ///
    617     /// @param[in] name
    618     ///     The name of the global or static variable we are looking
    619     ///     for.
    620     ///
    621     /// @return
    622     ///     An SBValue that gets filled in with the found variable (if any).
    623     //------------------------------------------------------------------
    624     ") FindFirstGlobalVariable;
    625     lldb::SBValue
    626     FindFirstGlobalVariable (const char* name);
    627 
    628     void
    629     Clear ();
    630 
    631     lldb::SBAddress
    632     ResolveLoadAddress (lldb::addr_t vm_addr);
    633 
    634     SBSymbolContext
    635     ResolveSymbolContextForAddress (const SBAddress& addr,
    636                                     uint32_t resolve_scope);
    637 
    638     lldb::SBBreakpoint
    639     BreakpointCreateByLocation (const char *file, uint32_t line);
    640 
    641     lldb::SBBreakpoint
    642     BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
    643 
    644     lldb::SBBreakpoint
    645     BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
    646 
    647     lldb::SBBreakpoint
    648     BreakpointCreateByName (const char *symbol_name,
    649                             uint32_t func_name_type,           // Logical OR one or more FunctionNameType enum bits
    650                             const SBFileSpecList &module_list,
    651                             const SBFileSpecList &comp_unit_list);
    652 
    653     lldb::SBBreakpoint
    654     BreakpointCreateByNames (const char *symbol_name[],
    655                              uint32_t num_names,
    656                              uint32_t name_type_mask,           // Logical OR one or more FunctionNameType enum bits
    657                              const SBFileSpecList &module_list,
    658                              const SBFileSpecList &comp_unit_list);
    659 
    660     lldb::SBBreakpoint
    661     BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
    662 
    663     lldb::SBBreakpoint
    664     BreakpointCreateBySourceRegex (const char *source_regex, const lldb::SBFileSpec &source_file, const char *module_name = NULL);
    665 
    666     lldb::SBBreakpoint
    667     BreakpointCreateForException  (lldb::LanguageType language,
    668                                    bool catch_bp,
    669                                    bool throw_bp);
    670 
    671     lldb::SBBreakpoint
    672     BreakpointCreateByAddress (addr_t address);
    673 
    674     uint32_t
    675     GetNumBreakpoints () const;
    676 
    677     lldb::SBBreakpoint
    678     GetBreakpointAtIndex (uint32_t idx) const;
    679 
    680     bool
    681     BreakpointDelete (break_id_t break_id);
    682 
    683     lldb::SBBreakpoint
    684     FindBreakpointByID (break_id_t break_id);
    685 
    686     bool
    687     EnableAllBreakpoints ();
    688 
    689     bool
    690     DisableAllBreakpoints ();
    691 
    692     bool
    693     DeleteAllBreakpoints ();
    694 
    695     uint32_t
    696     GetNumWatchpoints () const;
    697 
    698     lldb::SBWatchpoint
    699     GetWatchpointAtIndex (uint32_t idx) const;
    700 
    701     bool
    702     DeleteWatchpoint (lldb::watch_id_t watch_id);
    703 
    704     lldb::SBWatchpoint
    705     FindWatchpointByID (lldb::watch_id_t watch_id);
    706 
    707     bool
    708     EnableAllWatchpoints ();
    709 
    710     bool
    711     DisableAllWatchpoints ();
    712 
    713     bool
    714     DeleteAllWatchpoints ();
    715 
    716     lldb::SBWatchpoint
    717     WatchAddress (lldb::addr_t addr,
    718                   size_t size,
    719                   bool read,
    720                   bool write,
    721                   SBError &error);
    722 
    723 
    724     lldb::SBBroadcaster
    725     GetBroadcaster () const;
    726 
    727     lldb::SBInstructionList
    728     ReadInstructions (lldb::SBAddress base_addr, uint32_t count);
    729 
    730     lldb::SBInstructionList
    731     ReadInstructions (lldb::SBAddress base_addr, uint32_t count, const char *flavor_string);
    732 
    733     lldb::SBInstructionList
    734     GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
    735 
    736     lldb::SBInstructionList
    737     GetInstructionsWithFlavor (lldb::SBAddress base_addr, const char *flavor_string, const void *buf, size_t size);
    738 
    739     lldb::SBSymbolContextList
    740     FindSymbols (const char *name, lldb::SymbolType type = eSymbolTypeAny);
    741 
    742     bool
    743     GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
    744 
    745     lldb::addr_t
    746     GetStackRedZoneSize();
    747 
    748     bool
    749     operator == (const lldb::SBTarget &rhs) const;
    750 
    751     bool
    752     operator != (const lldb::SBTarget &rhs) const;
    753 
    754     lldb::SBValue
    755     EvaluateExpression (const char *expr, const lldb::SBExpressionOptions &options);
    756     %pythoncode %{
    757         class modules_access(object):
    758             '''A helper object that will lazily hand out lldb.SBModule objects for a target when supplied an index, or by full or partial path.'''
    759             def __init__(self, sbtarget):
    760                 self.sbtarget = sbtarget
    761 
    762             def __len__(self):
    763                 if self.sbtarget:
    764                     return int(self.sbtarget.GetNumModules())
    765                 return 0
    766 
    767             def __getitem__(self, key):
    768                 num_modules = self.sbtarget.GetNumModules()
    769                 if type(key) is int:
    770                     if key < num_modules:
    771                         return self.sbtarget.GetModuleAtIndex(key)
    772                 elif type(key) is str:
    773                     if key.find('/') == -1:
    774                         for idx in range(num_modules):
    775                             module = self.sbtarget.GetModuleAtIndex(idx)
    776                             if module.file.basename == key:
    777                                 return module
    778                     else:
    779                         for idx in range(num_modules):
    780                             module = self.sbtarget.GetModuleAtIndex(idx)
    781                             if module.file.fullpath == key:
    782                                 return module
    783                     # See if the string is a UUID
    784                     try:
    785                         the_uuid = uuid.UUID(key)
    786                         if the_uuid:
    787                             for idx in range(num_modules):
    788                                 module = self.sbtarget.GetModuleAtIndex(idx)
    789                                 if module.uuid == the_uuid:
    790                                     return module
    791                     except:
    792                         return None
    793                 elif type(key) is uuid.UUID:
    794                     for idx in range(num_modules):
    795                         module = self.sbtarget.GetModuleAtIndex(idx)
    796                         if module.uuid == key:
    797                             return module
    798                 elif type(key) is re.SRE_Pattern:
    799                     matching_modules = []
    800                     for idx in range(num_modules):
    801                         module = self.sbtarget.GetModuleAtIndex(idx)
    802                         re_match = key.search(module.path.fullpath)
    803                         if re_match:
    804                             matching_modules.append(module)
    805                     return matching_modules
    806                 else:
    807                     print "error: unsupported item type: %s" % type(key)
    808                 return None
    809 
    810         def get_modules_access_object(self):
    811             '''An accessor function that returns a modules_access() object which allows lazy module access from a lldb.SBTarget object.'''
    812             return self.modules_access (self)
    813 
    814         def get_modules_array(self):
    815             '''An accessor function that returns a list() that contains all modules in a lldb.SBTarget object.'''
    816             modules = []
    817             for idx in range(self.GetNumModules()):
    818                 modules.append(self.GetModuleAtIndex(idx))
    819             return modules
    820 
    821         __swig_getmethods__["modules"] = get_modules_array
    822         if _newclass: modules = property(get_modules_array, None, doc='''A read only property that returns a list() of lldb.SBModule objects contained in this target. This list is a list all modules that the target currently is tracking (the main executable and all dependent shared libraries).''')
    823 
    824         __swig_getmethods__["module"] = get_modules_access_object
    825         if _newclass: module = property(get_modules_access_object, None, doc=r'''A read only property that returns an object that implements python operator overloading with the square brackets().\n    target.module[<int>] allows array access to any modules.\n    target.module[<str>] allows access to modules by basename, full path, or uuid string value.\n    target.module[uuid.UUID()] allows module access by UUID.\n    target.module[re] allows module access using a regular expression that matches the module full path.''')
    826 
    827         __swig_getmethods__["process"] = GetProcess
    828         if _newclass: process = property(GetProcess, None, doc='''A read only property that returns an lldb object that represents the process (lldb.SBProcess) that this target owns.''')
    829 
    830         __swig_getmethods__["executable"] = GetExecutable
    831         if _newclass: executable = property(GetExecutable, None, doc='''A read only property that returns an lldb object that represents the main executable module (lldb.SBModule) for this target.''')
    832 
    833         __swig_getmethods__["debugger"] = GetDebugger
    834         if _newclass: debugger = property(GetDebugger, None, doc='''A read only property that returns an lldb object that represents the debugger (lldb.SBDebugger) that owns this target.''')
    835 
    836         __swig_getmethods__["num_breakpoints"] = GetNumBreakpoints
    837         if _newclass: num_breakpoints = property(GetNumBreakpoints, None, doc='''A read only property that returns the number of breakpoints that this target has as an integer.''')
    838 
    839         __swig_getmethods__["num_watchpoints"] = GetNumWatchpoints
    840         if _newclass: num_watchpoints = property(GetNumWatchpoints, None, doc='''A read only property that returns the number of watchpoints that this target has as an integer.''')
    841 
    842         __swig_getmethods__["broadcaster"] = GetBroadcaster
    843         if _newclass: broadcaster = property(GetBroadcaster, None, doc='''A read only property that an lldb object that represents the broadcaster (lldb.SBBroadcaster) for this target.''')
    844 
    845         __swig_getmethods__["byte_order"] = GetByteOrder
    846         if _newclass: byte_order = property(GetByteOrder, None, doc='''A read only property that returns an lldb enumeration value (lldb.eByteOrderLittle, lldb.eByteOrderBig, lldb.eByteOrderInvalid) that represents the byte order for this target.''')
    847 
    848         __swig_getmethods__["addr_size"] = GetAddressByteSize
    849         if _newclass: addr_size = property(GetAddressByteSize, None, doc='''A read only property that returns the size in bytes of an address for this target.''')
    850 
    851         __swig_getmethods__["triple"] = GetTriple
    852         if _newclass: triple = property(GetTriple, None, doc='''A read only property that returns the target triple (arch-vendor-os) for this target as a string.''')
    853     %}
    854 
    855 };
    856 
    857 } // namespace lldb
    858