Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2002:
[Freeciv-Dev] Re: autobacktrace (was: concerning the use of assert)
Home

[Freeciv-Dev] Re: autobacktrace (was: concerning the use of assert)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv Developers <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: autobacktrace (was: concerning the use of assert)
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 15 Sep 2002 11:08:54 +0000 (GMT)

On Fri, 13 Sep 2002, Raimar Falke wrote:
> Just to confirm that I understand you correctly: you want to replace
> the 673 asserts we have now with something which dumps a
> core/backtrace (this is easy) AND continue normal afterwards (this is
> hard)?

No.

> Note that it is also hard to save a game if an assert condition was
> triggerd. You just don't know what went wrong. And saving a game
> requires some non-small number of functions.

Correct.

The new call shouldn't replace all instances of assert, just do so in
cases where we believe that we can safely recover the error, like in

void bad_function(struct unit *punit)
{
  if (error(punit == NULL || punit->id == 0)) {
    return;
  }
  /* do stuff */
  return;
}

> The OS can do the job of preserving the state quite good. This was the
> reason why core files were implemented.

Reading core files from another computer / another platform is quite hard,
AFAIK. Backtraces help a lot.

Yours
Per

"I don't see why people are so upset about cloning sheep. American
television networks have been doing that to their audiences for years." --
Jello Biafra



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