Saturday, March 26, 2011

linux kernel debugging with gdb: show me the current task

The problem of getting the current task bothered me for a while when debugging with gdb.


define show_current
  set $thread_info = ((int)$sp) &0xffffe000
  set $current_task = (((struct thread_info *)($thread_info))->task)
  printf "current = %08x\n", (int)$current_task
  printf "current pid = %d\n", (int)($current_task->pid)
  printf "current mm = %08x\n", (int)($current_task->mm)
end


No comments:

Post a Comment