Bug 221026 - gdb internal error with incomplete type
gdb internal error with incomplete type
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gdb (Show other bugs)
4.4
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jan Kratochvil
Jay Turner
:
Depends On: 135488
Blocks:
  Show dependency treegraph
 
Reported: 2006-12-30 10:04 EST by Jan Kratochvil
Modified: 2015-01-07 19:15 EST (History)
5 users (show)

See Also:
Fixed In Version: RHBA-2007-0811
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-11-15 11:11:44 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Sourceware 1734 None None None Never

  None (edit)
Description Jan Kratochvil 2006-12-30 10:04:49 EST
+++ This bug was initially created as a clone of Bug #135488 +++

When attaching to a process and doing a backtrace, the following
assertion failure occurs:

internal-error: make_cv_type: Assertion `TYPE_OBJFILE (*typeptr) ==
TYPE_OBJFILE (type) || TYPE_STUB (*typeptr)' failed.

This is due to code in gdbtypes.c:check_typedef:

  /* If this is a struct/class/union with no fields, then check whether a
     full definition exists somewhere else.  This is for systems where a
     type definition with no fields is issued for such types, instead of
     identifying them as stub types in the first place */

  if (TYPE_IS_OPAQUE (type) && opaque_type_resolution &&
!currently_reading_symtab)
    {
      char *name = type_name_no_tag (type);
      struct type *newtype;
      if (name == NULL)
        {
          stub_noname_complaint ();           return type;
        }
      newtype = lookup_transparent_type (name);
      if (newtype)
        make_cv_type (is_const, is_volatile, newtype, &type);
    }

What's happening is the type returned by lookup_transparent_type is
from a shared library that the process loads, but the original
incomplete type reference is from the application binary. So the
objfile entries in the types differ, causing the assertion failure of
TYPE_OBJFILE (*typeptr) == TYPE_OBJFILE (type).

I can workaround this with the attached patch, but I'm not sure it's
the right thing. This just forces the type to be treated as a STUB.

-- Additional comment from manish.singh@oracle.com on 2004-10-12 20:17 EST --
Created an attachment (id=105103)
Simple workaround


-- Additional comment from jkratoch@redhat.com on 2006-12-30 10:00 EST --
Created an attachment (id=144581)
Reproducibility testcase (not gdb testsuite style).


-- Additional comment from jkratoch@redhat.com on 2006-12-30 10:01 EST --
Bug present on RHEL3U8.i386 and RHEL4U4.i386.
But not present on RHEL5.i386.
Comment 1 RHEL Product and Program Management 2007-05-09 04:27:04 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 2 Jan Kratochvil 2007-05-09 04:33:37 EDT
The crash fix was committed before for RHEL-3.9:
* Sat Mar 24 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.3.0.0-1.138
- Fixed crash on cross-file resolving of opaque types (BZ 135488).

Still the function is incorrect in such case.  Proposing this patch for RHEL-4.

The right fix was committed to Rawhide in Bug 233716 and accepted upstream:
* Sat Mar 24 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-8
- Use definition of an empty structure as it is not an opaque type (BZ 233716).
http://sourceware.org/ml/gdb-patches/2007-04/msg00114.html
Comment 4 Andrew Cagney 2007-07-17 14:27:16 EDT
Backport of upstream fix.  Test included.  Prevents crash.
Comment 10 errata-xmlrpc 2007-11-15 11:11:44 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0811.html

Note You need to log in before you can comment on or make changes to this bug.