mirror of
https://github.com/libretro/libretro-tyrquake.git
synced 2025-02-20 16:03:40 +00:00
zone: add Cache_CheckLinks for debugging cache memory trashing
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
84697dd12e
commit
b11b840f54
@ -796,6 +796,30 @@ Cache_Data(const cache_system_t *c)
|
||||
return (byte *)(c + 1) + c->user->pad;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
Cache_CheckLinks(void)
|
||||
{
|
||||
const cache_system_t *cache;
|
||||
|
||||
cache = cache_head.next;
|
||||
while (cache != &cache_head)
|
||||
cache = cache->next;
|
||||
|
||||
cache = cache_head.prev;
|
||||
while (cache != &cache_head)
|
||||
cache = cache->prev;
|
||||
|
||||
cache = cache_head.lru_next;
|
||||
while (cache != &cache_head)
|
||||
cache = cache->lru_next;
|
||||
|
||||
cache = cache_head.lru_prev;
|
||||
while (cache != &cache_head)
|
||||
cache = cache->lru_prev;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ===========
|
||||
* Cache_Move
|
||||
|
@ -149,4 +149,11 @@ void Cache_Free(cache_user_t *c);
|
||||
|
||||
void Cache_Report(void);
|
||||
|
||||
/* For debugging - Walk the links to check for data corruption */
|
||||
#ifdef DEBUG
|
||||
void Cache_CheckLinks(void);
|
||||
#else
|
||||
static inline void Cache_CheckLinks(void) { }
|
||||
#endif
|
||||
|
||||
#endif /* ZONE_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user