-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugger: Avoid unaligned reads in expressions #17269
Conversation
@@ -396,7 +396,7 @@ u32 DisassemblyManager::getNthNextAddress(u32 address, int n) | |||
analyze(address); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we avoid analyzing if the address has gotten unaligned? It feels like there are some early checks possible, rather than just aligning the return value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, that actually aligns the address, and I didn't want to change that logic.
-[Unknown]
Core/MIPS/MIPSDebugInterface.cpp
Outdated
|
||
switch (size) { | ||
case 1: | ||
dest = valid ? Memory::Read_U8(address) : 0; | ||
dest = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, how does this do the same as the old code? previously it returned maximum an 8-bit value. I think this case is swapped with "case 4".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, thanks. I guess I only tried something where the lowest byte mattered anyway...
-[Unknown]
GPU/Common/GPUDebugInterface.cpp
Outdated
|
||
switch (size) { | ||
case 1: | ||
dest = valid ? Memory::Read_U8(address) : 0; | ||
dest = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
Potentially, a watch or break condition could crash if it was unaligned between mirrors. This might happen if it's not the condition you wanted, especially. Play it safe.
We ended up with an unaligned start address for our window.
10ed99a
to
6998b18
Compare
To prevent crashes, this makes all reads from conditions memcpy()s. The issue is that a 32 bit read straddling a VRAM mirror will crash.
Also fix a long standing bug that makes the disasm confused when you return to an idle thread.
-[Unknown]