public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28740] New: Internal error: internal_type_vptr_fieldno() crashes
@ 2022-01-03 10:02 smurf at smurf dot noris.de
  2022-01-03 10:06 ` [Bug c++/28740] " smurf at smurf dot noris.de
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: smurf at smurf dot noris.de @ 2022-01-03 10:02 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 28740
           Summary: Internal error: internal_type_vptr_fieldno() crashes
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: smurf at smurf dot noris.de
  Target Milestone: ---

I managed to build a shared library (C++) which aborts GDB in function
internal_type_vptr_fieldno().

Debian Bullseye:

/build/gdb-Nav6Es/gdb-10.1/gdb/gdbtypes.c:1926: internal-error: int
internal_type_vptr_fieldno(type*): Assertion `type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION' failed.

To reproduce:

Fetch, build and install https://github.com/smurfix/clew.git

Fetch https://github.com/smurfix/kf2.git
check out commit ed25cacee

apt install $(grep -v '#' REQUIREMENTS)
make embed -j20  # more CPUs are better …
gdb libkf2-embed.so
b CFr<Tab>St<Tab>

which should find method CFraktalSFT::Stop() but instead emits the above error.

I have verified that the bug exists in current HEAD. Replacing the gdb_abort in
internal_type_vptr_fieldno (with a test that returns -1 instead of crashing)
"fixes" the problem and at first glance does not show any adverse effects.

I have not been able to create a smaller standalone example. (Admittedly I
didn't try very hard.)

I cannot attach the shared library in question because it's 155 MBytes large,
but if anybody needs it I can supply a download link.

-- 
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 c++/28740] Internal error: internal_type_vptr_fieldno() crashes
  2022-01-03 10:02 [Bug c++/28740] New: Internal error: internal_type_vptr_fieldno() crashes smurf at smurf dot noris.de
@ 2022-01-03 10:06 ` smurf at smurf dot noris.de
  2022-01-03 11:05 ` aburgess at redhat dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: smurf at smurf dot noris.de @ 2022-01-03 10:06 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from smurf at smurf dot noris.de ---
The library is here:

https://storgrid.noris.net/share.xhtml?token=L44e42cf1a7d347d296beb6f062ea6d8c

I compressed it with lz4, now "only" 55 MByte.

-- 
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 c++/28740] Internal error: internal_type_vptr_fieldno() crashes
  2022-01-03 10:02 [Bug c++/28740] New: Internal error: internal_type_vptr_fieldno() crashes smurf at smurf dot noris.de
  2022-01-03 10:06 ` [Bug c++/28740] " smurf at smurf dot noris.de
@ 2022-01-03 11:05 ` aburgess at redhat dot com
  2022-01-04 18:28 ` tromey at sourceware dot org
  2022-01-05  6:38 ` smurf at smurf dot noris.de
  3 siblings, 0 replies; 5+ messages in thread
From: aburgess at redhat dot com @ 2022-01-03 11:05 UTC (permalink / raw)
  To: gdb-prs

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

Andrew Burgess <aburgess at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aburgess at redhat dot com
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-01-03

--- Comment #2 from Andrew Burgess <aburgess at redhat dot com> ---
Using the pre-compiled library, I can reproduce the original error.  I also
observed this weird behaviour:

  (gdb) set max-value-size 200000
  (gdb) ptype CFraktalSFT
  type = struct CFraktalSFT {
    <snip lots of fields>
  gdb/gdbtypes.c:932: internal-error: type* create_range_type(type*, type*,
const dynamic_prop*, const dynamic_prop*, LONGEST): Assertion `TYPE_LENGTH
(index_type) > 0' failed.

Clearly a different error, but there's something odd about CFraktalSFT...

-- 
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 c++/28740] Internal error: internal_type_vptr_fieldno() crashes
  2022-01-03 10:02 [Bug c++/28740] New: Internal error: internal_type_vptr_fieldno() crashes smurf at smurf dot noris.de
  2022-01-03 10:06 ` [Bug c++/28740] " smurf at smurf dot noris.de
  2022-01-03 11:05 ` aburgess at redhat dot com
@ 2022-01-04 18:28 ` tromey at sourceware dot org
  2022-01-05  6:38 ` smurf at smurf dot noris.de
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2022-01-04 18:28 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

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

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
I think the problem is just that this is compiled with stabs and not DWARF:

murgatroyd. readelf -WS ./libkf2-embed.so | grep debug
murgatroyd. readelf -WS ./libkf2-embed.so | grep stab
  [26] .stab             PROGBITS        0000000000000000 617c300 2ed14ec 0c   
 27   0  4
  [27] .stabstr          STRTAB          0000000000000000 904d7ec 9382c3 00    
 0   0  1


The Makefile specifies -gstabs:

https://github.com/smurfix/kf2/blame/main/Makefile#L30

To the OP: stabs is an old, deprecated debug format.  It never supported
C++ very well, and is only kept around because there are a couple of
legacy C programs that use it.  Eventually we hope to remove it entirely.

You should basically never use -gstabs.  Use plain -g instead.

-- 
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 c++/28740] Internal error: internal_type_vptr_fieldno() crashes
  2022-01-03 10:02 [Bug c++/28740] New: Internal error: internal_type_vptr_fieldno() crashes smurf at smurf dot noris.de
                   ` (2 preceding siblings ...)
  2022-01-04 18:28 ` tromey at sourceware dot org
@ 2022-01-05  6:38 ` smurf at smurf dot noris.de
  3 siblings, 0 replies; 5+ messages in thread
From: smurf at smurf dot noris.de @ 2022-01-05  6:38 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from smurf at smurf dot noris.de ---
Ah. Thanks.

Ancient Makefiles building Windows binaries with mingw … among its myriad of
flags I missed that one, cleaning it up for transplanting to Linux.

Still, it'd be nice not to crash gdb when it encounters something like that.

-- 
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:[~2022-01-05  6:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-03 10:02 [Bug c++/28740] New: Internal error: internal_type_vptr_fieldno() crashes smurf at smurf dot noris.de
2022-01-03 10:06 ` [Bug c++/28740] " smurf at smurf dot noris.de
2022-01-03 11:05 ` aburgess at redhat dot com
2022-01-04 18:28 ` tromey at sourceware dot org
2022-01-05  6:38 ` smurf at smurf dot noris.de

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