commit f579bf773398809ee97341a20c91eadd918bc1ad from: Neels Hofmeyr date: Tue Oct 20 00:12:45 2020 UTC debug output fixes - fix compilation error with DEBUG 1, after moving patience state out of diff_atom, and after renaming diff_data.d to diff_data.root. - add some missing newlines. - also debug "HIT" on a max-effort cut, like when finding a mid snake, which eases finding all the places where boxes get cut. commit - ca85e8bc8fc561d9c93cf1c7d59b4ac8a25f94c1 commit + f579bf773398809ee97341a20c91eadd918bc1ad blob - e0580aa5e5f76cdaee48726754ed1af7595dfbe3 blob + e47997cd368a717d95c65f2748c4443d8f4f8de4 --- lib/diff_debug.h +++ lib/diff_debug.h @@ -47,22 +47,17 @@ dump_atom(const struct diff_data *left, const struct d } if (left) print(" %3u", diff_atom_root_idx(left, atom)); - if (right && atom->patience.pos_in_other) - print(" %3u", - diff_atom_root_idx(right, atom->patience.pos_in_other)); - print(" %s%s '", - atom->patience.unique_in_both ? "u" : " "); if (atom->at == NULL) { off_t remain = atom->len; - if (fseek(atom->d->root->f, atom->pos, SEEK_SET) == -1) + if (fseek(atom->root->f, atom->pos, SEEK_SET) == -1) abort(); /* cannot return error */ while (remain > 0) { char buf[16]; size_t r; int i; r = fread(buf, 1, MIN(remain, sizeof(buf)), - atom->d->root->f); + atom->root->f); if (r == -1) abort(); /* cannot return error */ if (r == 0) blob - a3ee66c02ed67883bf020b9f55312657a914e840 blob + deb8913f8f0388bd75c6b20bec62c202217d2854 --- lib/diff_myers.c +++ lib/diff_myers.c @@ -238,10 +238,10 @@ diff_divide_myers_forward(bool *found_midpoint, /* We are traversing negatively, and already * below the entire graph, nothing will come of * this. */ - debug(" break"); + debug(" break\n"); break; } - debug(" continue"); + debug(" continue\n"); continue; } debug("- k = %d\n", k); @@ -551,10 +551,10 @@ diff_divide_myers_backward(bool *found_midpoint, /* We are traversing negatively, and already * below the entire graph, nothing will come of * this. */ - debug(" break"); + debug(" break\n"); break; } - debug(" continue"); + debug(" continue\n"); continue; } debug("- c = %d\n", c); @@ -893,7 +893,10 @@ diff_algo_myers_divide(const struct diff_algo_config * int best_backward_x; int best_backward_y; - debug("~~~ d = %d > max_effort = %d\n", d, max_effort); + debug("~~~ HIT d = %d > max_effort = %d\n", d, max_effort); + debug_dump_myers_graph(left, right, NULL, + kd_forward, d, + kd_backward, d); for (i = d; i >= -d; i -= 2) { if (i >= -(int)right->atoms.len && i <= (int)left->atoms.len) { @@ -1155,10 +1158,10 @@ diff_algo_myers(const struct diff_algo_config *algo_co /* We are traversing negatively, and * already below the entire graph, * nothing will come of this. */ - debug(" break"); + debug(" break\n"); break; } - debug(" continue"); + debug(" continue\n"); continue; }