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
Attach to a processRead and write to registersSet hardware and software breakpointsOutput disassemblySupport 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.
What a fantastic book! It looks like it is about writing a debugger, but actually, there are way more hidden gems. I was surprised that the core debugging is facilitated by literally one function (ptrace). However, implementing the full debugger requires writing several parsers, interpreters, expression evaluators, and a handful of other algorithms.
The book shows the real programming "craftsmanship": being able to understand a very complex specification (such as DWARF), break complex problems into a bunch of smaller ones, and implement everything piece by piece in a structured and organized way (and what is more, in C++). I liked the approach of writing functions that use other functions that are yet to be implemented to explain the high-level principles before jumping into the details. In some places, the book goes the opposite direction - first, it prepares several helper functions, and then it composes the feature from these building blocks. Both approaches help to deal with complicated problems, and this is what every developer should learn and apply in their day-to-day job.
Even if you don't know assembly language and saw C/C++ only briefly in school many years ago, the book is really easy to follow.