"whatis -m" output started to generate duplicated results after GDB update:

crash> whatis -m mm_struct
SIZE  TYPE
   16  tlb_state
...
  256  linux_binprm
  2752  rq
  2752  rq  <<-- duplicated
  2752  rq
  2752  rq
  2752  rq
  4048  task_struct

It was caused by incorrect string comparisons.
Use strcmp for full string comparison instead of just string pointers
comparison.

Signed-off-by: Alexey Makhalov <[email protected]>
Reported-by: Kazuhito Hagio <[email protected]>
---
 symbols.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/symbols.c b/symbols.c
index 3321625..4dc50a0 100644
--- a/symbols.c
+++ b/symbols.c
@@ -6988,7 +6988,7 @@ append_struct_symbol (struct gnu_request *req, void *data)
        long s;
 
        for (i = 0; i < treq->idx; i++)
-               if (treq->types[i].name == req->name)
+               if (!strcmp(treq->types[i].name, req->name))
                        break;
 
        if (i < treq->idx) // We've already collected this type
-- 
2.11.0

--
Crash-utility mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/crash-utility

Reply via email to