discuss-gnustep
[Top][All Lists]
Advanced

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

segfault when debug=yes


From: Stefan Urbanek
Subject: segfault when debug=yes
Date: Mon, 08 Jan 2001 20:00:36 +0100

Hi.

I have two problems

Problem #1:

I do not know why, but I am getting different behaviour of programs with and
without debugging version. I've attachet a code, that is working fine without
debugging enabled. When I run debug version, it will segfault before main().

If it should help, here is backtrace:
(gdb) bt
#0  hash_string (cache=0x8064420, key=0xa0001) at objc/hash.h:177
#1  0x404dc199 in hash_value_for_key () at objc/objc-list.h:145
#2  0x404de3fe in __sel_register_typed_name () at selector.c:88
#3  0x404dca1a in __objc_exec_class () at init.c:440
#4  0x4044a720 in global constructors keyed to _objc_load_load_callback ()
    at objc-load.m:142
#5  0x40460c07 in __do_global_ctors_aux ()
#6  0x4031ec16 in _init ()


Problem #2:

I have program witch also tries to get all classes, like the one attached.
When executed, I've got same results for both, debug and nondebug version.
Exactly 25(!?!) ObjC classes. BUT: when I've run debug version with
--GNU-Debug=dflt option, I've got all 223 classes.

Does anybody knows, what should be wrong?

Thanks,

Stefan

#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSString.h>
#import <Foundation/NSArray.h>
#import <objc/objc-api.h>

int main(int argc, const char **argv)
{       
    NSAutoreleasePool* pool;
    void           *state = NULL;
    Class           class;
    const char     *str;
    NSMutableArray *array;

    pool = [NSAutoreleasePool new];
    
    array = [NSMutableArray array];

    while( (class = objc_next_class(&state)) )
    {
        str = class_get_class_name(class);
        
        [array addObject:[NSString stringWithCString:str]];
    }
    
    NSLog(@"%@", [array sortedArrayUsingSelector:@selector(compare:)]);
    NSLog(@"%i objc classes found",[array count]);

    [pool release];
    return 0;
}





reply via email to

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