From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27752 invoked by alias); 13 Jun 2009 10:11:34 -0000 Received: (qmail 27743 invoked by uid 22791); 13 Jun 2009 10:11:33 -0000 X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_00,BELOVED_BODY,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 13 Jun 2009 10:11:28 +0000 Received: (qmail 4224 invoked from network); 13 Jun 2009 10:11:25 -0000 Received: from unknown (HELO wind.localnet) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 13 Jun 2009 10:11:25 -0000 From: Vladimir Prus To: gdb@sources.redhat.com Subject: Robustifying pretty-printers Date: Sat, 13 Jun 2009 10:11:00 -0000 User-Agent: KMail/1.11.90 (Linux/2.6.24-24-generic; KDE/4.2.90; i686; svn-979530; 2009-06-10) MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200906131411.34204.vladimir@codesourcery.com> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00132.txt.bz2 While playing with pretty-printers and KDevelop, I've got GDB to "hang", with the below backtrace: (gdb) where #0 0xb7d0ed2a in strcmp () from /lib/tls/i686/cmov/libc.so.6 #1 0x081be1a7 in install_variable (var=0x191b0620) at /home/ghost/Work/CodeSourcery/Projects/egdb/gdb-cvs/gdb/varobj.c:1731 #2 0x081beef7 in create_child_with_value (parent=0x8a6e158, index=514255, name=0xb7bf8e14 "[514255]", value=0x191b03d0) at /home/ghost/Work/CodeSourcery/Projects/egdb/gdb-cvs/gdb/varobj.c:1859 The '514255' above is sufficient to understand what happened. Our beloved GCC fails to emit proper debug info, therefore a vector is considered in scope before constructor is executed, and the vector is full of random bits. Now, what are the best strategies for fix this (assuming GCC won't be fixed for 10 years to come)? One approach is to make IDE check at what line the variable is declared, and don't try to pretty-print it unless the current line is above that. Alternatively, we might need to revive the code to limit the number of children to fetch, and use some reasonable limit, like 10. Comments? - Volodya