www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Help debuggin

reply Ant <duitoolkit yahoo.ca> writes:
On a gdb session I see a call to a method that is not
what I wrote!

Is that a bug on dmd, on the linker or on gdb?

the assert(0); on the function that should have been
called is not 'fired' - obviously.

The code that gdb executes with nexti and setpi
doesn't correspond to what I wrote in D.
There is not doubt about that.
gdb calls a different function.
when executing normally I get printfs that are coded
after the assert(0);

the method that should have been called returns an object.
the var before calling the method contains 0x0,
and after NOT CALLING the method contains 0x1.
(so var===null == 0)

linux, dmd 0.101

Ant

here is the actual D code:
case "Image":
		printf("TestDrawing.drawPrimitive 1\n" );
		printf("TestDrawing.drawPrimitive image = 0x%X\n" , image);
		printf("TestDrawing.drawPrimitive 2\n" );
	Pixbuf p;
		printf("TestDrawing.drawPrimitive 2 0x%X\n", p );
	p = image.getPixbuf()trimTo(height , width);
		printf("TestDrawing.drawPrimitive 2 0x%X\n", p );
		printf("TestDrawing.drawPrimitive 2 %d\n", (p===null));
	Pixbuf pixbuf = p.trimTo(height , width);
		printf("TestDrawing.drawPrimitive 3\n" );
	Image i = new Image(pixbuf);
		printf("TestDrawing.drawPrimitive 4\n" );
	d.drawImage(i, x, y);
		printf("TestDrawing.drawPrimitive 5\n" );


//	d.drawImage(image, x, y);
	break;

and the method that should have been called but never is:

Pixbuf getPixbuf()
{
	assert(0);
		printf("Image.getPixbuf entry\n" );
	GdkPixbuf* gPix = gtk_image_get_pixbuf(cast(GtkImage*)gtkW());
		printf("Image.getPixbuf gPix = 0x%X\n", gPix);
	Pixbuf pix  = new Pixbuf(gPix);
		printf("Image.getPixbuf pix = 0x%X\n", pix);
	return pix;
	//return new Pixbuf(gtk_image_get_pixbuf(cast(GtkImage*)gtkW()));
}


TestDrawing.drawPrimitive 1
TestDrawing.drawPrimitive image = 0x40994A00
TestDrawing.drawPrimitive 2
TestDrawing.drawPrimitive 2 0x0
TestDrawing.drawPrimitive 2 0x1
TestDrawing.drawPrimitive 2 0
Segmentation fault
Sep 20 2004
parent Ant <duitoolkit yahoo.ca> writes:
On Mon, 20 Sep 2004 23:34:53 -0400, Ant wrote:

 On a gdb session I see a call to a method that is not
 what I wrote!
 
 Is that a bug on dmd, on the linker or on gdb?
 
 the assert(0); on the function that should have been
 called is not 'fired'
eventualy, if I don't use the part of the program that segfauls the assert(0) does get fired. Ant
Sep 20 2004