mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-15 17:39:28 +00:00
thermosphere: retrieve wp direction
This commit is contained in:
parent
abeaa72f94
commit
5de05ed8a8
3 changed files with 17 additions and 6 deletions
|
@ -228,9 +228,16 @@ int GDB_SendStopReply(GDBContext *ctx, const DebugEventInfo *info)
|
||||||
|
|
||||||
case Exception_WatchpointLowerEl: {
|
case Exception_WatchpointLowerEl: {
|
||||||
static const char *kinds[] = { "", "r", "", "a" };
|
static const char *kinds[] = { "", "r", "", "a" };
|
||||||
n = GDB_ParseExceptionFrame(buffer, ctx, SIGTRAP);
|
// Note: exception info doesn't provide us with the access size. Use 1.
|
||||||
u32 kind = 3; // TODO: retrieve the actual wp direction (if it's a bidirectional wp or not)
|
bool wnr = (info->frame->esr_el2.iss & BIT(6)) != 0;
|
||||||
sprintf(buffer + n, "%swatch:%016lx;", kinds[kind], info->frame->far_el2);
|
WatchpointLoadStoreControl dr = wnr ? WatchpointLoadStoreControl_Store : WatchpointLoadStoreControl_Load;
|
||||||
|
DebugControlRegister cr = retrieveSplitWatchpointConfig(info->frame->far_el2, 1, dr, false);
|
||||||
|
if (!cr.enabled) {
|
||||||
|
DEBUG("GDB: oops, unhandled watchpoint for core id %u, far=%016lx\n", info->coreId, info->frame->far_el2);
|
||||||
|
} else {
|
||||||
|
n = GDB_ParseExceptionFrame(buffer, ctx, SIGTRAP);
|
||||||
|
sprintf(buffer + n, "%swatch:%016lx;", kinds[cr.lsc], info->frame->far_el2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: we don't really support 32-bit sw breakpoints, we'll still report them
|
// Note: we don't really support 32-bit sw breakpoints, we'll still report them
|
||||||
|
|
|
@ -189,10 +189,14 @@ static DebugRegisterPair *doFindSplitWatchpoint(u64 addr, size_t size, Watchpoin
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugRegisterPair *findSplitWatchpoint(u64 addr, size_t size, WatchpointLoadStoreControl direction, bool strict)
|
DebugControlRegister retrieveSplitWatchpointConfig(u64 addr, size_t size, WatchpointLoadStoreControl direction, bool strict)
|
||||||
{
|
{
|
||||||
recursiveSpinlockLock(&g_watchpointManager.lock);
|
recursiveSpinlockLock(&g_watchpointManager.lock);
|
||||||
DebugRegisterPair *ret = doFindSplitWatchpoint(addr, size, direction, strict);
|
DebugRegisterPair *wp = doFindSplitWatchpoint(addr, size, direction, strict);
|
||||||
|
DebugControlRegister ret = { 0 };
|
||||||
|
if (wp != NULL) {
|
||||||
|
ret = wp->cr;
|
||||||
|
}
|
||||||
recursiveSpinlockUnlock(&g_watchpointManager.lock);
|
recursiveSpinlockUnlock(&g_watchpointManager.lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ typedef struct WatchpointManager {
|
||||||
extern WatchpointManager g_watchpointManager;
|
extern WatchpointManager g_watchpointManager;
|
||||||
|
|
||||||
void initWatchpoints(void);
|
void initWatchpoints(void);
|
||||||
DebugRegisterPair *findSplitWatchpoint(u64 addr, size_t size, WatchpointLoadStoreControl direction, bool strict);
|
DebugControlRegister retrieveSplitWatchpointConfig(u64 addr, size_t size, WatchpointLoadStoreControl direction, bool strict);
|
||||||
int addWatchpoint(u64 addr, size_t size, WatchpointLoadStoreControl direction);
|
int addWatchpoint(u64 addr, size_t size, WatchpointLoadStoreControl direction);
|
||||||
int removeWatchpoint(u64 addr, size_t size, WatchpointLoadStoreControl direction);
|
int removeWatchpoint(u64 addr, size_t size, WatchpointLoadStoreControl direction);
|
||||||
int removeAllWatchpoints(void);
|
int removeAllWatchpoints(void);
|
||||||
|
|
Loading…
Reference in a new issue