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: 1ea4ef0d3b ("freedreno: slurp in decode tools")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6242>
This commit is contained in:
Rob Clark 2020-08-08 09:50:08 -07:00 committed by Marge Bot
parent 8d437b2194
commit cbfce486f2
2 changed files with 28 additions and 7 deletions

View file

@ -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

View file

@ -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;