Thread View: comp.windows.interviews
2 messages
2 total messages
Started by Maximilian Ott
Tue, 29 Dec 1992 21:09
Problems with Raster::poke on sun sparc
Author: Maximilian Ott
Date: Tue, 29 Dec 1992 21:09
Date: Tue, 29 Dec 1992 21:09
139 lines
4061 bytes
4061 bytes
Hi,
I'm trying to write a class to read PPM files similar to the
TIFFRaster class. Last night I got a crude version running and tried
to massage it a little bit today.
And all of a sudden I ran into this crazy bug and have no idea what is
going on. I stripped it down to the small program below. All it does
is to create a Raster (256x256) and set every pixel to 0. Whenever I
ran it it core dumps when trying to poke 206@0 (!!). For reasons
beyond my understanding dbx crashes with
dbx: internal error: unexpected value 90 at line 2620 in file
../common/object.c
when looking at the core.
As a crude debugging hack I put a printf as first statement into
(xraster.c)Raster::poke
void Raster::poke(
unsigned long x, unsigned long y,
ColorIntensity red, ColorIntensity green, ColorIntensity blue, float
) {
printf("...... Raster::poke\n");
RasterRep* r = rep();
...
and it doesn't even print anything when it attempts the mysterious
poke(206,0). If I run the program I get
..
.... write col: 205 of: 256
...... Raster::poke
...... poked!
.... write col: 206 of: 256
Segmentation fault (core dumped)
Any ideas?
I'm using AT 2.1 from SUN on a sparc 2. All the example programs
including the one calling TIFFRaster compile and execute perfectly. We
also have Saber C++ installed but I hope I avoided mixing the incs and
libs.
Thanks,
max
----
Max Ott max@ccrl.nj.nec.com phone: (609)951-2469
NEC C&C Research Princeton, NJ, 08540 fax: (609)951-2499
--------------
/*@ make
* screwy.c -- trying to figure out Ratser::poke
* Author : Maximilian Ott
* Created On : Tue Dec 29 15:10:05 1992
* Last Modified On: Tue Dec 29 16:02:05 1992
*+********************************************************************/
#include <IV-look/kit.h>
#include <InterViews/background.h>
#include <InterViews/image.h>
#include <InterViews/layout.h>
#include <InterViews/session.h>
#include <InterViews/style.h>
#include <InterViews/color.h>
#include <InterViews/raster.h>
#include <stdlib.h>
Raster*
test_load()
{
int width, height;
int x, y;
width = height = 256;
printf(".. alloc raster %dx%d\n", width, height);
Raster* r = new Raster((u_long)width, (u_long)height);
printf(".... after alloc\n");
for (y = 0; y < height; ++y) {
for (x = 0; x < width; ++x) {
printf(".... write col: %d of: %d\n", x, width);
r->poke(
(u_long)x, (u_long)(height - y),
(ColorIntensity)0.0,
(ColorIntensity)0.0,
(ColorIntensity)0.0,
1.0
);
printf("...... poked!\n");
}
}
return r;
} /* end of PPMRasterImpl::load */
int
main(int argc, char** argv)
{
Session* session = new Session("Image", argc, argv);
WidgetKit& kit = *WidgetKit::instance();
const LayoutKit& layout = *LayoutKit::instance();
printf("calling load\n");
Raster* r = test_load();
} /* end of main */
----- Imakefile ------
#mk#
# Imakefile --
# Author : Maximilian Ott
# Created On : Tue Dec 29 15:13:43 1992
# Last Modified On: Tue Dec 29 15:45:38 1992
##################################################################
#ifdef InObjectCodeDir
/* APP_CCLDFLAGS = -L/usr/lang/SC1.0 */
Use_libInterViews()
ComplexProgramTarget(test)
MakeObjectFromSrc(screwy)
#else
MakeInObjectCodeDir()
#endif
--
Max Ott max@ccrl.nj.nec.com phone: (609)951-2469
NEC C&C Research Princeton, NJ, 08540 fax: (609)951-2499
Re: Problems with Raster::poke on sun sparc (Clarification)
Author: Maximilian Ott
Date: Wed, 30 Dec 1992 22:50
Date: Wed, 30 Dec 1992 22:50
37 lines
1654 bytes
1654 bytes
In article <1992Dec29.210927.23562@research.nj.nec.com> max@ccrl.nj.nec.com (Maximilian Ott) writes: >....For reasons >beyond my understanding dbx crashes with Ok, I got that solved (dbxtool picked up the wrong dbx) >As a crude debugging hack I put a printf as first statement into >(xraster.c)Raster::poke This was very optimistic and shows that I pretty much don't know what I'm doing :) >.. >.... write col: 205 of: 256 >...... Raster::poke >...... poked! >.... write col: 206 of: 256 >Segmentation fault (core dumped) I still get the same problem but now I compiled xraster.c with -g and single stepped it. It turns out that the 205@0 call corrupts r->image_ when calling XPutPixel. I looked at the definition of XPutPixel and have really no idea what this is doing. I tried a hack where I saved and restored r->image_ between calls to XPutPixel but, of course, this only delays the crash. The funny thing is that when using the saber debugger it works. Still clueless, max -- Max Ott max@ccrl.nj.nec.com phone: (609)951-2469 NEC C&C Research Princeton, NJ, 08540 fax: (609)951-2499
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads