Learn how debuggers work by building your own one - Sayani Bhattacharjee
Debuggers are one of the most useful tools while reading and writing code. Ever wondered if you can build your own? In this talk, we will learn and build one. - How to move beyond putting print statements while debugging code? How to pause the code at execution and inspect variables at that instance? - Delve is a popular debugger in Go that is used by IDEs like Goland, VScode, vim-go. This talk aims to go through the basic architecture of delve, the features, and components of every layer, and understand stack trace. - We will walk through a sample program and set breakpoints, and get the address of the instruction in the debug output of the assembly language, which is encoded in DWARF format, and then parse it. We will talk about various debugging information entries that DWARF defines. - We will see how to use ptrace to rewrite data in the above address - Next, we will learn how CPU registers can be manipulated usingPtraceGetRegs and PtraceSetRegs. - The sample code will also demonstrate how step into, step out works in a procedure