public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* macros/2564: 'p siginfo->si_addr' doesn't work anymore
@ 2008-12-10 15:48 pedro
  2008-12-10 15:58 ` pending/2565: " Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: pedro @ 2008-12-10 15:48 UTC (permalink / raw)
  To: gdb-gnats; +Cc: pedro


>Number:         2564
>Category:       macros
>Synopsis:       'p siginfo->si_addr' doesn't work anymore
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 10 15:48:04 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     pedro@codesourcery.com
>Release:        gdb HEAD 20081210
>Organization:
>Environment:
Linux orlando 2.6.24-21-generic #1 SMP Tue Oct 21 23:09:30 UTC 2008 x86_64 GNU/Linux
>Description:
Trying to 'print siginfo_p->si_addr' in the attached test fails with:

 (gdb) p siginfo_p->si_addr
 There is no member named .

Although si_addr is a macro defined as:
#define si_addr _sifields._sigfault.si_addr

This worked on 6.8.

And struct siginfo does have those members.
>How-To-Repeat:
Build with gcc -g3 for the extra macro info.

b main; run; next;

 (gdb) p siginfo_p->si_addr
 There is no member named .
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-csrc; name="siginfo_exp.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="siginfo_exp.c"

I2luY2x1ZGUgPHNpZ25hbC5oPgojaW5jbHVkZSA8c3RyaW5nLmg+CgppbnQKbWFpbiAoaW50IGFy
Z2MsIGNoYXIgKiphcmd2KQp7CiAgc3RydWN0IHNpZ2luZm8gaW5mbzsgLyogbWFrZSBzdXJlIGl0
J3Mgbm90IHJlbGF0ZWQgdG8gdmFyIG5hbWUgZXF1YWwgdHlwZSBuYW1lLiAgKi8KICBzdHJ1Y3Qg
c2lnaW5mbyBzaWdpbmZvOyAvKiB2YXIgdnMgLi4uICovCiAgc3RydWN0IHNpZ2luZm8gKnNpZ2lu
Zm9fcCA9ICZzaWdpbmZvOyAvKiAuLi4gcG9pbnRlciAqLwoKICByZXR1cm4gMDsKfQo=


^ permalink raw reply	[flat|nested] 3+ messages in thread

* pending/2565: Re: 'p siginfo->si_addr' doesn't work anymore
  2008-12-10 15:48 macros/2564: 'p siginfo->si_addr' doesn't work anymore pedro
@ 2008-12-10 15:58 ` Pedro Alves
  0 siblings, 0 replies; 3+ messages in thread
From: Pedro Alves @ 2008-12-10 15:58 UTC (permalink / raw)
  To: gdb-gnats


>Number:         2565
>Category:       pending
>Synopsis:       Re: 'p siginfo->si_addr' doesn't work anymore
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   unknown
>Arrival-Date:   Wed Dec 10 15:58:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:
 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
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: pending/2565: Re: 'p siginfo->si_addr' doesn't work anymore
@ 2008-12-10 18:16 tromey
  0 siblings, 0 replies; 3+ messages in thread
From: tromey @ 2008-12-10 18:16 UTC (permalink / raw)
  To: gdb-prs, nobody, pedro

Synopsis: Re: 'p siginfo->si_addr' doesn't work anymore

State-Changed-From-To: open->closed
State-Changed-By: tromey
State-Changed-When: Wed Dec 10 18:16:16 2008
State-Changed-Why:
    Duplicate of PR 2564

http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=2565


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-10 18:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-10 15:48 macros/2564: 'p siginfo->si_addr' doesn't work anymore pedro
2008-12-10 15:58 ` pending/2565: " Pedro Alves
2008-12-10 18:16 tromey

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).