brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.2 KiB · 289cf53 Raw
215 lines · plain
1%feature("docstring",2"Represents an executable image and its associated object and symbol files.3 4The module is designed to be able to select a single slice of an5executable image as it would appear on disk and during program6execution.7 8You can retrieve SBModule from :py:class:`SBSymbolContext` , which in turn is available9from SBFrame.10 11SBModule supports symbol iteration, for example, ::12 13    for symbol in module:14        name = symbol.GetName()15        saddr = symbol.GetStartAddress()16        eaddr = symbol.GetEndAddress()17 18and rich comparison methods which allow the API program to use, ::19 20    if thisModule == thatModule:21        print('This module is the same as that module')22 23to test module equality.  A module also contains object file sections, namely24:py:class:`SBSection` .  SBModule supports section iteration through section_iter(), for25example, ::26 27    print('Number of sections: %d' % module.GetNumSections())28    for sec in module.section_iter():29        print(sec)30 31And to iterate the symbols within a SBSection, use symbol_in_section_iter(), ::32 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()))39 40produces this following output: ::41 42    [0x0000000100001780-0x0000000100001d5c) a.out.__TEXT.__text43        id = {0x00000004}, name = 'mask_access(MaskAction, unsigned int)', range = [0x00000001000017c0-0x0000000100001870)44        symbol type: code45        id = {0x00000008}, name = 'thread_func(void*)', range = [0x0000000100001870-0x00000001000019b0)46        symbol type: code47        id = {0x0000000c}, name = 'main', range = [0x00000001000019b0-0x0000000100001d5c)48        symbol type: code49        id = {0x00000023}, name = 'start', address = 0x000000010000178050        symbol type: code51    [0x0000000100001d5c-0x0000000100001da4) a.out.__TEXT.__stubs52        id = {0x00000024}, name = '__stack_chk_fail', range = [0x0000000100001d5c-0x0000000100001d62)53        symbol type: trampoline54        id = {0x00000028}, name = 'exit', range = [0x0000000100001d62-0x0000000100001d68)55        symbol type: trampoline56        id = {0x00000029}, name = 'fflush', range = [0x0000000100001d68-0x0000000100001d6e)57        symbol type: trampoline58        id = {0x0000002a}, name = 'fgets', range = [0x0000000100001d6e-0x0000000100001d74)59        symbol type: trampoline60        id = {0x0000002b}, name = 'printf', range = [0x0000000100001d74-0x0000000100001d7a)61        symbol type: trampoline62        id = {0x0000002c}, name = 'pthread_create', range = [0x0000000100001d7a-0x0000000100001d80)63        symbol type: trampoline64        id = {0x0000002d}, name = 'pthread_join', range = [0x0000000100001d80-0x0000000100001d86)65        symbol type: trampoline66        id = {0x0000002e}, name = 'pthread_mutex_lock', range = [0x0000000100001d86-0x0000000100001d8c)67        symbol type: trampoline68        id = {0x0000002f}, name = 'pthread_mutex_unlock', range = [0x0000000100001d8c-0x0000000100001d92)69        symbol type: trampoline70        id = {0x00000030}, name = 'rand', range = [0x0000000100001d92-0x0000000100001d98)71        symbol type: trampoline72        id = {0x00000031}, name = 'strtoul', range = [0x0000000100001d98-0x0000000100001d9e)73        symbol type: trampoline74        id = {0x00000032}, name = 'usleep', range = [0x0000000100001d9e-0x0000000100001da4)75        symbol type: trampoline76    [0x0000000100001da4-0x0000000100001e2c) a.out.__TEXT.__stub_helper77    [0x0000000100001e2c-0x0000000100001f10) a.out.__TEXT.__cstring78    [0x0000000100001f10-0x0000000100001f68) a.out.__TEXT.__unwind_info79    [0x0000000100001f68-0x0000000100001ff8) a.out.__TEXT.__eh_frame80"81) lldb::SBModule;82 83%feature("docstring", "84    Check if the module is file backed.85 86    @return87 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;91 92%feature("docstring", "93    Get const accessor for the module file specification.94 95    This function returns the file for the module on the host system96    that is running LLDB. This can differ from the path on the97    platform since we might be doing remote debugging.98 99    @return100        A const reference to the file specification object."101) lldb::SBModule::GetFileSpec;102 103%feature("docstring", "104    Get accessor for the module platform file specification.105 106    Platform file refers to the path of the module as it is known on107    the remote system on which it is being debugged. For local108    debugging this is always the same as Module::GetFileSpec(). But109    remote debugging might mention a file '/usr/lib/liba.dylib'110    which might be locally downloaded and cached. In this case the111    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.114 115    @return116        A const reference to the file specification object."117) lldb::SBModule::GetPlatformFileSpec;118 119%feature("docstring", "Returns the UUID of the module as a Python string."120) lldb::SBModule::GetUUIDString;121 122%feature("docstring", "123    Find compile units related to this module and passed source124    file.125 126    @param[in] sb_file_spec127        A :py:class:`SBFileSpec` object that contains source file128        specification.129 130    @return131        A :py:class:`SBSymbolContextList` that gets filled in with all of132        the symbol contexts for all the matches."133) lldb::SBModule::FindCompileUnits;134 135%feature("docstring", "136    Find functions by name.137 138    @param[in] name139        The name of the function we are looking for.140 141    @param[in] name_type_mask142        A logical OR of one or more FunctionNameType enum bits that143        indicate what kind of names should be used when doing the144        lookup. Bits include fully qualified names, base names,145        C++ methods, or ObjC selectors.146        See FunctionNameType for more details.147 148    @return149        A symbol context list that gets filled in with all of the150        matches."151) lldb::SBModule::FindFunctions;152 153%feature("docstring", "154    Get all types matching type_mask from debug info in this155    module.156 157    @param[in] type_mask158        A bitfield that consists of one or more bits logically OR'ed159        together from the lldb::TypeClass enumeration. This allows160        you to request only structure types, or only class, struct161        and union types. Passing in lldb::eTypeClassAny will return162        all types found in the debug information for this module.163 164    @return165        A list of types in this module that match type_mask"166) lldb::SBModule::GetTypes;167 168%feature("docstring", "169    Find global and static variables by name.170 171    @param[in] target172        A valid SBTarget instance representing the debuggee.173 174    @param[in] name175        The name of the global or static variable we are looking176        for.177 178    @param[in] max_matches179        Allow the number of matches to be limited to max_matches.180 181    @return182        A list of matched variables in an SBValueList."183) lldb::SBModule::FindGlobalVariables;184 185%feature("docstring", "186    Find the first global (or static) variable by name.187 188    @param[in] target189        A valid SBTarget instance representing the debuggee.190 191    @param[in] name192        The name of the global or static variable we are looking193        for.194 195    @return196        An SBValue that gets filled in with the found variable (if any)."197) lldb::SBModule::FindFirstGlobalVariable;198 199%feature("docstring", "200    Returns the number of modules in the module cache. This is an201    implementation detail exposed for testing and should not be relied upon.202 203    @return204        The number of modules in the module cache."205) lldb::SBModule::GetNumberAllocatedModules;206 207%feature("docstring", "208    Removes all modules which are no longer needed by any part of LLDB from209    the module cache.210 211    This is an implementation detail exposed for testing and should not be212    relied upon. Use SBDebugger::MemoryPressureDetected instead to reduce213    LLDB's memory consumption during execution.214") lldb::SBModule::GarbageCollectAllocatedModules;215