public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* force scanning of includes?
@ 2005-08-08 17:12 tom fogal
  2005-08-08 20:57 ` Jason Molenda
  0 siblings, 1 reply; 2+ messages in thread
From: tom fogal @ 2005-08-08 17:12 UTC (permalink / raw)
  To: gdb

This is probably in the docs somewhere, but my greps are coming up
empty. sorry.

I'm trying to debug a C++ program, and gdb doesn't seem to know about
objects defined in a library. The library is built with -g and
installed in /usr/local/lib/vtk, which is listed in /etc/ld.so.conf.
The headers are in /usr/local/include/vtk.

When I try to print an instance of an object from the library, gdb
thinks it is a struct:

#10 0x000000000040825c in main (argc=1, argv=0x7fffffffe748) at test.cxx:60
60              Renderer->Delete();
(gdb) print Renderer
$1 = (struct vtkRenderer *) 0x52d5b0
(gdb) print *Renderer
$2 = <incomplete type>

How can I tell gdb to scan /usr/local/include/vtk/vtkRenderer.h, so it
will know what a vtkRenderer is? The 'directories' command doesn't seem
to be much use here.

I've tried compiling my test.cxx program with '-g' and later '-gdwarf-2
-g3' after reading through some archives.

Thanks,

-tom

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

* Re: force scanning of includes?
  2005-08-08 17:12 force scanning of includes? tom fogal
@ 2005-08-08 20:57 ` Jason Molenda
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Molenda @ 2005-08-08 20:57 UTC (permalink / raw)
  To: tfogal; +Cc: gdb


On Aug 8, 2005, at 10:12 AM, tom fogal wrote:

> When I try to print an instance of an object from the library, gdb
> thinks it is a struct:
>
> #10 0x000000000040825c in main (argc=1, argv=0x7fffffffe748) at  
> test.cxx:60
> 60              Renderer->Delete();
> (gdb) print Renderer
> $1 = (struct vtkRenderer *) 0x52d5b0
> (gdb) print *Renderer
> $2 = <incomplete type>

gdb doesn't know what a vtkRenderer is.  This class is probably  
defined in vtkRenderer.h.  Is the definition actually included there?

If so, then either your debug info is incomplete/incorrect, or gdb is  
failing in reading it.

> I've tried compiling my test.cxx program with '-g' and later '- 
> gdwarf-2
> -g3' after reading through some archives.

-gdwarf-2 is enough.  It looks like you're on a 64-bit host -- best  
off not messing with anything but DWARF 2.

I don't know of any problems like this with DWARF debug info, but I'm  
not too familiar with non-MacOS systems these days.  If you'd like to  
pursue this problem further, start by running readelf -wi  on your  
application and looking for the definition of vtkRenderer.

Jason

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

end of thread, other threads:[~2005-08-08 20:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-08 17:12 force scanning of includes? tom fogal
2005-08-08 20:57 ` Jason Molenda

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