[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Subclassing off Array_c [Swarm 1.2, Solaris 2.6]
From: |
Gary Polhill |
Subject: |
Subclassing off Array_c [Swarm 1.2, Solaris 2.6] |
Date: |
Fri, 11 Sep 1998 13:32:02 +0100 |
I get a seg fault when subclassing off Array_c. Can anyone
tell me what I might have done wrong?
Here's the simplest code required to reproduce the problem:
::::::::::::::
test-ArraySub-main.m
::::::::::::::
#import <simtools.h>
#import <collections.h>
#import "test-ArraySub.h"
int main(int argc, const char **argv) {
id a;
initSwarm(argc, argv);
a = [ArraySub create: globalZone setCount: 1];
return(0);
}
::::::::::::::
test-ArraySub.h
::::::::::::::
#import <defobj.h>
#import <collections.h>
#import <collections/Array.h>
@interface ArraySub: Array_c {
int thingyBob;
}
//+create: (id)aZone setCount: (int)aCount;
@end
::::::::::::::
test-ArraySub.m
::::::::::::::
#import "test-ArraySub.h"
@implementation ArraySub
/*
+create: (id)aZone setCount: (int)aCount {
ArraySub *newArraySub;
newArraySub = [super create: aZone setCount: aCount];
newArraySub->thingyBob = 42;
return(newArraySub);
}
*/
@end
::::::::::::::
Makefile-test-ArraySub
::::::::::::::
ifeq ($(SWARMHOME),)
SWARMHOME=/home/swarm/swarm1.2/sunos5.5/swarm
endif
APPLICATION=test-ArraySub-main
OBJECTS=test-ArraySub.o test-ArraySub-main.o
include $(SWARMHOME)/Makefile.appl
test-ArraySub.o: test-ArraySub.m test-ArraySub.h
test-ArraySub-main.o: test-ArraySub.h test-ArraySub-main.m
--------------------------------------------
Here's some gdb output
gdb test-ArraySub-main
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (sparc-sun-solaris2.5), Copyright 1996 Free Software Foundation, Inc...
(gdb) run
Starting program: /home/gp/swarm/fearlus/model0-2/test-ArraySub-main
Program received signal SIGSEGV, Segmentation fault.
-[Zone(c) _allocIVars:] (self=0xa2400, _cmd=0x9e630, aClass=0x0) at Zone.m:24
24 {
(gdb) bt
#0 -[Zone(c) _allocIVars:] (self=0xa2400, _cmd=0x9e630, aClass=0x0) at
Zone.m:24
#1 0x3d618 in +[Array(c) _create:setCount:] (self=0x92db8, _cmd=0x92e10,
aZone=0xc0f68, memberCount=1) at Array.m:63
#2 0x1b424 in main (argc=1, argv=0xefffe18c) at test-ArraySub-main.m:9
------------------------------------------------
Here's what I get if I uncomment the commented code (looks like it's
essentially the same problem):
(gdb) run
Starting program: /home/gp/swarm/fearlus/model0-2/test-ArraySub-main
Program received signal SIGSEGV, Segmentation fault.
-[Zone(c) _allocIVars:] (self=0xa5800, _cmd=0x9e6cc, aClass=0x0) at Zone.m:24
24 {
(gdb) bt
#0 -[Zone(c) _allocIVars:] (self=0xa5800, _cmd=0x9e6cc, aClass=0x0) at
Zone.m:24
#1 0x3d668 in +[Array(c) _create:setCount:] (self=0x92e4c, _cmd=0x92e7c,
aZone=0xc1000, memberCount=1) at Array.m:63
#2 0x1b400 in +[ArraySub create:setCount:] (self=0x92e4c, _cmd=0x92eac,
aZone=0xc1000, aCount=1) at test-ArraySub.m:8
#3 0x1b474 in main (argc=1, argv=0xefffe18c) at test-ArraySub-main.m:9
--
Macaulay Land Use Research Institute, Craigiebuckler, Aberdeen. AB15 8QH
Tel: +44 (0) 1224 318611 Email: address@hidden
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
==================================
- Subclassing off Array_c [Swarm 1.2, Solaris 2.6],
Gary Polhill <=