Re: Segmentation Faults

new topic     » goto parent     » topic index » view thread      » older message » newer message

On 14 Aug 2000, at 13:06, Irv Mullins wrote:

> On Mon, 14 Aug 2000, Kayhlan wrote:
> > Hello Folks,
> >
> > I'm coding a game in Euphoria under the Linux platform. After three
> > years + of programming, I have approximately 1.5 meg of game code (this
> > is a text-based game, not a graphical one) and I've recently been
> > getting "segmentation fault" errors. I know that Euphoria does not
> > generate an ex.err file because of the segmentation fault, but I need to
> > know what sorts of things cause these segmentation faults because I
> > cannot duplicate the error at will, it seems to randomly occur. I use
> > very few calls to the C language, mostly it is just manipulation of
> > sequences.
>
> Hi  Kayhlan:
>
> >From my own experience, segmentation faults are generally caused by an
> attempt to reference a physical location in memory that Euphoria does not
> "own".
> This can happen thu pokes (or peeks) into memory that Euphoria has not
> allocated. Sometimes it happens when calling a c routine and passing an
> invalid pointer. That causes the c routine to muck about where it doesn't
> belong.
>
> These things can be hard to track down, the only way I know is to trace into
> the suspected area, and step thru the code. You'll find the call that  is
> causing the problem. Then it's just a matter of trying to figure out which
> parameter of the call is incorrect.

do something like this:

if ( PtrVar > UpperMemoryLimit ) or ( PtrVar < LowerMemoryLimit ) then trace(1)
end if

That will drop you into the debugger where you can check vars or ! to abort and
get a
var dump in ex.err.

Kat

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu