qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RISU PATCH v4 23/29] Standardize reginfo_dump_mismatch printing


From: Peter Maydell
Subject: Re: [RISU PATCH v4 23/29] Standardize reginfo_dump_mismatch printing
Date: Mon, 18 Jul 2022 12:54:53 +0100

On Fri, 8 Jul 2022 at 17:39, Richard Henderson
<richard.henderson@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.henderson@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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]