<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 使用 SystemTap 調試內核

          使用 SystemTap 調試內核

          作者: 時間:2016-09-12 來源:網(wǎng)絡 收藏

          #!/usr/bin/env stap## display the top 10 syscalls called in last 5 seconds#global syscallsfunction print_top () {cnt=0log (SYSCALLttttCOUNT)foreach ([name] in syscalls-) {printf(%-20stt%5dn,name, syscalls[name])if (cnt++ == 10)break}printf(--------------------------------------n)delete syscalls}probe syscall.* {syscalls[probefunc()]++}probe timer.ms(5000) {print_top ()}

          它的輸出結果一目了然:

          圖

          看看是誰在偷偷動我的文件

          有時候,我們如果中了惡意的病毒軟件,會發(fā)現(xiàn)某些文件莫名其妙的被修改,下面這個例子可以幫你監(jiān)視誰在修改你的文件。

          #!/usr/bin/env stap## monitor who is messing my file of secrets#probe generic.fop.open {if(filename == secrets)printf(%s is opening my file: %sn, execname(), filename)}

          我們運行這個腳本,在另外一個窗口做一些操作,來看看它的輸出結果:

          圖

          打印ANSI字符串

          SystemTap不僅僅是一個簡單的調試工具,強大的腳本語言能力讓它同樣能做一些有趣的事情,

          下面這個例子就可以對輸出的字符進行美化:

          #!/usr/bin/env stap## print colorful ANSI strings#probe begin {printf(a \ b |);for (c = 40; c 48; c++)printf( %d , c);printf(12);for (l = 0; l 71; l++)printf(-);printf(12);for (r = 30; r 38; r++)for (t = 0; t 2; t++) {printf(%d |, r);for (c = 40; c 48; c++)printf(看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();