public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: Craig Jeffree <craig.jeffree@preston.net>
Cc: gdb@sources.redhat.com
Subject: Re: <incomplete type>
Date: Fri, 26 Aug 2005 19:04:00 -0000	[thread overview]
Message-ID: <m3acj45xnv.fsf@alligator.red-bean.com> (raw)
In-Reply-To: <1125021866.10500.71.camel@norman> (Craig Jeffree's message of "Fri, 26 Aug 2005 12:04:26 +1000")


Craig Jeffree <craig.jeffree@preston.net> writes:
> I'm having trouble with GDB reporting an incomplete type...
>
> (gdb) p *acft->posn_->fpi_->seg_->wpApi_[0]
> $1 = <incomplete type>
> (gdb) p *(*acft->posn_->fpi_->seg_->wpApi_)
> $2 = <incomplete type>
>
> Although the variable I'm printing is deeply nested there is nothing
> unusual or complicated about it.  There is no templating involved in
> this hierarchy of objects.  It's simply classes, structs and an array of
> a class type.
>
> I can successfully do the following when stopped at the same breakpoint:
>
> (gdb) p *acft->posn_->fpi_->seg_->wpApi_
> $3 = (struct Soi::Waypoint *) 0x94d58b8
>
> And I also get...
> (gdb) ptype *acft->posn_->fpi_->seg_->wpApi_[0]
> type = struct Soi::Waypoint {
>     <incomplete type>
> }
>
> What is going on???

From that, it looks to me like GDB knows that
acft->posn_->fpi_->seg_->wpApi_ is a struct Soi::Waypoint **, but it
doesn't know what members 'struct Soi::Waypoint' has.  This is the way
it behaves when it has declarations like this:

    struct foo;
    struct foo *ptr;

but no definition for 'struct foo' itself.  'incomplete type' is C
terminology, not random GDB grousing.

The first thing I'd do in this case is check the debug info.  That
helps you at least decide whether it's GDB's problem, or whether
something upstream --- that is, the compiler, assembler, or linker ---
is munging things, and GDB's just doing the best it can.

'readelf -wi' dumps Dwarf debugging info in a human-readable form.
You can apply it to relocatable object files, executables, and shared
libraries.  You probably want to apply it to the executable or shared
library, since that's fewer steps removed from GDB, but the output
will be large.  You'll need to search for a DW_TAG_structure debugging
information entry ("die") whose DW_AT_name attribute is the mangled
form of Soi::Waypoint, and verify that the members are indeed listed
there.  If you could post that die when you find it, that might be
interesting.

You can dump the info from a .o file, too.  That'd be less to dig
through.  But then you can't distinguish problems introduced by the
linker from GDB screwing up.

  reply	other threads:[~2005-08-26 19:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-26  2:06 Craig Jeffree
2005-08-26 19:04 ` Jim Blandy [this message]
2005-08-29  7:50   ` Craig Jeffree
2005-08-29 18:38     ` Jim Blandy
2005-09-01 23:55       ` Craig Jeffree
2005-09-02  0:22         ` Jim Blandy
2005-09-02  1:50           ` Craig Jeffree
2005-09-02 13:16             ` Daniel Jacobowitz
2005-09-05  7:34               ` Craig Jeffree
2005-09-05 14:00                 ` Daniel Jacobowitz
2005-09-06  7:15                   ` Craig Jeffree
2005-09-12  1:34                     ` Daniel Jacobowitz
2005-09-15  5:12                       ` Craig Jeffree
2005-09-19  7:44                         ` Craig Jeffree
2005-09-12  1:35           ` Daniel Jacobowitz
2005-09-02  2:05       ` Craig Jeffree
  -- strict thread matches above, loose matches on Subject: below --
2005-05-01 21:21 "Incomplete Type" lin q

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3acj45xnv.fsf@alligator.red-bean.com \
    --to=jimb@redhat.com \
    --cc=craig.jeffree@preston.net \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).