original_docstring: calculate the stack used by the thread
docstring: calculate the stack used by the thread
docstring_tokens: calculate the stack used by the thread
code: def stack_used(self):
  		"""calculate the stack used by the thread"""
  		if 'stack_used' not in self.__dict__:
  			stack_base = self._tcb['stack_alloc_ptr'].cast(gdb.lookup_type('unsigned char').pointer())
  			if stack_base == 0:
  				self.__dict__['stack_used'] = 0
  			else:
  				stack_limit = self._tcb['adj_stack_size']
  				for offset in range(0, stack_limit):
  					if stack_base[offset] != 0xff:
  						break
  				self.__dict__['stack_used'] = stack_limit - offset
  		return self.__dict__['stack_used']
code_tokens: def stack_used ( self ) : if 'stack_used' not in self . __dict__ : stack_base = self . _tcb [ 'stack_alloc_ptr' ] . cast ( gdb . lookup_type ( 'unsigned char' ) . pointer ( ) ) if stack_base == 0 : self . __dict__ [ 'stack_used' ] = 0 else : stack_limit = self . _tcb [ 'adj_stack_size' ] for offset in range ( 0 , stack_limit ) : if stack_base [ offset ] != 0xff : break self . __dict__ [ 'stack_used' ] = stack_limit - offset return self . __dict__ [ 'stack_used' ]
short_docstring: calculate the stack used by the thread
short_docstring_tokens: calculate the stack used by the thread
comment: """calculate the stack used by the thread"""