aboutsummaryrefslogtreecommitdiff
path: root/kernel/proc/kthread.gdb
blob: 9c6e160ccabe9ed49ad51bc4d9ca90eb824ebce1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
define kstack
	if $argc == 0
		set $kthr = curthr
	else
		set $kthr = $arg0
	end

	set $save_eip = $eip
	set $save_ebp = $ebp
	set $save_esp = $esp

	if ($kthr == curthr) && (_intr_regs != NULL)
		set $eip = _intr_regs->r_eip
		set $ebp = _intr_regs->r_ebp
		set $esp = _intr_regs->r_esp
		info stack
	else if $kthr != curthr
		set $eip = $kthr->kt_ctx.c_eip
		set $ebp = $kthr->kt_ctx.c_ebp
		set $esp = $kthr->kt_ctx.c_esp
		info stack
	else
		info stack
	end

	set $eip = $save_eip
	set $ebp = $save_ebp
	set $esp = $save_esp
end
document kstack
usage: kthread [kthread_t*]
Takes a single, optional kthread_t as an argument.
If no argument is given curthr is used instead. This
command prints the current stack of the given thread.
This includes detecting if the given thread is has
been interrupted, and looking up the interrupted
stack, rather than the interrupt stack (useful for
viewing the stack trace which caused a page-fault).
end