3 ms·
Since I write mostly in Rust and Python, I seldom need a debugger any more. I used one back in the C/C++ era. Sometimes, when some C/C++ level below Rust breaks
by Animats 3y ago
Since I write mostly in Rust and Python, I seldom need a debugger any more. I used one back in the C/C++ era. Sometimes, when some C/C++ level below Rust breaks, I use gdb. Not often.
Somewhat to my surprise, I was able to use gdb to find out why a multi-thread program Rust had a 100x performance degradation under Wine.
The trouble was down in Wine's DLLs which emulate Windows. The memory allocator is vulnerable to futex congestion. They layered spinlocks 3 deep, and when enough threads are allocating, all the CPUs spend most of their time in spinlocks. The Wine devs
acknowledge the problem but are still struggling with a fix.
I would have used a profiler, but "tracy" under Wine is broken at the moment.
I used a debugger last year when a C++ JPEG 2000 decoder called from Rust was crashing. Valgrind was more helpful, though. Once someone got the decoder to fail under valgrind, they were able to fix the problem.
The year before that, I used gdb to find a bug in the Rend3 graphics library. That's in Rust, but has unsafe code. The bug was in the unsafe code, of course.
There are times like this when the high-level language abstraction has broken down, and you need to delve into the machinery underneath. But that doesn't come up too often in modern languages.