public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/16581] New: GDB crash on inherit_abstract_dies infinite recursion
@ 2014-02-14  3:24 brobecker at gnat dot com
  2014-02-14  3:25 ` [Bug symtab/16581] " brobecker at gnat dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: brobecker at gnat dot com @ 2014-02-14  3:24 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 16581
           Summary: GDB crash on inherit_abstract_dies infinite recursion
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: brobecker at gnat dot com

Compiling at high levels of optimization some code involving nested subprograms
making recursive calls of the parent function sometimes produces some debugging
information that causes GDB to crash.

See https://www.sourceware.org/ml/gdb-patches/2014-01/msg00798.html:

The c++ code causing the problem is:

    // Integer variants of certain metrics, used for HTML rendering.
    int ascent(FontBaseline baselineType = AlphabeticBaseline) const
    {
        if (baselineType == AlphabeticBaseline)
            return lroundf(m_ascent);
        return height() - height() / 2;
    }

    int height(FontBaseline baselineType = AlphabeticBaseline) const
    {
        return ascent(baselineType) + descent(baselineType);
    }

As you can see,ascent(0x5816d55) calls height(0x5812c1b),and height calls
ascent(0x5816d55) recursivly.And the compiler  generates these dwarf code
representing this relationship preciously.

>> A dwarf die may have the following relationship:
>> 564860c<-----------------------------
>>   |                                 |
>>   |(abstract origin)                |
>>   |                                 |
>>   V                                 |
>> 5816d55                             | (abstract origin)
>>   |                                 |
>>   |(child)                          |
>>   |                                 |
>>   V                                 |
>>   ...                               |
>> 5812c34------------------------------
>> So inherit_abstract_dies may results in infinite recursive call.

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


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

* [Bug symtab/16581] GDB crash on inherit_abstract_dies infinite recursion
  2014-02-14  3:24 [Bug symtab/16581] New: GDB crash on inherit_abstract_dies infinite recursion brobecker at gnat dot com
@ 2014-02-14  3:25 ` brobecker at gnat dot com
  2014-02-14  3:26 ` brobecker at gnat dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: brobecker at gnat dot com @ 2014-02-14  3:25 UTC (permalink / raw)
  To: gdb-prs

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

Joel Brobecker <brobecker at gnat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |brobecker at gnat dot com
   Target Milestone|---                         |7.8

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


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

* [Bug symtab/16581] GDB crash on inherit_abstract_dies infinite recursion
  2014-02-14  3:24 [Bug symtab/16581] New: GDB crash on inherit_abstract_dies infinite recursion brobecker at gnat dot com
  2014-02-14  3:25 ` [Bug symtab/16581] " brobecker at gnat dot com
@ 2014-02-14  3:26 ` brobecker at gnat dot com
  2014-02-14  3:28 ` brobecker at gnat dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: brobecker at gnat dot com @ 2014-02-14  3:26 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Joel Brobecker <brobecker at gnat dot com> ---
>From https://www.sourceware.org/ml/gdb-patches/2014-01/msg00805.html:

For the record, we've actually seen the exact same behavior from
with GNAT a few years ago.  The problem occured when when we had
the following situation:

   procedure Outer (...) is
      [...]
      procedure Inner (...) is
         [...]
         -- Recurse by calling Outer..
         Outer (...);
      end Inner;
   begin
      [...]
      Inner (...);

In that case, when compiled at -O3, the compiler generated an Abstract
Instance Root (AIR) for procedure Outer, which owned/contained a DIE
defining procedure Inner (an out-of-line instance), which itself
contains a Concrete Instance Entry (CIIE) corresponding to the inlined
version of Outer's AIR. The CIIE has a reference to its AIR via
the DW_AT_abstract_origin attribute, hence the cycle.

Not being all quite sure how to make sense of the cycle in terms of
inheritance, we initially tried to fix in the compiler.  Although
the patch was initially approved in GCC, it was noted that the output
appeared to be conformant with the DWARF specifications (version 3,i
at the time, now version 4), particularly in light of the examples
in section D.7 of the specifications (3rd example).

Eventually, it was found that our GCC patch was causing some issues,
and thus was reverted. So far, we've kept the patch in AdaCore's
GCC tree, with a note to look into a GDB fix at some point.

We are indeed very close to the example from the DWARF specs cited
above, but it does not deal with recursion as we do here, so I think
that the DWARF specifications do have a hole when it comes to that.
Logically speaking, its seems that the sensible thing to do is to
inherit the whole Abstract Instance Tree (AIT) but excluding oneself.

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


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

* [Bug symtab/16581] GDB crash on inherit_abstract_dies infinite recursion
  2014-02-14  3:24 [Bug symtab/16581] New: GDB crash on inherit_abstract_dies infinite recursion brobecker at gnat dot com
  2014-02-14  3:25 ` [Bug symtab/16581] " brobecker at gnat dot com
  2014-02-14  3:26 ` brobecker at gnat dot com
@ 2014-02-14  3:28 ` brobecker at gnat dot com
  2014-02-14  3:32 ` brobecker at gnat dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: brobecker at gnat dot com @ 2014-02-14  3:28 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Joel Brobecker <brobecker at gnat dot com> ---
A run-able testcase at:
https://www.sourceware.org/ml/gdb-patches/2014-02/msg00331.html

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


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

* [Bug symtab/16581] GDB crash on inherit_abstract_dies infinite recursion
  2014-02-14  3:24 [Bug symtab/16581] New: GDB crash on inherit_abstract_dies infinite recursion brobecker at gnat dot com
                   ` (2 preceding siblings ...)
  2014-02-14  3:28 ` brobecker at gnat dot com
@ 2014-02-14  3:32 ` brobecker at gnat dot com
  2014-02-14  3:33 ` brobecker at gnat dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: brobecker at gnat dot com @ 2014-02-14  3:32 UTC (permalink / raw)
  To: gdb-prs

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

Joel Brobecker <brobecker at gnat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|brobecker at gnat dot com          |dje at google dot com

--- Comment #3 from Joel Brobecker <brobecker at gnat dot com> ---
Assigned to Doug - Thank you!

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


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

* [Bug symtab/16581] GDB crash on inherit_abstract_dies infinite recursion
  2014-02-14  3:24 [Bug symtab/16581] New: GDB crash on inherit_abstract_dies infinite recursion brobecker at gnat dot com
                   ` (3 preceding siblings ...)
  2014-02-14  3:32 ` brobecker at gnat dot com
@ 2014-02-14  3:33 ` brobecker at gnat dot com
  2014-02-20 17:16 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: brobecker at gnat dot com @ 2014-02-14  3:33 UTC (permalink / raw)
  To: gdb-prs

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

Joel Brobecker <brobecker at gnat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |brobecker at gnat dot com

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


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

* [Bug symtab/16581] GDB crash on inherit_abstract_dies infinite recursion
  2014-02-14  3:24 [Bug symtab/16581] New: GDB crash on inherit_abstract_dies infinite recursion brobecker at gnat dot com
                   ` (4 preceding siblings ...)
  2014-02-14  3:33 ` brobecker at gnat dot com
@ 2014-02-20 17:16 ` cvs-commit at gcc dot gnu.org
  2014-02-24 20:13 ` jan.kratochvil at redhat dot com
  2014-02-24 20:57 ` brobecker at gnat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2014-02-20 17:16 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  adde2bff0757e89175ede493f03b86953d0d9352 (commit)
      from  3be75f87b9a0e5b06175dadedb268c609609c821 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=adde2bff0757e89175ede493f03b86953d0d9352

commit adde2bff0757e89175ede493f03b86953d0d9352
Author: Doug Evans <xdje42@gmail.com>
Date:   Thu Feb 20 09:13:53 2014 -0800

    Fix PR symtab/16581

        * dwarf2read.c (struct die_info): New member in_process.
        (reset_die_in_process): New function.
        (process_die): Set it at the start, reset when returning.
        (inherit_abstract_dies): Only call process_die if origin_child_die
        not already being processed.

        testsuite/
        * gdb.dwarf2/dw2-icycle.S: New file.
        * gdb.dwarf2/dw2-icycle.c: New file.
        * gdb.dwarf2/dw2-icycle.exp: New file.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog                                     |   11 +
 gdb/dwarf2read.c                                  |   30 +++-
 gdb/testsuite/ChangeLog                           |    9 +
 gdb/testsuite/gdb.dwarf2/dw2-icycle.S             |  258 +++++++++++++++++++++
 gdb/testsuite/gdb.dwarf2/{main.c => dw2-icycle.c} |    0
 gdb/testsuite/gdb.dwarf2/dw2-icycle.exp           |   46 ++++
 6 files changed, 352 insertions(+), 2 deletions(-)
 create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-icycle.S
 copy gdb/testsuite/gdb.dwarf2/{main.c => dw2-icycle.c} (100%)
 create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-icycle.exp

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


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

* [Bug symtab/16581] GDB crash on inherit_abstract_dies infinite recursion
  2014-02-14  3:24 [Bug symtab/16581] New: GDB crash on inherit_abstract_dies infinite recursion brobecker at gnat dot com
                   ` (5 preceding siblings ...)
  2014-02-20 17:16 ` cvs-commit at gcc dot gnu.org
@ 2014-02-24 20:13 ` jan.kratochvil at redhat dot com
  2014-02-24 20:57 ` brobecker at gnat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: jan.kratochvil at redhat dot com @ 2014-02-24 20:13 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jan.kratochvil at redhat dot com

--- Comment #5 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
This Bug is therefore fixed now, isn't it?

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


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

* [Bug symtab/16581] GDB crash on inherit_abstract_dies infinite recursion
  2014-02-14  3:24 [Bug symtab/16581] New: GDB crash on inherit_abstract_dies infinite recursion brobecker at gnat dot com
                   ` (6 preceding siblings ...)
  2014-02-24 20:13 ` jan.kratochvil at redhat dot com
@ 2014-02-24 20:57 ` brobecker at gnat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: brobecker at gnat dot com @ 2014-02-24 20:57 UTC (permalink / raw)
  To: gdb-prs

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

Joel Brobecker <brobecker at gnat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Joel Brobecker <brobecker at gnat dot com> ---
Fixed by Doug's patch.

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


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

end of thread, other threads:[~2014-02-24 20:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-14  3:24 [Bug symtab/16581] New: GDB crash on inherit_abstract_dies infinite recursion brobecker at gnat dot com
2014-02-14  3:25 ` [Bug symtab/16581] " brobecker at gnat dot com
2014-02-14  3:26 ` brobecker at gnat dot com
2014-02-14  3:28 ` brobecker at gnat dot com
2014-02-14  3:32 ` brobecker at gnat dot com
2014-02-14  3:33 ` brobecker at gnat dot com
2014-02-20 17:16 ` cvs-commit at gcc dot gnu.org
2014-02-24 20:13 ` jan.kratochvil at redhat dot com
2014-02-24 20:57 ` brobecker at gnat dot com

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