swarm-support
[Top][All Lists]
Advanced

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

Strange error...


From: jalex
Subject: Strange error...
Date: Sun, 3 Oct 1999 12:46:50 -0700 (PDT)

This morning I discovered a strange error in my Swarm program that I
cannot explain.  I would appreciate it if someone could enlighten me
as to why it happens.

In my ModelSwarm, the buildObjects method begins in the following way:

- buildObjects
{
  id agent;
  int x,y;

  // Here, we create the objects in the model
  game = [Game create: self];
  CREATE_PROBE_DISPLAY(game);

  // much more stuff deleted...

}

If I _comment out_ the line containing CREATE_PROBE_DISPLAY, the model
crashes with a core dump.  If I leave that line in, the model runs
normally.

I'm perplexed as to why this should happen.  What magic does
CREATE_PROBE_DISPLAY do that should cause the program to fail so
horribly?  

I'm puzzled because the game object, while _conceptually_ important to
the model, doesn't really _do_ that much.  It's just a singleton
instance variable representing the game agents play with each other.
Since the source files are so short, I include them below (there's
really nothing to them).


// game.h 
#import <objectbase/SwarmObject.h>
#import <gui.h>
#import "constants.h"

@interface Game: SwarmObject
{
  int cake_size;
}
+ create: aZone;
- (int) playGame: (id) me Against: (id) them; 
@end
// End game.h


I derive the Game from SwarmObject because, occasionally, I want to to
change the cake_size via a dialog box, and the easiest way to do this
is via the box displayed by a probe.


// game.m
#import "Game.h"
#import "AgentCore.h"

@implementation Game

+ create: aZone
{
  Game *game = [super create: aZone];
  game->cake_size = 10;
  return game;
}

- (int) playGame: (id) me Against: (id) them
{
  if ( [me getStrategy] + [them getStrategy] <= cake_size)
    return [me getStrategy];
  else
    return 0;
}
@end
// End game.m



In case it should help, here is a backtrace from the core dump.  



address@hidden nash]$ gdb .libs/nash ./core
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 (i586-unknown-linux), Copyright 1996 Free Software Foundation, Inc...
warning: core file may not match specified executable file.
Core was generated by `lt-nash'.
Program terminated with signal 11, Segmentation fault.
find_solib: Can't read pathname for load map: I/O error
#0  0x40203146 in ?? () from /usr/local/swarm/lib/libobjc.so.0
(gdb) bt
#0  0x40203146 in ?? () from /usr/local/swarm/lib/libobjc.so.0
#1  0x8 in ?? ()
#2  0x804ae52 in -[Game playGame:Against:] (self=0x80d6108, _cmd=0x8054360,
    me=0x8209a78, them=0x8) at Game.m:15
#3  0x8049254 in -[AgentCore interactUsingMoore8Nbhd] (self=0x8209a78,
    _cmd=0x80542f0) at AgentCore.m:116
#4  0x8048fe1 in -[AgentCore interact] (self=0x8209a78, _cmd=0x8055c20)
    at AgentCore.m:86
#5  0x4018e8dd in ?? () from /usr/local/swarm/lib/libdefobj.so.2
#6  0x40154a38 in ?? () from /usr/local/swarm/lib/libactivity.so.2
#7  0x4015bbcb in ?? () from /usr/local/swarm/lib/libactivity.so.2
#8  0x4015bacd in ?? () from /usr/local/swarm/lib/libactivity.so.2
#9  0x4015bacd in ?? () from /usr/local/swarm/lib/libactivity.so.2
#10 0x4015bacd in ?? () from /usr/local/swarm/lib/libactivity.so.2
#11 0x4015bacd in ?? () from /usr/local/swarm/lib/libactivity.so.2
#12 0x4015bacd in ?? () from /usr/local/swarm/lib/libactivity.so.2
#13 0x4015b9ba in ?? () from /usr/local/swarm/lib/libactivity.so.2
#14 0x4004b07d in ?? () from /usr/local/swarm/lib/libsimtoolsgui.so.1
#15 0x4004bb4c in ?? () from /usr/local/swarm/lib/libsimtoolsgui.so.1
#16 0x80513e4 in main (argc=1, argv=0xbffffae4) at main.m:44
#17 0x40572cb3 in ?? () from /lib/libc.so.6


Thanks,

Jason








                  ==================================
   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.



reply via email to

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