From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5175 invoked by alias); 10 Dec 2008 16:58:02 -0000 Received: (qmail 5159 invoked by uid 71); 10 Dec 2008 16:58:02 -0000 Date: Wed, 10 Dec 2008 16:58:00 -0000 Message-ID: <20081210165802.5156.qmail@sourceware.org> To: nobody@sources.redhat.com Cc: gdb-prs@sources.redhat.com, From: Pedro Alves Subject: Re: macros/2564: 'p siginfo->si_addr' doesn't work anymore Reply-To: Pedro Alves Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2008-q4/txt/msg00072.txt.bz2 The following reply was made to PR macros/2564; it has been noted by GNATS. From: Pedro Alves To: gdb-gnats@sources.redhat.com Cc: Subject: Re: macros/2564: 'p siginfo->si_addr' doesn't work anymore Date: Wed, 10 Dec 2008 16:47:10 +0000 Test inline: #include #include int main (int argc, char **argv) { struct siginfo info; /* make sure it's not related to var name equal type name. */ struct siginfo siginfo; /* var vs ... */ struct siginfo *siginfo_p = &siginfo; /* ... pointer */ return 0; } Some more info: (gdb) info macro si_addr Defined at /usr/include/bits/siginfo.h:122 included at /usr/include/signal.h:212 included at /home/pedro/gdb/tests/siginfo_exp.c:1 #define si_addr _sifields._sigfault.si_addr (gdb) >/home/pedro/gdb/baseline/build/gdb/gdb ./siginfo_exp GNU gdb (GDB) 6.8.50.20081210-cvs Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-unknown-linux-gnu". For bug reporting instructions, please see: ... (gdb) start Temporary breakpoint 1 at 0x400460: file siginfo_exp.c, line 9. Starting program: /home/pedro/gdb/tests/siginfo_exp Temporary breakpoint 1, main (argc=1, argv=0x7fffffffe408) at siginfo_exp.c:9 9 struct siginfo *siginfo_p = &siginfo; /* ... pointer */ (gdb) p siginfo $1 = {si_signo = 1, si_errno = 0, si_code = 0, _sifields = {_pad = {1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -134241448, 32767, -7296, 32767, -134242304, 32767, 4195034, 0, 0, 0, 1, 0, -139464905, 32767, 0, 0, 134090501, 191}, _kill = { si_pid = 1, si_uid = 0}, _timer = {si_tid = 1, si_overrun = 0, si_sigval = {sival_int = 0, sival_ptr = 0x0}}, _rt = {si_pid = 1, si_uid = 0, si_sigval = {sival_int = 0, sival_ptr = 0x0}}, _sigchld = {si_pid = 1, si_uid = 0, si_status = 0, si_utime = 0, si_stime = 0}, _sigfault = {si_addr = 0x1}, _sigpoll = {si_band = 1, si_fd = 0}}} (gdb) p siginfo_p->si_addr There is no member named . (gdb) macro expand siginfo_p->si_addr expands to: siginfo_p->_sifields._sigfault.si_addr Manual expansion succeeds, but, (guessing) it seems that when evaluating, GDB is trying to further re-expand the si_addr member of _sigfault, as a macro. Trying the manually expanded form is no help, since GDB tries to expand si_addr, and doesn't fallback to a real member: (gdb) p siginfo_p->_sifields._sigfault.si_addr There is no member named _sifields. Interestingly, macro expansion when using the '.' operator instead of the '->' operator behaves differently: (gdb) p siginfo.si_addr There is no member named . (gdb) macro expand siginfo.si_addr expands to: siginfo.si_addr Making sure it's not related to var named siginfo and type named siginfo; printing through a variable, with '.' operator: (gdb) p info.si_addr There is no member named . (gdb) macro expand info.si_addr expands to: info.si_addr Evaluation seems to have expanded, and hit the same bug as before, but manual expansion fails to even expand the first si_addr. Making sure its not related to the var type, but to the operator used: (gdb) p siginfo_p.si_addr There is no member named . (gdb) macro expand siginfo_p.si_addr expands to: siginfo_p.si_addr This is a regression against 6.8: (gdb) p siginfo.si_addr $1 = (void *) 0x1 (gdb) macro expand siginfo_p->si_addr expands to: siginfo_p->_sifields._sigfault.si_addr (gdb) p siginfo_p->si_addr $2 = (void *) 0x1 (gdb) Although macro expanding with the '.' operator was broken already: (gdb) macro expand siginfo.si_addr expands to: siginfo.si_addr -- Pedro Alves