From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8157 invoked by alias); 2 Apr 2009 13:28:36 -0000 Received: (qmail 8141 invoked by uid 22791); 2 Apr 2009 13:28:35 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: sourceware.org Received: from relay-pt3.poste.it (HELO relay-pt3.poste.it) (62.241.4.129) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 02 Apr 2009 13:28:29 +0000 Received: from geppetto.reilabs.com (212.123.91.176) by relay-pt3.poste.it (7.3.122) (authenticated as stefano.sabatini-lala@poste.it) id 49D3F23F00006921 for gdb@sources.redhat.com; Thu, 2 Apr 2009 15:28:26 +0200 Received: from stefano by geppetto.reilabs.com with local (Exim 4.67) (envelope-from ) id 1LpMxn-0002kE-0S for gdb@sources.redhat.com; Thu, 02 Apr 2009 15:28:11 +0200 Date: Thu, 02 Apr 2009 13:28:00 -0000 From: Stefano Sabatini To: gdb Mailing List Subject: C++ and "no data fields" when printing objects Message-ID: <20090402132811.GA9472@geppetto> Mail-Followup-To: gdb Mailing List MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) 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: 2009-04/txt/msg00020.txt.bz2 Hi all, It often occurrs to me to find such situatons when debugging: (gdb) p ptr $8 = { <> = {}, } and everytime I wonder why the object is not represented meanignfully. I previously made many researches on the subject, maybe I also already asked on this list, and came out with the following man of the road wisdom notions: 1) the problem shows up when you use inlined functions (but the problem here seems to be related to printing *objects* rather than step over functions). 2) in order to avoid that you need to use -ggdb -O0 3) it depends on some compiler magic which you really can't understand I'm quite sure that even using code compiled with gcc and -ggdb -O0 the abovementioned problem shows anyway. I'd happily spend months studying the objcode structure and the gdb internals, but unfortunately I can't, so I'm here to just ask if you can reply to this questions: 1) which are the conditions under which the abovementioned problem occurrs (e.g. with shared/static lib, with some arch, only with some compiler+flags/binary format)? 2) how can I do to be sure not to encounter this problem when debugging, i.e. which magic do I need to add to the compilation command, even affecting code size/speed? Thanks in advance, and thanks for the great tool. Cheers.