CppCon 2018: James McNellis “Unwinding the Stack: Exploring How C++ Exceptions Work on Windows”

  Рет қаралды 16,210

CppCon

CppCon

Күн бұрын

Пікірлер: 20
@hl2mukkel
@hl2mukkel 6 жыл бұрын
His talks always fascinate me somehow lol Great job as always! I love this guy's talks!
@andrewpod5693
@andrewpod5693 6 жыл бұрын
Actually it's good, really good. Without any unnecessary "stage performance".
@georganatoly6646
@georganatoly6646 Жыл бұрын
surprisingly well put together and delivered
@mrlithium69
@mrlithium69 6 жыл бұрын
Thanks for your talk. It was exceptional. =D
@OCTAGRAM
@OCTAGRAM 5 жыл бұрын
Changing architecture was not strictly required. GNAT and GCC (that GNAT being the most important part of), implements zero cost exceptions internally (using DWARF format or something) and registers its handler once for all the code ZCX covers. Nonetheless I am thankful to Microsoft that these changes are forced for all x64 code. Linux lacks strong hand to make everybody follow the rules. Ada, Delphi, FPC, Java all are competing to change global per-process SIGSEGV handler, but then fail to handle hardware exceptions in the scope of foreign programming language. Nobody can end this havoc in Linux, and in Windows everything just works, for 24+ years. Experiments with resumable exceptions happened in Mesa decades ago. They reported subtle issues with non-unwound code still holding a mutex while handler trying to do something that requires this mutex to be available. So they developed some stuff to release mutexes before entering handler, forbidding handler to use stuff protected by mutex, and reacquiring mutexes again if handler decided to resume. So many subtle issues lead to wide abandonment of resumable exceptions in most programming languages.
@tk36_real
@tk36_real 2 жыл бұрын
12:32 wouldn't like all compilers optimize and print out 0 twice?
@patrolin
@patrolin Жыл бұрын
if the compiler can prove that ConstantZero doesn't change, then yes but he writes to it, so...
@zeez7777
@zeez7777 2 жыл бұрын
Great talk
@luncliff
@luncliff 6 жыл бұрын
Thanks for your talk. I really like it. :D
@peterfireflylund
@peterfireflylund 5 жыл бұрын
I wonder if the exception handling and stack unwinding happens on a separate stack. That would explain why CaptureStackBackTrace() from an SEH exception handler on WIN32 captures a short trace leading up to the exception handler but not the trace from the start of the program leading up to the actual exception being raised.
@FiveFiveZeroTwo
@FiveFiveZeroTwo 2 жыл бұрын
At 12:32, how did ConstantZero get set to 1? If the write is retried it'll just fail again wouldn't it?
@bumbread5989
@bumbread5989 2 жыл бұрын
In the handler he makes the memory page he's writing to writeable, that way he can now alter the value of that variable
@fromscratch3633
@fromscratch3633 3 жыл бұрын
there isn't something like that in CPU, so const is a compiler thing it does not reflect to binary
@bumbread5989
@bumbread5989 2 жыл бұрын
There is a way to make certain memory regions unwriteable or unreadable in the CPU. That's the whole reason OS even knows that you have attempted to access those addresses.
@maxbd2618
@maxbd2618 Жыл бұрын
Yeah but I'm assuming the actual value is in a read-execute page of memory, so when you try to write the OS throws a write violation
@messerschnitt7943
@messerschnitt7943 6 жыл бұрын
I don't know... I find the talk somehow boring (didn't even finish watching it), feels like he is simply just reading out loud some manual found somewhere on the msdn ... in most parts doesn't even explain WHY it is done in this particular way, etc.
@mrlithium69
@mrlithium69 6 жыл бұрын
Yea Exceptions are pretty boring. But you should be glad he is condensing years worth of knowledge down to an hour of your time. The things he skipped are obscure and need hours of background explanation, and are not the most important. As far as "Why?", its mostly "because thats how it is" - status quo - he didnt design the ABI or Windows SEH - Don't shoot the messenger. Theres also a movement happening to re-think exceptions entirely from the ground up due to performance implications and lots of people just disabling them entirely. So taking time to understand the legwork of all the error handlers and stack unwinding and windows OS functions is an insight into exactly why its so slow, (besides context switches and such); it's being an informed programmer citizen. Maybe you want another talk comparing and constrasting different Exception concepts. He went into it a bit at the end. Also he is not saying this is the ideal mental or computational model for exceptions, he just is explaining what life is like currently.
@TheChrisey
@TheChrisey 6 жыл бұрын
"As any programmer would".. Please speak for yourself.. Anyone who has the slightest idea about how segments work knows not to write to anyrhing in .rodata for obvious reasons
@ericLemanissier
@ericLemanissier 6 жыл бұрын
You realize it was a joke, right?
@TheChrisey
@TheChrisey 6 жыл бұрын
Yes I do, thank you very much. It was a very bad one though.
CppCon 2018: Jason Turner “Surprises in Object Lifetime”
1:01:28
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
Javier Honduvilla Coto - "How stack unwinding works?" - C++ London
29:19
CppCon 2018: Andrei Alexandrescu “Expect the expected”
58:58
Pacific++ 2018: James McNellis "Time Travel Debugging"
1:09:04
Pacific++
Рет қаралды 2,3 М.
CppCon 2018: Simon Brand “How C++ Debuggers Work”
1:01:00
Keynote: Advent of Code, Behind the Scenes - Eric Wastl
46:01