swarm-support
[Top][All Lists]
Advanced

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

Re: [Swarm-Support] I have the strangest seg fault (ever)!


From: Paul Johnson
Subject: Re: [Swarm-Support] I have the strangest seg fault (ever)!
Date: Fri, 15 Apr 2005 16:47:55 -0500
User-agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324)

You are a little over my head. How can call sequences be impossible if they show up in the backtrace?

Anyway, I ran gdb on a different computer and I get different messages. (??different gcc, gdb, I don't know what! but will try to find out.) The errors point at color setting in EZGraphs. The gdb output has a lot of those tcl warnings and a comment like "invalid color: double". SO that makes me focus on color settings. And if I comment out my color setting in EZGraph, then the model does not die anymore.

I wonder what's wrong with this?  Am I declaring "colors" wrongly?


- (void)createGraphWriter
{
  int numParties;
  char hdfEZGraphName[100];

  id <HDF5> hdf5container; /*"HDF5 data container"*/

   const char *colors[] =
{"black", "brown", "red", "green", "blue", "orange", "purple", "DeepPink","grey50"};

  prSeatGraph = [EZGraph createBegin: [[self getZone] getZone]];
  SET_WINDOW_GEOMETRY_RECORD_NAME (prSeatGraph);

  if (swarmGUIMode == YES)
    {
      [prSeatGraph setGraphics: YES];
    }
  else
    {
      [prSeatGraph setGraphics: NO];
    }
  [prSeatGraph setHDF5Container: hdf5container];
  [prSeatGraph setFileName: "prSeats"];//not a file name, but hdf5 object
  [prSeatGraph setFileOutput: YES];



  [prSeatGraph setTitle: "PR Seats"];
  [prSeatGraph setAxisLabelsX: "time" Y: "Seats"];
  // [prSeatGraph setColors: colors count: 9];

  prSeatGraph = [prSeatGraph createEnd];

  // Snip: more EZGraphs were created here
        
}


And then the sequences get added when agents (parties) are added:



- (void)createSequencesParty: (int)i
{
  id partyList = [modelSwarm getPartyList];
  {
    char aString[100];
    id aSeq;
    Party * anObject = [partyList atOffset: i];
    [anObject sayHi];
    snprintf(aString,99,"Seats %d", [anObject getID]);
fprintf(stderr,"Create Sequences \n Party Count %d",[partyList getCount]);
    fprintf(stderr,"This party is %d \n",[anObject getID]);

    aSeq = [prSeatGraph createSequence: aString
                        withFeedFrom: anObject
                        andSelector: M(getPRSeats)];
    [prSeatGraphSequences setCount: [partyList getCount]];
    [prSeatGraphSequences atOffset: i put: aSeq];
  }
  // Snip: more sequences for more graphs were created.
}

I wonder if maybe "colors" needs to be an IVAR if the EZGraph doesn't make its own copy, but instead looks back at the colors that existed inside the method that created the graphs???


Marcus G. Daniels wrote:
Paul Johnson wrote:

Is there some thing like "gdb" where I can compile with stronger range checking or something?


Besides scrutinizing -[Output createSequencesParty:] for ways you might get bad pointers in a data structure (e.g. frees without deletion, or creation methods that don't returned pointers because of, say, uninitialized values, one tool for detecting memory overruns is GCC's Mudflap. http://gcc.fyxm.net/summit/2003/mudflap.pdf

(Btw, I don't think that trace you sent is from valid data, some of the function call sequences simply aren't possible.)


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


reply via email to

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