crash.types.task module
***********************

class crash.types.task.LinuxTask(task_struct: Value)

   Bases: "object"

   A wrapper class for "struct task_struct".  There will be typically
   one of these allocated for every task discovered in the debugging
   environment.

   Parameters:
      **task_struct** -- The task to wrap.  The value must be of type
      "struct task_struct".

   task_struct

      The task being wrapped.  The value is of type "struct
      task_struct".

      Type:
         "gdb.Value"

   active

      Whether this task is active

      Type:
         "bool"

   cpu

      The CPU number the task was using

      Type:
         "int"

   regs

      The registers associated with this task, if active

   thread_info

      The architecture-specific "struct thread_info" for this task.
      The value will be of type "struct thread_info".

      Type:
         "gdb.Value"

   thread

      The GDB representation of the thread.

      Type:
         "gdb.InferiorThread"

   mem_valid

      Whether the memory statistics are currently valid.

      Type:
         "bool"

   rss

      The size of the resident memory for this task.

      Type:
         "int"

   total_vm

      The total size of the vm space for this task.

      Type:
         "int"

   pgd_addr

      The address of the top of the page table tree.

      Type:
         "int"

   Raises:
      * **.ArgumentTypeError** -- task_struct was not a "gdb.Value".

      * **.UnexpectedGDBTypeError** -- task_struct was not of type
        "struct task_struct".

      * **.InvalidArgumentError** -- The cpu number was not "None" or
        an     "int".

   attach_thread(thread: InferiorThread) -> None

      Associate a gdb thread with this task

      Parameters:
         **thread** -- The gdb thread to associate with this task

   get_last_cpu() -> int

      Returns the last cpu this task was scheduled to execute on

      Returns:
         The last cpu this task was scheduled to execute on

      Return type:
         "int"

   get_rss() -> int

      Return the resident set for this task

      Returns:
         The size of the resident memory set for this task

      Return type:
         "int"

   get_stack_pointer() -> int

      Get the stack pointer for this task

      Returns:
         The address of the stack pointer for this task.

      Return type:
         "int"

      Raises:
         * **NotImplementedError** -- The architecture hasn't provided

         * **a stack pointer callback.** --

   get_thread_info() -> Value

      Get the thread info for this task

      The thread info structure is architecture specific and so this
      method abstracts its retreival.

      Returns:
         The struct thread_info associated with this
            task.  The type of the value is "struct thread_info".

      Return type:
         "gdb.Value"

   get_thread_struct() -> Value

      Get the thread struct for this task

      The thread struct structure is architecture specific and so this
      method abstracts its retreival.

      Returns:
         The struct thread_struct associated with this
            task.  The type of the value is "struct thread_struct".

      Return type:
         "gdb.Value"

   is_exiting() -> bool

      Returns whether a task is exiting

      Returns:
         Whether the task is exiting

      Return type:
         "bool"

   is_kernel_task() -> bool

   is_thread_group_leader() -> bool

      Returns whether a task is a thread group leader

      Returns:
         Whether the task is a thread group leader

      Return type:
         "bool"

   is_zombie() -> bool

      Returns whether a task is in Zombie state

      Returns:
         Whether the task is in zombie state

      Return type:
         "bool"

   last_run() -> int

      The timestamp of when this task was last run

      Returns:
         The timestamp of when this task was last run

      Return type:
         "int"

   maybe_dead() -> bool

      Returns whether this task is dead

      Returns:
         Whether this task is dead

      Return type:
         "bool"

   parent_pid() -> int

      Returns the pid of this task's parent

      Returns:
         The pid of this task's parent

      Return type:
         "int"

   set_active(cpu: int, regs: Dict[str, int]) -> None

      Set this task as active in the debugging environment

      Parameters:
         * **cpu** -- Which CPU this task was using

         * **regs** -- The registers associated with this task

      Raises:
         **.InvalidArgumentError** -- The cpu was not a valid integer.

   set_thread_info(thread_info: Value) -> None

      Set the thread info for this task

      The thread info structure is architecture specific.  This method
      allows the architecture code to assign its thread info structure
      to this task.

      Parameters:
         **thread_info** -- The "struct thread_info" to be associated
         with this task.  The value must be of type "struct
         thread_info".

   set_thread_struct(thread_struct: Value) -> None

      Set the thread struct for this task

      The thread struct structure is architecture specific.  This
      method allows the architecture code to assign its thread struct
      structure to this task.

      Parameters:
         **thread_struct** -- The "struct thread_struct" to be
         associated with this task.  The value must be of type "struct
         thread_struct".

   task_address() -> int

      Returns the address of the task_struct for this task

      Returns:
         The address of the task_struct

      Return type:
         "int"

   task_flags() -> int

      Returns the flags for this task

      Returns:
         The flags for this task

      Return type:
         "int"

   task_name(brackets: bool = False) -> str

      Returns the "comm" field of this task

      Parameters:
         **brackets** -- If this task is a kernel thread, surround the
         name in square brackets

      Returns:
         The "comm" field of this task a python string

      Return type:
         "str"

   task_pid() -> int

      Returns the pid of this task

      Returns:
         The pid of this task

      Return type:
         "int"

   task_state() -> int

      Return the task state flags for this task *(possibly broken due
      to combining flags from ``state`` and ``exit_state``)*.

      Returns:
         The state flags for this task.

      Return type:
         "int"

   update_mem_usage() -> None

      Update the memory usage for this task

      Tasks are created initially without their memory statistics.
      This method explicitly updates them.

crash.types.task.TF

   alias of "TaskStateFlags"

class crash.types.task.TaskStateFlags

   Bases: "object"

   A class to contain state related to discovering task flag values.
   Not meant to be instantiated.

   The initial values below are overridden once symbols are available
   to resolve them properly.

   EXIT_DEAD: int = -1

   EXIT_ZOMBIE: int = -1

   TASK_DEAD: int = -1

   TASK_FLAG_UNINITIALIZED = -1

   TASK_IDLE: int = -1

   TASK_INTERRUPTIBLE: int = -1

   TASK_NEW: int = -1

   TASK_NOLOAD: int = -1

   TASK_PARKED: int = -1

   TASK_RUNNING = 0

   TASK_STOPPED: int = -1

   TASK_SWAPPING: int = -1

   TASK_TRACING_STOPPED: int = -1

   TASK_UNINTERRUPTIBLE: int = -1

   TASK_WAKEKILL: int = -1

   TASK_WAKING: int = -1

   classmethod has_flag(flagname: str) -> bool

   classmethod task_state_flags_callback(symbol: Symbol) -> None

      Detect which task flags this kernel uses.

      Meant to be used as a SymbolCallback.

      Different kernels use different task flags or even different
      values for the same flags.  This method tries to determine the
      flags for the kernel.

      Parameters:
         **symbol** -- The "task_state_array" symbol.

crash.types.task.for_each_all_tasks() -> Iterator[Value]

   Iterate the task list and yield each task including any associated
   thread tasks

   Yields:
      "gdb.Value" -- The next task on the list.  The value is of type
      "struct task_struct".

crash.types.task.for_each_thread_group_leader() -> Iterator[Value]

   Iterate the task list and yield each thread group leader

   Yields:
      "gdb.Value" -- The next task on the list.  The value is of type
      "struct task_struct".

crash.types.task.for_each_thread_in_group(task: Value) -> Iterator[Value]

   Iterate a thread group leader's thread list and yield each struct
   task_struct

   Parameters:
      **task** -- The task_struct that is the thread group leader.
      The value must be of type "struct task_struct".

   Yields:
      "gdb.Value" -- The next task on the list.  The value is of type
      "struct task_struct".
