디버거 핵심 기능(GDB, WinDbg)
프로세스에 연결하고 바이너리를 불러오는 방법을 포함하여 GDB 및 WinDbg와 같은 디버거의 핵심 기능을 배웁니다.
디버거 핵심 기능(GDB, WinDbg)은(는) CoddyKit의 무료 Reverse Engineering & Binary Analysis Basics 강의입니다. 이것은 4개 중 1번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Reverse Engineering & Binary Analysis Basics 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Reverse Engineering & Binary Analysis Basics 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Meet Your Debugger!
Welcome to dynamic analysis! Here, we'll learn about debuggers, powerful tools that let you see a program in action.
A debugger allows you to pause a running program, inspect its internal state (like memory and registers), and even change its execution path. It's like having X-ray vision for software!
Why Debuggers for RE?
In reverse engineering, debuggers are crucial for understanding how a program behaves at runtime. While static analysis (looking at code without running it) gives you clues, dynamic analysis shows you the truth.
- See actual data values as they change.
- Observe which code paths are taken.
- Understand interactions with the operating system.
GDB & WinDbg: Your Toolkit
We'll focus on two primary debuggers:
- GDB (GNU Debugger): The standard debugger for Linux, macOS, and other Unix-like systems. It's command-line based and highly versatile.
- WinDbg: A powerful debugger for Windows, often used for kernel-mode debugging and complex user-mode issues. It has both a GUI and a command-line interface.
Core Debugger Actions
Regardless of the debugger, you'll perform a few fundamental actions:
- Loading a Binary: Starting a program directly under the debugger's control.
- Attaching to a Process: Connecting the debugger to a program that is already running.
- Inspecting State: Examining memory, registers, stack, and other program data.
Loading with GDB: Example
To load a program with GDB, you typically specify the executable on the command line. Let's compile a tiny C program first:
#include <stdio.h>
int main() {
printf("Hello from GDB!\n");
return 0;
}Loading and Running in GDB
After compiling the C code (e.g., gcc -o hello hello.c), you can load it into GDB. Then, use the run command to start its execution.
GDB Commands:gdb ./hello(gdb) run
This will execute the program, and GDB will show you its output and then return to the GDB prompt.
Attaching to a Process with GDB
Sometimes, a program is already running, and you need to debug it on the fly. This is where attaching comes in. You'll need the program's Process ID (PID).
First, get the PID (e.g., using ps aux | grep on Linux). Then, use GDB with the -p flag:
#include <stdio.h>
#include <unistd.h>
int main() {
printf("Program running. PID: %d\n", getpid());
sleep(60); // Keep program alive for 60 seconds
printf("Program exiting.\n");
return 0;
}GDB Attach Command
Run the previous C program in a terminal. Note its PID. Then, in another terminal, you can attach GDB to it:
GDB Command:gdb -p <PID_OF_YOUR_PROGRAM>
Once attached, the program will pause. You can then use GDB commands to inspect its state, set breakpoints, and continue execution.
WinDbg: Loading & Attaching
WinDbg offers similar functionalities for Windows. To load a binary, you can launch WinDbg and use File > Open Executable, or use the command line: windbg.exe -o myprogram.exe.
To attach to a running process, navigate to File > Attach to a Process. You'll then see a list of running processes by name and PID, allowing you to select the target.
Quick Check!
You've learned about loading and attaching programs to debuggers. Which GDB command is used to start a program that has already been loaded into GDB?
Recap: Debugger Essentials
Great job! You've grasped the fundamental ways to get a debugger connected to a program:
- Loading: Starting a new program directly under debugger control (e.g.,
gdb ./programthenrun). - Attaching: Connecting to an already active program (e.g.,
gdb -p <PID>).
These techniques are your entry points into dynamic analysis, allowing you to observe and manipulate programs in real-time. Next, we'll explore how to pause execution and step through code!
자주 묻는 질문
“디버거 핵심 기능(GDB, WinDbg)” 강의는 무료인가요?
네 — “디버거 핵심 기능(GDB, WinDbg)” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Reverse Engineering & Binary Analysis Basics 강의 전체를 잠금 해제할 수 있습니다. Reverse Engineering & Binary Analysis Basics 강의에는 총 4개의 강의가 포함되어 있습니다.
“디버거 핵심 기능(GDB, WinDbg)”에서 뭘 배우나요?
프로세스에 연결하고 바이너리를 불러오는 방법을 포함하여 GDB 및 WinDbg와 같은 디버거의 핵심 기능을 배웁니다. 브라우저에서 직접 실행하는 실습 코드로 Reverse Engineering & Binary Analysis Basics을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Reverse Engineering & Binary Analysis Basics을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Reverse Engineering & Binary Analysis Basics은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 1번째 강의입니다.
“디버거 핵심 기능(GDB, WinDbg)” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Reverse Engineering & Binary Analysis Basics 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Reverse Engineering & Binary Analysis Basics 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- 디버거 핵심 기능(GDB, WinDbg)
- 중단점 설정 및 단계별 실행
- 메모리 및 레지스터 검사
- 실행 중 API와 시스템 호출 추적