summaryrefslogtreecommitdiffstats
path: root/src/core/gdbstub (unfollow)
Commit message (Collapse)AuthorFilesLines
2019-03-15gdbstub: Fix some bugs in IsMemoryBreak() and ServeBreak. Add workaround to let watchpoints break into GDB. (#4651)Dimitri A1-1/+1
* 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-02-06gdbstub: only let Execute breakpoints write/restore BKPT opcodes into target memoryDimitri ALBORA1-4/+10
2018-12-19kernel/thread: Make thread_id a 64-bit valueLioncash1-2/+2
The kernel uses a 64-bit value for the thread ID, so we shouldn't be using a 32-bit value.
2018-11-27gdbstub: Silence value truncation warning within FpuWrite()Lioncash1-1/+1
Previously this would cause an implicit truncation warning about assigning a u64 value to a u32 value without an explicit cast.
2018-11-13GDBStub improvements:Hedges1-37/+86
- Add FPU support - Fix access to TLS Fix clang-format.
2018-10-15core_cpu: Make Cpu scheduler instances unique_ptrs instead of shared_ptrsLioncash1-3/+3
2018-10-04kernel/thread: Make all instance variables privateLioncash1-17/+27
Many of the member variables of the thread class aren't even used outside of the class itself, so there's no need to make those variables public. This change follows in the steps of the previous changes that made other kernel types' members private. The main motivation behind this is that the Thread class will likely change in the future as emulation becomes more accurate, and letting random bits of the emulator access data members of the Thread class directly makes it a pain to shuffle around and/or modify internals. Having all data members public like this also makes it difficult to reason about certain bits of behavior without first verifying what parts of the core actually use them. Everything being public also generally follows the tendency for changes to be introduced in completely different translation units that would otherwise be better introduced as an addition to the Thread class' public interface.
2018-09-30kernel/process: Make data member variables privateLioncash1-2/+2
Makes the public interface consistent in terms of how accesses are done on a process object. It also makes it slightly nicer to reason about the logic of the process class, as we don't want to expose everything to external code.
2018-09-30arm_interface: Add missing fpsr/tpidr members to the ThreadContext structLioncash1-1/+1
Internally within the kernel, it also includes a member variable for the floating-point status register, and TPIDR, so we should do the same here to match it. While we're at it, also fix up the size of the struct and add a static assertion to ensure it always stays the correct size.
2018-09-25memory: Dehardcode the use of fixed memory range constantsLioncash1-5/+10
The locations of these can actually vary depending on the address space layout, so we shouldn't be using these when determining where to map memory or be using them as offsets for calculations. This keeps all the memory ranges flexible and malleable based off of the virtual memory manager instance state.
2018-09-20Correct endianness of BKPTJarek Syrylak1-1/+1
2018-09-18arm_interface: Remove ARM11-isms from the CPU interfaceLioncash1-25/+25
This modifies the CPU interface to more accurately match an AArch64-supporting CPU as opposed to an ARM11 one. Two of the methods don't even make sense to keep around for this interface, as Adv Simd is used, rather than the VFP in the primary execution state. This is essentially a modernization change that should have occurred from the get-go.
2018-09-15Port #4182 from Citra: "Prefix all size_t with std::"fearlessTobi1-7/+7
2018-08-07GDBStub works with both Unicorn and Dynarmic now (#941)Hedges1-0/+10
* GDBStub works with both Unicorn and Dynarmic now * Tidy up
2018-08-05gdbstub: Use type alias for breakpoint mapsLioncash1-37/+42
Rather than having to type out the full std::map type signature, we can just use a straightforward alias. While we're at it, rename GetBreakpointList to GetBreakpointMap, which makes the name more accurate. We can also get rid of unnecessary u64 static_casts, since VAddr is an alias for a u64.
2018-08-05gdbstub: Move all file-static variables into the GDBStub namespaceLioncash1-35/+36
Keeps everything under the same namespace. While we're at it, enclose them all within an inner anonymous namespace.
2018-08-05gdbstub: Replace PAddr alias with VAddrLioncash2-14/+14
In all cases, a virtual address is being passed in, not a physical one.
2018-08-02kernel: Move object class to its own source filesLioncash1-1/+0
General moving to keep kernel object types separate from the direct kernel code. Also essentially a preliminary cleanup before eliminating global kernel state in the kernel code.
2018-07-19gdbstub: Get rid of a few signed/unsigned comparisonsLioncash1-7/+7
Ensures both operands in comparisons are the same signedness.
2018-07-13More improvements to GDBStub (#653)Hedges2-47/+155
* More improvements to GDBStub - Debugging of threads should work correctly with source and assembly level stepping and modifying registers and memory, meaning threads and callstacks are fully clickable in VS. - List of modules is available to the client, with assumption that .nro and .nso are backed up by an .elf with symbols, while deconstructed ROMs keep N names. - Initial support for floating point registers. * Tidy up as requested in PR feedback * Tidy up as requested in PR feedback
2018-07-03Update clang formatJames Rowe1-9/+8
2018-07-03Rename logging macro back to LOG_*James Rowe1-28/+28
2018-06-06GDB Stub Improvements (#508)Hedges2-26/+153
* GDB Stub should work now. * Applied clang-format. * Replaced htonll with swap64. * Tidy up.
2018-05-11core: Implement multicore support.bunnei1-12/+12
2018-04-26core/gdbstub: Move logging macros to new fmt-compatible onesLioncash1-38/+37
2018-03-19Clean Warnings (?)N00byKing1-1/+1
2018-02-14gdbstub: Silence formatting specifier warningsLioncash1-6/+9
2018-01-21gdbstub: Update registers and sizes for aarch64Rozlette1-113/+155
This gets gdbstub working at least to the point where clients can communicate with it. What works: - Reading/writing GPRegs - Reading/writing memory - Interrupting the emulated program and continuing What does NOT work: - Breakpoints. Sizes have been updated to u64, but support will need to be added in the interpreter for them to work. - VRegs. Mostly because my gdb was having issues with 128-bit regs for some reason. However, the current u128 representation is a bit awkward to use and should probably be updated first.
2018-01-21Format: Run the new clang format on everythingJames Rowe1-1/+1
2018-01-20Fixes some cast warnings, partial port of citra #3064 (#106)River City Ransomware1-13/+14
* Fixes some cast warnings, partially fixes citra #3064 * Converted casts to uint32_t to u32 * Ran clang-format
2018-01-17Fix gdbstub typo, fixes Citra #3318River City Ransomware1-1/+1
Core::System().GetInstance().IsPoweredOn() -> Core::System::GetInstance().IsPoweredOn()
2018-01-03arm: Remove SkyEye/Dyncom code that is ARMv6-only.bunnei1-6/+3
2017-10-04Memory: Remove all GetPointer usages from the GDB stub.Subv1-8/+12
2017-09-30arm: Use 64-bit addressing in a bunch of places.bunnei1-2/+2
2017-09-30Fixed type conversion ambiguityHuw Pascoe1-2/+2
2017-02-27Doxygen: Amend minor issues (#2593)Mat M1-0/+1
Corrects a few issues with regards to Doxygen documentation, for example: - Incorrect parameter referencing. - Missing @param tags. - Typos in @param tags. and a few minor other issues.
2017-01-04Fix some warnings (#2399)Jonathan Hao1-5/+0
2016-12-22core: Replace "AppCore" nomenclature with just "CPU".bunnei1-20/+19
2016-12-22Address clang-format issues.bunnei1-2/+2
2016-12-22core: Consolidate core and system state, remove system module & cleanups.bunnei1-19/+20
2016-12-16gdbstub: const correctness changesLioncash1-9/+8
Also uses size_t as the length indicator type, as is common with buffers.
2016-12-15gdbstub: Remove global variable from public interfaceLioncash2-12/+19
Currently, this is only ever queried, so adding a function to check if the server is enabled is more sensible. If directly modifying this externally is ever desirable, it should be done by adding a function to the interface, rather than exposing implementation details directly.
2016-12-05gdbstub: Remove unused includeJannik Vogel1-1/+0
2016-12-05Support mingw cross-compileJannik Vogel1-1/+2
2016-11-14Add mingw compile supportJames Rowe1-1/+1
2016-10-28Small fix to let IDA see target.xmlmailwl1-1/+1
2016-09-21Remove special rules for Windows.h and library includesYuri Kunde Schlesner1-1/+1
2016-09-21Remove empty newlines in #include blocks.Emmanuel Gil Peyrot1-1/+0
This makes clang-format useful on those. Also add a bunch of forgotten transitive includes, which otherwise prevented compilation.
2016-09-18Sources: Run clang-format on everything.Emmanuel Gil Peyrot2-52/+63
2016-06-08gdbstub: E0 should be E00shinyquagsire231-1/+1
2016-05-10gdbstub: Silence missing prototype warningsLioncash1-3/+3
2016-05-07fixup simple type conversions where possibleAlexander Laties1-10/+10
2016-04-23gdbstub: Don't check if unsigned int is > 0Sam Spilsbury1-2/+2
2016-04-06Adopted WinterMute's gdbstub changespolaris-1-23/+85
This fixes the comments left on the PR (whitespace, SO_REUSEADDR, comment changes).
2016-03-20Fix missing headerLittleWhite1-0/+2
2015-11-22Fix read and write register blocks in gdbstubpolaris-1-26/+31
Previously, the padding wasn't correctly accounted for which caused the gdbstub to read and write everything after R15 (starting with the dummy FPA registers) incorrectly, which caused CPSR to not be handled correctly. Everything appears to be working as expected with this change.
2015-11-04Fix bug with reading addresses and lengthspolaris-1-45/+55
2015-10-29Change headerspolaris-1-2/+2
2015-10-22Add some headers so TravisCI will hopefully workpolaris-1-0/+2
2015-10-22Use CHAR_BIT instead of 8polaris-1-11/+11
2015-10-22Handle changes pointed out in comments on PRpolaris-1-61/+34
2015-10-21Add a register variable to loopspolaris-1-6/+9
2015-10-21Update register read loops to go with last commitpolaris-1-6/+7
2015-10-21Pad responses to gdb for VFP registerspolaris-1-0/+3
2015-10-21Try to add support for VFP registerspolaris-1-4/+21
2015-10-21Fix buffer overflow commentspolaris-1-2/+3
2015-10-12Remove unnecessary new lines, changed Deinit to Shutdownpolaris-2-6/+6
2015-10-04Use BreakpointAddress struct instead of passing address directlypolaris-2-5/+15
2015-10-04Implement gdbstubpolaris-2-0/+1029
2015-09-20Implement gdbstubpolaris-2-0/+1029