Segmentation Fault

The Uzebox now have a fully functional emulator! Download and discuss it here.
Post Reply
shaurz
Posts: 15
Joined: Fri May 15, 2009 3:25 pm

Segmentation Fault

Post by shaurz »

I am trying to run uzem in Linux/x86-64 but when I try to run one of the demos it segfaults (the black screen appears for a brief moment). Here is the traceback:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fdb6a054700 (LWP 9277)]
0x0000000000402f05 in avr8::update_hardware (this=0x7fff7207f960, cycles=2)
    at avr8.cpp:2048
2048                                    next_scanline[current_cycle>>1] = pixel;
(gdb) bt
#0  0x0000000000402f05 in avr8::update_hardware (this=0x7fff7207f960, cycles=2) at avr8.cpp:2048
#1  0x0000000000407158 in avr8::exec (this=0x7fff7207f960, disasmOnly=true, verbose=false) at avr8.cpp:1762
#2  0x000000000040754b in main (argc=3, argv=0x7fff720814b8) at avr8.cpp:2271
shaurz
Posts: 15
Joined: Fri May 15, 2009 3:25 pm

Re: Segmentation Fault

Post by shaurz »

I fixed the problem by changing line 60 from:

Code: Select all

typedef unsigned long u32;
to:

Code: Select all

typedef unsigned int u32;
Since "unsigned long" is 64-bit on x86-64. The tetris games works fine, but SpriteDemo has a load of illegal reads and writes and resets when you press "A". I'm not sure if this is the expected behaviour but there might be a few more 32-bit assumptions in the code which need sorting out.

May I suggest using <stdint.h> (uint16_t, uint32_t etc.)? It's the only portable way to ensure you have the right integer types.
DavidEtherton
Posts: 252
Joined: Tue Dec 02, 2008 12:38 am
Location: Carlsbad, California (USA)

Re: Segmentation Fault

Post by DavidEtherton »

Yeah, that's my old 16 bit habits showing...
Post Reply