mntmn/interim

SDL1 port segfaults on the Open Pandora (ARMv7 TI Cortex-A8)

Opened this issue · 4 comments

Hi all,

I just gave the updated master branch a try, as I couldn't apply @wasamasa 's SDL1.2 patch into my local copy of @mntmn 's reform branch (git apply just didn't work).

Good news: compilation no longer crashes on the Pandora :)

cc -g -o sledge --std=gnu99 -Wall -O1 -I. ${CFLAGS} sledge.c reader.c writer.c alloc.c strmap.c stream.c ../devices/sdl.c ../devices/posixfs.c -lm -lSDL -DCPU_ARM -DDEV_SDL -DDEV_POSIXFS

Bad news: the resulting binary still segfaults when trying to run tests/boot2.l. I can see an empty black SDL window (I set the height to 480 in sdl.c btw), but that's it.

/media/Pandora1/dev/interim/sledge$ gdb --args ./sledge tests/boot2.l

[alloc] cell heap at 0x40531008, 1200000 bytes reserved
[compiler] interim knows 55 symbols. enter (symbols) to see them.
[fs] mounted: /framebuffer
[fs] mounted: /keyboard
[fs] mounted: /sd
[open] via /sd: /sd/os/lib.l
[posixfs] trying to read file of len 3323...
[open] via /sd: /sd/os/gfx.l
[posixfs] trying to read file of len 8267...
[mmap] found matching fs: /framebuffer for path: /framebuffer
[open] via /framebuffer: /framebuffer/width
[open] via /framebuffer: /framebuffer/height
[open] via /framebuffer: /framebuffer/depth
("[gfx] fb " (surface 800 480 1 1600 0 0 [ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff] ))
[open] via /framebuffer: /framebuffer
[open] via /sd: /sd/unifont.bin
[posixfs] trying to read file of len 3014656...
[open] via /sd: /sd/os/shell.l
[posixfs] trying to read file of len 6718...
[open] via /keyboard: /keyboard
[open] via /sd: /sd/os/mouse.l
[posixfs] trying to read file of len 1033...

Program received signal SIGSEGV, Segmentation fault.
0x40a4f058 in ?? ()
(gdb) bt
#0 0x40a4f058 in ?? ()
#1 0x40a534e4 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Could this crash be related to the fact that the master branch lacks (AFAIK) the latest commits on the reform branch (i.e even a simple (+ 1 1) crashes on my end)

Could you please have a look ?

Cheers, Sam

Sounds about right. You'll have to merge the changes one way or the other to prove that hypothesis, be it manually or by using git merge master. Either way you'll have to resolve conflicts yourself.

@wasamasa : thanks for your help, it worked (somehow) :) I typed "git merge master" while on the reform branch. Now sledge no longer segfaults. I can see two white windows over a white background. There's also some kind of yellow arrow on the right hand side of the screen, and a black mouse cursor that doesn't move in the upper left corner. Also of interest (IMHO) is the error message that keeps appearing in the interpreter:

[fs] error: non-stream passed to recv

Do you understand what that means ?

Cheers, Sam

Well, it's exactly what it says, recv was called with an argument that's not a stream. What the argument is is something you'll have to find out with printf debugging. Could you try my demo file to ensure basic graphics work as expected?

@wasamasa: I just tried your palette.l demo, and it worked as expected (I guess... I could see a 32x8 grid with colours ranging from green to red). Thanks for the hint regarding printf, I'll give it a go ASAP.

Cheers, Sam

P.S: sorry for all the silly questions, and thanks again @mntmn and @wasamasa for your help.