I'm afraid I've come to another grinding halt, encountering behaviour
that seems completely inexplicable. This particular problem appears
entirely in the Linux environment (BeOS is not involved at all) so
I'm hoping someone involved with that version can explain what's
happening.
I have to briefly go through the sequence of my tests, I think, to
show my problem.
As I mentioned in an earlier post, it seemed that it was the 'brk()'
and 'sbrk()' system calls in BeOS that were causing problems, so
to investigate I created a new C module in libpop.a that had functions
'l_brk()' and 'l_sbrk()'. These in turn call the real system functions
and print out the parameters and return values. I found that the
actual calls were in syscomp/sysdefs.p, so I modified that module
(on the Linux machine) to call the modified functions:
GET_REAL_BREAK =
[procedure(); _extern l_sbrk(_0)@(b.r->vpage) endprocedure],
SET_REAL_BREAK =
[procedure(_break) -> _break;
lvars _break = _break@(w.r->vpage);
if _extern l_brk(_break@(w->b)) == _-1 then
_-1 -> _break
endif
endprocedure],
I rebuilt popc.psv with '$popsrc/mksyscomp popc' and then made a fresh
newpop11.
This worked perfectly. I got a printout of how all the calls were
made, and when I transferred over to BeOS, I could see where it wasn't
working. (brk was, er..., broken...) I modified my substitute function
so that it (apparently) did the correct thing, but the BeOS version
didn't work any better.
I reasoned that the only way I was going to find out what was actually
failing was to be able to put traces in the pop11 system code (specifically
setpop.p), so I initially added a very simple function to my extra C
module:
void dbgnpr(long val) {
printf("dbgnpr called with %d\n", val);
}
and then tried putting this sort of line into various places in setpop.p:
_extern dbgnpr(_1);
Wherever, and however, I inserted it, absolutely *nothing* happened!
I eventually went back to sysdefs.p and put it right next to the
modified lines that are working:
SET_REAL_BREAK =
[procedure(_break) -> _break;
_extern dbgnpr(_11);
lvars _break = _break@(w.r->vpage);
if _extern l_brk(_break@(w->b)) == _-1 then
_-1 -> _break
endif
endprocedure],
I **still** get no output from it, even though the apparently almost
identically formed 'l_brk' call right below it is invoked perfectly
well!
I've checked that the 'dbgnpr' identifier is getting into the files
by doing a 'strings' or 'objdump' on the object modules and libraries,
so I'm pretty sure I'm doing all the necessary steps ('mklibpop' in
extern/lib, 'mksyscomp popc' to get sysdefs incorporated, and finally
'newpop' to build newpop11).
Unless I can get this cleared up, I think I'm done. (:-()
-- Pete --
|