From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3531 invoked by alias); 23 Apr 2008 10:51:27 -0000 Received: (qmail 3521 invoked by uid 22791); 23 Apr 2008 10:51:26 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 23 Apr 2008 10:51:07 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1JocZ6-00086v-2U for gdb@sources.redhat.com; Wed, 23 Apr 2008 10:51:04 +0000 Received: from 78.158.192.230 ([78.158.192.230]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Apr 2008 10:51:04 +0000 Received: from vladimir by 78.158.192.230 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Apr 2008 10:51:04 +0000 To: gdb@sources.redhat.com From: Vladimir Prus Subject: Re: Python/MI/STL visualization Date: Wed, 23 Apr 2008 11:46:00 -0000 Message-ID: References: <200804230006.55278.vladimir@codesourcery.com> <200804230929.19011.apoenitz@trolltech.com> <200804231200.52610.apoenitz@trolltech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8Bit User-Agent: KNode/0.10.5 X-IsSubscribed: yes 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: 2008-04/txt/msg00198.txt.bz2 André Pönitz wrote: >> Well, segfaul is not scary. What is scary is if due to uninitialized data, >> the amount of the children the visualizer wants to fetch end up been 10000 :-) > > Indeed. > > My "solution" here is to wildly poke around in the structure hoping to > trigger a segfault early and interpret such segfault as "uninitialized object". > > So if there's a std::vector<> with size() reporting a non-0 value, try > to access the first and last element and one from the middle and > hope that at least one of these addresses are "bad" ;-) > > In practice, this works rather nicely. The bigger the reported size() > gets the more potential harm would actually listing the children do, > but the more likely it also is to recognize the object as uninitialized. Oh, I think it's a nice trick :-) - Volodya