joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.76k stars 381 forks source link

Crash on a loongarch64 CPU (Loongson 3A5000M). #4475

Open KatyushaScarlet opened 1 year ago

KatyushaScarlet commented 1 year ago

Describe the bug

For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from dosbox-x... (gdb) run Starting program: /home/katyusha/program/dosbox-x/dosbox-x/src/dosbox-x-dosbox-x-v2023.09.01/src/dosbox-x

This GDB supports auto-downloading debuginfo from the following URLs: http://debuginfod.loongarch.zhcn.cc:8002 Enable debuginfod for this session? (y or [n]) y Debuginfod has been enabled. To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit. Downloading separate debug info for /usr/lib/libts.so.0
Downloading separate debug info for /usr/lib/libfreetype.so.6
Downloading separate debug info for /usr/lib/libpcap.so.1
Downloading separate debug info for /usr/lib/libslirp.so.0
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1". Downloading separate debug info for /usr/lib/libvpx.so.8
Downloading separate debug info for /usr/lib/libcairo.so.2
Downloading separate debug info for /usr/lib/libgsm.so.1
Downloading separate debug info for /usr/lib/libopenjp2.so.7
Downloading separate debug info for /usr/lib/libopus.so.0
Downloading separate debug info for /usr/lib/libvorbis.so.0
Downloading separate debug info for /usr/lib/libvorbisenc.so.2
Downloading separate debug info for /usr/lib/libx265.so.199
Downloading separate debug info for /usr/lib/libxvidcore.so.4
Downloading separate debug info for /usr/lib/libbluray.so.2
Downloading separate debug info for /usr/lib/libgnutls.so.30
Downloading separate debug info for /usr/lib/libssh.so.4
Downloading separate debug info for /usr/lib/libvdpau.so.1
Downloading separate debug info for /usr/lib/libdrm.so.2
Downloading separate debug info for /usr/lib/libbrotlidec.so.1
Downloading separate debug info for /usr/lib/libnl-genl-3.so.200
Downloading separate debug info for /usr/lib/libnl-3.so.200
Downloading separate debug info for /usr/lib/libpulse-simple.so.0
Downloading separate debug info for /usr/lib/libpulse.so.0
Downloading separate debug info for /usr/lib/libportaudio.so.2
Downloading separate debug info for /usr/lib/libinstpatch-1.0.so.2
Downloading separate debug info for /usr/lib/libsoxr.so.0
Downloading separate debug info for /usr/lib/libcairo-gobject.so.2
Downloading separate debug info for /usr/lib/libpangocairo-1.0.so.0
Downloading separate debug info for /usr/lib/libpango-1.0.so.0
Downloading separate debug info for /usr/lib/libpcre2-8.so.0
Downloading separate debug info for /usr/lib/libfontconfig.so.1
Downloading separate debug info for /usr/lib/libbrotlienc.so.1
Downloading separate debug info for /usr/lib/libogg.so.0
Downloading separate debug info for /usr/lib/libmpg123.so.0
Downloading separate debug info for /usr/lib/libvorbisfile.so.3
Downloading separate debug info for /usr/lib/libzstd.so.1
Downloading separate debug info for /usr/lib/libidn2.so.0
Downloading separate debug info for /usr/lib/libunistring.so.5
Downloading separate debug info for /usr/lib/libtasn1.so.6
Downloading separate debug info for /usr/lib/libXfixes.so.3
Downloading separate debug info for /usr/lib/libXau.so.6
Downloading separate debug info for /usr/lib/libXdmcp.so.6
Downloading separate debug info for /usr/lib/libgraphite2.so.3
Downloading separate debug info for /usr/lib/libbrotlicommon.so.1
Downloading separate debug info for /usr/lib/pulseaudio/libpulsecommon-16.1.so
Downloading separate debug info for /usr/lib/libjpeg.so.8
Downloading separate debug info for /usr/lib/libpangoft2-1.0.so.0
Downloading separate debug info for /usr/lib/libgcrypt.so.20
Downloading separate debug info for /usr/lib/liblz4.so.1
Downloading separate debug info for /usr/lib/libgpg-error.so.0
LOG: Early LOG Init complete
LOG: DOSBox-X's working directory: /home/katyusha/program/dosbox-x/dosbox-x/src/dosbox-x-dosbox-x-v2023.09.01/src LOG: Logging init: beginning logging proper. This is the end of the early init logging LOG: Logging: No logfile was given. All further logging will be discarded. LOG: DOSBox-X version 2023.09.01 (Linux SDL1) [New Thread 0x7fffe6e02b00 (LWP 82660)] Warning: XMODIFIERS is unspecified [New Thread 0x7fffe22aeb00 (LWP 82661)]
[Thread 0x7fffe22aeb00 (LWP 82661) exited] LOG: Current X11 keyboard layout (token) is: 'us' LOG: Host keyboard layout is now us (US English) LOG: Mapper keyboard layout is now us (US English) LOG: SDL1 auto-detected desktop as 1920 x 1080 LOG: The default output for the video system: surface LOG: Configured windowposition: - LOG: X11 main window is 640 x 400 maximized=0 LOG: X11 extension XRANDR is available LOG: XRandR CRTC 0: pos=(0,0) size=(1920,1080) outputs=1 LOG: Our window lies on this CRTC display (window pos=(0,0) size=(640,400) match=(320,200)). LOG: Goes to output 0: name='eDP-1' size_mm=(300 x 170) LOG: Screen report: Method 'XRandR' (1920.000 x 1080.000 pixels) at (0.000 x 0.000) (300.000 x 170.000 mm) (11.811 x 6.693 in) (162.560 x 161.365 DPI) LOG: Current X11 keyboard layout (token) is: 'us' LOG: SDL_mapper: US keyboard detected, set usescancodes=false LOG: ISA BCLK: 8333333.333Hz (25000000/3) LOG: monopal: green, LOG: Active save slot: 1 [Empty] LOG: USING AVI+ZMBV LOG: Max 3670016 sz 16384 LOG: Final 16384 [New Thread 0x7fffe22aeb00 (LWP 82664)] LOG: SDLNet_TCP_Open: Couldn't connect to remote host LOG: TiMidity: can't open control connection (host=127.0.0.1, port=7777) LOG: MIDI:fluidsynth: SoundFont not specified, and no system SoundFont found LOG: MIDI:synth: Specify .SF2 sound font file with midiconfig= LOG: MIDI:Opened device:none LOG: Pentium CMPXCHG8B emulation is enabled

Thread 1 "dosbox-x" received signal SIGFPE, Arithmetic exception. __log (x=4.9406564584124654e-324) at ../sysdeps/ieee754/dbl-64/e_log.c:69 69 r3 = r * r2;
(gdb) bt

0 __log (x=4.9406564584124654e-324) at ../sysdeps/ieee754/dbl-64/e_log.c:69

1 0x0000555555ca9d38 in voodoo_init(int) (type=) at voodoo_emu.cpp:2962

2 0x0000555555c9f788 in Voodoo_Initialize(long, long, bool) (emulation_type=, card_type=card_type@entry=1, max_voodoomem=max_voodoomem@entry=true)

at voodoo_interface.cpp:293

3 0x0000555555c9e79c in VOODOO::VOODOO(Section*) (this=0x55555ab11bd0, configuration=) at voodoo.cpp:123

4 0x0000555555c9e428 in VOODOO_OnPowerOn(Section*) () at voodoo.cpp:236

5 0x0000555555e6b194 in DispatchVMEvent(vm_event) (event=event@entry=VM_EVENT_POWERON) at setup.cpp:1036

6 0x0000555555a135c0 in VM_PowerOn() () at sdlmain.cpp:7398

7 0x000055555568cef4 in VM_PowerOn() () at sdlmain.cpp:8939

8 main(int, char**) (argc=, argv=0x7ffffffeec08) at sdlmain.cpp:9165

(gdb)


### Steps to reproduce the behaviour

1. Clone from `https://aur.archlinux.org/dosbox-x.git`
2. Alter `PKGBUILD` file.

Add loong64 to arch Change x86_64 to native Change -O2 or -O3 to -O0 Add -g to FLAG


4. Run `makepkg`.
5. Go to `src/dosbox-x-dosbox-x-v2023.09.01/src/` path
6. Run `dosbox-x`.

### Expected behavior

_No response_

### What operating system(s) this bug have occurred on?

Arch Linux loongarch64

### What version(s) of DOSBox-X have this bug?

Release 2023.09.01 2023-09-01 17:00

### Used configuration

_No response_

### Output log

_No response_

### Additional information

_No response_

### Have you checked that no similar bug report(s) exist?

- [X] I have searched and didn't find any similar bug report.

### Code of Conduct & Contributing Guidelines

- [X] I agree to follow the code of conduct and the contributing guidelines.
xry111 commented 7 months ago

Per a duplicate report at https://github.com/loongson-community/discussions/issues/48, the FCSR value is 0x3df when the program crashes. So FE_INEXACT has somehow been set to trap (indicated by the lowest bit of the FCSR).

Can you try setting a breakpoint on feenableexcept with gdb?