تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
0.8 Steps to Debug with x64dbg خطوات التصحيح باستخدام
#1
[صورة مرفقة: dark.jpg]
 رحلة في عالم الهندسة العكسية  Heart
 
https://www.youtube.com/playlist?list=PL...Moshvgu35x

# الفصل 0 : تمهيد



To create a simple C++ program that illustrates the functionality of various debugging commands in x64dbg, you can write a program with a few functions to step into, step over, and run till return. Here's a basic example:
#include <iostream>

// Function to demonstrate stepping into a call
void stepIntoFunction() {
    std::cout << "Inside stepIntoFunction()" << std::endl;
}

// Function to demonstrate stepping over a call
void stepOverFunction() {
    std::cout << "Inside stepOverFunction()" << std::endl;
}

// Function to demonstrate execute till return
void tillReturnFunction() {
    std::cout << "Inside tillReturnFunction() - Start" << std::endl;
    // Some dummy calculations
    int sum = 0;
    for(int i = 0; i < 100; ++i) {
        sum += i;
    }
    std::cout << "Inside tillReturnFunction() - End" << std::endl;
}

int main() {
    std::cout << "Starting main()" << std::endl;

    // Step into this call (F7)
    stepIntoFunction();

    // Step over this call (F8)
    stepOverFunction();

    // Execute till return from this call (Ctrl+F9)
    tillReturnFunction();

    // Run to user code (Alt+F9)
    std::cout << "Ending main()" << std::endl;

    return 0;
}


### Steps to Debug with x64dbg

1. **Compile the Code**:
   Compile the C++ code using your favorite compiler. For example, using g++:
   ```sh
   g++ -o debugging_stepping_into_calls_x64dbg debugging_stepping_into_calls_x64dbg.cpp
   ```

2. **Open x64dbg**:
   Launch x64dbg and open the compiled executable (debug_example.exe).

3. **Set Initial Breakpoint**:
   Set a breakpoint at the main function or the beginning of the code.

4. **Debugging Commands**:
   - **F9 (Run)**: This will run the program until it hits the next breakpoint or the program ends.
   - **F8 (Step Over)**: Use this to step over function calls. It will execute the entire function call without entering into it.
   - **F7 (Step Into)**: Use this to step into function calls. It will enter the called function and allow you to debug inside it.
   - **Ctrl+F9 (Execute till Return)**: Use this to run the current function until it returns, then break.
   - **Alt+F9 (Run to User Code)**: Use this to run until the next user code line (skipping over system/library code).

### Explanation

- **Step Into** (stepIntoFunction): When you press F7 on the call to stepIntoFunction, x64dbg will take you inside the stepIntoFunction allowing you to debug line by line within it.
- **Step Over** (stepOverFunction): When you press F8 on the call to stepOverFunction, x64dbg will execute the function but won't step into it; it will directly move to the next line after the function call.
- **Execute till Return** (tillReturnFunction): When you press Ctrl+F9 while inside the tillReturnFunction, x64dbg will run the entire function until it returns, then break.
- **Run to User Code**: Using Alt+F9 will skip over any non-user code and stop at the next user-defined code line.

This simple example should help you illustrate and understand how to use the various debugging commands in x64dbg.



   happy
أعضاء أعجبوا بهذه المشاركة : adhem , azarol


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم