WinDbg KP KB Command test

Source: Internet
Author: User


In order to be familiar with WinDbg KB,KP command, write a simple program debugging observation, the program is as follows:

#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";p rintstr (str, a); return 1;} int main () {kbtest (1); System ("pause"); return 1;}

Set the windbg symbol table path (compile the generated symbol table path),

1. Using the WinDbg loader program

2, BP windbg_k!printstr in the function out of the breakpoint

3, G running program, program suspension such as:

When calling a function, it is usually the first argument in the stack, then the function of the next instruction address into the stack, and then the EBP

Call Fun (Arg1, arg2)

Push Arg2push arg1push ret  //  parameter after the stack is finished, call-fun is called, then the calling fun next day instruction address into the stack, that is, the function's return address push Ebpmov EBP, ESP

It can be learned that the parameters shown in KB are from left to right for EBP, ret, arg1, arg2


Using the R command to view the register value, the EBP is 003DF7E0

WinDbg KP KB Command test

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.