https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108107
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The segfault seems to be calling rdbuf() from this Python code:
# Check if the stream was redirected. This is essentially:
# val['_M_streambuf'] != val['_M_stringbuf'].address
# However, GDB can't resolve the virtual inheritance, so we do that
# manually.
basetype = [f.type for f in val.type.fields() if f.is_base_class][0]
gdb.set_convenience_variable('__stream', val.cast(basetype).address)
self._streambuf = gdb.parse_and_eval('$__stream->rdbuf()')
The errors suggest $__stream is a null pointer.