[Info-vax] debugging stack corruption on Macro64?
John Reagan
xyzzy1959 at gmail.com
Mon Mar 9 10:43:17 EDT 2015
> $ROUTINE ffi_call_osf,-
> SAVED_REGS=<R2,R3,R4,FP>,-
> KIND=STACK,-
> STANDARD_PROLOGUE=FALSE
> $CODE_SECTION
>
> lda sp,-24(sp)
> stq r27,(sp)
> stq r26,8(sp)
> stq fp,16(sp)
> ; step/inst to here ok.
> mov sp,fp
> ; step/inst
> ; DEBUG-I-INCMPSTACK, WARNING: stack corrupted; session integrity not
> guaranteed.
> ; fp and sp now contain 07ad8b9a8
In STACK routines with BASE_REG_IS_FP (the default is TRUE and you didn't change that), the contents of FP must always point to the stack base *AND* the sop of the stack must point to the procedure descriptor. You stored the current value in 16(FP) but when you did the MOV to overwrite the FP, but the top of the stack at 24(FP) does not point to a procedure descriptor. The debugger now gets confused since it cannot determine the active routine and how large the stack should be.
I'm not even sure why you need a STACK routine (in either dynamic or fixed form).
And your STANDARD_PROLOGUE=FALSE covers over your bogus SAVED_REGS mask since STANDARD_PROLOGUE=FALSE prevents $ROUTINE from generating any code.
If you are trying to dead-reckon a Macro64 routine by looking at the generated code from a C compilation, you'll probably have problems. Besides looking at the generated code, you need to look at the procedure descriptor that GEM formatted into the procedure descriptor also. The problem is that it isn't to map the GEM formatted PDSC fields to the arguments of $ROUTINE. And I'm not even sure that GEM formats all of them...
More information about the Info-vax
mailing list