Название: Building a Debugger (Early Access) Автор: Sy Brand Издательство: No Starch Press Год: 2025 Страниц: 738 Язык: английский Формат: pdf (true) Размер: 11.9 MB
Master the inner workings of your x64 Linux system and expand your OS expertise by writing your very own debugger using C++.
If debuggers seem like magic to you, there is no better way to demystify them than to write your own. This book will show you exactly how to do it, walking you through the entire process of building a debugger for x64 Linux systems using C++. As go from an empty filesystem folder to a fully fledged debugger capable of setting breakpoints, stepping through code, manipulating variables, and more, you’ll learn how to:
Attach to a process Read and write to registers Set hardware and software breakpoints Output disassembly Support multithreading and other tasks
As you add features to your debugger, you’ll also pick up a wealth of knowledge about operating systems, compilers, software testing, and low-level programming that you can use in your day-to-day development.
Most of the time, however, we’re not looking for actual bugs in our systems, so we don’t require a screwdriver and magnifying glass to identify issues. Instead, we need a program that can trace, manipulate, and visualize the state of a different program running on our system. Such a program is called a debugger.
Developers typically use debuggers for tasks such as tracing the control flow of their code as it runs, inspecting the values of variables at various points of execution, halting the program at pre-determined locations, and executing functions inside the running process.
In this book, we’re particularly concerned with debuggers for compiled code that runs directly on your central processing unit (CPU), written in a language like C, C++, Rust, or FORTRAN. Debuggers for these programs need to interface directly with the operating system and the underlying hardware, which can lead us to some deep insights into how computers actually work.
What Will We Build? Over the course of this book, we’ll build a command line debugger for native code. I’ll call the debugger sdb, for Sy’s Debugger, but you can call yours whatever you like. (You might want to avoid conflicting with existing debuggers like GDB and LLDB, however.)
When we begin, the project will consist of a single executable, sdb, which the user can interact with on the command line. As we progress, we’ll build the majority of the debugger as a library, libsdb, then author a command line driver that uses its functionality. This design will make it easier to write automated tests for the code and enable you to develop applications that interact with the debugger programmatically.
Advanced Windows Debugging Название: Advanced Windows Debugging Автор: Mario Hewardt, Daniel Pravat Издательство: Addison-Wesley Professional Год: 2007 Формат: PDF Страниц: 840...