1
0
Fork 0
forked from suyu/suyu
suyu/src/core
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
..
arm 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
crypto Fixes Unicode Key File Directories (#2120) 2019-02-20 21:24:25 -05:00
file_sys file_sys/vfs_vector: Fix ignored offset on Write 2019-02-25 00:27:49 +01:00
frontend Merge pull request #2170 from lioncash/emu-window 2019-02-27 11:26:24 -05:00
gdbstub 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
hle Merge pull request #2230 from lioncash/global 2019-03-14 20:42:46 -04:00
loader loader: Propagate NCA logo section to ReadBanner and ReadLogo 2019-01-15 16:01:04 -05:00
tracer
CMakeLists.txt hle/service/audio: Extract audio error codes to a header 2019-03-05 16:51:37 -05:00
core.cpp kernel: Make the address arbiter instance per-process 2019-03-07 23:27:51 -05:00
core.h core/core: Remove the global telemetry accessor function 2019-03-04 10:24:13 -05:00
core_cpu.cpp kernel/scheduler: Pass in system instance in constructor 2019-03-04 17:01:37 -05:00
core_cpu.h kernel/scheduler: Pass in system instance in constructor 2019-03-04 17:01:37 -05:00
core_timing.cpp core_timing: Convert core timing into a class 2019-02-15 21:50:25 -05:00
core_timing.h core_timing: Convert core timing into a class 2019-02-15 21:50:25 -05:00
core_timing_util.cpp core_timing: Rename CoreTiming namespace to Core::Timing 2019-02-12 12:42:17 -05:00
core_timing_util.h core_timing: Rename CoreTiming namespace to Core::Timing 2019-02-12 12:42:17 -05:00
cpu_core_manager.cpp kernel/scheduler: Pass in system instance in constructor 2019-03-04 17:01:37 -05:00
cpu_core_manager.h
memory.cpp gpu: Move command processing to another thread. 2019-03-06 21:48:57 -05:00
memory.h
memory_hook.cpp
memory_hook.h
memory_setup.h
perf_stats.cpp
perf_stats.h
settings.cpp clang fix 2019-03-09 16:42:56 +02:00
settings.h settings: Add new graphics setting for use_asynchronous_gpu_emulation. 2019-03-06 21:09:09 -05:00
telemetry_session.cpp settings: Add new graphics setting for use_asynchronous_gpu_emulation. 2019-03-06 21:09:09 -05:00
telemetry_session.h