1 //===-- SWIG Interface for SBTarget -----------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
12 "Represents the target program running under the debugger.
14 SBTarget supports module, breakpoint, and watchpoint iterations. For example,
16 for m in target.module_iter():
21 (x86_64) /Volumes/data/lldb/svn/trunk/test/python_api/lldbutil/iter/a.out
22 (x86_64) /usr/lib/dyld
23 (x86_64) /usr/lib/libstdc++.6.dylib
24 (x86_64) /usr/lib/libSystem.B.dylib
25 (x86_64) /usr/lib/system/libmathCommon.A.dylib
26 (x86_64) /usr/lib/libSystem.B.dylib(__commpage)
30 for b in target.breakpoint_iter():
35 SBBreakpoint: id = 1, file ='main.cpp', line = 66, locations = 1
36 SBBreakpoint: id = 2, file ='main.cpp', line = 85, locations = 1
40 for wp_loc in target.watchpoint_iter():
45 Watchpoint 1: addr = 0x1034ca048 size = 4 state = enabled type = rw
46 declare @ '/Volumes/data/lldb/svn/trunk/test/python_api/watchpoint/main.c:12'
47 hw_index = 0 hit_count = 2 ignore_count = 0"
52 //------------------------------------------------------------------
54 //------------------------------------------------------------------
57 eBroadcastBitBreakpointChanged = (1 << 0),
58 eBroadcastBitModulesLoaded = (1 << 1),
59 eBroadcastBitModulesUnloaded = (1 << 2),
60 eBroadcastBitWatchpointChanged = (1 << 3),
61 eBroadcastBitSymbolsLoaded = (1 << 4)
64 //------------------------------------------------------------------
66 //------------------------------------------------------------------
69 SBTarget (const lldb::SBTarget& rhs);
71 //------------------------------------------------------------------
73 //------------------------------------------------------------------
77 GetBroadcasterClassName ();
82 explicit operator bool() const;
85 EventIsTargetEvent (const lldb::SBEvent &event);
88 GetTargetFromEvent (const lldb::SBEvent &event);
91 GetNumModulesFromEvent (const lldb::SBEvent &event);
94 GetModuleAtIndexFromEvent (const uint32_t idx, const lldb::SBEvent &event);
100 %feature("docstring", "
101 Return the platform object associated with the target.
103 After return, the platform object should be checked for
107 A platform object.") GetPlatform;
111 %feature("docstring", "
112 Install any binaries that need to be installed.
114 This function does nothing when debugging on the host system.
115 When connected to remote platforms, the target's main executable
116 and any modules that have their install path set will be
117 installed on the remote platform. If the main executable doesn't
118 have an install location set, it will be installed in the remote
119 platform's working directory.
122 An error describing anything that went wrong during
123 installation.") Install;
127 %feature("docstring", "
128 Launch a new process.
130 Launch a new process by spawning a new process using the
131 target object's executable module's file as the file to launch.
132 Arguments are given in argv, and the environment variables
133 are in envp. Standard input and output files can be
134 optionally re-directed to stdin_path, stdout_path, and
138 An optional listener that will receive all process events.
139 If listener is valid then listener will listen to all
140 process events. If not valid, then this target's debugger
141 (SBTarget::GetDebugger()) will listen to all process events.
147 The environment array.
149 @param[in] launch_flags
150 Flags to modify the launch (@see lldb::LaunchFlags)
152 @param[in] stdin_path
153 The path to use when re-directing the STDIN of the new
154 process. If all stdXX_path arguments are NULL, a pseudo
155 terminal will be used.
157 @param[in] stdout_path
158 The path to use when re-directing the STDOUT of the new
159 process. If all stdXX_path arguments are NULL, a pseudo
160 terminal will be used.
162 @param[in] stderr_path
163 The path to use when re-directing the STDERR of the new
164 process. If all stdXX_path arguments are NULL, a pseudo
165 terminal will be used.
167 @param[in] working_directory
168 The working directory to have the child process run in
170 @param[in] launch_flags
171 Some launch options specified by logical OR'ing
172 lldb::LaunchFlags enumeration values together.
174 @param[in] stop_at_entry
175 If false do not stop the inferior at the entry point.
178 An error object. Contains the reason if there is some failure.
181 A process object for the newly created process.
185 process = target.Launch(self.dbg.GetListener(), None, None,
186 None, '/tmp/stdout.txt', None,
187 None, 0, False, error)
189 launches a new process by passing nothing for both the args and the envs
190 and redirect the standard output of the inferior to the /tmp/stdout.txt
191 file. It does not specify a working directory so that the debug server
192 will use its idea of what the current working directory is for the
193 inferior. Also, we ask the debugger not to stop the inferior at the
194 entry point. If no breakpoint is specified for the inferior, it should
195 run to completion if no user interaction is required.") Launch;
197 Launch (SBListener &listener,
200 const char *stdin_path,
201 const char *stdout_path,
202 const char *stderr_path,
203 const char *working_directory,
204 uint32_t launch_flags, // See LaunchFlags
206 lldb::SBError& error);
208 %feature("docstring", "
209 Launch a new process with sensible defaults.
215 The environment array.
217 @param[in] working_directory
218 The working directory to have the child process run in
221 Set to the target's debugger (SBTarget::GetDebugger())
223 Default: launch_flags
229 A pseudo terminal will be used.
232 A process object for the newly created process.
236 process = target.LaunchSimple(['X', 'Y', 'Z'], None, os.getcwd())
238 launches a new process by passing 'X', 'Y', 'Z' as the args to the
239 executable.") LaunchSimple;
241 LaunchSimple (const char **argv,
243 const char *working_directory);
246 Launch (lldb::SBLaunchInfo &launch_info, lldb::SBError& error);
248 %feature("docstring", "
252 File path of the core dump.
255 An error explaining what went wrong if the operation fails.
259 A process object for the newly created core file.
263 process = target.LoadCore('./a.out.core')
265 loads a new core file and returns the process object.") LoadCore;
267 LoadCore(const char *core_file);
270 LoadCore(const char *core_file, lldb::SBError &error);
273 Attach(lldb::SBAttachInfo &attach_info, lldb::SBError& error);
275 %feature("docstring", "
276 Attach to process with pid.
279 An optional listener that will receive all process events.
280 If listener is valid then 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.
285 The process ID to attach to.
288 An error explaining what went wrong if attach fails.
291 A process object for the attached process.") AttachToProcessWithID;
293 AttachToProcessWithID (SBListener &listener,
295 lldb::SBError& error);
297 %feature("docstring", "
298 Attach to process with name.
301 An optional listener that will receive all process events.
302 If listener is valid then listener will listen to all
303 process events. If not valid, then this target's debugger
304 (SBTarget::GetDebugger()) will listen to all process events.
307 Basename of process to attach to.
310 If true wait for a new instance of 'name' to be launched.
313 An error explaining what went wrong if attach fails.
316 A process object for the attached process.") AttachToProcessWithName;
318 AttachToProcessWithName (SBListener &listener,
321 lldb::SBError& error);
323 %feature("docstring", "
324 Connect to a remote debug server with url.
327 An optional listener that will receive all process events.
328 If listener is valid then listener will listen to all
329 process events. If not valid, then this target's debugger
330 (SBTarget::GetDebugger()) will listen to all process events.
333 The url to connect to, e.g., 'connect://localhost:12345'.
335 @param[in] plugin_name
336 The plugin name to be used; can be NULL.
339 An error explaining what went wrong if the connect fails.
342 A process object for the connected process.") ConnectRemote;
344 ConnectRemote (SBListener &listener,
346 const char *plugin_name,
352 %feature("docstring", "
353 Append the path mapping (from -> to) to the target's paths mapping list.") AppendImageSearchPath;
355 AppendImageSearchPath (const char *from,
360 AddModule (lldb::SBModule &module);
363 AddModule (const char *path,
368 AddModule (const char *path,
370 const char *uuid_cstr,
371 const char *symfile);
374 AddModule (const SBModuleSpec &module_spec);
377 GetNumModules () const;
380 GetModuleAtIndex (uint32_t idx);
383 RemoveModule (lldb::SBModule module);
389 FindModule (const lldb::SBFileSpec &file_spec);
391 %feature("docstring", "
392 Find compile units related to *this target and passed source
395 @param[in] sb_file_spec
396 A lldb::SBFileSpec object that contains source file
400 A lldb::SBSymbolContextList that gets filled in with all of
401 the symbol contexts for all the matches.") FindCompileUnits;
402 lldb::SBSymbolContextList
403 FindCompileUnits (const lldb::SBFileSpec &sb_file_spec);
409 GetAddressByteSize();
414 %feature("docstring", "
415 Architecture data byte width accessor
418 The size in 8-bit (host) bytes of a minimum addressable
419 unit from the Architecture's data bus") GetDataByteSize;
423 %feature("docstring", "
424 Architecture code byte width accessor
427 The size in 8-bit (host) bytes of a minimum addressable
428 unit from the Architecture's code bus") GetCodeByteSize;
433 SetSectionLoadAddress (lldb::SBSection section,
434 lldb::addr_t section_base_addr);
437 ClearSectionLoadAddress (lldb::SBSection section);
440 SetModuleLoadAddress (lldb::SBModule module,
441 int64_t sections_offset);
444 ClearModuleLoadAddress (lldb::SBModule module);
446 %feature("docstring", "
447 Find functions by name.
450 The name of the function we are looking for.
452 @param[in] name_type_mask
453 A logical OR of one or more FunctionNameType enum bits that
454 indicate what kind of names should be used when doing the
455 lookup. Bits include fully qualified names, base names,
456 C++ methods, or ObjC selectors.
457 See FunctionNameType for more details.
460 A lldb::SBSymbolContextList that gets filled in with all of
461 the symbol contexts for all the matches.") FindFunctions;
462 lldb::SBSymbolContextList
463 FindFunctions (const char *name,
464 uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
467 FindFirstType (const char* type);
470 FindTypes (const char* type);
473 GetBasicType(lldb::BasicType type);
475 lldb::SBSourceManager
478 %feature("docstring", "
479 Find global and static variables by name.
482 The name of the global or static variable we are looking
485 @param[in] max_matches
486 Allow the number of matches to be limited to max_matches.
489 A list of matched variables in an SBValueList.") FindGlobalVariables;
491 FindGlobalVariables (const char *name,
492 uint32_t max_matches);
494 %feature("docstring", "
495 Find the first global (or static) variable by name.
498 The name of the global or static variable we are looking
502 An SBValue that gets filled in with the found variable (if any).") FindFirstGlobalVariable;
504 FindFirstGlobalVariable (const char* name);
508 FindGlobalVariables(const char *name,
509 uint32_t max_matches,
510 MatchType matchtype);
512 lldb::SBSymbolContextList
513 FindGlobalFunctions(const char *name,
514 uint32_t max_matches,
515 MatchType matchtype);
520 %feature("docstring", "
521 Resolve a current file address into a section offset address.
526 An SBAddress which will be valid if...") ResolveFileAddress;
528 ResolveFileAddress (lldb::addr_t file_addr);
531 ResolveLoadAddress (lldb::addr_t vm_addr);
534 ResolvePastLoadAddress (uint32_t stop_id, lldb::addr_t vm_addr);
537 ResolveSymbolContextForAddress (const SBAddress& addr,
538 uint32_t resolve_scope);
540 %feature("docstring", "
541 Read target memory. If a target process is running then memory
542 is read from here. Otherwise the memory is read from the object
543 files. For a target whose bytes are sized as a multiple of host
544 bytes, the data read back will preserve the target's byte order.
547 A target address to read from.
550 The buffer to read memory into.
553 The maximum number of host bytes to read in the buffer passed
557 Error information is written here if the memory read fails.
560 The amount of data read in host bytes.") ReadMemory;
562 ReadMemory (const SBAddress addr, void *buf, size_t size, lldb::SBError &error);
565 BreakpointCreateByLocation (const char *file, uint32_t line);
568 BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
571 BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line, lldb::addr_t offset);
574 BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line,
575 lldb::addr_t offset, SBFileSpecList &module_list);
578 BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line,
579 uint32_t column, lldb::addr_t offset,
580 SBFileSpecList &module_list);
583 BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
586 BreakpointCreateByName (const char *symbol_name,
587 uint32_t func_name_type, // Logical OR one or more FunctionNameType enum bits
588 const SBFileSpecList &module_list,
589 const SBFileSpecList &comp_unit_list);
592 BreakpointCreateByName (const char *symbol_name,
593 uint32_t func_name_type, // Logical OR one or more FunctionNameType enum bits
594 lldb::LanguageType symbol_language,
595 const SBFileSpecList &module_list,
596 const SBFileSpecList &comp_unit_list);
599 %typemap(in) (const char **symbol_name, uint32_t num_names) {
600 using namespace lldb_private;
601 /* Check if is a list */
602 if (PythonList::Check($input)) {
603 PythonList list(PyRefType::Borrowed, $input);
606 $1 = (char**)malloc(($2+1)*sizeof(char*));
607 for (i = 0; i < $2; i++) {
608 PythonString py_str = list.GetItemAtIndex(i).AsType<PythonString>();
609 if (!py_str.IsAllocated()) {
610 PyErr_SetString(PyExc_TypeError,"list must contain strings and blubby");
615 $1[i] = const_cast<char*>(py_str.GetString().data());
618 } else if ($input == Py_None) {
621 PyErr_SetString(PyExc_TypeError,"not a list");
628 BreakpointCreateByNames (const char **symbol_name,
630 uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
631 const SBFileSpecList &module_list,
632 const SBFileSpecList &comp_unit_list);
635 BreakpointCreateByNames (const char **symbol_name,
637 uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
638 lldb::LanguageType symbol_language,
639 const SBFileSpecList &module_list,
640 const SBFileSpecList &comp_unit_list);
643 BreakpointCreateByNames (const char **symbol_name,
645 uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
646 lldb::LanguageType symbol_language,
648 const SBFileSpecList &module_list,
649 const SBFileSpecList &comp_unit_list);
652 BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
655 BreakpointCreateByRegex (const char *symbol_name_regex,
656 lldb::LanguageType symbol_language,
657 const SBFileSpecList &module_list,
658 const SBFileSpecList &comp_unit_list);
661 BreakpointCreateBySourceRegex (const char *source_regex, const lldb::SBFileSpec &source_file, const char *module_name = NULL);
664 BreakpointCreateBySourceRegex (const char *source_regex, const lldb::SBFileSpecList &module_list, const lldb::SBFileSpecList &file_list);
667 BreakpointCreateBySourceRegex (const char *source_regex,
668 const SBFileSpecList &module_list,
669 const SBFileSpecList &source_file,
670 const SBStringList &func_names);
673 BreakpointCreateForException (lldb::LanguageType language,
678 BreakpointCreateByAddress (addr_t address);
681 BreakpointCreateBySBAddress (SBAddress &sb_address);
683 %feature("docstring", "
684 Create a breakpoint using a scripted resolver.
686 @param[in] class_name
687 This is the name of the class that implements a scripted resolver.
688 The class should have the following signature:
690 def __init__(self, bkpt, extra_args):
691 # bkpt - the breakpoint for which this is the resolver. When
692 # the resolver finds an interesting address, call AddLocation
693 # on this breakpoint to add it.
695 # extra_args - an SBStructuredData that can be used to
696 # parametrize this instance. Same as the extra_args passed
697 # to BreakpointCreateFromScript.
699 def __get_depth__ (self):
700 # This is optional, but if defined, you should return the
701 # depth at which you want the callback to be called. The
702 # available options are:
703 # lldb.eSearchDepthModule
704 # lldb.eSearchDepthCompUnit
705 # The default if you don't implement this method is
706 # eSearchDepthModule.
708 def __callback__(self, sym_ctx):
709 # sym_ctx - an SBSymbolContext that is the cursor in the
710 # search through the program to resolve breakpoints.
711 # The sym_ctx will be filled out to the depth requested in
713 # Look in this sym_ctx for new breakpoint locations,
714 # and if found use bkpt.AddLocation to add them.
715 # Note, you will only get called for modules/compile_units that
716 # pass the SearchFilter provided by the module_list & file_list
717 # passed into BreakpointCreateFromScript.
719 def get_short_help(self):
720 # Optional, but if implemented return a short string that will
721 # be printed at the beginning of the break list output for the
724 @param[in] extra_args
725 This is an SBStructuredData object that will get passed to the
726 constructor of the class in class_name. You can use this to
727 reuse the same class, parametrizing it with entries from this
731 If this is non-empty, this will be used as the module filter in the
732 SearchFilter created for this breakpoint.
735 If this is non-empty, this will be used as the comp unit filter in the
736 SearchFilter created for this breakpoint.
739 An SBBreakpoint that will set locations based on the logic in the
740 resolver's search callback.") BreakpointCreateFromScript;
741 lldb::SBBreakpoint BreakpointCreateFromScript(
742 const char *class_name,
743 SBStructuredData &extra_args,
744 const SBFileSpecList &module_list,
745 const SBFileSpecList &file_list,
746 bool request_hardware = false);
749 GetNumBreakpoints () const;
752 GetBreakpointAtIndex (uint32_t idx) const;
755 BreakpointDelete (break_id_t break_id);
758 FindBreakpointByID (break_id_t break_id);
761 bool FindBreakpointsByName(const char *name, SBBreakpointList &bkpt_list);
763 void DeleteBreakpointName(const char *name);
765 void GetBreakpointNames(SBStringList &names);
768 EnableAllBreakpoints ();
771 DisableAllBreakpoints ();
774 DeleteAllBreakpoints ();
776 %feature("docstring", "
777 Read breakpoints from source_file and return the newly created
778 breakpoints in bkpt_list.
780 @param[in] source_file
781 The file from which to read the breakpoints
783 @param[out] bkpt_list
784 A list of the newly created breakpoints.
787 An SBError detailing any errors in reading in the breakpoints.") BreakpointsCreateFromFile;
789 BreakpointsCreateFromFile(SBFileSpec &source_file,
790 SBBreakpointList &bkpt_list);
792 %feature("docstring", "
793 Read breakpoints from source_file and return the newly created
794 breakpoints in bkpt_list.
796 @param[in] source_file
797 The file from which to read the breakpoints
799 @param[in] matching_names
800 Only read in breakpoints whose names match one of the names in this
803 @param[out] bkpt_list
804 A list of the newly created breakpoints.
807 An SBError detailing any errors in reading in the breakpoints.") BreakpointsCreateFromFile;
808 lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file,
809 SBStringList &matching_names,
810 SBBreakpointList &new_bps);
812 %feature("docstring", "
813 Write breakpoints to dest_file.
816 The file to which to write the breakpoints.
819 An SBError detailing any errors in writing in the breakpoints.") BreakpointsCreateFromFile;
821 BreakpointsWriteToFile(SBFileSpec &dest_file);
823 %feature("docstring", "
824 Write breakpoints listed in bkpt_list to dest_file.
827 The file to which to write the breakpoints.
830 Only write breakpoints from this list.
833 If true, append the breakpoints in bkpt_list to the others
834 serialized in dest_file. If dest_file doesn't exist, then a new
835 file will be created and the breakpoints in bkpt_list written to it.
838 An SBError detailing any errors in writing in the breakpoints.") BreakpointsCreateFromFile;
840 BreakpointsWriteToFile(SBFileSpec &dest_file,
841 SBBreakpointList &bkpt_list,
842 bool append = false);
845 GetNumWatchpoints () const;
848 GetWatchpointAtIndex (uint32_t idx) const;
851 DeleteWatchpoint (lldb::watch_id_t watch_id);
854 FindWatchpointByID (lldb::watch_id_t watch_id);
857 EnableAllWatchpoints ();
860 DisableAllWatchpoints ();
863 DeleteAllWatchpoints ();
866 WatchAddress (lldb::addr_t addr,
874 GetBroadcaster () const;
876 %feature("docstring", "
877 Create an SBValue with the given name by treating the memory starting at addr as an entity of type.
880 The name of the resultant SBValue
883 The address of the start of the memory region to be used.
886 The type to use to interpret the memory starting at addr.
889 An SBValue of the given type, may be invalid if there was an error reading
890 the underlying memory.") CreateValueFromAddress;
892 CreateValueFromAddress (const char *name, lldb::SBAddress addr, lldb::SBType type);
895 CreateValueFromData (const char *name, lldb::SBData data, lldb::SBType type);
898 CreateValueFromExpression (const char *name, const char* expr);
900 %feature("docstring", "
901 Disassemble a specified number of instructions starting at an address.
903 base_addr -- the address to start disassembly from
904 count -- the number of instructions to disassemble
905 flavor_string -- may be 'intel' or 'att' on x86 targets to specify that style of disassembly
906 Returns an SBInstructionList.")
908 lldb::SBInstructionList
909 ReadInstructions (lldb::SBAddress base_addr, uint32_t count);
911 lldb::SBInstructionList
912 ReadInstructions (lldb::SBAddress base_addr, uint32_t count, const char *flavor_string);
914 %feature("docstring", "
915 Disassemble the bytes in a buffer and return them in an SBInstructionList.
917 base_addr -- used for symbolicating the offsets in the byte stream when disassembling
918 buf -- bytes to be disassembled
919 size -- (C++) size of the buffer
920 Returns an SBInstructionList.")
922 lldb::SBInstructionList
923 GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
925 %feature("docstring", "
926 Disassemble the bytes in a buffer and return them in an SBInstructionList, with a supplied flavor.
928 base_addr -- used for symbolicating the offsets in the byte stream when disassembling
929 flavor -- may be 'intel' or 'att' on x86 targets to specify that style of disassembly
930 buf -- bytes to be disassembled
931 size -- (C++) size of the buffer
932 Returns an SBInstructionList.")
933 GetInstructionsWithFlavor;
934 lldb::SBInstructionList
935 GetInstructionsWithFlavor (lldb::SBAddress base_addr, const char *flavor_string, const void *buf, size_t size);
937 lldb::SBSymbolContextList
938 FindSymbols (const char *name, lldb::SymbolType type = eSymbolTypeAny);
941 GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
944 GetStackRedZoneSize();
947 GetLaunchInfo () const;
950 SetLaunchInfo (const lldb::SBLaunchInfo &launch_info);
952 void SetCollectingStats(bool v);
954 bool GetCollectingStats();
956 lldb::SBStructuredData GetStatistics();
959 operator == (const lldb::SBTarget &rhs) const;
962 operator != (const lldb::SBTarget &rhs) const;
965 EvaluateExpression (const char *expr);
968 EvaluateExpression (const char *expr, const lldb::SBExpressionOptions &options);
970 STRING_EXTENSION_LEVEL(SBTarget, lldb::eDescriptionLevelBrief)
974 class modules_access(object):
975 '''A helper object that will lazily hand out lldb.SBModule objects for a target when supplied an index, or by full or partial path.'''
976 def __init__(self, sbtarget):
977 self.sbtarget = sbtarget
981 return int(self.sbtarget.GetNumModules())
984 def __getitem__(self, key):
985 num_modules = self.sbtarget.GetNumModules()
987 if key < num_modules:
988 return self.sbtarget.GetModuleAtIndex(key)
989 elif type(key) is str:
990 if key.find('/') == -1:
991 for idx in range(num_modules):
992 module = self.sbtarget.GetModuleAtIndex(idx)
993 if module.file.basename == key:
996 for idx in range(num_modules):
997 module = self.sbtarget.GetModuleAtIndex(idx)
998 if module.file.fullpath == key:
1000 # See if the string is a UUID
1002 the_uuid = uuid.UUID(key)
1004 for idx in range(num_modules):
1005 module = self.sbtarget.GetModuleAtIndex(idx)
1006 if module.uuid == the_uuid:
1010 elif type(key) is uuid.UUID:
1011 for idx in range(num_modules):
1012 module = self.sbtarget.GetModuleAtIndex(idx)
1013 if module.uuid == key:
1015 elif type(key) is re.SRE_Pattern:
1016 matching_modules = []
1017 for idx in range(num_modules):
1018 module = self.sbtarget.GetModuleAtIndex(idx)
1019 re_match = key.search(module.path.fullpath)
1021 matching_modules.append(module)
1022 return matching_modules
1024 print("error: unsupported item type: %s" % type(key))
1027 def get_modules_access_object(self):
1028 '''An accessor function that returns a modules_access() object which allows lazy module access from a lldb.SBTarget object.'''
1029 return self.modules_access (self)
1031 def get_modules_array(self):
1032 '''An accessor function that returns a list() that contains all modules in a lldb.SBTarget object.'''
1034 for idx in range(self.GetNumModules()):
1035 modules.append(self.GetModuleAtIndex(idx))
1038 def module_iter(self):
1039 '''Returns an iterator over all modules in a lldb.SBTarget
1041 return lldb_iter(self, 'GetNumModules', 'GetModuleAtIndex')
1043 def breakpoint_iter(self):
1044 '''Returns an iterator over all breakpoints in a lldb.SBTarget
1046 return lldb_iter(self, 'GetNumBreakpoints', 'GetBreakpointAtIndex')
1048 def watchpoint_iter(self):
1049 '''Returns an iterator over all watchpoints in a lldb.SBTarget
1051 return lldb_iter(self, 'GetNumWatchpoints', 'GetWatchpointAtIndex')
1053 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).''')
1054 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.''')
1055 process = property(GetProcess, None, doc='''A read only property that returns an lldb object that represents the process (lldb.SBProcess) that this target owns.''')
1056 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.''')
1057 debugger = property(GetDebugger, None, doc='''A read only property that returns an lldb object that represents the debugger (lldb.SBDebugger) that owns this target.''')
1058 num_breakpoints = property(GetNumBreakpoints, None, doc='''A read only property that returns the number of breakpoints that this target has as an integer.''')
1059 num_watchpoints = property(GetNumWatchpoints, None, doc='''A read only property that returns the number of watchpoints that this target has as an integer.''')
1060 broadcaster = property(GetBroadcaster, None, doc='''A read only property that an lldb object that represents the broadcaster (lldb.SBBroadcaster) for this target.''')
1061 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.''')
1062 addr_size = property(GetAddressByteSize, None, doc='''A read only property that returns the size in bytes of an address for this target.''')
1063 triple = property(GetTriple, None, doc='''A read only property that returns the target triple (arch-vendor-os) for this target as a string.''')
1064 data_byte_size = property(GetDataByteSize, None, doc='''A read only property that returns the size in host bytes of a byte in the data address space for this target.''')
1065 code_byte_size = property(GetCodeByteSize, None, doc='''A read only property that returns the size in host bytes of a byte in the code address space for this target.''')
1066 platform = property(GetPlatform, None, doc='''A read only property that returns the platform associated with with this target.''')