CppCon 2018: Simon Brand “How C++ Debuggers Work”

preview_player
Показать описание


Debuggers are one of the most important tools in the belt of any developer, but they are often seen as a magic black box. This is compounded by the lack of available literature, especially when compared to other toolchain components like compilers. This talk aims to demystify debuggers by showing how the utilities you use every day actually work.

Topics which will be covered include debug information and object file formats, breakpoints, stepping, register and memory manipulation, stack unwinding, multi-threaded applications, and expression evaluation. x86 Linux platforms will be used for demonstrative purposes, but the general concepts are platform independent.

Simon Brand, Microsoft
C++ Developer Advocate

Simon is a C++ Developer Advocate at Microsoft. He turns into a metaprogramming fiend every full moon, when he can be found bringing compilers to their knees with template errors and debating undefined behaviour online. He co-organises the Edinburgh C++ user group and contributes to various programming standards bodies.

Outside of programming, he enjoys experimental films, homebrewing, and board games.

*-----*
Рекомендации по теме
Комментарии
Автор

What a great talk and quite a good sport answering so many questions in the middle of his talk!

onceuponapriori
Автор

Nice talk!

One thing to note is that in the explanation of how functions are called by the debugger (38:25), Simon said "JIT compile to machine code".
To clarify, from my experience (and looking at the source code for GDB), what GDB does when you call a precompiled function is a bunch of trickery with the debuggee's state, like adding a dummy call stack frame and calling the memory allocation function on behalf of the debuggee.
But ultimately, it will transfer execution to the original pre-compiled function and let it do the job.
Simon mentions that LLDB does JIT compile the expressions being evaluated so I presume it would do that for the function call "shim" as well, but I don't think it would re-compile the function being called, either. (Unless it's a template function or some other special case, and you're using a modern LLDB version with experimental features enabled.)
Just wanted to clarify that detail.

tetraphobie
Автор

Phenomenal talk in every regard. Thanks!

barrettellisadair
Автор

One of the best talks in CppCon this year I attended.

LesleyLai
Автор

I was trying to remember where I saw this guy last, it was this: "CppCon 2018: Brand & Nash “What Could Possibly Go Wrong?: A Tale of Expectations and Exceptions”" also a useful talk.

mrlithium
Автор

"So this is how stack unwinding would work if you have easy access to frame pointers." (casual ohcrap) "Sometimes you don't."

henke
Автор

56:55 The annotation should read ptrace calls not petrie skulls

robinbuster
Автор

Can't find slides on github by link in description

AleksandrSerov-rncn