📄 kernel_utils.tcl
字号:
## Copyright (C) 1996-1998 by the Board of Trustees# of Leland Stanford Junior University.# # This file is part of the SimOS distribution. # See LICENSE file for terms of the license. ## kernel_utils.tcl# various little helpful utilities...## tracking process fork, exec, and exitannotation set osEvent procstart { log "PFORK $CYCLES cpu=$CPU $PID($CPU)-$PROCESS($CPU)\n"}annotation set pc kernel::exece { set argv [symbol read "kernel:exec.c:((struct execa*)$a0)->argp"] log "PEXEC $CYCLES cpu=$CPU " # print out the whole command line set arg 1 while {$arg != 0} { set arg [symbol read kernel::((int*)$argv)<0>] if {$arg != 0} { set arg [symbol read kernel::((char**)$argv)<0>] log " $arg" set argv [expr $argv + 4] } } log "\n"}annotation set osEvent procexit { log "PEXIT $CYCLES cpu=$CPU $PID($CPU)-$PROCESS($CPU)\n"}# reads the process table and prints all the processes and their statusproc dumpProcesses {} { set proctbl "((proc_t*)[symbol read kernel::proc])" set numprocs [symbol read kernel::v.v_proc] for {set i 0} {$i < $numprocs} {incr i} { set stat [symbol read kernel:proc.h:$proctbl<$i>.p_stat] if $stat { console "pid [symbol read kernel:proc.h:$proctbl<$i>.p_pid] " set upte [symbol read kernel:proc.h:$proctbl<$i>.p_upgs<0>.pgi] set user "((user_t*)[expr (($upte & 0xFFFFFE00) << 3) + 0x80000000])" console "\"[symbol read kernel:proc.h:$user->u_comm]\" " switch $stat { 1 { console "sleeping " set semapp [symbol read kernel:proc.h:&$proctbl<$i>.p_wchan] set sema [hex [symbol read kernel::*((int*)$semapp)]] if {$sema != 0} { console "on [symbol find kernel $sema] " } } 2 { console "running " } 3 { console "zombie " } 4 { console "stoped " } 5 { console "creating " } 6 { console "sxbrk " } } console "\n" } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -