parameters: (process)
docstring: Create code that defines a structure that represents all segments that
      can contain data for all images in "target". It returns a static sized
      array initialized with all of base, size structs for all the threads.
docstring_summary: Create code that defines a structure that represents all segments that
      can contain data for all images in "target". It returns a static sized
      array initialized with all of base, size structs for all the threads.
docstring_tokens: Create code that defines a structure that represents all segments that can contain data for all images in target . It returns a static sized array initialized with all of base size structs for all the threads .
function: def get_sections_ranges_struct(process):
      '''Create code that defines a structure that represents all segments that
      can contain data for all images in "target". It returns a static sized
      array initialized with all of base, size structs for all the threads.'''
      target = process.target
      segment_dicts = list()
      for (module_idx, module) in enumerate(target.modules):
          for sect_idx in range(module.GetNumSections()):
              section = module.GetSectionAtIndex(sect_idx)
              if not section:
                  break
              name = section.name
              if name != '__TEXT' and name != '__LINKEDIT' and name != '__PAGEZERO':
                  base = section.GetLoadAddress(target)
                  size = section.GetByteSize()
                  if base != lldb.LLDB_INVALID_ADDRESS and size > 0:
                      segment_dicts.append({'base': base, 'size': size})
      segment_dicts_len = len(segment_dicts)
      if segment_dicts_len > 0:
          result = '''
  #define NUM_SEGMENTS %u
  typedef struct segment_range_t { uint64_t base; uint32_t size; } segment_range_t;
  segment_range_t segments[NUM_SEGMENTS];''' % (segment_dicts_len,)
          for (idx, segment_dict) in enumerate(segment_dicts):
              segment_dict['index'] = idx
              result += '''
  segments[%(index)u].base = 0x%(base)x;
  segments[%(index)u].size = 0x%(size)x;''' % segment_dict
          return result
      else:
          return ''
function_tokens: def get_sections_ranges_struct ( process ) : target = process . target segment_dicts = list ( ) for ( module_idx , module ) in enumerate ( target . modules ) : for sect_idx in range ( module . GetNumSections ( ) ) : section = module . GetSectionAtIndex ( sect_idx ) if not section : break name = section . name if name != '__TEXT' and name != '__LINKEDIT' and name != '__PAGEZERO' : base = section . GetLoadAddress ( target ) size = section . GetByteSize ( ) if base != lldb . LLDB_INVALID_ADDRESS and size > 0 : segment_dicts . append ( { 'base' : base , 'size' : size } ) segment_dicts_len = len ( segment_dicts ) if segment_dicts_len > 0 : result = '''
  #define NUM_SEGMENTS %u
  typedef struct segment_range_t { uint64_t base; uint32_t size; } segment_range_t;
  segment_range_t segments[NUM_SEGMENTS];''' % ( segment_dicts_len , ) for ( idx , segment_dict ) in enumerate ( segment_dicts ) : segment_dict [ 'index' ] = idx result += '''
  segments[%(index)u].base = 0x%(base)x;
  segments[%(index)u].size = 0x%(size)x;''' % segment_dict return result else : return ''