Commit 276d2603 authored by Mike Hibler's avatar Mike Hibler

Some debug options.

parent ba3ab203
......@@ -21,6 +21,7 @@
* }}}
*/
#define MAP_DEBUG
//#define CHUNKIFY_DEBUG
/*
......@@ -319,12 +320,14 @@ readifile(struct fileinfo *info, int usesig)
next->start, next->end);
fprintf(stderr, "%s: error while validating range/hash maps\n",
ndz_filename(info->ndz));
#if 0
printf("==== Image ");
ndz_rangemap_dump(info->map, (debug==0), NULL);
printf("==== Hash ");
ndz_hashmap_dump(info->sigmap, (debug==0));
fflush(stdout);
#ifdef MAP_DEBUG
if (debug) {
printf("==== Image ");
ndz_rangemap_dump(info->map, (debug==1), NULL);
printf("==== Hash ");
ndz_hashmap_dump(info->sigmap, (debug==1));
fflush(stdout);
}
#endif
exit(1);
}
......@@ -480,9 +483,8 @@ chunkify(struct ndz_rangemap *mmap, struct ndz_range *range, void *arg)
fprintf(stderr, " found hash=%s\n",
ndz_hash_dump(hdata->hash, hashlen));
#endif
#if 0
/* sanity check */
{
if (debug > 1) {
unsigned char hbuf[HASH_MAXSIZE];
ndz_hash_data(delta.ndz, cstate->chunkdatabuf, hbytes, hbuf);
......@@ -495,7 +497,6 @@ chunkify(struct ndz_rangemap *mmap, struct ndz_range *range, void *arg)
hstart, hstart + hsize - 1);
}
}
#endif
} else {
ndz_hash_data(delta.ndz, cstate->chunkdatabuf, hbytes,
hdata->hash);
......@@ -771,16 +772,18 @@ main(int argc, char **argv)
readifile(&ndz1, usesigfiles);
readifile(&ndz2, usesigfiles);
#if 0
printf("==== Old range ");
ndz_rangemap_dump(ndz1.map, (debug==0), chunkfunc);
printf("==== Old hash ");
ndz_hashmap_dump(ndz1.sigmap, (debug==0));
printf("==== New range ");
ndz_rangemap_dump(ndz2.map, (debug==0), chunkfunc);
printf("==== New hash ");
ndz_hashmap_dump(ndz2.sigmap, (debug==0));
fflush(stdout);
#ifdef MAP_DEBUG
if (debug) {
printf("==== Old range ");
ndz_rangemap_dump(ndz1.map, (debug==1), chunkfunc);
printf("==== Old hash ");
ndz_hashmap_dump(ndz1.sigmap, (debug==1));
printf("==== New range ");
ndz_rangemap_dump(ndz2.map, (debug==1), chunkfunc);
printf("==== New hash ");
ndz_hashmap_dump(ndz2.sigmap, (debug==1));
fflush(stdout);
}
#endif
/*
......@@ -808,14 +811,16 @@ main(int argc, char **argv)
*/
delta.ndz->maplo = ndz2.ndz->maplo;
delta.ndz->maphi = ndz2.ndz->maphi;
#if 0
printf("==== Delta hash ");
ndz_hashmap_dump(delta.map, (debug==0));
printf("==== Old hashmap stats:");
ndz_rangemap_dumpstats(ndz1.sigmap);
printf("==== New hashmap stats:");
ndz_rangemap_dumpstats(ndz2.sigmap);
fflush(stdout);
#ifdef MAP_DEBUG
if (debug) {
printf("==== Delta hash ");
ndz_hashmap_dump(delta.map, (debug==1));
printf("==== Old hashmap stats:");
ndz_rangemap_dumpstats(ndz1.sigmap);
printf("==== New hashmap stats:");
ndz_rangemap_dumpstats(ndz2.sigmap);
fflush(stdout);
}
#endif
}
/*
......@@ -837,14 +842,16 @@ main(int argc, char **argv)
delta.ndz->maplo = ndz2.ndz->maplo;
delta.ndz->maphi = ndz2.ndz->maphi;
#if 0
printf("==== Delta map ");
ndz_hashmap_dump(delta.map, (debug==0));
printf("==== Old map stats:");
ndz_rangemap_dumpstats(ndz1.map);
printf("==== New map stats:");
ndz_rangemap_dumpstats(ndz2.map);
fflush(stdout);
#ifdef MAP_DEBUG
if (debug) {
printf("==== Delta map ");
ndz_hashmap_dump(delta.map, (debug==1));
printf("==== Old map stats:");
ndz_rangemap_dumpstats(ndz1.map);
printf("==== New map stats:");
ndz_rangemap_dumpstats(ndz2.map);
fflush(stdout);
}
#endif
exit(2);
}
......
......@@ -21,6 +21,7 @@
* }}}
*/
#define MAP_DEBUG
//#define APPLYDELTA_DEBUG
//#define CHUNKIFY_DEBUG
......@@ -296,10 +297,9 @@ readifile(struct fileinfo *info, int usesig)
ndz_filename(info->ndz));
exit(1);
}
#if 1
fprintf(stderr, "sig covers %lu more sectors than in image\n",
ssects - isects);
#endif
if (debug)
fprintf(stderr, "sig covers %lu more sectors than in image\n",
ssects - isects);
}
} else
info->sigmap = NULL;
......@@ -986,16 +986,18 @@ main(int argc, char **argv)
readifile(&base, 0);
readifile(&delta, usesigfile);
#if 1
printf("==== Base range ");
ndz_rangemap_dump(base.map, (debug==0), chunkfunc);
printf("==== Delta range ");
ndz_rangemap_dump(delta.map, (debug==0), chunkfunc);
if (usesigfile) {
printf("==== Delta hash ");
ndz_hashmap_dump(delta.sigmap, (debug==0));
#ifdef MAP_DEBUG
if (debug) {
printf("==== Base range ");
ndz_rangemap_dump(base.map, (debug==1), chunkfunc);
printf("==== Delta range ");
ndz_rangemap_dump(delta.map, (debug==1), chunkfunc);
if (usesigfile) {
printf("==== Delta hash ");
ndz_hashmap_dump(delta.sigmap, (debug==1));
}
fflush(stdout);
}
fflush(stdout);
#endif
/*
......@@ -1018,10 +1020,12 @@ main(int argc, char **argv)
exit(1);
}
#if 1
printf("==== Merge ");
ndz_rangemap_dump(new.map, (debug==0), mergefunc);
fflush(stdout);
#ifdef MAP_DEBUG
if (debug) {
printf("==== Merge ");
ndz_rangemap_dump(new.map, (debug==1), mergefunc);
fflush(stdout);
}
#endif
/*
......@@ -1047,10 +1051,11 @@ main(int argc, char **argv)
new.ndz->maplo = base.ndz->maplo;
else
new.ndz->maplo = delta.ndz->maplo;
#if 1
printf("new map range: low=%lu, high=%lu\n", new.ndz->maplo, new.ndz->maphi);
fflush(stdout);
#endif
if (debug) {
printf("new map range: low=%lu, high=%lu\n",
new.ndz->maplo, new.ndz->maphi);
fflush(stdout);
}
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment