Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tasks: implement `ps' and infrastructure behind it
This patch will ultimately be split up but I'm committing for testing.
  • Loading branch information
jeffmahoney committed Feb 25, 2016
commit cb9f190c03598f6849a18584154ad8deda7a5b20
3 changes: 3 additions & 0 deletions crash/arch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ def setup_thread_active(self, thread):
def setup_thread_scheduled(self, thread):
raise NotImplementedError("setup_thread_scheduled not implemented")

def setup_thread_info(self, thread):
raise NotImplementedError("setup_thread_info not implemented")

def setup_thread(self, thread):
if thread.info.active:
self.setup_thread_active(thread)
Expand Down
13 changes: 13 additions & 0 deletions crash/arch/x86_64.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ def __init__(self):
# PC for blocked threads
self.rip = gdb.lookup_minimal_symbol("thread_return").value()
self.ulong_type = gdb.lookup_type('unsigned long')
thread_info_type = gdb.lookup_type('struct thread_info')
self.thread_info_p_type = thread_info_type.pointer()

def setup_thread_info(self, thread):
task = thread.info.task_struct
thread_info = task['stack'].cast(self.thread_info_p_type)
thread.info.set_thread_info(thread_info)

def setup_thread_active(self, thread):
task = thread.info
Expand Down Expand Up @@ -50,4 +57,10 @@ def setup_thread_scheduled(self, thread):
thread.registers['cs'].value = 2*8
thread.registers['ss'].value = 3*8

thread.info.stack_pointer = rsp
thread.info.valid_stack = True

def get_stack_pointer(self, thread):
return long(thread.registers['rsp'].value)

register(x86_64Architecture)
Loading