View unanswered posts | View active topics It is currently Tue Oct 22, 2019 8:29 am



This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
bsnes 0.037a segfaults upon rom load (linux i386) 
Author Message
Hazed

Joined: Tue Dec 07, 2004 10:24 am
Posts: 68
Reply with quote
Post bsnes 0.037a segfaults upon rom load (linux i386)
Hi, this seems to occur only for i386 builds, since x86_64 ones do work fine. ThBacktrace I was able to get seems really short:
Quote:
(gdb) bt
#0 0xf0d1f020 in ?? ()
#1 0x080adee7 in Scheduler::sync_cpusmp () at snes/scheduler/scheduler.h:30
#2 sCPU::mmio_write (this=0x81c1000, addr=8512, data=0 '\0')
at cpu/scpu/mmio/mmio.cpp:482
Backtrace stopped: frame did not save the PC
(gdb)

There is longer one available in the review request.


Sat Nov 29, 2008 6:33 pm
Profile
Reply with quote
Post 
Lots of odd things on that page.

First, the zlib patch shouldn't be needed for Linux. It converts filenames to UTF-16 before opening them, but only on Windows. Linux is UTF-8 native.

Second, I don't think ZSNES uses BGR15 internal mode. So you probably won't be able to use the system snes_ntsc library.

I don't get the zeal to make everything a system library, personally. I understand the "we can fix bugs in the libs without updating the main binary" part -- but these are only ~100kb libs, and it's just as likely that future lib updates will retro-actively break the program anyway. But ... if you want those two separate, that's fine by me I guess.

$(strip) is just a function to remove excess whitespace (" _A_ _B_ " -> "A B") from strings. It makes the console compilation output slightly prettier. It strips binaries through the -s flag passed to the linker.

As for your crash, not that I'm upset -- but this is why you shouldn't randomly modify others' makefiles :P

sed -i "s#flags = -O3 -fomit-frame-pointer#flags = %{optflags}#" src/Makefile

Most likely, %{optflags} does not contain -fomit-frame-pointer, which is needed for libco's co_switch() function to work properly. It's a GCC issue (it adds code even to 'naked' functions when the frame pointer is enabled), only other way around that is to go back to assembling libco with yasm.


Sat Nov 29, 2008 9:03 pm
Regular
User avatar

Joined: Tue Mar 07, 2006 10:32 am
Posts: 347
Location: The Netherlands
Reply with quote
Post 
byuu wrote:
It's a GCC issue (it adds code even to 'naked' functions when the frame pointer is enabled)

Sorry for this somewhat off-topic question, but how do you get naked functions in GCC? Everything I found when I was looking into this a while ago said the compiler tries to determine on its own whether or not to include prolog and epilog code.. which consistently failed when I tried to make assembly-only functions. Does using -fomit-frame-pointer fix this? (I'd still prefer to have MSVC's __declspec(naked) rather than rely on compiler magic, but..)


Sat Nov 29, 2008 9:19 pm
Profile
Hazed

Joined: Tue Dec 07, 2004 10:24 am
Posts: 68
Reply with quote
Post 
byuu wrote:
Lots of odd things on that page.

First, the zlib patch shouldn't be needed for Linux. It converts filenames to UTF-16 before opening them, but only on Windows. Linux is UTF-8 native.

OK, I'll re-add the zlib patch then.
byuu wrote:
Second, I don't think ZSNES uses BGR15 internal mode. So you probably won't be able to use the system snes_ntsc library.

Using system snes_ntsc was abandoned.
byuu wrote:
I don't get the zeal to make everything a system library, personally. I understand the "we can fix bugs in the libs without updating the main binary" part -- but these are only ~100kb libs, and it's just as likely that future lib updates will retro-actively break the program anyway. But ... if you want those two separate, that's fine by me I guess.

I don't get the zeal either, especially when it requires excessive amounts of work :)
byuu wrote:
$(strip) is just a function to remove excess whitespace (" _A_ _B_ " -> "A B") from strings. It makes the console compilation output slightly prettier. It strips binaries through the -s flag passed to the linker.

Oh, so strip can stay, and to have a working debuginfo I only need to get rid of -s?
byuu wrote:
As for your crash, not that I'm upset -- but this is why you shouldn't randomly modify others' makefiles :P

sed -i "s#flags = -O3 -fomit-frame-pointer#flags = %{optflags}#" src/Makefile

Most likely, %{optflags} does not contain -fomit-frame-pointer, which is needed for libco's co_switch() function to work properly. It's a GCC issue (it adds code even to 'naked' functions when the frame pointer is enabled), only other way around that is to go back to assembling libco with yasm.

OK, I'll keep -fomit-frame-pointer then.


Sat Nov 29, 2008 9:30 pm
Profile
Reply with quote
Post 
Quote:
how do you get naked functions in GCC?


There's no __attribute__ for it, sadly. For Linux, you need -fomit-frame-pointer, for OS X I believe you need -static or something like that in addition to. You'd have to check with Lucas or Vas. It ends up having the same effect, and since the code isn't portable anyway ...

I do wish there were a way I could detect frame pointer mode and at least give a compiler warning.

Quote:
Oh, so strip can stay, and to have a working debuginfo I only need to get rid of -s?


Yeah, replace -s with -g, IIRC.


Sat Nov 29, 2008 9:57 pm
Display posts from previous:  Sort by  
This topic is locked, you cannot edit posts or make further replies.   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software.