help-gnustep
[Top][All Lists]
Advanced

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

Debugging problems


From: Michael Scheibler
Subject: Debugging problems
Date: Wed, 11 Apr 2001 14:32:45 +0200

I am currently working with cygwin, my sources are compiled with
gcc -mno-cygwin (thats mingw). I wanted to test our huge project with objc
and gnustep-base linked as a shared DLL. When I run it from my console
everything seems to be okay, but when I try to debug it using cygwin's gdb
5.0, I get a SIGSEGV fault even before main() is invoked.

Program received signal SIGSEGV, Segmentation fault.
0x67bc867d in sarray_free ()

When I use objc_d, I can see, that the error occurs when the Objective-C
runtime loads and registers all the classes and their methods of our project
(loading of gnustep-base classes has been successful). However, I get this
error only when using Windows 2000. On Windows NT 4.0 everything runs fine.
I can even shift the place where the error occurs, I just have to change the
compilation order of my source files.

The error occurs in sarray_free()

  384 void
- 385 sarray_free(struct sarray* array) {
  386
  387 #ifdef OBJC_SPARSE3
  388   size_t old_max_index = (array->capacity-1)/INDEX_CAPACITY;
  389   struct sindex ** old_indices;
  390 #else
- 391   size_t old_max_index = (array->capacity-1)/BUCKET_SIZE;
  392   struct sbucket ** old_buckets;
  393 #endif
  394   int counter = 0;
  395
- 396   assert(array->ref_count != 0); /* Freed multiple times!!! */
  397
- 398   if(--(array->ref_count) != 0) /* There exists copies of me */
  399     return;
  400
  401 #ifdef OBJC_SPARSE3
  402   old_indices = array->indices;
  403 #else
  404   old_buckets = array->buckets;
  405 #endif
  406
- 407   if((array->is_copy_of) && ((array->is_copy_of->ref_count - 1) == 0))
- 408     sarray_free(array->is_copy_of);
  409
  410   /* Free all entries that do not point to empty_bucket */
- 411   for(counter = 0; counter <= old_max_index; counter++ ) {
  412 #ifdef OBJC_SPARSE3
  413     struct sindex* idx = old_indices[counter];
  414     if((idx != array->empty_index) &&
  415        (idx->version.version == array->version.version)) {
  416       int c2;
  417       for(c2=0; c2<INDEX_SIZE; c2++) {
  418  struct sbucket* bkt = idx->buckets[c2];
  419  if((bkt != array->empty_bucket) &&
  420     (bkt->version.version == array->version.version))
  421    {
  422      sarray_free_garbage(bkt);
  423      nbuckets -= 1;
  424    }
  425       }
  426       sarray_free_garbage(idx);
  427       nindices -= 1;
  428     }
  429 #else /* OBJC_SPARSE2 */
- 430     struct sbucket* bkt = array->buckets[counter];
- 431     if ((bkt != array->empty_bucket) &&
  432  (bkt->version.version == array->version.version))      // <--
btk->version.version => Access violation
  433       {
- 434  sarray_free_garbage(bkt);
- 435  nbuckets -= 1;
- 436       }
  437 #endif
- 438   }
  439
  440 #ifdef OBJC_SPARSE3
  441   /* free empty_index */
  442   if(array->empty_index->version.version == array->version.version) {
  443     sarray_free_garbage(array->empty_index);
  444     nindices -= 1;
  445   }
  446 #endif
  447
  448   /* free empty_bucket */
- 449   if(array->empty_bucket->version.version == array->version.version) {
- 450     sarray_free_garbage(array->empty_bucket);
- 451     nbuckets -= 1;
- 452   }
- 453   idxsize -= (old_max_index+1);
- 454   narrays -= 1;
  455
  456 #ifdef OBJC_SPARSE3
  457   /* free bucket table */
  458   sarray_free_garbage(array->indices);
  459
  460 #else
  461   /* free bucket table */
- 462   sarray_free_garbage(array->buckets);
  463
  464 #endif
  465
  466   /* free array */
- 467   sarray_free_garbage(array);
- 468 }
  469




reply via email to

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