bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GDB error: this=<incomplete type> or this=<erro type>?


From: Wenqing Jiang
Subject: GDB error: this=<incomplete type> or this=<erro type>?
Date: Mon, 09 Jul 2001 23:25:37 GMT

Hi there,

i am not sure this is a C++ problem or that of the gdb I am using.
basically i could not step into a class function with correct
'this' pointer. 
I either got
this = <incomplete type> or
this = <error type>
as shown in the screen copy below.

The problem seems to narrow down to the
usage of <stdio.h>. If this line is commented out, everything is ok.
I can see the 'this' pointer when steping into the 
'Image' constructor.
however, whenever <stdio.h> is there, i am in trouble. I tried <cstdio>
or extern "C". same problems persist.

I am not sure whether only 'stdio.h' makes trouble or all old style
c header files.

Your help will be greatly appreciated.

Thanks in advance,


Wenqing


---------------------------debug session----------------------------
/lhome/wen/usc/philemon/samples% gdb waveFT
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for
details.
GDB 4.16 (sparc-sun-solaris2.5), Copyright 1996 Free Software
Foundation, Inc...
(gdb) list
1       #include <cstdio>
2
3       #include "WWimage.hh"
4
5
6
7
8       int main (int argc, char **argv)
9       {
10        char *program = argv[0];
(gdb) 
11
12        int hsize = 512;
13        int vsize = 512;
14
15        // Load the image to be coded
16        Image *image = new Image ("myfile.img", hsize, vsize);
17
18        //std::printf("this is good\n");
19        delete image;
20
(gdb) break 16
Breakpoint 1 at 0x1098c: file waveFT.cc, line 16.
(gdb) run
Starting program: /lhome/wen/usc/philemon/samples/waveFT 
..login SOLARIS 2.x
warning: Unable to find dynamic linker breakpoint function.
warning: GDB will be unable to debug shared library initializers
warning: and track explicitly loaded dynamic code.

Breakpoint 1, main (argc=1, argv=0xeffff20c) at waveFT.cc:16
16        Image *image = new Image ("myfile.img", hsize, vsize);
(gdb) step
Image::Image (this=<incomplete type>, filename=0x10cf8 "myfile.img",
new_hsize=512, 
    new_vsize=512) at WWimage.cc:28
28      Image::Image (const char *filename, int new_hsize, int
new_vsize) : 
(gdb) 
----------------------------------------------------------------------------------------------
//-----------main function--------------------------

#include <cstdio>

#include "WWimage.hh"


int main (int argc, char **argv)
{
  char *program = argv[0];

  int hsize = 512;
  int vsize = 512;

  // Load the image to be coded
  Image *image = new Image ("myfile.img", hsize, vsize);

  //std::printf("this is good\n");
  delete image;

  return 0;
}
-------------------WWimage.hh--------------------------------------

ifndef _IMAGE_
#define _IMAGE_


class Image {
public:

  // Loads an image of size hsize by vsize from the specified file
  //    The file is assumed to contain an image in raw byte format
  Image  (const char *filename, int hsize, int vsize = -1);
  
  ~Image();// { delete [] value;}
private:
  int hsize;
  int vsize;

  float * value;

};

#endif

------------------WWimage.cc-------------------------------------------------------
#include <iostream>
#include "WWimage.hh"

Image::Image (const char *filename, int new_hsize, int new_vsize) : 
  hsize(new_hsize), vsize(new_vsize)
{
  if (hsize == -1)
    hsize = vsize = 0;
  if (vsize == -1)
    vsize = hsize;
    
  value = new float  [hsize*vsize];
  if (!value )
    cout << "Can't allocate memory for image" << endl;

}


Image::~Image() {
  delete [] value;
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]