diff mbox series

[Crash-utility,8/8] RISCV64: Add the implementation of symbol verify

Message ID 20220718025346.411758-9-xianting.tian@linux.alibaba.com (mailing list archive)
State New, archived
Headers show
Series Support RISCV64 arch and common commands | expand

Commit Message

Xianting Tian July 18, 2022, 2:53 a.m. UTC
Verify the symbol to accept or reject a symbol from the kernel namelist.

Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
---
 riscv64.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/riscv64.c b/riscv64.c
index cbf75cf..04064df 100644
--- a/riscv64.c
+++ b/riscv64.c
@@ -188,11 +188,20 @@  riscv64_cmd_mach(void)
 	riscv64_display_machine_stats();
 }
 
+/*
+ * Accept or reject a symbol from the kernel namelist.
+ */
 static int
 riscv64_verify_symbol(const char *name, ulong value, char type)
 {
-	/* TODO: */
-	return TRUE;
+	if (CRASHDEBUG(8) && name && strlen(name))
+		fprintf(fp, "%08lx %s\n", value, name);
+
+	if (STREQ(name, "_text") || STREQ(name, "_stext"))
+		machdep->flags |= KSYMS_START;
+
+	return (name && strlen(name) && (machdep->flags & KSYMS_START) &&
+		!STRNEQ(name, "__func__.") && !STRNEQ(name, "__crc_"));
 }
 
 void