Fix bug of list -h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Dave,

When investigating list command, I found the "-h" is involved but not
discussed in help page. And then I tried to use, but I find some
problems with it.

The first, I made patch to show it. The "ld->start" should be the
pointer to the structure list_head.

And the second one, I am not sure about the reason why you don't
display the node related to the address user input. I will take the
tasks of task_struct as an example.


crash> task_struct.tasks ffff8800371a0ac0
  tasks = {
    next = 0xffffffff81a8d468,
    prev = 0xffff88004a9e0f88
  }
crash> list task_struct.tasks -s task_struct.tasks -h ffff8800371a0ac0
ffffffff81a8d020
  tasks = {
    next = 0xffff88004eaf1908,
    prev = 0xffff8800371a0f08
  }
ffff88004eaf14c0
  tasks = {
    next = 0xffff88004eaf0ec8,
    prev = 0xffffffff81a8d468
  }
...

As the command shows, the command neglect the task_struct at
ffff8800371a0ac0. I don't know why it is omitted. And if only one node
is in the list, why prints "(empty)"?

                readmem(ld->start, KVADDR, &ld->start, sizeof(void *),
                        "LIST_HEAD contents", FAULT_ON_ERROR);
                if (ld->start == ld->end) {
                        fprintf(fp, "(empty)\n");
                        return;
                }


--
--
Regards
Qiao Nuohan


>From ebdef11edf94fd1aa9dcb9f46eb2235d365d53eb Mon Sep 17 00:00:00 2001
From: qiaonuohan <qiaonuohan@xxxxxxxxxxxxxx>
Date: Fri, 1 Jun 2012 19:36:14 +0800
Subject: [PATCH] fix list -h

---
 tools.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/tools.c b/tools.c
index 7cc580a..b20df2e 100755
--- a/tools.c
+++ b/tools.c
@@ -3299,15 +3299,16 @@ next_arg:
 	if (ld->flags & LIST_HEAD_FORMAT) {
 		ld->list_head_offset = ld->member_offset;
 		ld->member_offset = 0;
-		if (ld->flags & LIST_HEAD_POINTER) {
-			if (!ld->end)
-				ld->end = ld->start;
-        		readmem(ld->start, KVADDR, &ld->start, sizeof(void *),
-				"LIST_HEAD contents", FAULT_ON_ERROR);
-			if (ld->start == ld->end) {
-				fprintf(fp, "(empty)\n");
-				return;
-			}
+		if (!(ld->flags & LIST_HEAD_POINTER))
+			ld->start = ld->start + ld->list_head_offset;
+
+		if (!ld->end)
+			ld->end = ld->start;
+        	readmem(ld->start, KVADDR, &ld->start, sizeof(void *),
+			"LIST_HEAD contents", FAULT_ON_ERROR);
+		if (ld->start == ld->end) {
+			fprintf(fp, "(empty)\n");
+			return;
 		}
 	}
 
-- 
1.7.1

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux