public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/26393] New: gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. (dump_recursive_type)
@ 2020-08-15  8:26 vries at gcc dot gnu.org
  2020-08-16 15:55 ` [Bug gdb/26393] gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. (recursive_dump_type) vries at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-08-15  8:26 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 26393
           Summary: gdbtypes.h:526: internal-error: LONGEST
                    dynamic_prop::const_val() const: Assertion `m_kind ==
                    PROP_CONST' failed. (dump_recursive_type)
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

[ As reported here: PR26390 comment 3 ]

When doing:
...
(gdb) recursive_dump_type (type, 0)
...
for a dynamic type, I run into an assert, due to this code:
...
                       plongest (type->bounds ()->high.const_val ()),
...
which accesses type->bounds ()->high assuming it has kind == PROP_CONST, while
in fact it has kind == PROP_LOCEXPR.

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

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

* [Bug gdb/26393] gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. (recursive_dump_type)
  2020-08-15  8:26 [Bug gdb/26393] New: gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. (dump_recursive_type) vries at gcc dot gnu.org
@ 2020-08-16 15:55 ` vries at gcc dot gnu.org
  2020-08-17  1:58 ` simark at simark dot ca
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-08-16 15:55 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|gdbtypes.h:526:             |gdbtypes.h:526:
                   |internal-error: LONGEST     |internal-error: LONGEST
                   |dynamic_prop::const_val()   |dynamic_prop::const_val()
                   |const: Assertion `m_kind == |const: Assertion `m_kind ==
                   |PROP_CONST' failed.         |PROP_CONST' failed.
                   |(dump_recursive_type)       |(recursive_dump_type)

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

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

* [Bug gdb/26393] gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. (recursive_dump_type)
  2020-08-15  8:26 [Bug gdb/26393] New: gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. (dump_recursive_type) vries at gcc dot gnu.org
  2020-08-16 15:55 ` [Bug gdb/26393] gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. (recursive_dump_type) vries at gcc dot gnu.org
@ 2020-08-17  1:58 ` simark at simark dot ca
  2020-08-17  7:54 ` cvs-commit at gcc dot gnu.org
  2020-08-17  7:58 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: simark at simark dot ca @ 2020-08-17  1:58 UTC (permalink / raw)
  To: gdb-prs

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

Simon Marchi <simark at simark dot ca> changed:

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

--- Comment #1 from Simon Marchi <simark at simark dot ca> ---
The patch you give in that comment looks reasonable.

I'd suggest making the reference parameter const, and using
gdb_assert_not_reached in the default case.

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

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

* [Bug gdb/26393] gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. (recursive_dump_type)
  2020-08-15  8:26 [Bug gdb/26393] New: gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. (dump_recursive_type) vries at gcc dot gnu.org
  2020-08-16 15:55 ` [Bug gdb/26393] gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. (recursive_dump_type) vries at gcc dot gnu.org
  2020-08-17  1:58 ` simark at simark dot ca
@ 2020-08-17  7:54 ` cvs-commit at gcc dot gnu.org
  2020-08-17  7:58 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-17  7:54 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

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

commit 53d5a2a5c146f98dd525eda2f33d7781666463bf
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Aug 17 09:54:37 2020 +0200

    [gdb] Fix printing of unresolved dynamic type

    When debugging gdb in batch mode with executable mixed-lang-stack and doing
a
    backtrace at breakpt:
    ...
    $ gdb --args gdb \
      -batch \
      outputs/gdb.fortran/mixed-lang-stack/mixed-lang-stack \
      -ex "b breakpt" \
      -ex r \
      -ex bt
    ...
    and stopping at resolve_dynamic_type to print the type:
    ...
    (gdb) b resolve_dynamic_type
    Breakpoint 1 at 0x6b020c: file gdbtypes.c, line 2633.
    (gdb) commands
    Type commands for breakpoint(s) 1, one per line.
    End with a line saying just "end".
    >call recursive_dump_type (type, 0)
    >continue
    >end
    (gdb) run
    ...
    we eventually run into an assert for the dynamic type of "str":
    ...
    Thread 1 "gdb" hit Breakpoint 1, resolve_dynamic_type (type=0x22204f0, \
      valaddr=..., addr=4199408) at gdbtypes.c:2633
    2633        = {check_typedef (type), valaddr, addr, NULL};
    type node 0x22204f0
    name '<NULL>' (0x0)
    code 0xd (TYPE_CODE_STRING)
    length 0
      ...
        nfields 0 0x22204b0
    gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: \
      Assertion `m_kind == PROP_CONST' failed.
    A problem internal to GDB has been detected,
    further debugging may prove unreliable.
    ...
    when trying to print the high bound of a TYPE_CODE_RANGE, which has m_kind
    PROP_LOCEXPR, while the code in resolve_dynamic_type assumes PROP_CONST.

    Fix this by extending the printing of TYPE_CODE_RANGE to allow
    PROP_LOCEXPR/PROP_LOCLIST as well, such that we have instead:
    ...
        nfields 0 0x1fbc020
        low 1  high (dynamic)
    ...

    Tested on x86_64-linux.

    gdb/ChangeLog:

    2020-08-17  Tom de Vries  <tdevries@suse.de>

            PR gdb/26393
            * gdbtypes.c (dump_dynamic_prop): New function.
            (recursive_dump_type): Use dump_dynamic_prop for TYPE_CODE_RANGE.

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

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

* [Bug gdb/26393] gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. (recursive_dump_type)
  2020-08-15  8:26 [Bug gdb/26393] New: gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. (dump_recursive_type) vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-08-17  7:54 ` cvs-commit at gcc dot gnu.org
@ 2020-08-17  7:58 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-08-17  7:58 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Simon Marchi from comment #1)
> The patch you give in that comment looks reasonable.
> 
> I'd suggest making the reference parameter const, and using
> gdb_assert_not_reached in the default case.

Thanks for the review, followed up on the two suggestions, and committed.

Marking resolved-fixed.

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

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

end of thread, other threads:[~2020-08-17  7:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-15  8:26 [Bug gdb/26393] New: gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. (dump_recursive_type) vries at gcc dot gnu.org
2020-08-16 15:55 ` [Bug gdb/26393] gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. (recursive_dump_type) vries at gcc dot gnu.org
2020-08-17  1:58 ` simark at simark dot ca
2020-08-17  7:54 ` cvs-commit at gcc dot gnu.org
2020-08-17  7:58 ` vries at gcc dot gnu.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).