[Bug c++/23023] New: gdb crashes printing circular referencing iterator

mieabby at gmail dot com sourceware-bugzilla@sourceware.org
Sun Apr 1 18:52:00 GMT 2018


https://sourceware.org/bugzilla/show_bug.cgi?id=23023

            Bug ID: 23023
           Summary: gdb crashes printing circular referencing iterator
           Product: gdb
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: mieabby at gmail dot com
  Target Milestone: ---

Created attachment 10929
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10929&action=edit
The sample code.

gdb crashes when it tries to print a struct which has a std::list<>::iterator
referencing itself. A sample source code that demonstrates the bug is attached.

Steps to reproduce:
- Compile the sample code: g++ -O0 -g -o gdb_circular gdb_circular.cpp
- Run: gdb gdb_circular
- On gdb:
br gdb_circular.cpp:37
r
print list

Expected reuslt:
gdb should not fall in a loop. gdb should detect that it's going in circle and
step out while trying to print "posInList" member.

Actual result:
gdb crashes with following lines printed:
$1 = std::__cxx11::list = {[0] = {id = 0, posInList = Python Exception <class
'RecursionError'> maximum recursion depth exceeded in comparison: 
Fatal Python error: Cannot recover from stack overflow.

Current thread 0x00007fa63a2548c0 (most recent call first):
  File "/lib64/../share/gcc-7/python/libstdcxx/v6/printers.py", line 1240 in
get_basic_type
  File "/lib64/../share/gcc-7/python/libstdcxx/v6/printers.py", line 1249 in
__call__
  File "/lib64/../share/gcc-7/python/libstdcxx/v6/printers.py", line 222 in
to_string
  File "/lib64/../share/gcc-7/python/libstdcxx/v6/printers.py", line 222 in
to_string
  ...
Aborted (core dumped)


Startup line:
GNU gdb (GDB) Fedora 8.0.1-36.fc27

Configure:
   configure --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu
             --with-auto-load-dir=$debugdir:$datadir/auto-load
             --with-auto-load-safe-path=$debugdir:$datadir/auto-load
             --with-expat
             --with-gdb-datadir=/usr/share/gdb
             --with-jit-reader-dir=/usr/lib64/gdb
             --without-libunwind-ia64
             --with-lzma
             --with-python=/usr
             --with-guile
             --with-separate-debug-dir=/usr/lib/debug
             --with-system-gdbinit=/etc/gdbinit
             --with-babeltrace

/proc/version:
Linux version 4.15.13-300.fc27.x86_64
(mockbuild@bkernel02.phx2.fedoraproject.org) (gcc version 7.3.1 20180303 (Red
Hat 7.3.1-5) (GCC)) #1 SMP Mon Mar 26 19:06:57 UTC 2018

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list