gdb/2062: Derived class static member CRTP infinite recursion on print

barkelma@switch.com barkelma@switch.com
Tue Jan 3 21:08:00 GMT 2006


>Number:         2062
>Category:       gdb
>Synopsis:       Derived class static member CRTP infinite recursion on print
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 03 21:08:01 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Mark Barkell
>Release:        GNU gdb 6.3
>Organization:
>Environment:

 g++ -v: g++ (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-39)

 uname -a: Linux COMPUTERNAME 2.4.21-4.EL #1 Fri Oct 3 18:13:58 EDT 2003 i686 i686 i386 GNU/Linux

This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".
>Description:
GDB infinitely recurses when printing static member instances of a derived class within the derived class' base class template while using the Curiously Recurring Template Pattern (CRTP).

The infinite recursion printing in GDB as been seen through just simple printing as shown in the How-To-Repeat section, and also when doing a "where" command as one of my co-workers as pointed out.  It has also been seen when using a GUI such as ddd with fly-over printing.  Given the infinite looping behavior it makes difficult debugging with GDB while using the CRTP design pattern.  
>How-To-Repeat:
g++ -g3 test.C
gdb a.out
break test.C:62
run
print b
(Observe the infinite recursion).
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.C"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.C"

Ci8vIFByb2dyYW1tZXI6IE1hcmsgQmFya2VsbAoKLy8gRGF0ZTogMjAwNi0wMS0wMyAKCi8vIFB1
cnBvc2U6IFNob3cgaW5maW5pdGUgcmVjdXJzaW9uIHdpdGggR05VIEdEQiA2LjMgYW5kIHByaW9y
IHdoZW4KLy8gcHJpbnRpbmcgYSBkZXJpdmVkIGNsYXNzJyBzdGF0aWMgaW5zdGFuY2UgaW4gdGhl
IGJhc2UgY2xhc3MuCgov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