[PATCH] struct: fix struct print member array of list_heads

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

 



Due to the way that an array of list_head entries are printed,
parsing of them fails.  Note the difference in spacing between the
double opening and double closing brackets.

    crash> struct blk_mq_ctx.rq_lists ffffc447ffc0f740
    <-->rq_lists = {{
            next = 0xffffc447ffc0f748,
            prev = 0xffffc447ffc0f748
          }, {
            next = 0xffffc447ffc0f758,
            prev = 0xffffc447ffc0f758
          }, {
            next = 0xffffc447ffc0f768,
            prev = 0xffffc447ffc0f768
    <---->}}

As parse_for_member() relies on opening and closing brackets having
the same spacing, make a condition for these arrays of list_head
members.

    Before:

    crash> struct blk_mq_ctx.rq_completed ffffc447ffc0f740
    crash>

    After:

    crash> struct blk_mq_ctx.rq_completed ffffc447ffc0f740
      rq_completed = {221, 1333}

Signed-off-by: John Pittman <jpittman@xxxxxxxxxx>
---
 symbols.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/symbols.c b/symbols.c
index 215d523..a2d5c6c 100644
--- a/symbols.c
+++ b/symbols.c
@@ -7918,7 +7918,8 @@ parse_for_member(struct datatype_member *dm, ulong flag)
 		sprintf(lookfor2, "  %s[", s);
 next_item:
 		while (fgets(buf, BUFSIZE, pc->tmpfile)) {
-			if (embed && (count_leading_spaces(buf) == embed))
+			if ((embed && (count_leading_spaces(buf) == embed)) ||
+				(strstr(buf, "}}") && embed == count_leading_spaces(buf) - 2))
 				embed = 0;
 
 			if (!on && !embed && strstr(buf, "= {") && !strstr(buf, lookfor1))
@@ -7940,6 +7941,11 @@ next_item:
 				    !strstr(buf, "}")) || (buf[0] == '}')) {
 					break;
 				}
+				if (indent && (on > 1) && indent == count_leading_spaces(buf) - 2 &&
+					strstr(buf, "}}")) {
+					fprintf(pc->saved_fp, "%s", buf);
+					break;
+				}
 				if (!indent) {
 					if ((p1 = strstr(buf, ", \n")))
 						sprintf(p1, "\n");
-- 
2.17.2

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




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

 

Powered by Linux