SolraBizna / MacLua5.3

Classic MacOS port of Lua 5.3, supporting System 7.1.2 and later
83 stars 2 forks source link

basilisk crash #1

Closed cy384 closed 4 years ago

cy384 commented 4 years ago

When I follow the install instructions in the Basilisk II emulator (on Ubuntu 19.04), running System 7.5.5, opening "Lua Interpreter" causes a quick crash:

Basilisk II V1.0 by Christian Bauer et al.
Reading ROM file...
WARNING: RmvTime(000dc7f6): Descriptor not found
Caught SIGSEGV at address 0x8167000c [IP=0x5585af28890f]
D0: 03e6fe44 D1: 00000002 D2: 00000001 D3: 00000000 
D4: 00000001 D5: 00000001 D6: 00000001 D7: 00000000 
A0: 03e87b50 A1: 4000000c A2: 03e6fe44 A3: 03f6bd3c 
A4: 03e6fe44 A5: 03f6cd20 A6: 03f6bd10 A7: 03f6bcfc 
USP=00000000 ISP=03f6bcfc MSP=00000000 VBR=00000000
T=00 S=1 M=0 X=0 N=0 Z=0 V=0 C=0 IMASK=0
FP0: nan FP1: nan FP2: nan FP3: nan 
FP4: nan FP5: nan FP6: nan FP7: nan 
N=0 Z=0 I=0 NAN=0
03e6efe2: 1011 722d b001 6644 1029 MOVE.B (A1),D0
next PC: 03e6efe4

I have no idea if this is a basilisk issue, something with my setup, or an issue with your software, so I'm just mentioning it in case you or someone else wants to know or mess with it. I'll note that checking the "Ignore Illegal Memory Accesses" box allows it to run and seems to work fine.

Thanks for the fun software!

SolraBizna commented 4 years ago

Very strange. I actually only tested the 68k code on PowerPC machines (by leaving out the PowerPC half of the binary), so it's possible that it doesn't work on real 68k at all. On the other hand, random things failing to work under Basilisk without "ignore illegal memory accesses" is ... sort of par for the course.

Guess it's time to break out my old LC III and test it! :D

classilla commented 4 years ago

Personally, I think this is more likely to be a Basilisk bug (or at minimum a combination). Even if it was an illegal memory access that triggered the problem, that shouldn't segfault Basilisk.

SolraBizna commented 4 years ago

Well, we brought the LC III out of storage. Couldn't find her keyboard and mouse, so I started to make a replacement device. When it was time for the first test, we found that the LC III wouldn't power on. We opened her up, found that the power supply was toast. We salvaged an old BTX power supply, tested everything with a multimeter, jury-rigged it into working with the LC III, started her up—it chimed, and a capacitor burst into metal-oxide-spewing flames. We determined that the capacitor was a filter for the -5V rail, determined that the -5V rail was only used by the serial port line drivers, dusted the tantalum oxide off of the motherboard, left the -5V rail unconnected, started her up...and her hard disk was dead.

So we got the CD-ROM drive out of storage. Couldn't find the SCSI cable (it's with the keyboard and mouse), so it was useless to us. Got a USB floppy drive out of storage. Tested a bunch of old floppies. Finally found a 1.44MB floppy with no bad blocks. Wasted hours using various methods of formatting it, including giving an emulated copy of OS9 direct access to the drive using USB pass-through (which only didn't work because, during the course of an entire formatting operation, the drive draws a little too much power for that specific host computer to provide)...

Found a System 7.1.2 Disk Tools image, specifically meant for the LC III, and somehow got it onto the disk. That failed to boot, complaining that later system software was required for this machine. I manually checked; System Enabler 003 is indeed present on the disk, so I don't know why it didn't work. Tried a System 7.5 Disk Tools floppy instead. Finally, something booted!

So now I just have to finish building an ADB keyboard+mouse simulator, and then jury-rig some kind of horrible emulated SCSI thing, and then I can get to work on testing this bug...

(Even for me, this is a lot of yak shaving for a bug that should have been easy to test. Oh well.)

SolraBizna commented 4 years ago

Long story short, handling the hard disk roughly resurrected it, and we just spent about a day trying to get things backed up and shuffled around and get MacLua5.3 onto the system.

A low-resolution photo of the bug being reproduced on real hardware.

This bug is for real, apparently!

I'm uncertain of how to move forward on debugging this. Anybody know where I can find a MacsBug that's compatible with the Macintosh LC III?

jduerstock commented 4 years ago

The same MacsBug should work everywhere. Check Macintosh Garden or Macintosh Repository?

On Fri, May 22, 2020 at 6:10 PM Solra Bizna notifications@github.com wrote:

Long story short, handling the hard disk roughly resurrected it, and we just spent about a day trying to get things backed up and shuffled around and get MacLua5.3 onto the system.

[image: A low-resolution photo of the bug being reproduced on real hardware.] https://camo.githubusercontent.com/4184cc9c79925d77cd4acaf4b073e18084b25c7b/68747470733a2f2f74656a61742e6e65742f6570682f4d61634c7561352e335f6973737565315f726570726f2e6a706567

This bug is for real, apparently!

I'm uncertain of how to move forward on debugging this. Anybody know where I can find a MacsBug that's compatible with the Macintosh LC III?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SolraBizna/MacLua5.3/issues/1#issuecomment-632939621, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA5HXICB24SUAAQKOMIAULRS4A6HANCNFSM4JNE2YMA .

cymraegish commented 4 years ago

FWIW I’ve had problems it crashing on native ppc as well. OS 8.1 is good but 8.5 or higher not. Classic running on 10.2.8 is OK. I have one 68k Mac I regularly use and it crashes there but I thought it might be it’s got a huge 128MB ram stick quadra 630. I’ve got a PowerBook 540 68k haven’t tried it there yet. The restriction to max out at 8.1 on ppc is trouble for me with the now need for SetDate which crashes on 8.1

cymraegish commented 4 years ago

BTW I guess others know “error of type 1” means memory access out of bounds, consistent with the original bug report when he told basilisk to ignore that it worked

SolraBizna commented 4 years ago

Does increasing or decreasing the amount of memory allocated to Lua change anything? And, anybody with working MacsBug, can you try to see if g allows it to finish starting up?

(I won't have a keyboard for a few days, so I can't use MacsBug on it myself yet)

SolraBizna commented 4 years ago

Amid other fruitless troubleshooting and testing, I've just learned that the version of CFM-68K Runtime Enabler that shipped with pre-7.6 MacOS has some crashing bugs. (I think I knew this once, but it's been 24 years since the last time it would have mattered to me...)

@cy384: Please install version 4.0 of the CFM-68K Runtime Enabler and see if the crash still happens.

cy384 commented 4 years ago

still crashes with 4.0

new info discovered: if I drag a lua file onto the application, it runs without crashing.

SolraBizna commented 4 years ago

still crashes with 4.0

Drat.

new info discovered: if I drag a lua file onto the application, it runs without crashing.

... well that I did not expect. Makes me wonder if the problem has something to do with argv handling.

Keyboard is late arriving. When it gets here, we'll have some answers.

cymraegish commented 4 years ago

I checked my Quadra 630 last night and increased memory requirements to min 2500 k and desired 8000k -> no help. Tossing a script on app (set file ID to Lua with BBEDIT) and putting in a read call for delay so I could see it a simple script did run. Note : no error message here just crash.

cymraegish commented 4 years ago

I have MPW installed on the Quadra and can build there. Also on PowerBook 1400 / G3, and G4 / 400. I want to run the Lua tool in MPW

SolraBizna commented 4 years ago

You should be able to change into Lua's directory and run the tool from there, or copy the Lua Interpreter to the System Folder and the Lua tool into MPW's Tools directory and run it that way.

cymraegish commented 4 years ago

Unfortunately tho it only runs for me on ppc OS8.1 or Classic OS running under OS X. Not on Quadra 68k at all and not on the 8.6 / 9.2 MacOS PowerBooks. Yes the MPW tool runs anywhere the Interactive SIOUX app runs. I’ve tested that.

cymraegish commented 4 years ago

I’m just learning about MPW and looking for things to do. Curious that the editor has support for tcl ... not for Lua.

SolraBizna commented 4 years ago

Does the tool also crash, or just fail to run at all? Either way, this means I can rule out SIOW as a likely cause.

(STILL waiting for that keyboard to get here. This week For Sure™...)

SolraBizna commented 4 years ago

Crash doesn't reproduce under a vMac-emulated Macintosh IIx running System 7.5.5. (Drat!)

Keyboard just came; will clear space on my desk today, set up the LC III, and get MacsBug's opinion on all this.

SolraBizna commented 4 years ago

Crash occurs in the collectargs routine, which assumes that you can iterate through argv until NULL is reached. I'm guessing that SIOW doesn't put a trailing NULL in that array. If so, a fix is coming.

SolraBizna commented 4 years ago

3492636911cdfc40f49889471d0576c755f7ffa0 fixes the crash on my LC III. New release is going up when she's done doing a complete build, which takes about ten hours(!!?!). If you have a Mac with a fast processor and lots of memory—I only have Macs with fast processor or lots of memory, it seems—you can try making this change and building it yourself.

SolraBizna commented 4 years ago

Release 5.3.5.1 should no longer suffer from this problem. @cy384, please check; if the problem is now fixed, the issue can be closed.

cy384 commented 4 years ago

5.3.5.1 works fine with no errors or crashes in basilisk now, thanks for your significant efforts here!