To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 1212
1211  |  1213
Subject: 
Re: Strange crash (and possible fix)
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Fri, 14 Jul 2000 18:25:41 GMT
Viewed: 
1319 times
  
Mike-
I wish I knew. I have frequently seen the same kinds of "random" changes
produce better results. For example, I had one piece of code that used a
switch statement- 19 statements in all. I added a 20th and poof... it
froze. I have no idea what could cause that kind of thing, but wish I knew...
Luis

On Fri, 14 Jul 2000, Michael J Ash wrote:

Date: Fri, 14 Jul 2000 04:34:11 GMT
From: Michael J Ash <mikeash@csd.uwm.edu>
To: lugnet.robotics.rcx.legos@lugnet.com
Subject: Strange crash (and possible fix)

I had a strange experience today. My program likes to crash a lot. I
accept this as a fact of life now; part of it is the difficulty in
debugging it, and part seems to be the beta-ness of legOS. However, today,
I tracked down one particularly evil bug, and I really don't understand it
at all.

Before, my program would crash roughly 50% of the time right at startup.
I'd make some irrelevant changes and it'd be happy the next time.. maybe.
Then I got the compiler working under LinuxPPC, and started playing around
with LNP. I made some neat debug functions that let me see what was going
on better. I tracked these semi-random crashes down to three lines of
code.

  gNavInfo.x = 0;
  gNavInfo.y = 0;
  gNavInfo.dir = 0;

gNavInfo was defined as:

struct {
  long x, y;
  long dir;
} gNavInfo;

When the program did its weird random crashes, it was at those three
lines. I'm certain of it. What I don't know is WHY? I changed the
definition into a typedef and made gNavInfo a pointer to that struct. Then
I use malloc to get a chunk for storage. Voila, my crashes seem to have
gone away. The only thing I can think of is if something would break if
the longs weren't aligned on a four-byte boundary. My "irrelevant" changes
could possibly fix things so that they were on a boundary, on break things
so that they weren't. But I don't see why that would crash. Does anybody
have any insight?

Btw, LNP is awesome!

--
  "Do not go gentle into that good night.
   Rage, rage against the dying of the light."
                    - Dylan Thomas
Mike Ash - <http://www.mikeash.com/>, <mailto:mail@mikeash.com>



-----------------------------------------------------------------------

    "Summertime... and the living is easy...
    fish are jumping and the cotton is high...
    So hush, little baby, baby don't you cry."
-Ella

-----------------------------------------------------------------------



Message has 1 Reply:
  Re: Strange crash (and possible fix)
 
(...) Well, it'd be nice to know, certainly, but I'm not going to look into it too hard. The fact is that it works wonderfully now. I compiled and downlaoded probably twenty versions of my program over the past two hours or so, and not a single one (...) (24 years ago, 14-Jul-00, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Strange crash (and possible fix)
 
I had a strange experience today. My program likes to crash a lot. I accept this as a fact of life now; part of it is the difficulty in debugging it, and part seems to be the beta-ness of legOS. However, today, I tracked down one particularly evil (...) (24 years ago, 14-Jul-00, to lugnet.robotics.rcx.legos)

3 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR