base/regdump.c: Be helpful about VFP/NEON registers before `regdump_init'.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 7 Nov 2019 01:31:29 +0000 (01:31 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 9 May 2020 19:46:54 +0000 (20:46 +0100)
On ARM32 (only), you really /must/ call `regdump_init' before dumping
VFP/NEON registers because otherwise there's no way to tell that they
need saving -- so they aren't and an important pointer is left null.

Rather than crashing, detect this and print a message explaining why the
register can't be dumped.

base/regdump.c

index 2fc0f99..c591fd5 100644 (file)
@@ -857,6 +857,13 @@ void regdump(const void *base, const char *lbl, uint32 f)
     case REGSRC_FP:
     case REGSRC_SIMD:
       map = (const struct regmap *)base;
+      if (!map->fp) {
+       printf(";;");
+       if (lbl) printf(" %s:", lbl);
+       if (reg) printf(" %s =", reg);
+       printf(" #<not available -- regdump_init?>\n");
+       return;
+      }
       if (ix == REGIX_FPSCR) {
        assert(!(f&REGF_FMTMASK));
        dump_fpflags(lbl, map->fp->fpscr);