On Thu, Jan 12, 2017 at 12:56 PM, David T. Lewis <lewis@mail.msen.com> wrote:
On Wed, Jan 11, 2017 at 09:03:53PM -0500, David T. Lewis wrote:
> On Wed, Jan 11, 2017 at 05:10:24PM +0100, Bert Freudenberg wrote:
> >
> > Some early images fill the context stack before advancing its stack
> > pointer. I have a flag to allow that, it's pretty certainly used in
> > primitive 61.
> Brilliant, thanks Bert.
> I see several places where we check "fmt = 3 and: [self isContextHeader: hdr]",
> including in #stObject:at:put: which is probably the immediate cause of the
> failure that I was seeing. And #stSizeOf: does this:
>       (fmt = 3 and: [self isContextHeader: hdr])
>               ifTrue: [stSize := self fetchStackPointerOf: array]
>               ifFalse: [stSize := totalLength - fixedFields].
> I'll try playing with it this weekend and see if I can get it working for the
> older images.
> But I have to ask ... how in the world did you figure this out?

Well, debugging the startup code is actually quite comfortable using my VM debugger (https://lively-web.org/users/bert/squeak.html). It shows the call stack, current frame, and byte code, and lets you set a break point, and single-step through the code. Someone should make a similar UI for the Squeak VM Simulator :)

So what I did is pause the VM when the startup didn't finish, look up the call stack to see where things went wrong, set a break point for that method, run again, and then single-step to where it goes wrong.

At least I think that's what I did, because right now I can't get it to malfunction even when I disable the flag ... where exactly did it break for you?
> :-)

Indeed, disabling the stack pointer check in #stObject:at:put: results in
a VM that now works with the old Squeak1.13u.image

Yay! :)

- Bert -