Project

General

Profile

Actions

Emulator Issues #13526

open

"Attempted to flush discarded PPC reg 4" durring stepping inside the debugger

Added by Neui 13 days ago. Updated 12 days ago.

Status:
Fix pending
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

Game Name?
Pokemon XD Gale of Darkness (PAL), other versions of the game probably also work

Game ID?
GXXP01

MD5 Hash?
f36d14bebf8fea6a046404bff6adb7e6

What's the problem? Describe what went wrong.
When using the debugger inside Dolphin Emulator and stepping onto a certain instruction, it'll cause an assert. However, it seems to continue running just fine.

What steps will reproduce the problem?

  1. Have the debugger UI open with the code widget open.
  2. Start Pokemon XD Gale of Darkness (PAL version, GXXP01, probably also works on other versions but I don't have them).
  3. Before the health and safety screen disappears, go to 8019f43c (an lwz instruction) in the code widget and set a breakpoint there.
  4. After the health and safety screen disappears, at the beginning of the logo fade in, the breakpoint should hit (twice).
  5. Click on "Step Over" 4 times. On the last Step (on addi), the following message appears:
An error occurred.

Attempted to flush discarded PPC reg 4

Condition: false
File: dolphin-emu/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp
Line: 413
Function: Flush

Ignore and continue?

It doesn't seem to cause any other issues.

Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.
Yes, 5.0-21418, 20665ebce715165c9e126a0c43dddb2453d26535 (compiled manually)

Is the issue present in the latest stable version?
Not tested, but I used an older version before Qt6 became a requirement where I didn't have the issue.

If the issue isn't present in the latest stable version, which is the first broken version?
I haven't bisected yet.

What are your PC specifications?
Ubuntu 20.04
AMD Ryzen 7 5700U with Radeon Graphics

Is there anything else that can help developers narrow down the issue?
This doesn't happen when using JIT → Interpreter Core.
Using "Step" instead of "Step over" doesn't seem to make the issue occur.
I tried to make a minimal example with devkitPro but I was unable to reproduce it there without putting more time into it.

Actions #1

Updated by JosJuice 13 days ago

Probably fixed by this pull request: https://github.com/dolphin-emu/dolphin/pull/12682

Actions #2

Updated by Neui 13 days ago

JosJuice wrote in #note-1:

Probably fixed by this pull request: https://github.com/dolphin-emu/dolphin/pull/12682

I have git cherry-picked it (so it's on top of master so I don't have to recompile a lot), but I get a different error message:

An error occurred.

Attempted to flush discarded PPC reg 4

  Condition: ignore_discarded_registers != IgnoreDiscardedRegisters::No
  File: dolphin-emu/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp
  Line: 413
  Function: Flush

Ignore and continue?

Looking at the diff, it's the same line as with the assert on master.

Actions #3

Updated by JosJuice 13 days ago

Okay, I see. It must have a different cause than what I was thinking of then. Will try to investigate this later.

Actions #4

Updated by Neui 13 days ago

Some more info I think might help:

I've tried the (unofficial) flatpak version (5.0-21264, 1efda863e47b690f460f069502a4391b3c7d87c4) which triggers the same assert.

But interestingly, my other machine doesn't show the issue. It's running Windows 22H2 (19045) with official Dolphin 5.0-21424 (f1e40f73bd2a9da298d9aceafa7f956041bac142, without the PR) (AMD Ryzen 5 2600x).

This is the backtrace when I say "no" (to crash) in the assert dialog (with the cherry-picked commit):

#0  RegCache::Flush(Common::BitSet<unsigned int>, RegCache::IgnoreDiscardedRegisters) (this=this@entry=0x7fff3c3ecf28, pregs=..., pregs@entry=..., ignore_discarded_registers=ignore_discarded_registers@entry=RegCache::IgnoreDiscardedRegisters::No)
    at dolphin-emu/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp:396
#1  0x0000555555ba13b8 in Jit64::DoJit(unsigned int, JitBlock*, unsigned int) (this=0x7fff3c36c8d0, em_address=<optimized out>, b=0x7fff3fe912a8, nextPC=2148206388) at dolphin-emu/Source/Core/Core/PowerPC/Jit64/Jit.cpp:1071
#2  0x0000555555ba2ce9 in Jit64::Jit(unsigned int, bool) (this=0x7fff3c36c8d0, em_address=2149184584, clear_cache_and_retry_on_failure=<optimized out>) at dolphin-emu/Source/Core/Core/PowerPC/Jit64/Jit.cpp:805
#3  0x00007ffb95ffb0af in  ()
#4  0x00007fffe40ca280 in  ()
#5  0xffffffffffffffff in  ()
#6  0x00007ffff4831c10 in pthread_key_create () at /lib/x86_64-linux-gnu/libpthread.so.0
#7  0x00007fffe434c3d0 in  ()
#8  0x00007fff527fa838 in  ()
#9  0x00007ffff4831c10 in pthread_key_create () at /lib/x86_64-linux-gnu/libpthread.so.0
#10 0x00007fffe40ca2d8 in  ()
#11 0x00007fffe40ca250 in  ()
#12 0x00007fff3c36c8d0 in  ()
#13 0x0000555555b9c4e7 in Jit64::Run() (this=0x7fffe434c450) at dolphin-emu/Source/Core/Core/PowerPC/Jit64/Jit.cpp:689
#14 0x0000555555b6fb65 in PowerPC::PowerPCManager::RunLoop() (this=this@entry=0x7fffe434c3d0) at dolphin-emu/Source/Core/Core/PowerPC/PowerPC.cpp:412
#15 0x0000555555a4391f in CPU::CPUManager::Run() (this=0x7ffd95fff000) at dolphin-emu/Source/Core/Core/HW/CPU.cpp:107
#16 0x0000555555a07c98 in Core::CpuThread(Core::System&, std::optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&, bool) (system=..., savestate_path=
    std::optional<std::string> [no contained value], delete_savestate=delete_savestate@entry=false) at dolphin-emu/Source/Core/Core/Core.cpp:427
#17 0x0000555555a081b8 in Core::EmuThread(Core::System&, std::unique_ptr<BootParameters, std::default_delete<BootParameters> >, WindowSystemInfo) (system=..., boot=..., wsi=...) at dolphin-emu/Source/Core/Core/Core.cpp:695
(cut to be short)
Actions #5

Updated by Neui 13 days ago

Neui wrote in #note-4:

But interestingly, my other machine doesn't show the issue. It's running Windows 22H2 (19045) with official Dolphin 5.0-21424 (f1e40f73bd2a9da298d9aceafa7f956041bac142, without the PR) (AMD Ryzen 5 2600x).

Actually, I forgot to enable the panic handlers. It also occurs on Windows.

Actions #6

Updated by JosJuice 12 days ago

  • Status changed from New to Fix pending
Actions #7

Updated by Neui 12 days ago

JosJuice wrote in #note-6:

https://github.com/dolphin-emu/dolphin/pull/12729

I can confirm that this fixes the issue. The assert doesn't trigger anymore.

Actions

Also available in: Atom PDF