3
0
Fork 0
forked from suyu/suyu
suyu/src
Dimitri A 0e7ad1c367 gdbstub: Fix some bugs in IsMemoryBreak() and ServeBreak. Add workaround to let watchpoints break into GDB. (#4651)
* gdbstub: fix IsMemoryBreak() returning false while connected to client

As a result, the only existing codepath for a memory watchpoint hit to break into GDB (InterpeterMainLoop, GDB_BP_CHECK, ARMul_State::RecordBreak) is finally taken,
which exposes incorrect logic* in both RecordBreak and ServeBreak.

* a blank BreakpointAddress structure is passed, which sets r15 (PC) to NULL

* gdbstub: DynCom: default-initialize two members/vars used in conditionals

* gdbstub: DynCom: don't record memory watchpoint hits via RecordBreak()

For now, instead check for GDBStub::IsMemoryBreak() in InterpreterMainLoop and ServeBreak.

Fixes PC being set to a stale/unhit breakpoint address (often zero) when a memory watchpoint (rwatch, watch, awatch) is handled in ServeBreak() and generates a GDB trap.

Reasons for removing a call to RecordBreak() for memory watchpoints:
* The``breakpoint_data`` we pass is typed Execute or None. It describes the predicted next code breakpoint hit relative to PC;

* GDBStub::IsMemoryBreak() returns true if a recent Read/Write operation hit a watchpoint. It doesn't specify which in return, nor does it trace it anywhere. Thus, the only data we could give RecordBreak() is a placeholder BreakpointAddress at offset NULL and type Access. I found the idea silly, compared to simply relying on GDBStub::IsMemoryBreak().

There is currently no measure in the code that remembers the addresses (and types) of any watchpoints that were hit by an instruction, in order to send them to GDB as "extended stop information."
I'm considering an implementation for this.

* gdbstub: Change an ASSERT to DEBUG_ASSERT

I have never seen the (Reg[15] == last_bkpt.address) assert fail in practice, even after several weeks of (locally) developping various branches around GDB.  Only leave it inside Debug builds.
2019-03-15 16:31:06 +01:00
..
audio_core audio_core/cubeb_sink: Convert _MSC_VER ifdefs to _WIN32 2019-03-09 18:06:23 -05:00
common Merge pull request #2147 from ReinUsesLisp/texture-clean 2019-03-10 17:28:36 -04:00
core gdbstub: Fix some bugs in IsMemoryBreak() and ServeBreak. Add workaround to let watchpoints break into GDB. (#4651) 2019-03-15 16:31:06 +01:00
input_common fixup! Joystick: Allow for background events; Add deadzone to SDLAnalog 2019-03-02 19:12:46 +01:00
tests kernel: Make the address arbiter instance per-process 2019-03-07 23:27:51 -05:00
video_core Merge pull request #2233 from ReinUsesLisp/morton-cleanup 2019-03-14 21:23:12 -04:00
web_service web_service: Remove unnecessary inclusions 2019-03-02 14:58:49 -05:00
yuzu Merge pull request #2187 from FearlessTobi/port-sdl-things 2019-03-13 11:46:57 -04:00
yuzu_cmd Merge pull request #2187 from FearlessTobi/port-sdl-things 2019-03-13 11:46:57 -04:00
.clang-format
CMakeLists.txt Port web_service from Citra 2018-10-02 15:30:48 +02:00