public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/29865] New: The GDB dies during unwind the stack - question
@ 2022-12-07 15:24 filip.bascarevic at siemens dot com
  2022-12-07 23:02 ` [Bug gdb/29865] " tromey at sourceware dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: filip.bascarevic at siemens dot com @ 2022-12-07 15:24 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29865
           Summary: The GDB dies during unwind the stack - question
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: filip.bascarevic at siemens dot com
  Target Milestone: ---

Hello community,
I was debugging something and my GDB application just died when I wanted to do
"backtrace". After debugging the source code, I figure out the application died
at the assert in the file gdb/dwarf2/loc.c:1147 (in the function
dwarf_expr_reg_to_entry_parameter()). The reason why the assert is triggered is
because I setup the backtrace limit to 30 and during unwinding the stack the
frame type was "INLINE_FRAME" so the get_priv_frame() function returned NULL
(see line gdb/frame.c:2527) and the assert is triggered. 
Is it really necessary to have this assert? Why we need to consider if the
current frame is "INLINE_FRAME" on this place? 

Problematic code is:
    while (get_frame_type (frame) == INLINE_FRAME)
    {
      frame = get_prev_frame (frame);
      gdb_assert (frame != NULL);
    }

Thanks a lot for the support,
Filip Bascarevic

-- 
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 gdb/29865] The GDB dies during unwind the stack - question
  2022-12-07 15:24 [Bug gdb/29865] New: The GDB dies during unwind the stack - question filip.bascarevic at siemens dot com
@ 2022-12-07 23:02 ` tromey at sourceware dot org
  2022-12-08  7:55 ` filip.bascarevic at siemens dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2022-12-07 23:02 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
Offhand I'm not sure what the deal is here.
Maybe "set backtrace limit" has to take this situation
into account and allow some leeway, or maybe it
should only work on "physical" (non-inline/tailcall)
frames -- dunno.  (And, assuming that's what you did...)

However - what version of gdb are you using?
This assert doesn't seem to appear in git master.

-- 
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 gdb/29865] The GDB dies during unwind the stack - question
  2022-12-07 15:24 [Bug gdb/29865] New: The GDB dies during unwind the stack - question filip.bascarevic at siemens dot com
  2022-12-07 23:02 ` [Bug gdb/29865] " tromey at sourceware dot org
@ 2022-12-08  7:55 ` filip.bascarevic at siemens dot com
  2022-12-21 18:42 ` tromey at sourceware dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: filip.bascarevic at siemens dot com @ 2022-12-08  7:55 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Filip Bascarevic <filip.bascarevic at siemens dot com> ---
When I noticed the issue, I used gdb-10.2, but during report of the bug, I put
information from master in the gdb mirror from the GitHub. On this link you can
find problematic lines:
https://github.com/bminor/binutils-gdb/blob/b0f110a5ea0914aff686bab0f511d749433104d8/gdb/dwarf2/loc.c#L1144-L1148

Thanks for the support.
Also, if I can help somehow, just let me know.

-- 
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 gdb/29865] The GDB dies during unwind the stack - question
  2022-12-07 15:24 [Bug gdb/29865] New: The GDB dies during unwind the stack - question filip.bascarevic at siemens dot com
  2022-12-07 23:02 ` [Bug gdb/29865] " tromey at sourceware dot org
  2022-12-08  7:55 ` filip.bascarevic at siemens dot com
@ 2022-12-21 18:42 ` tromey at sourceware dot org
  2024-01-06 14:01 ` ssbssa at sourceware dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2022-12-21 18:42 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
> Also, if I can help somehow, just let me know.

Well... if you're interested in hacking on gdb, maybe
the way to approach this is to change how the backtrace
limit works.  One idea is to have it only count "real"
frames and ignore inline frames and tailcall frames.

-- 
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 gdb/29865] The GDB dies during unwind the stack - question
  2022-12-07 15:24 [Bug gdb/29865] New: The GDB dies during unwind the stack - question filip.bascarevic at siemens dot com
                   ` (2 preceding siblings ...)
  2022-12-21 18:42 ` tromey at sourceware dot org
@ 2024-01-06 14:01 ` ssbssa at sourceware dot org
  2024-01-06 20:16 ` ssbssa at sourceware dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-06 14:01 UTC (permalink / raw)
  To: gdb-prs

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

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ssbssa at sourceware dot org

-- 
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 gdb/29865] The GDB dies during unwind the stack - question
  2022-12-07 15:24 [Bug gdb/29865] New: The GDB dies during unwind the stack - question filip.bascarevic at siemens dot com
                   ` (3 preceding siblings ...)
  2024-01-06 14:01 ` ssbssa at sourceware dot org
@ 2024-01-06 20:16 ` ssbssa at sourceware dot org
  2024-01-06 20:16 ` ssbssa at sourceware dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-06 20:16 UTC (permalink / raw)
  To: gdb-prs

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

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |ssbssa at sourceware dot org

--- Comment #4 from Hannes Domani <ssbssa at sourceware dot org> ---
https://sourceware.org/pipermail/gdb-patches/2024-January/205693.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 gdb/29865] The GDB dies during unwind the stack - question
  2022-12-07 15:24 [Bug gdb/29865] New: The GDB dies during unwind the stack - question filip.bascarevic at siemens dot com
                   ` (4 preceding siblings ...)
  2024-01-06 20:16 ` ssbssa at sourceware dot org
@ 2024-01-06 20:16 ` ssbssa at sourceware dot org
  2024-01-29 14:34 ` cvs-commit at gcc dot gnu.org
  2024-01-29 14:36 ` ssbssa at sourceware dot org
  7 siblings, 0 replies; 9+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-06 20:16 UTC (permalink / raw)
  To: gdb-prs

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

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-01-06
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

-- 
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 gdb/29865] The GDB dies during unwind the stack - question
  2022-12-07 15:24 [Bug gdb/29865] New: The GDB dies during unwind the stack - question filip.bascarevic at siemens dot com
                   ` (5 preceding siblings ...)
  2024-01-06 20:16 ` ssbssa at sourceware dot org
@ 2024-01-29 14:34 ` cvs-commit at gcc dot gnu.org
  2024-01-29 14:36 ` ssbssa at sourceware dot org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-29 14:34 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Hannes Domani <ssbssa@sourceware.org>:

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

commit 633680620bb85ed6f80b22371ef49610faec8d03
Author: Hannes Domani <ssbssa@yahoo.de>
Date:   Mon Jan 29 15:31:44 2024 +0100

    Fix backtrace limit stopping on inline frame

    If you have set up a backtrace limit, and the backtrace stops
    because of this in an inline frame with arguments, you get an
    assertion failure:
    ```
    (gdb) bt
    (gdb) set backtrace limit 2
    (gdb) bt
    C:/src/repos/binutils-gdb.git/gdb/frame.c:3346: internal-error: reinflate:
Assertion `m_cached_level >= -1' failed.
    ```

    And if this one is fixed, there is another one as well:
    ```
    (gdb) bt
    C:/src/repos/binutils-gdb.git/gdb/dwarf2/loc.c:1160: internal-error:
dwarf_expr_reg_to_entry_parameter: Assertion `frame != NULL' failed.
    ```

    The reason for both of them is this kind of loop:
    ```
      while (get_frame_type (frame) == INLINE_FRAME)
        frame = get_prev_frame (frame);
    ```
    Since get_prev_frame respects the backtrace limit, it will return
    NULL, and from there on you can't continue.
    This changes these loops to use get_prev_frame_always instead, so
    you always get a non-inline frame in the end.

    With this backtrace works:
    ```
    (gdb) bt
    (gdb)
    ```

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29865
    Approved-By: Andrew Burgess <aburgess@redhat.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 gdb/29865] The GDB dies during unwind the stack - question
  2022-12-07 15:24 [Bug gdb/29865] New: The GDB dies during unwind the stack - question filip.bascarevic at siemens dot com
                   ` (6 preceding siblings ...)
  2024-01-29 14:34 ` cvs-commit at gcc dot gnu.org
@ 2024-01-29 14:36 ` ssbssa at sourceware dot org
  7 siblings, 0 replies; 9+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-29 14:36 UTC (permalink / raw)
  To: gdb-prs

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

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |15.1

--- Comment #6 from Hannes Domani <ssbssa at sourceware dot org> ---
Fixed.

-- 
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:[~2024-01-29 14:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07 15:24 [Bug gdb/29865] New: The GDB dies during unwind the stack - question filip.bascarevic at siemens dot com
2022-12-07 23:02 ` [Bug gdb/29865] " tromey at sourceware dot org
2022-12-08  7:55 ` filip.bascarevic at siemens dot com
2022-12-21 18:42 ` tromey at sourceware dot org
2024-01-06 14:01 ` ssbssa at sourceware dot org
2024-01-06 20:16 ` ssbssa at sourceware dot org
2024-01-06 20:16 ` ssbssa at sourceware dot org
2024-01-29 14:34 ` cvs-commit at gcc dot gnu.org
2024-01-29 14:36 ` ssbssa at sourceware dot org

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