memory tracker: more data; avoid weird faults
This commit is contained in:
parent
4ea638742d
commit
f8b93f33d7
@ -292,6 +292,10 @@ void free(void * ptr) {
|
|||||||
x = (uint32_t *)tag;
|
x = (uint32_t *)tag;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
page_t * page = get_page((uintptr_t)x, 0, current_directory);
|
||||||
|
if (page->present != 1) break;
|
||||||
|
page = get_page((uintptr_t)x + 8, 0, current_directory);
|
||||||
|
if (page->present != 1) break;
|
||||||
if (*x == 0xDEADBEEF) {
|
if (*x == 0xDEADBEEF) {
|
||||||
if (x[1] == i) {
|
if (x[1] == i) {
|
||||||
_failed = 0;
|
_failed = 0;
|
||||||
|
@ -5,9 +5,16 @@ addresses = {}
|
|||||||
sources = {}
|
sources = {}
|
||||||
last_touched = {}
|
last_touched = {}
|
||||||
|
|
||||||
def find_nearby_allocations(addr):
|
def find_nearby_allocations(addr,size):
|
||||||
|
results = []
|
||||||
for key in addresses.keys():
|
for key in addresses.keys():
|
||||||
if abs(addr - key) < 0x100 and addresses[key]:
|
if abs(addr - key) < size*2 and addresses[key]:
|
||||||
|
results.append(key)
|
||||||
|
results = sorted(results)
|
||||||
|
for key in results:
|
||||||
|
if key == addr:
|
||||||
|
print(" self: 0x%x (size %d, allocated by 0x%x)" % (key, addresses[key], sources[key]))
|
||||||
|
else:
|
||||||
print(" nearby: 0x%x (size %d, allocated by 0x%x)" % (key, addresses[key], sources[key]))
|
print(" nearby: 0x%x (size %d, allocated by 0x%x)" % (key, addresses[key], sources[key]))
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
@ -56,7 +63,7 @@ while 1:
|
|||||||
print("Large buffer has bad value: 0x%x (0x%x) expected size is %d, supposed is %d" % (addr, extra, addresses[addr], size))
|
print("Large buffer has bad value: 0x%x (0x%x) expected size is %d, supposed is %d" % (addr, extra, addresses[addr], size))
|
||||||
elif addresses[addr] != size:
|
elif addresses[addr] != size:
|
||||||
print("Size on free is incorrect: 0x%x %d %d 0x%x allocated by 0x%x last touched by %c" % (addr,addresses[addr], size, fault, sources[addr], last_touched[addr]))
|
print("Size on free is incorrect: 0x%x %d %d 0x%x allocated by 0x%x last touched by %c" % (addr,addresses[addr], size, fault, sources[addr], last_touched[addr]))
|
||||||
find_nearby_allocations(addr)
|
find_nearby_allocations(addr,addresses[addr])
|
||||||
else:
|
else:
|
||||||
addresses[addr] = None
|
addresses[addr] = None
|
||||||
elif t == 'h':
|
elif t == 'h':
|
||||||
|
Loading…
Reference in New Issue
Block a user