| |
@@ -0,0 +1,60 @@
|
| |
+ From 60676c5ad2052aa6a515444465a2d15310689221 Mon Sep 17 00:00:00 2001
|
| |
+ From: Kevin Chen <kevin@bloxroute.com>
|
| |
+ Date: Tue, 2 Jul 2019 17:30:16 -0500
|
| |
+ Subject: [PATCH] Fix sorting for Python3, field names, and lib paths
|
| |
+
|
| |
+ ---
|
| |
+ heap/commands.py | 3 ++-
|
| |
+ heap/glibc.py | 4 ++--
|
| |
+ heap/gobject.py | 2 +-
|
| |
+ 3 files changed, 5 insertions(+), 4 deletions(-)
|
| |
+
|
| |
+ diff --git a/heap/commands.py b/heap/commands.py
|
| |
+ index d6244c0..062a49a 100644
|
| |
+ --- a/heap/commands.py
|
| |
+ +++ b/heap/commands.py
|
| |
+ @@ -115,7 +115,8 @@ def invoke(self, args, from_tty):
|
| |
+ pass # FIXME
|
| |
+ t = Table(['Chunk size', 'Num chunks', 'Allocated size'])
|
| |
+ for size in sorted(chunks_by_size.keys(),
|
| |
+ - lambda s1, s2: chunks_by_size[s2] * s2 - chunks_by_size[s1] * s1):
|
| |
+ + key=lambda s1: chunks_by_size[s1] * s1,
|
| |
+ + reverse=True):
|
| |
+ t.add_row([fmt_size(size),
|
| |
+ chunks_by_size[size],
|
| |
+ fmt_size(chunks_by_size[size] * size)])
|
| |
+ diff --git a/heap/glibc.py b/heap/glibc.py
|
| |
+ index cd90807..330a4e3 100644
|
| |
+ --- a/heap/glibc.py
|
| |
+ +++ b/heap/glibc.py
|
| |
+ @@ -68,7 +68,7 @@ def gdb_type(cls):
|
| |
+
|
| |
+ def size(self):
|
| |
+ if not(hasattr(self, '_cached_size')):
|
| |
+ - self._cached_size = int(self.field('size'))
|
| |
+ + self._cached_size = int(self.field('mchunk_size'))
|
| |
+ return self._cached_size
|
| |
+
|
| |
+ def chunksize(self):
|
| |
+ @@ -94,7 +94,7 @@ def __str__(self):
|
| |
+ if self.has_PREV_INUSE():
|
| |
+ result += ' PREV_INUSE'
|
| |
+ else:
|
| |
+ - result += ' prev_size=%i' % self.field('prev_size')
|
| |
+ + result += ' prev_size=%i' % self.field('mchunk_prev_size')
|
| |
+ if self.has_NON_MAIN_ARENA():
|
| |
+ result += ' NON_MAIN_ARENA'
|
| |
+ if self.has_IS_MMAPPED():
|
| |
+ diff --git a/heap/gobject.py b/heap/gobject.py
|
| |
+ index e16e232..0509433 100644
|
| |
+ --- a/heap/gobject.py
|
| |
+ +++ b/heap/gobject.py
|
| |
+ @@ -25,7 +25,7 @@
|
| |
+ dir_ = '/usr/share/glib-2.0/gdb'
|
| |
+ if not dir_ in sys.path:
|
| |
+ sys.path.insert(0, dir_)
|
| |
+ -from glib import read_global_var, g_quark_to_string
|
| |
+ +from glib_gdb import read_global_var, g_quark_to_string
|
| |
+
|
| |
+
|
| |
+ # This was adapted from glib's gobject.py:g_type_to_name
|
| |