debugger seg faults
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Nov 6 06:58:03 AEDT 1998
The debugger gets a segmentation violation for e.g. tests/debugger/queens
in grade `reg' on murlibobo.
The bug is a memory management bug.
The debugger (trace/*.c) allocates memory in two ways:
(1) by calling incr_saved_hp() in MR_create_type_info() and elsewhere
(2) by calling Mercury routines defined in browser or library
that allocate memory, e.g. io__print
Method (1) allocates using the hp (unless the hp register is transient, in
which case it uses the fake_reg copy, but that's not the case on alphas).
Method (2) ends up allocating using the saved copy of the hp in fake_reg,
since when we call Mercury code from C, the stub created by `pragma export'
calls restore_registers(), then call_engine() to invoke the Mercury code,
and the save_regsters() again.
The hp and the saved copy of it in fake_reg start out the same,
so when we allocate some memory using method (1) and then allocate
some more using method (2), the second allocation overwrites the first.
I'm not sure yet what the best fix is.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list