public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/15223] New: reversed order of inlined function parameters
@ 2013-03-04 14:13 jan.kratochvil at redhat dot com
  2013-03-21  3:36 ` [Bug symtab/15223] " xunxun1982 at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-03-04 14:13 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15223

             Bug #: 15223
           Summary: reversed order of inlined function parameters
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
        AssignedTo: unassigned@sourceware.org
        ReportedBy: jan.kratochvil@redhat.com
    Classification: Unclassified
            Target: x86_64-unknown-linux-gnu


--------------------------------------------------------------------------------
int v;
__attribute__((always_inline)) static void
f (int a, int b, int c)
{
  v = a + b + c;
}
int
main (void)
{
  f (1, 2, 3);
  return 0;
}
--------------------------------------------------------------------------------
gcc -Wall -g 
(it occurs also with -O2 and without explicit always_inline)
--------------------------------------------------------------------------------
OK:
 <1><2d>: Abbrev Number: 2 (DW_TAG_subprogram)7
    <2e>   DW_AT_name        : f        
 <2><38>: Abbrev Number: 3 (DW_TAG_formal_parameter)
    <39>   DW_AT_name        : a        
 <2><41>: Abbrev Number: 3 (DW_TAG_formal_parameter)
    <42>   DW_AT_name        : b        
but the instance has them in reversed order:
 <2><81>: Abbrev Number: 6 (DW_TAG_inlined_subroutine)
    <82>   DW_AT_abstract_origin: <0x2d>        
    <86>   DW_AT_low_pc      : 0x40046d 
    <8e>   DW_AT_high_pc     : 0x40047e 
 <3><a0>: Abbrev Number: 7 (DW_TAG_formal_parameter)
    <a1>   DW_AT_abstract_origin: <0x41>        
    <a5>   DW_AT_location    : 2 byte block: 91 68      (DW_OP_fbreg: -24)
 <3><a8>: Abbrev Number: 7 (DW_TAG_formal_parameter)
    <a9>   DW_AT_abstract_origin: <0x38>        
    <ad>   DW_AT_location    : 2 byte block: 91 6c      (DW_OP_fbreg: -20)
--------------------------------------------------------------------------------
GDB output is reversed then:
f (c=3, b=2, a=1) at 16.c:5


It was rejected as a GCC PR:
  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49828

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug symtab/15223] reversed order of inlined function parameters
  2013-03-04 14:13 [Bug symtab/15223] New: reversed order of inlined function parameters jan.kratochvil at redhat dot com
@ 2013-03-21  3:36 ` xunxun1982 at gmail dot com
  2013-04-17  8:46 ` nils at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: xunxun1982 at gmail dot com @ 2013-03-21  3:36 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15223

xunxun <xunxun1982 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xunxun1982 at gmail dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug symtab/15223] reversed order of inlined function parameters
  2013-03-04 14:13 [Bug symtab/15223] New: reversed order of inlined function parameters jan.kratochvil at redhat dot com
  2013-03-21  3:36 ` [Bug symtab/15223] " xunxun1982 at gmail dot com
@ 2013-04-17  8:46 ` nils at redhat dot com
  2013-05-28  5:51 ` jan.kratochvil at redhat dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: nils at redhat dot com @ 2013-04-17  8:46 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15223

Nils Philippsen <nils at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nils at redhat dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug symtab/15223] reversed order of inlined function parameters
  2013-03-04 14:13 [Bug symtab/15223] New: reversed order of inlined function parameters jan.kratochvil at redhat dot com
  2013-03-21  3:36 ` [Bug symtab/15223] " xunxun1982 at gmail dot com
  2013-04-17  8:46 ` nils at redhat dot com
@ 2013-05-28  5:51 ` jan.kratochvil at redhat dot com
  2013-12-09  5:38 ` naesten at gmail dot com
  2020-09-04  2:12 ` simark at simark dot ca
  4 siblings, 0 replies; 6+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-05-28  5:51 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15223

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dje at google dot com

--- Comment #1 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
*** Bug 15541 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug symtab/15223] reversed order of inlined function parameters
  2013-03-04 14:13 [Bug symtab/15223] New: reversed order of inlined function parameters jan.kratochvil at redhat dot com
                   ` (2 preceding siblings ...)
  2013-05-28  5:51 ` jan.kratochvil at redhat dot com
@ 2013-12-09  5:38 ` naesten at gmail dot com
  2020-09-04  2:12 ` simark at simark dot ca
  4 siblings, 0 replies; 6+ messages in thread
From: naesten at gmail dot com @ 2013-12-09  5:38 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15223

Samuel Bronson <naesten at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |naesten at gmail dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug symtab/15223] reversed order of inlined function parameters
  2013-03-04 14:13 [Bug symtab/15223] New: reversed order of inlined function parameters jan.kratochvil at redhat dot com
                   ` (3 preceding siblings ...)
  2013-12-09  5:38 ` naesten at gmail dot com
@ 2020-09-04  2:12 ` simark at simark dot ca
  4 siblings, 0 replies; 6+ messages in thread
From: simark at simark dot ca @ 2020-09-04  2:12 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15223

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca

--- Comment #5 from Simon Marchi <simark at simark dot ca> ---
I stumbled on what I think is a variant of this, but where it's the order of
parameters in an out-of-line subprogram instance (DWARF5 section 3.3.8.3)
instead of "standard" inlining.  I presumed it was a GCC bug, but seeing the
reject PR mentioned above, I presume the response will be the same.

One instance of the problem, when I build GDB master (c5cd900e4f19) with GCC
master (8ad3fc6ca46c), is with the "do_examine" function.  The order of
parameters of this function is: fmt, gdbarch, addr.  This is how the abstract
instance is defined:

0x0004a912:   DW_TAG_subprogram
                DW_AT_name [DW_FORM_strp]       ("do_examine")
                DW_AT_decl_file [DW_FORM_data1]
("/home/smarchi/src/binutils-gdb/gdb/printcmd.c")
                DW_AT_decl_line [DW_FORM_data2] (972)
                DW_AT_decl_column [DW_FORM_data1]       (0x01)
                DW_AT_inline [DW_FORM_data1]    (DW_INL_inlined)
                DW_AT_sibling [DW_FORM_ref4]    (0x0004a9cb)

0x0004a921:     DW_TAG_formal_parameter
                  DW_AT_name [DW_FORM_string]   ("fmt")
                  ...

0x0004a92e:     DW_TAG_formal_parameter
                  DW_AT_name [DW_FORM_strp]     ("gdbarch")
                  ...

0x0004a93b:     DW_TAG_formal_parameter
                  DW_AT_name [DW_FORM_strp]     ("addr")
                  ...

And here's the out-of-line instance:

0x0004e0bd:   DW_TAG_subprogram
                DW_AT_abstract_origin [DW_FORM_ref4]    (0x0004a912
"do_examine")
                ...
0x0004e0cd:     DW_TAG_formal_parameter
                  DW_AT_abstract_origin [DW_FORM_ref4]  (0x0004a92e "gdbarch")
                  ...

0x0004e0d6:     DW_TAG_formal_parameter
                  DW_AT_abstract_origin [DW_FORM_ref4]  (0x0004a93b "addr")
                  ...

... some more dies children of the subprogram ...

0x0004e130:     DW_TAG_formal_parameter
                  DW_AT_abstract_origin [DW_FORM_ref4]  (0x0004a921 "fmt")

0x0004e135:     DW_TAG_formal_parameter
                  DW_AT_abstract_origin [DW_FORM_ref4]  (0x0004a921 "fmt")


So, not only the parameters are not in the right order, but the "fmt" one is
duplicated.

Perhaps we could open a bug with gcc for the duplication.  But for the order,
we can take care of it in GDB.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2020-09-04  2:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-04 14:13 [Bug symtab/15223] New: reversed order of inlined function parameters jan.kratochvil at redhat dot com
2013-03-21  3:36 ` [Bug symtab/15223] " xunxun1982 at gmail dot com
2013-04-17  8:46 ` nils at redhat dot com
2013-05-28  5:51 ` jan.kratochvil at redhat dot com
2013-12-09  5:38 ` naesten at gmail dot com
2020-09-04  2:12 ` simark at simark dot ca

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