[Crash-utility] Speed up list/tree '-s' output.

Alexandr Terekhov Alexandr_Terekhov at epam.com
Mon Aug 22 13:12:31 UTC 2016


Hi Dave,

while I was working on your suggestions, I faced the following problem:

(gdb) call datatype_info("page", "mapping", -3)
$1 = 0

It happens because entire anonymous structure is represented as single field
with empty name within gdb.
Please, consider the patch which fixes such behavior:
(gdb) call datatype_info("page", "mapping", -3)
$1 = 1
(gdb) call datatype_info("page", "index", -3)
$5 = 8
(gdb) call datatype_info("page", "lru", -3)
$6 = 3
(gdb) call datatype_info("page", "objects", -3)
$7 = 22

diff --git a/gdb-7.6.patch b/gdb-7.6.patch
index 794555f..8a61f20 100644
--- a/gdb-7.6.patch
+++ b/gdb-7.6.patch
@@ -351,7 +351,7 @@
    return lookup_symbol_in_language (name, block, domain,
                                    current_language->la_language,
                                    is_a_field_of_this);
-@@ -5100,3 +5115,662 @@ When enabled, debugging messages are pri
+@@ -5100,3 +5115,666 @@ When enabled, debugging messages are pri
  
    observer_attach_executable_changed (symtab_observer_executable_changed);
  }
@@ -736,6 +736,10 @@
 +                          (typedef_type = check_typedef(nextfield->type))) 
 +                              req->member_length = TYPE_LENGTH(typedef_type);
 +                      return;
++              } else if (*nextfield->name == 0) { /* Anonymous struct/union */
++                      get_member_data(req, nextfield->type);
++                      if (req->member_offset != -1)
++                              return;
 +              }
 +              nextfield++;
 +      }

______________________________________
From: crash-utility-bounces at redhat.com <crash-utility-bounces at redhat.com> on behalf of Dave Anderson <anderson at redhat.com>
Sent: Thursday, August 18, 2016 23:39
To: Discussion list for crash utility usage,    maintenance and development
Subject: Re: [Crash-utility] Speed up list/tree '-s' output.

Another suggestion:

Use MEMBER_TYPE(), or pass a datatype_member structure to datatype_info(), in
order to determine whether a structure member is TYPE_CODE_PTR, and if so, always
print the member in hexadecimal regardless of the current radix.  (i.e. like
gdb does)

Dave




More information about the Crash-utility mailing list