There are a few fixes in place in gdb/dwarf2/read.c that deal with self-referencing DIEs: ... $ grep -i self-ref gdb/dwarf2/read.c /* Handle DIE with self-reference. */ /* Self-referential typedefs are, it seems, not allowed by the DWARF complaint (_("Self-referential DW_TAG_typedef " /* Self-reference, we're done. */ /* Self-reference, we're done. */ /* Self-reference, we're done. */ ... These prevent either a hang or running out of stack. The generic case of cyclic DIE references (for instance DIE A references DIE B, DIE B references DIE A) hasn't been solved though. Tom Tromey mentioned using a tortoise/hare approach to detect the cycles here ( https://sourceware.org/pipermail/gdb-patches/2023-August/201921.html ). See https://en.wikipedia.org/wiki/Cycle_detection#Floyd's_tortoise_and_hare .