xcore / tool_axe

An XCore Emulator
Other
15 stars 8 forks source link

No debug is no fopen #10

Closed henkmuller closed 11 years ago

henkmuller commented 11 years ago

I cannot get fopen to work - which I presume is related to not having debug. Fopen is useful for running regressions on large datasets.

How difficult would it be to add fopen?

rlsosborne commented 11 years ago

Syscall handling doesn't need debug support - the simulator just needs to intercept calls to _DoSyscall

There is already code to handle the open syscall (https://github.com/rlsosborne/tool_axe/blob/master/lib/SyscallHandler.cpp#L258) and I've definitely used file I/O with axe in the past, maybe some recent changes broke support for this?

henkmuller commented 11 years ago

It maybe that, or maybe it is a mac issue. Even though I run it form the command line, it creates an icon on my toolbar.

dtruss shows that it is trying to open; it is just not using the right filename :) - the top three opens are for fopen, the bottom one is a direct call to open:

open("\0", 0x601, 0x180) = -1 Err#2 open("\0", 0x601, 0x180) = -1 Err#2 open("\0", 0x0, 0x180) = -1 Err#2 write(0x7, "00000000\n\377S\373\377\377\255\004\0", 0x9) = 9 0 open("\0", 0x402, 0x0) = -1 Err#2 write(0x7, "ffffffff\n\0", 0x9) = 9 0

rlsosborne commented 11 years ago

"Even though I run it form the command line, it creates an icon on my toolbar."

Yes that's annoying isn't it. This is an artifact of linking against SDL for the LCD screen peripheral. In order to use SDL for 2D graphics the entry point of the program must be different, and on OS X this results in an icon appearing in the dock. If you disable SDL by setting AXE_ENABLE_SDL to false and recompile it will fix this.