windbg kp kb 命令測試,windbgkp

來源:互聯網
上載者:User

windbg kp kb 命令測試,windbgkp


為了熟悉windbg kb,kp命令,寫一段簡單的程式調試觀察,程式如下:

#include <stdio.h>#include <Windows.h>void printstr(char *str, int b){printf("xxx b is :%d\n",b);}int kbtest(int a){char str[] = "xxxxxxxxxx";printstr(str, a);return 1;}int main(){kbtest(1);system("pause");return 1;}

設定好windbg符號表路徑(編譯產生的符號表路徑),

1、使用windbg載入程式

2、bp windbg_k!printstr 在函數出下斷點

3、g 運行程式,程式暫停如:

 

調用函數時,一般是先參數入棧,然後函數下一條指令地址入棧,然後還有ebp

call fun(arg1, arg2)

push arg2push arg1push ret  //  參數壓棧完後,調用 call fun ,然後將 call fun 下一天指令地址入棧,即函數的返回地址push ebpmov ebp, esp

可以得知,kb 顯示的參數 從左至右分別為 ebp, ret ,arg1, arg2


通過 r 命令查看寄存器值,可知ebp 為003df7e0  

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.