crash/0007-symbols-Add-mod_symname_hash-table-dump-to-help-s.patch
Lianbo Jiang e1f6e2b6fb Update to the latest upstream <68870c83d299>
Release: crash-7.3.0-5

Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
2021-11-06 14:37:23 +08:00

100 lines
2.7 KiB
Diff

From 5c04a6f3f923af7c50f0d853477044802b3fa6ec Mon Sep 17 00:00:00 2001
From: Tao Liu <ltao@redhat.com>
Date: Sat, 16 Oct 2021 13:21:17 +0800
Subject: [PATCH 7/9] symbols: Add mod_symname_hash table dump to help -s
Previously, help -s only print out the dump status of symname_hash
table. Since we have mod_symname_hash table introduced, let's print
out mod_symname_hash in help -s as well.
Signed-off-by: Tao Liu <ltao@redhat.com>
---
symbols.c | 57 ++++++++++++++++++++++++++++++++++---------------------
1 file changed, 35 insertions(+), 22 deletions(-)
diff --git a/symbols.c b/symbols.c
index 67b701454563..73baa953217a 100644
--- a/symbols.c
+++ b/symbols.c
@@ -3219,13 +3219,40 @@ kallsyms_module_function_size(struct syment *sp, struct load_module *lm, ulong *
return FALSE;
}
+static void
+dump_symname_hash_table(struct syment *table[])
+{
+ int i, cnt, tot;
+ struct syment *sp;
+
+ fprintf(fp, " ");
+ for (i = tot = 0; i < SYMNAME_HASH; i++) {
+ fprintf(fp, "[%3d]: ", i);
+ if ((sp = table[i]) == NULL)
+ fprintf(fp, "%3d ", 0);
+ else {
+ cnt = 1;
+ while (sp->name_hash_next) {
+ cnt++;
+ sp = sp->name_hash_next;
+ }
+ fprintf(fp, "%3d ", cnt);
+ tot += cnt;
+ }
+ if (i && (((i+1) % 6) == 0))
+ fprintf(fp, "\n ");
+ }
+ if (SYMNAME_HASH % 6)
+ fprintf(fp, "\n");
+}
+
/*
* "help -s" output
*/
void
dump_symbol_table(void)
{
- int i, s, cnt, tot;
+ int i, s, cnt;
struct load_module *lm;
struct syment *sp;
struct downsized *ds;
@@ -3355,28 +3382,14 @@ dump_symbol_table(void)
fprintf(fp, " symname_hash[%d]: %lx\n", SYMNAME_HASH,
(ulong)&st->symname_hash[0]);
+ if (CRASHDEBUG(1))
+ dump_symname_hash_table(st->symname_hash);
+
+ fprintf(fp, "mod_symname_hash[%d]: %lx\n", SYMNAME_HASH,
+ (ulong)&st->mod_symname_hash[0]);
+ if (CRASHDEBUG(1))
+ dump_symname_hash_table(st->mod_symname_hash);
- if (CRASHDEBUG(1)) {
- fprintf(fp, " ");
- for (i = tot = 0; i < SYMNAME_HASH; i++) {
- fprintf(fp, "[%3d]: ", i);
- if ((sp = st->symname_hash[i]) == NULL)
- fprintf(fp, "%3d ", 0);
- else {
- cnt = 1;
- while (sp->name_hash_next) {
- cnt++;
- sp = sp->name_hash_next;
- }
- fprintf(fp, "%3d ", cnt);
- tot += cnt;
- }
- if (i && (((i+1) % 6) == 0))
- fprintf(fp, "\n ");
- }
- if (SYMNAME_HASH % 6)
- fprintf(fp, "\n");
- }
fprintf(fp, " symbol_namespace: ");
fprintf(fp, "address: %lx ", (ulong)st->kernel_namespace.address);
fprintf(fp, "index: %ld ", st->kernel_namespace.index);
--
2.30.2