From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11350 invoked by alias); 1 May 2012 21:56:27 -0000 Received: (qmail 11342 invoked by uid 22791); 1 May 2012 21:56:26 -0000 X-SWARE-Spam-Status: No, hits=-5.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_GD X-Spam-Check-By: sourceware.org Received: from mail-yw0-f41.google.com (HELO mail-yw0-f41.google.com) (209.85.213.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 May 2012 21:56:06 +0000 Received: by yhr47 with SMTP id 47so377161yhr.0 for ; Tue, 01 May 2012 14:56:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.184.102 with SMTP id r66mr27928079yhm.46.1335909365180; Tue, 01 May 2012 14:56:05 -0700 (PDT) Received: by 10.236.115.200 with HTTP; Tue, 1 May 2012 14:56:05 -0700 (PDT) In-Reply-To: <4FA04961.7020404@minimum.se> References: <4FA04961.7020404@minimum.se> Date: Tue, 01 May 2012 21:56:00 -0000 Message-ID: Subject: Re: -ggdb3 -gdwarf-4 but "info macro BLAH" still doesn't work? From: Matt Rice To: Martin Olsson Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2012-05/txt/msg00001.txt.bz2 On Tue, May 1, 2012 at 1:36 PM, Martin Olsson wrote: > Hello, > > In a small test app built with -g3 I can print values of macros inside gdb > by doing "info macro MYMACRONAME", however in a larger application I cann= ot > get it to work despite passing the same -g3 and using the same gdb comman= d. > Just to be sure, I tried turning off stuff like pre-compiled headers etc = in > the large app but I still can't get the macro values to print correctly. = In > the large app, what I see is: > > (gdb) info macro MYMACRONAME > The symbol `MYMACRONAME' has no definition as a C/C++ preprocessor macro > at ../../platforms/linux/src/main.cpp:263 the important part here I think is the: at ../../platforms/linux/src/main.cpp:263 are you sure that MYMACRONAME is included and defined at that point in the main.o file? info macro only does macros for the place the program is currently executing at. i see you are not getting the error message from the function macro_inform_no_debuginfo so it seems there is a 'macro scope'. > In both cases gdb "info source" reports "Includes preprocessor macro info= ." > and also "Compiled with DWARF 2 debugging format." > > For the large app readelf also reports the macro I'm testing as present (= so > I'm assuming the gcc end is doing the right thing): > > $ readelf -wm binary | grep MYMACRONAME > =A0DW_MACINFO_define - lineno : 12 macro : MYMACRONAME 4096 > > FWIW; I'm using ubuntu 12.04 LTS which means I got gcc 4:4.6.3-1ubuntu5 a= nd > gdb 7.4-2012.02-0ubuntu2. I've also tried building with "-ggdb3 -gdwarf-4" > but I still can't get values of macros and oddly gdb then still reports > "Compiled with DWARF 2 debugging format", which was a bit weird? > > Also if I do "info macros" then I get nothing printed at all. that is rather odd, even in empty sources i've always noticed some gcc defined stuff from "info macros". > What else can I try to make progress on this issue? > > If there is no easier way, maybe someone can recommend a breakpoint locat= ion > in GDB where I can step through the code that executes the "info macro BL= AH" > command ? macrocmd.c the function info_macro_command would probably be the place to s= tart. you can also try running make check and checking the results for the macro tests, macscp.exp info-macros.exp