cnvogelg / amitools

Various tools for using AmigaOS programs on other platforms
250 stars 69 forks source link

An issue with vamos I have no idea how to even start debugging #178

Closed acf closed 1 year ago

acf commented 1 year ago

Long story, but maybe there's a detail in there that helps somehow....

I've been a keen user of vamos of a while. I've been using bebbo/amiga-gcc to build a small project on my (intel) Mac and using vamos to run the unit tests "on an amiga"as part of the build.

I paused for a while (lost my job, found another one, yay) and went to get started again. In the interim I had bought a new M1 Mac, so I started to install all my amiga tooling again. I had a problem with amiga-gcc installation and decided to try VBCC, which now plays nicely with 3.2.x.

When I ran my tests, vamos crashed. If I ran the same binary inside FS-UAE all was well.

I have stripped back and narrowed it down and got to the point where its apparent that a little hello world app built with vbcc works fine until I link it with Frank Wille's posixlib

Exact same C code, recompiled with -lposix, crashes vamos, but with or without posix the executable runs fine in FS-UAE.

I confess I'm largely cargo-culting a lot of the compiler end of this so I can work more quickly than just using SAS on the virtual amiga so I'm not sure where to start figuring out the issue, which is why this ticket is so rambling and vague.

Is there anything obvious in the vamos log? Or anything further I could try poking at ? I'm happy to do as much legwork as I can but I'm not sure where to start.

Thanks!

Alan

acf@M1Pro AmigaGit % vc +aos68k hello.c -lamiga -lauto         
acf@M1Pro AmigaGit % vamos -l lib:error,libmgr:error -c sas.vamos a.out
hello, world!
acf@M1Pro AmigaGit % vc +aos68k hello.c -lamiga -lauto -lposix         
acf@M1Pro AmigaGit % vamos -l lib:error,libmgr:error -c sas.vamos a.out
09:03:31.989    machine:  ERROR:  ----- ERROR in CPU Run #1 -----
09:03:31.989    machine:  ERROR:  Run: 'a.out': Initial PC=002148, SP=005430
09:03:31.989    machine:  ERROR:  PC=00000404  SR=-----    USP=00006684 ISP=000006fa MSP=00000780
09:03:31.989    machine:  ERROR:  D0=ffffffff  D1=00003324  D2=0000000c  D3=00000001  D4=00001000  D5=0000000c  D6=00000000  D7=00000000
09:03:31.989    machine:  ERROR:  A0=000056c0  A1=00005428  A2=00002ef4  A3=000031dc  A4=0000b162  A5=000056c0  A6=0000133c  A7=000006fa
09:03:31.989    machine:  ERROR:  SP-32=000000 SP-28=000000 SP-24=000000 SP-20=000000 SP-16=000000 SP-12=000000 SP-08=000000 SP-04=000000
09:03:31.989    machine:  ERROR:  SP+00=7000000 SP+04=2d110000 SP+08=000000 SP+12=000000 SP+16=000000 SP+20=000000 SP+24=000000 SP+28=000000
09:03:31.989    machine:  ERROR:  InvalidCPUStateError: Invalid CPU State: pc=002d11: m68k Exception: sr=0700
09:03:31.989       main:  ERROR:  vamos failed!
acf commented 1 year ago

ARGH. Inevitably I find the answer two minutes after I have given up and posted an issue. PosixLib readme says it requires an FPU for the math functions and when I switch the CPU to 68020 all is well. :-). Sorry for the noise.