parameters: (process)
docstring: Create code that defines a structure that represents threads stack bounds
      for all  threads. It returns a static sized array initialized with all of
      the tid, base, size structs for all the threads.
docstring_summary: Create code that defines a structure that represents threads stack bounds
      for all  threads. It returns a static sized array initialized with all of
      the tid, base, size structs for all the threads.
docstring_tokens: Create code that defines a structure that represents threads stack bounds for all threads . It returns a static sized array initialized with all of the tid base size structs for all the threads .
function: def get_thread_stack_ranges_struct(process):
      '''Create code that defines a structure that represents threads stack bounds
      for all  threads. It returns a static sized array initialized with all of
      the tid, base, size structs for all the threads.'''
      stack_dicts = list()
      if process:
          i = 0
          for thread in process:
              min_sp = thread.frame[0].sp
              max_sp = min_sp
              for frame in thread.frames:
                  sp = frame.sp
                  if sp < min_sp:
                      min_sp = sp
                  if sp > max_sp:
                      max_sp = sp
              if min_sp < max_sp:
                  stack_dicts.append({'tid': thread.GetThreadID(
                  ), 'base': min_sp, 'size': max_sp - min_sp, 'index': i})
                  i += 1
      stack_dicts_len = len(stack_dicts)
      if stack_dicts_len > 0:
          result = '''
  #define NUM_STACKS %u
  #define STACK_RED_ZONE_SIZE %u
  typedef struct thread_stack_t { uint64_t tid, base, size; } thread_stack_t;
  thread_stack_t stacks[NUM_STACKS];''' % (stack_dicts_len, process.target.GetStackRedZoneSize())
          for stack_dict in stack_dicts:
              result += '''
  stacks[%(index)u].tid  = 0x%(tid)x;
  stacks[%(index)u].base = 0x%(base)x;
  stacks[%(index)u].size = 0x%(size)x;''' % stack_dict
          return result
      else:
          return ''
function_tokens: def get_thread_stack_ranges_struct ( process ) : stack_dicts = list ( ) if process : i = 0 for thread in process : min_sp = thread . frame [ 0 ] . sp max_sp = min_sp for frame in thread . frames : sp = frame . sp if sp < min_sp : min_sp = sp if sp > max_sp : max_sp = sp if min_sp < max_sp : stack_dicts . append ( { 'tid' : thread . GetThreadID ( ) , 'base' : min_sp , 'size' : max_sp - min_sp , 'index' : i } ) i += 1 stack_dicts_len = len ( stack_dicts ) if stack_dicts_len > 0 : result = '''
  #define NUM_STACKS %u
  #define STACK_RED_ZONE_SIZE %u
  typedef struct thread_stack_t { uint64_t tid, base, size; } thread_stack_t;
  thread_stack_t stacks[NUM_STACKS];''' % ( stack_dicts_len , process . target . GetStackRedZoneSize ( ) ) for stack_dict in stack_dicts : result += '''
  stacks[%(index)u].tid  = 0x%(tid)x;
  stacks[%(index)u].base = 0x%(base)x;
  stacks[%(index)u].size = 0x%(size)x;''' % stack_dict return result else : return ''