2 "Represents an executable image and its associated object and symbol files.
4 The module is designed to be able to select a single slice of an
5 executable image as it would appear on disk and during program
8 You can retrieve SBModule from :py:class:`SBSymbolContext` , which in turn is available
11 SBModule supports symbol iteration, for example, ::
14 name = symbol.GetName()
15 saddr = symbol.GetStartAddress()
16 eaddr = symbol.GetEndAddress()
18 and rich comparison methods which allow the API program to use, ::
20 if thisModule == thatModule:
21 print('This module is the same as that module')
23 to test module equality. A module also contains object file sections, namely
24 :py:class:`SBSection` . SBModule supports section iteration through section_iter(), for
27 print('Number of sections: %d' % module.GetNumSections())
28 for sec in module.section_iter():
31 And to iterate the symbols within a SBSection, use symbol_in_section_iter(), ::
33 # Iterates the text section and prints each symbols within each sub-section.
34 for subsec in text_sec:
35 print(INDENT + repr(subsec))
36 for sym in exe_module.symbol_in_section_iter(subsec):
37 print(INDENT2 + repr(sym))
38 print(INDENT2 + 'symbol type: %s' % symbol_type_to_str(sym.GetType()))
40 produces this following output: ::
42 [0x0000000100001780-0x0000000100001d5c) a.out.__TEXT.__text
43 id = {0x00000004}, name = 'mask_access(MaskAction, unsigned int)', range = [0x00000001000017c0-0x0000000100001870)
45 id = {0x00000008}, name = 'thread_func(void*)', range = [0x0000000100001870-0x00000001000019b0)
47 id = {0x0000000c}, name = 'main', range = [0x00000001000019b0-0x0000000100001d5c)
49 id = {0x00000023}, name = 'start', address = 0x0000000100001780
51 [0x0000000100001d5c-0x0000000100001da4) a.out.__TEXT.__stubs
52 id = {0x00000024}, name = '__stack_chk_fail', range = [0x0000000100001d5c-0x0000000100001d62)
53 symbol type: trampoline
54 id = {0x00000028}, name = 'exit', range = [0x0000000100001d62-0x0000000100001d68)
55 symbol type: trampoline
56 id = {0x00000029}, name = 'fflush', range = [0x0000000100001d68-0x0000000100001d6e)
57 symbol type: trampoline
58 id = {0x0000002a}, name = 'fgets', range = [0x0000000100001d6e-0x0000000100001d74)
59 symbol type: trampoline
60 id = {0x0000002b}, name = 'printf', range = [0x0000000100001d74-0x0000000100001d7a)
61 symbol type: trampoline
62 id = {0x0000002c}, name = 'pthread_create', range = [0x0000000100001d7a-0x0000000100001d80)
63 symbol type: trampoline
64 id = {0x0000002d}, name = 'pthread_join', range = [0x0000000100001d80-0x0000000100001d86)
65 symbol type: trampoline
66 id = {0x0000002e}, name = 'pthread_mutex_lock', range = [0x0000000100001d86-0x0000000100001d8c)
67 symbol type: trampoline
68 id = {0x0000002f}, name = 'pthread_mutex_unlock', range = [0x0000000100001d8c-0x0000000100001d92)
69 symbol type: trampoline
70 id = {0x00000030}, name = 'rand', range = [0x0000000100001d92-0x0000000100001d98)
71 symbol type: trampoline
72 id = {0x00000031}, name = 'strtoul', range = [0x0000000100001d98-0x0000000100001d9e)
73 symbol type: trampoline
74 id = {0x00000032}, name = 'usleep', range = [0x0000000100001d9e-0x0000000100001da4)
75 symbol type: trampoline
76 [0x0000000100001da4-0x0000000100001e2c) a.out.__TEXT.__stub_helper
77 [0x0000000100001e2c-0x0000000100001f10) a.out.__TEXT.__cstring
78 [0x0000000100001f10-0x0000000100001f68) a.out.__TEXT.__unwind_info
79 [0x0000000100001f68-0x0000000100001ff8) a.out.__TEXT.__eh_frame
83 %feature
("docstring", "
84 Check if the module is file backed.
88 True, if the module is backed by an object file on disk.
89 False, if the module is backed by an object file in memory."
90 ) lldb
::SBModule
::IsFileBacked
;
92 %feature
("docstring", "
93 Get const accessor for the module file specification.
95 This function returns the file for the module on the host system
96 that is running LLDB. This can differ from the path on the
97 platform since we might be doing remote debugging.
100 A const reference to the file specification object."
101 ) lldb
::SBModule
::GetFileSpec
;
103 %feature
("docstring", "
104 Get accessor for the module platform file specification.
106 Platform file refers to the path of the module as it is known on
107 the remote system on which it is being debugged. For local
108 debugging this is always the same as Module::GetFileSpec(). But
109 remote debugging might mention a file '/usr/lib/liba.dylib'
110 which might be locally downloaded and cached. In this case the
111 platform file could be something like:
112 '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
113 The file could also be cached in a local developer kit directory.
116 A const reference to the file specification object."
117 ) lldb
::SBModule
::GetPlatformFileSpec
;
119 %feature
("docstring", "Returns the UUID of the module as a Python string."
120 ) lldb
::SBModule
::GetUUIDString
;
122 %feature
("docstring", "
123 Find compile units related to this module and passed source
126 @param[in] sb_file_spec
127 A :py:class:`SBFileSpec` object that contains source file
131 A :py:class:`SBSymbolContextList` that gets filled in with all of
132 the symbol contexts for all the matches."
133 ) lldb
::SBModule
::FindCompileUnits
;
135 %feature
("docstring", "
136 Find functions by name.
139 The name of the function we are looking for.
141 @param[in] name_type_mask
142 A logical OR of one or more FunctionNameType enum bits that
143 indicate what kind of names should be used when doing the
144 lookup. Bits include fully qualified names, base names,
145 C++ methods, or ObjC selectors.
146 See FunctionNameType for more details.
149 A symbol context list that gets filled in with all of the
151 ) lldb
::SBModule
::FindFunctions
;
153 %feature
("docstring", "
154 Get all types matching type_mask from debug info in this
158 A bitfield that consists of one or more bits logically OR'ed
159 together from the lldb::TypeClass enumeration. This allows
160 you to request only structure types, or only class, struct
161 and union types. Passing in lldb::eTypeClassAny will return
162 all types found in the debug information for this module.
165 A list of types in this module that match type_mask"
166 ) lldb
::SBModule
::GetTypes
;
168 %feature
("docstring", "
169 Find global and static variables by name.
172 A valid SBTarget instance representing the debuggee.
175 The name of the global or static variable we are looking
178 @param[in] max_matches
179 Allow the number of matches to be limited to max_matches.
182 A list of matched variables in an SBValueList."
183 ) lldb
::SBModule
::FindGlobalVariables
;
185 %feature
("docstring", "
186 Find the first global (or static) variable by name.
189 A valid SBTarget instance representing the debuggee.
192 The name of the global or static variable we are looking
196 An SBValue that gets filled in with the found variable (if any)."
197 ) lldb
::SBModule
::FindFirstGlobalVariable
;
199 %feature
("docstring", "
200 Returns the number of modules in the module cache. This is an
201 implementation detail exposed for testing and should not be relied upon.
204 The number of modules in the module cache."
205 ) lldb
::SBModule
::GetNumberAllocatedModules
;
207 %feature
("docstring", "
208 Removes all modules which are no longer needed by any part of LLDB from
211 This is an implementation detail exposed for testing and should not be
212 relied upon. Use SBDebugger::MemoryPressureDetected instead to reduce
213 LLDB's memory consumption during execution.
214 ") lldb
::SBModule
::GarbageCollectAllocatedModules
;