Index: [thread] [date] [subject] [author]
  From: Christoph Egger <Christoph_Egger@t-online.de>
  To  : GGI-Mailing-Liste <ggi-develop@eskimo.com>
  Date: Mon, 12 Jul 1999 19:01:13 +0200 (MEST)

Re: hacking methods to find out bugs

Hi all!

Thanks very much to all (Andrew, Steffen, Christoph Reichenbach,...) who
gives me advertisements to find bugs!

The screen is no longer blank, and the programs are now stable! WAAHOO!!



On Mon, 12 Jul 1999, Christoph Egger wrote:

> 
> Hi all!
> 
> At first thanks to all who have given me advertisements!!
> 
> Now I am despairing!! I don't know where the bug is. Here are code-snips,
> where I assume the bug is...
> 
> 
> 
> 
> 	if (use_mathtype == USE_FIXPOINT) {
> 		fixcontext = (fix_3Dcontext_t *)context;
> 
> printf("__3dtk_init: call fix_3Dcontext_init, context is %p\n", fixcontext);
> 
>                 fix_3Dcontext_init(fixcontext);
> 
> printf("__3dtk_init: fix_3Dcontext_init called, context is %p\n", fixcontext);
> 
> printf("__3dtk_init: calling fix_polygon_init\n");
>                 if ((fixcontext == NULL) || (fix_polygon_init(fixcontext) == ENOMEM))
>                 {
>                         fix_3Dcontext_done(fixcontext);
>                         __3dtk_panic("Not enough memory\n");
>                 } // if
>                 fix_lights_init();
>                 fix_world_init();
>         } else {
>                 flocontext = (flo_3Dcontext_t *)context;
> 
>                 flo_3Dcontext_init(flocontext);
>                 if ((flocontext == NULL) || (flo_polygon_init(flocontext) == ENOMEM))
>                 {
>                         flo_3Dcontext_done(flocontext);
>                         __3dtk_panic("Not enough memory\n");
>                 } // if
>                 flo_lights_init();
>                 flo_world_init();
>         } // if
> 
> The output of gdb is:
> 
> __3dtk_init: call fix_3Dcontext_init, context is (nil)
> __3dtk_init: fix_3Dcontext_init called, context is (nil)
> __3dtk_init: calling fix_polygon_init
> 
> Program received SIGSEGV, Segmentation fault
> 0x400d7267 in fix_bitmap_done
> 
> The fix_bitmap_done-routine is called by fix_3Dcontext_done. But because
> of the output by gdb I assume that the error is in the
> fix_3Dcontext_init-Routine. The pointer returned by fix_3Dcontext_init
> needn't be nil!
> 
> Here the implementation of fix_3Dcontext_init:
> 
> void fix_3Dcontext_init(fix_3Dcontext_t *context)
> {
>         context = (struct fix_3Dcontext_t *)malloc(sizeof(struct fix_3Dcontext_t));
>         if (context == NULL)
>                 __3dtk_panic("Not enough memory!!\n");
> 
>         CAMERA(context) = (struct fix_camera_t *)malloc(sizeof(struct fix_camera_t));
>         fix_camera_init(context);
> 
>         fix_bitmap_init(context);
>         fix_CalcViewspaceFrustum(context);
> 
>         context->z_buffer = create_bitmap(sizeof(fix_t)*8,
>                 BITMAP(context)->width, BITMAP(context)->height);
> } // fix_3Dcontext_init
> 
> 
> Can anyone explain this paradox?
>  
> 
> Christoph Egger
> E-Mail: Christoph_Egger@t-online.de
> 

Christoph Egger
E-Mail: Christoph_Egger@t-online.de

Index: [thread] [date] [subject] [author]