On Fri, 8 Jul 2022 at 17:39, Richard Henderson <richard.hender...@linaro.org> wrote: > > Hoist the "master vs apprentice" label to apprentice(), since > we will want different labels for dumping. Remove all of the > "mismatch" text from reginfo_dump_mismatch -- just print "vs". > > Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
> diff --git a/risu_reginfo_ppc64.c b/risu_reginfo_ppc64.c > index 9899b36..e96dc48 100644 > --- a/risu_reginfo_ppc64.c > +++ b/risu_reginfo_ppc64.c > @@ -27,6 +27,15 @@ > const struct option * const arch_long_opts; > const char * const arch_extra_help; > > +static const char * const greg_names[NGREG] = { > + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", > + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", > + "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", > + "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", > + [XER] = "xer", > + [CCR] = "ccr", > +}; > + > void process_arch_opt(int opt, const char *arg) > { > abort(); > @@ -147,35 +156,21 @@ int reginfo_dump(struct reginfo *ri, FILE * f) > return !ferror(f); > } > > -int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) > +void reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) > { > int i; > - for (i = 0; i < 32; i++) { > - if (i == 1 || i == 13) { > - continue; > + > + for (i = 0; i < NGREG; i++) { > + if (greg_names[i] != NULL && m->gregs[i] != a->gregs[i]) { > + fprintf(f, "%6s: %016lx vs %016lx\n", > + greg_names[i], m->gregs[i], a->gregs[i]); > } This used to skip r1 and r13, and now it does not. > - > - if (m->gregs[i] != a->gregs[i]) { > - fprintf(f, "Mismatch: Register r%d\n", i); > - fprintf(f, "master: [%lx] - apprentice: [%lx]\n", > - m->gregs[i], a->gregs[i]); > - } > - } > - > - if (m->gregs[XER] != a->gregs[XER]) { > - fprintf(f, "Mismatch: XER\n"); > - fprintf(f, "m: [%lx] != a: [%lx]\n", m->gregs[XER], a->gregs[XER]); > - } > - > - if (m->gregs[CCR] != a->gregs[CCR]) { > - fprintf(f, "Mismatch: Cond. Register\n"); > - fprintf(f, "m: [%lx] != a: [%lx]\n", m->gregs[CCR], a->gregs[CCR]); > } > > for (i = 0; i < 32; i++) { > if (m->fpregs[i] != a->fpregs[i]) { > - fprintf(f, "Mismatch: Register f%d\n", i); > - fprintf(f, "m: [%016lx] != a: [%016lx]\n", > + fprintf(f, "%*s%d: %016lx vs %016lx\n", > + 6 - (i < 10 ? 1 : 2), "f", i, > m->fpregs[i], a->fpregs[i]); > } > } thanks -- PMM