public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: nobody@sources.redhat.com
Cc: gdb-prs@sources.redhat.com,
Subject: Re: macros/2564: 'p siginfo->si_addr' doesn't work anymore
Date: Wed, 10 Dec 2008 16:58:00 -0000	[thread overview]
Message-ID: <20081210165802.5156.qmail@sourceware.org> (raw)

The following reply was made to PR macros/2564; it has been noted by GNATS.

From: Pedro Alves <pedro@codesourcery.com>
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 <signal.h>
 #include <string.h>
 
 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 <http://gnu.org/licenses/gpl.html>
 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:
 <http://www.gnu.org/software/gdb/bugs/>...
 (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


             reply	other threads:[~2008-12-10 16:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-10 16:58 Pedro Alves [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-12-11 18:31 tromey
2008-12-11  1:14 tromey
2008-12-10 21:18 Pedro Alves
2008-12-10 19:28 Tom Tromey
2008-12-10 15:48 pedro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081210165802.5156.qmail@sourceware.org \
    --to=pedro@codesourcery.com \
    --cc=gdb-prs@sources.redhat.com \
    --cc=nobody@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).