19-05-2024, 04:15 PM
رحلة في عالم الهندسة العكسية
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:
### 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 (
3. **Set Initial Breakpoint**:
Set a breakpoint at the
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** (
- **Step Over** (
- **Execute till Return** (
- **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.
https://www.youtube.com/playlist?list=PL...Moshvgu35x
# الفصل 0 : تمهيد
- 0.1 تحميل و تثبيت : x64dbg و Detect it easy
- 0.2 Program Analysis رحلة استكشافية لتحليل البرامج
- 0.3 علّم نفسك كيفية فهم رموز الخروج exit code وتحليل الأخطاء في x64dbg
- 0.4 معلومات مهمة حول عملية الdebugging وكيفية استخدام x64dbg debugger بشكل فعال
- 0.5 اعاده برمجه المثال 0.4 عن طريق cLion IDE وعمل التتبع والباتشينك
- 0.6 اعاده برمجه المثال 0.4 عن طريق Visual Studio وعمل التتبع والباتشينك
- 0.7 اعاده برمجه المثال 0.4 عن طريق RAD Studio وعمل التتبع والباتشينك
- 0.8 Steps to Debug with x64dbg خطوات التصحيح باستخدام
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.