swarm-support
[Top][All Lists]
Advanced

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

[Swarm-Support] Fwd: Re: [Swarm-Modelling] conformsTo: with Collections


From: Gary Polhill
Subject: [Swarm-Support] Fwd: Re: [Swarm-Modelling] conformsTo: with Collections
Date: Thu, 21 Sep 2006 14:30:49 +0100

Sorry for the confusion over the lists.

If you look at the example program, I'm not sending the message to a
nil object, but to a freshly created List object, and I don't get the
problem if I do exactly the same with an Array object. This suggests
that Paul Johnson's diagnosis pertaining to lispArchiver isn't quite
right either.

I get this problem (or something similar) on Solaris 2.8 and Windows XP
platforms, the former running the CVS version of Swarm from 12 June
2006, the latter running the official Swarm 2.2 release.

Here's what happens when I run a slightly revised test_protocol.pl
script (from the one I mistakenly sent to Swarm Modelling yesterday) a
couple of times on Windows XP:

$ ./test_protocol.pl Array Collection

### Output from make cut ###

Array var is not nil
Array var conforms to Collection protocol

$ ./test_protocol.pl List Collection

### Output from make cut ###

List var is not nil

$ ./conforms
List var is not nil

If you look at the main.m created by the test_protocol.pl script, it
seems to me that after calling initSwarm(), one should be able to create
any kind of object and then ask it whether it conforms to any kind of
protocol without a crash that is evidently occurring on the call to
conformsTo:. Here is a backtrace of ./conforms from gdb (on Solaris,
Swarm 2.1.1):

(gdb) bt
#0  0xfe7a02d4 in _libc_kill () from /usr/lib/libc.so.1
#1  0xfe735a5c in abort () from /usr/lib/libc.so.1
#2  0xff034f58 in debugabort (filename=0xfe7c3a54 "", lineno=0, 
    function=0xfeff2dd8 "-[Error(c) _raiseEvent:]")
    at ../../../src-20011218/src/misc/debugabort.c:9
#3  0xfefd3a04 in -[Error(c) _raiseEvent:] (self=0x57388,
_cmd=0xff012d6c, 
    eventData=0xfeff76e0) at
../../../src-20011218/src/defobj/Symbol.m:173
#4  0xfefdbc74 in nil_method (receiver=0x0, op=0x57388)
    at ../../../src-20011218/src/defobj/internal.m:637
#5  0xfe8e172c in +[Object conformsTo:] (self=0x5f7b8, _cmd=0xff00e268,

    aProtocol=0x21358)
    at /software/swarm/swarm-testing/src-20011218/libobjc/Object.m:214
#6  0xfefc6acc in +[Object(s) _conformsTo:] (self=0x5f7b8,
_cmd=0xfe8f6fd0, 
    protocol=<incomplete type>)
    at ../../../src-20011218/src/defobj/DefObject.m:158
#7  0xfe8e1818 in -[Object conformsTo:] (self=0x10c4c8, _cmd=0x212b4, 
    aProtocol=0x21358)
    at /software/swarm/swarm-testing/src-20011218/libobjc/Object.m:227
#8  0x00010b3c in main (argc=1098952, argv=0x212b4) at main.m:26

Looking at #5:

#5  0xfe8e172c in +[Object conformsTo:] (self=0x5f7b8, _cmd=0xff00e268,

    aProtocol=0x21358)
    at /software/swarm/swarm-testing/src-20011218/libobjc/Object.m:214
214             if ([proto_list->list[i] conformsTo: aProtocol])
(gdb) l
209       for (proto_list = ((Class) self)->protocols;
210            proto_list; proto_list = proto_list->next)
211         {
212           for (i=0; i < proto_list->count; i++)
213           {
214             if ([proto_list->list[i] conformsTo: aProtocol])
215               return YES;
216           }
217         }
218
(gdb) print proto_list->list[i]
$1 = (class Protocol *) 0x0
(gdb) print self
$2 = (struct objc_object *) 0x5f7b8
(gdb) print [self name]
$3 = 0xfef4dfc0 "List_linked"

This suggests to me that somehow a linked list's proto_list has not
been correctly filled...

Gary

-- 
Please note that the views expressed in this e-mail are those of the
sender and do not necessarily represent the views of the Macaulay
Institute. This email and any attachments are confidential and are
intended solely for the use of the recipient(s) to whom they are
addressed. If you are not the intended recipient, you should not read,
copy, disclose or rely on any information contained in this e-mail, and
we would ask you to contact the sender immediately and delete the email
from your system. Thank you.
Macaulay Institute and Associated Companies, Macaulay Drive,
Craigiebuckler, Aberdeen, AB15 8QH.

--- Begin Message --- Subject: Re: [Swarm-Modelling] conformsTo: with Collections Date: Wed, 20 Sep 2006 10:50:55 -0700 User-agent: Thunderbird 1.5.0.5 (X11/20060812)
Gary Polhill wrote:
> I get a bus error in Swarm 2.2 (from CVS on 12 June 2006) when asking a
> List if it follows the Collections protocol. In Swarm 2.1.1 it complains
> that I've sent the request to nil! See attached perl script and
> Makefile.
> 
> (e.g. test_protocol.pl List Collections; ./conforms -> Bus Error;
> test_protocol.pl Array Collections -> "Array var conforms to Collection
> protocol")

This is a address@hidden question, by the way.

Marcus recently configured Swarm so that it disallowed messages to nil.

All you need to do is test to see if the receiver is nil and if it is,
don't send it a message.

-- 
glen e. p. ropella, 971-219-3846, http://tempusdictum.com
We must not allow the clock and the calendar to blind us to the fact
that each moment of life is a miracle and mystery. -- H. G. Wells
_______________________________________________
Modelling mailing list
address@hidden
http://www.swarm.org/mailman/listinfo/modelling

--- End Message ---
--- Begin Message --- Subject: Re: [Swarm-Modelling] conformsTo: with Collections Date: Wed, 20 Sep 2006 13:06:20 -0500 User-agent: Thunderbird 1.5.0.5 (X11/20060808)
glen e. p. ropella wrote:
Gary Polhill wrote:
I get a bus error in Swarm 2.2 (from CVS on 12 June 2006) when asking a
List if it follows the Collections protocol. In Swarm 2.1.1 it complains
that I've sent the request to nil! See attached perl script and
Makefile.

(e.g. test_protocol.pl List Collections; ./conforms -> Bus Error;
test_protocol.pl Array Collections -> "Array var conforms to Collection
protocol")

This is a address@hidden question, by the way.

Marcus recently configured Swarm so that it disallowed messages to nil.

All you need to do is test to see if the receiver is nil and if it is,
don't send it a message.

Gary was referring to the CVS as of June 12, 2006, and so I don't think the message to nil would crash Swarm. Hence, there's a good chance the bus error is caused by sending a message to nil, that does not cause an error/warning, and then something is empty and fails to respond to an instruction. In particular, I expect lispArchiver is not created, and the bus error happens when you tell a nill object to get some data. We had problems with the gcc in FC5 that cause that kind of trouble.

The Swarm-2.1 stops because it did have the "message to nil" warning in place, and I liked it that way. The newest Swarm is that way again.
pj

--
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ku.edu/~pauljohn
1541 Lilac Lane, Rm 504 University of Kansas Office: (785) 864-9086
Lawrence, Kansas 66044-3177           FAX: (785) 864-5700

_______________________________________________
Modelling mailing list
address@hidden
http://www.swarm.org/mailman/listinfo/modelling

--- End Message ---

Attachment: Makefile
Description: Binary data

Attachment: test_protocol.pl
Description: Binary data


reply via email to

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