diff mbox series

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

Message ID 20220813031753.3097720-10-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 Aug. 13, 2022, 3:17 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 | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/riscv64.c b/riscv64.c
index 0e5c9c6..cbb57f2 100644
--- a/riscv64.c
+++ b/riscv64.c
@@ -165,10 +165,23 @@  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: */
+	if (CRASHDEBUG(8) && name && strlen(name))
+		fprintf(fp, "%08lx %s\n", value, name);
+
+	if (!(machdep->flags & KSYMS_START)) {
+		if (STREQ(name, "_text") || STREQ(name, "_stext"))
+			machdep->flags |= KSYMS_START;
+
+		return (name && strlen(name) && !STRNEQ(name, "__func__.") &&
+			!STRNEQ(name, "__crc_"));
+	}
+
 	return TRUE;
 }