From: Rob Clark Date: Sat, 8 Aug 2020 16:50:08 +0000 (-0700) Subject: freedreno/crashdec: handle section name typos X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cbfce486f2cea8ace3bda5d2d93d28952ad2944d;p=mesa.git freedreno/crashdec: handle section name typos The fixes tag isn't so much because it was incorrect before, but because I'm going to send a kernel patch to fix the typo, and that will break old crashdec. Fixes: 1ea4ef0d3be ("freedreno: slurp in decode tools") Signed-off-by: Rob Clark Part-of: --- diff --git a/src/freedreno/.gitlab-ci/reference/crash.log b/src/freedreno/.gitlab-ci/reference/crash.log index 4cbc4e42bed..e0c20435ae7 100644 --- a/src/freedreno/.gitlab-ci/reference/crash.log +++ b/src/freedreno/.gitlab-ci/reference/crash.log @@ -2452,7 +2452,7 @@ registers-gmu: 00000000 0x12b: 00000000 00000000 0x140: 00000000 indexed-registers: - - regs-name: CP_SEQ_STAT + - regs-name: CP_SQE_STAT dwords: 51 PC: 00c5 $01: deadd00d $11: 00000000 diff --git a/src/freedreno/decode/crashdec.c b/src/freedreno/decode/crashdec.c index 8c5ccb562c7..933da0ddec0 100644 --- a/src/freedreno/decode/crashdec.c +++ b/src/freedreno/decode/crashdec.c @@ -101,6 +101,23 @@ regval(const char *name) * Line reading and string helpers: */ +static char * +replacestr(char *line, const char *find, const char *replace) +{ + char *tail, *s; + + if (!(s = strstr(line, find))) + return line; + + tail = s + strlen(find); + + char *newline; + asprintf(&newline, "%.*s%s%s", (int)(s - line), line, replace, tail); + free(line); + + return newline; +} + static char *lastline; static char *pushedline; @@ -120,6 +137,10 @@ popline(void) if (getline(&r, &n, in) < 0) exit(0); + /* Handle section name typo's from earlier kernels: */ + r = replacestr(r, "CP_MEMPOOOL", "CP_MEMPOOL"); + r = replacestr(r, "CP_SEQ_STAT", "CP_SQE_STAT"); + lastline = r; return r; } @@ -471,7 +492,7 @@ decode_clusters(void) */ static void -dump_cp_seq_stat(uint32_t *stat) +dump_cp_sqe_stat(uint32_t *stat) { printf("\t PC: %04x\n", stat[0]); stat++; @@ -850,23 +871,23 @@ decode_indexed_registers(void) * so far) not useful, so skip them if not in verbose mode: */ bool dump = verbose || - !strcmp(name, "CP_SEQ_STAT") || + !strcmp(name, "CP_SQE_STAT") || !strcmp(name, "CP_DRAW_STATE") || !strcmp(name, "CP_ROQ") || 0; - if (!strcmp(name, "CP_SEQ_STAT")) - dump_cp_seq_stat(buf); + if (!strcmp(name, "CP_SQE_STAT")) + dump_cp_sqe_stat(buf); if (!strcmp(name, "CP_UCODE_DBG_DATA")) dump_cp_ucode_dbg(buf); - /* note that name was typo'd in earlier kernels: */ - if (!strcmp(name, "CP_MEMPOOL") || !strcmp(name, "CP_MEMPOOOL")) + if (!strcmp(name, "CP_MEMPOOL")) dump_cp_mem_pool(buf); if (dump) dump_hex_ascii(buf, 4 * sizedwords, 1); + free(buf); continue;