#Miscellaneous macros
define lsmod
    set $mod = (struct module*)module_list
    # the last module is the kernel, ignore it
    while $mod != &kernel_module
    	printf "%p\t%s\n", (long)$mod, ($mod)->name
	set $mod = $mod->next
    end
end

define show_stack_x86
    set $tmp = (unsigned long) $esp
    while $tmp & 8191
	set $addr = *($tmp += 4)
	if $addr >= (unsigned long) &_stext && $addr <= (unsigned long) &_etext
	    info line *$addr
	end
#	printf "%x\n", $tmp
    end
end

define current
    print (struct task_struct *) ((unsigned long) $esp & ~8191)
end

define current_comm
    print ((struct task_struct *) ((unsigned long) $esp & ~8191))->comm
end

define smp_processor_id
    print ((struct task_struct *) ((unsigned long) $esp & ~8191))->cpu
end
