Share E-Book

Building a Debugger (Sy Brand)(Z-Library)

Author

Rating No ratings yet

Log in to rate

Programming
Language English

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.

Format EPUB
Size 19.4 MB
4
Views

AI Guide

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

Full assistant
AI guide
【One-Line Pitch】 A hands-on guide to demystifying debuggers by building one from scratch for x64 Linux in C++, taking you from an empty folder to a tool that sets breakpoints, steps through code, and inspects variables. Best for C++ programmers curious about operating systems, compilers, and low-level tooling. 【Book Arc】 - **Opening (~0%–8%)**: Sets up the project skeleton (CMake, vcpkg, directory layout) and lays the theoretical groundwork on compilation, computer architecture, user/kernel space, and how Linux loads programs. - **Early (~8%–27%)**: Implements the debugger's core mechanics—attaching to processes, inter-process communication via pipes and procfs, automated testing, register access, and both software and hardware breakpoints/watchpoints. - **Middle (~27%–57%)**: Dives into binary and debug-info formats: parsing ELF object files, DWARF debug information, line tables, and call frame information to enable source-level breakpoints, stepping, and stack unwinding. - **Late (~57%–76%)**: Extends the debugger to real-world complexity—shared libraries, multithreading, DWARF expressions, variable/type visualization, and expression evaluation with inferior function calls. - **Ending (~76%–100%)**: Surveys advanced topics (remote debugging, GDB/MI, DAP, time-travel debugging, non-stop mode) and closes with knowledge-check answers and a glossary. 【Key Takeaways】 - **Debuggers are built on OS primitives, not magic** (Early): attaching to processes, reading registers, and setting breakpoints all rely on Linux facilities like ptrace, procfs, and pipes—understanding these is the real payoff. - **Breakpoints come in two flavors with distinct trade-offs** (Early): software breakpoints patch instructions while hardware breakpoints use debug registers; the book implements both plus watchpoints. - **Binary formats are the bridge to source-level debugging** (Middle): parsing ELF and DWARF is what lets a debugger map machine addresses back to source lines, variables, and types. - **Stack unwinding depends on call frame information** (Middle): DWARF CFI lets you generate backtraces and restore registers to pre-call state, a prerequisite for meaningful stepping. - **Real programs are messy** (Late): shared libraries, multithreading, and inlined functions each require dedicated support beyond a single-threaded, statically-linked toy. - **Expression evaluation is the hardest feature** (Late): calling functions inside the inferior process requires ABI knowledge, argument classification, calling conventions, and memory allocation in the target. - **Testing is woven throughout** (Early–Late): each feature is paired with automated tests, reinforcing that debugger development demands rigorous verification. - **The book is deliberately scoped** (Middle): the debugger is not thread-safe by design, trading robustness for focus on core concepts. 【Reading Tips】 - Deep-read Chapters 1–4 even if you know C++; the build setup and testing harness pay off across the whole book. - Skim the DWARF/ELF parsing chapters (11–15) on first pass if binary formats are new—return to them when implementing source-level features. - Treat the "Check Your Knowledge" questions as genuine checkpoints; the appendix answers are useful for self-assessment. - Keep the companion GitHub repository (chapter-by-chapter branches) open alongside the text to compare your implementation. - Don't skip Chapter 2's architecture background—it's the conceptual foundation for everything that follows. 【Coverage Limits】 This guide is synthesized from stratified excerpts covering the table of contents, introduction, and early chapters; specific code details, later-chapter depth, and the advanced topics chapter are only partially represented.

Passage locations

Excerpt 1
103 phone: +1.415.863.9900 www.nostarch.com ; info@nostarch.com Publisher: William Pollock Managing Editor: Jill Franklin Production Manager: Sabrina Plomita...
View in text
Excerpt 2
mary Check Your Knowledge 11 OBJECT FILES What Is an ELF?
View in text
Excerpt 3
c Executables Dynamic Executables Loading Dependencies The .
View in text
Excerpt 4
tables Dynamic Executables Loading Dependencies The .
View in text

Recommended for You

Loading recommended books...
Failed to load, please try again later

Tip the Site

Scan the WeChat Pay or Alipay code to tip. No login required.

WeChat Pay
Alipay
← Back to List