Bug 135488 - gdb internal error with incomplete type
Summary: gdb internal error with incomplete type
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gdb   
(Show other bugs)
Version: 3.0
Hardware: i386 Linux
Target Milestone: ---
Assignee: Jan Kratochvil
QA Contact: Jay Turner
Depends On:
Blocks: 221026 233716
TreeView+ depends on / blocked
Reported: 2004-10-13 00:16 UTC by Manish Singh
Modified: 2015-01-08 00:08 UTC (History)
4 users (show)

Fixed In Version: RHSA-2007-0469
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-06-11 17:50:52 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Simple workaround (558 bytes, patch)
2004-10-13 00:17 UTC, Manish Singh
no flags Details | Diff
Reproducibility testcase (not gdb testsuite style). (501 bytes, application/octet-stream)
2006-12-30 15:00 UTC, Jan Kratochvil
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2007:0469 normal SHIPPED_LIVE Low: gdb security and bug fix update 2007-06-07 23:20:53 UTC
Sourceware 1734 None None None Never

Description Manish Singh 2004-10-13 00:16:16 UTC
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 &&
      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.

Comment 1 Manish Singh 2004-10-13 00:17:11 UTC
Created attachment 105103 [details]
Simple workaround

Comment 2 Jan Kratochvil 2006-12-30 15:00:18 UTC
Created attachment 144581 [details]
Reproducibility testcase (not gdb testsuite style).

Comment 3 Jan Kratochvil 2006-12-30 15:01:58 UTC
Bug present on RHEL3U8.i386 and RHEL4U4.i386.
But not present on RHEL5.i386.

Comment 5 Andrew Cagney 2007-02-14 18:42:19 UTC
Testcase available; fix understood.

Comment 12 Red Hat Bugzilla 2007-06-11 17:50:52 UTC
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.


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