ppsspp icon indicating copy to clipboard operation
ppsspp copied to clipboard

Strange for loop in Debugger WebSocketDisasmState::Disasm

Open GermanAizek opened this issue 10 months ago • 1 comments

@hrydgard, I am confused by this cycle, unless stop is equal to end, and end is equal to next. It will only be executed once, am I right?

https://github.com/hrydgard/ppsspp/blob/d0afdcd94f1ce5346772b45ab9a45dd62498680d/Core/Debugger/WebSocket/DisasmSubscriber.cpp#L343-L345

full code:

https://github.com/hrydgard/ppsspp/blob/d0afdcd94f1ce5346772b45ab9a45dd62498680d/Core/Debugger/WebSocket/DisasmSubscriber.cpp#L333-L345

GermanAizek avatar Apr 04 '24 14:04 GermanAizek

Assuming the assignment end = disasm_.getNthNextAddress(end, 1) does not make end less than it used to be, the expression end >= next is always evaluated to true (during the first check it's equal to next, so it also holds). So what I see is for (end = initial_value; end < stopping_value; end = next_value()). So it depends on what the method getNthNextAddress does. I don't see why it should execute only once.

Nemoumbra avatar Apr 07 '24 12:04 Nemoumbra