From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17690 invoked by alias); 21 Jun 2010 07:48:23 -0000 Received: (qmail 17668 invoked by uid 22791); 21 Jun 2010 07:48:19 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_20,TW_SM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp.nokia.com (HELO mgw-mx03.nokia.com) (192.100.122.230) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 21 Jun 2010 07:48:15 +0000 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o5L7liRZ014274 for ; Mon, 21 Jun 2010 10:48:10 +0300 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 21 Jun 2010 10:47:56 +0300 Received: from mgw-da01.ext.nokia.com ([147.243.128.24]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 21 Jun 2010 10:47:55 +0300 Received: from gar.localnet (berwst16747.europe.nokia.com [172.25.167.47]) by mgw-da01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o5L7lrxW003637 for ; Mon, 21 Jun 2010 10:47:54 +0300 From: =?utf-8?q?Andr=C3=A9_P=C3=B6nitz?= To: gdb@sourceware.org Subject: Re: About the "info locals" command of gdb and python pretty printer Date: Mon, 21 Jun 2010 07:48:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.32-21-generic; KDE/4.4.2; i686; ; ) References: <4C1DDBB0.9010202@gmail.com> In-Reply-To: <4C1DDBB0.9010202@gmail.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201006210948.12939.andre.poenitz@nokia.com> X-Nokia-AV: Clean 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: 2010-06/txt/msg00082.txt.bz2 On Sunday 20 June 2010 11:13:20 asmwarrior wrote: > Hi, I have some problems to show some uninitialized local variables. > > For example, here is the test code: > > void test() > { > int aaaa = 1; > int bbbb = 2; > int cccc = 3; > } > > int main() > { > test(); > return 0; > } > > Here, if I set a breakpoint at the first statement of the "test()", then > run "info locals" command. gdb will plot all the information about both > "aaaa, bbbb and cccc". > > Things becomes more complex when bbbb and cccc are not simple type, but > instead, they are stl containers like vector or maps. > like: > > void test() > { > int aaaa = 1; > vector bbbb; > mapcccc; > } > > At this time, if we run the "info locals" with python stl pretty printer > enabled, as you see, if you breakpoint is still at the first line "int > aaa = 1;", then bbbb and cccc are not initialized, this may cause the > python script to plot random values, some times, gdb or python will get > crashed. As data "damaged" after the initialization can look pretty much like uninitialized data, taking the scope information into account would not solve the problem, only reduce the likelihood of running into it. Andre'