koutheir/libcxx-pretty-printers

weak_ptr loop crashes debugger w/ stack overflow

abrownsword opened this issue · 1 comments

I just tracked down a problem that was causing my gdb to mysteriously abort when it hit a breakpoint early in my program's execution. After a bit of digging through logs & print debugging in the pretty-printers, I discovered that a library I'm using has an object which keeps a vector of std::weak_ptrs to handler objects... one of which is itself. This repo's pretty printer has no guard against this and attempts to resolve it immediately (not in a lazy manner), therefore it prints weak_ptr -> vector -> weak_ptr -> ad infinitum (well, at least until the stack explodes).

I'm going to hack mine so that it doesn't call dereference on weak_ptrs, but I'm sure there is a better solution.

Commit d80dd8b should avoid this issue.