Make trace-malloc dumps not print '(nil)' instead of an address. b=331743 (fixing regression from previous patch)

This commit is contained in:
dbaron%dbaron.org 2007-02-14 07:07:51 +00:00
parent 10d5ca630a
commit 0c76c7aa5d
2 changed files with 12 additions and 9 deletions

View File

@ -80,12 +80,14 @@ ADLog::Read(const char* aFileName)
return false;
}
char *data = (char*)malloc(((datasize+3)/4)*4);
size_t data_mem_size = ((datasize + sizeof(unsigned long) - 1) /
sizeof(unsigned long)) * sizeof(unsigned long);
char *data = (char*)malloc(data_mem_size);
for (char *cur_data = data,
*cur_data_end = data + ((datasize+3)/4)*4;
cur_data != cur_data_end; cur_data += 4) {
res = fscanf(in, " %x\n", (unsigned int*)cur_data);
for (unsigned long *cur_data = (unsigned long*) data,
*cur_data_end = (unsigned long*) ((char*)data + data_mem_size);
cur_data != cur_data_end; ++cur_data) {
res = fscanf(in, " %lX\n", cur_data);
if (res != 1) {
return false;
}

View File

@ -2172,16 +2172,17 @@ allocation_enumerator(PLHashEntry *he, PRIntn i, void *arg)
callsite *site = (callsite*) he->value;
extern const char* nsGetTypeName(const void* ptr);
void **p, **end;
unsigned long *p, *end;
fprintf(ofp, "%p <%s> (%lu)\n",
he->key,
nsGetTypeName(he->key),
(unsigned long) alloc->size);
end = (void**)(((char*) he->key) + alloc->size);
for (p = (void**)he->key; p < end; ++p)
fprintf(ofp, "\t%p\n", *p);
for (p = (unsigned long*) he->key,
end = (unsigned long*) ((char*)he->key + alloc->size);
p < end; ++p)
fprintf(ofp, "\t0x%08lX\n", *p);
while (site) {
if (site->name || site->parent) {