-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to run heap on Fedora:31 #28
Comments
After digging further, it looks like the gdb python interface has changed, more precisely native (gdb) set python print-stack full
(gdb) heap
Blocks retrieved 10000
Blocks retrieved 20000
Blocks retrieved 30000
Traceback (most recent call last):
File "/usr/share/gdb-heap/heap/commands.py", line 34, in g
return f(self, args, from_tty)
File "/usr/share/gdb-heap/heap/commands.py", line 56, in invoke
usage_list = list(lazily_get_usage_list())
File "/usr/share/gdb-heap/heap/__init__.py", line 503, in lazily_get_usage_list
categorize_usage_list(usage_list)
File "/usr/share/gdb-heap/heap/__init__.py", line 528, in categorize_usage_list
if u.obj.categorize_refs(usage_set):
File "/usr/share/gdb-heap/heap/cpython.py", line 280, in categorize_refs
m_str = int(self.field('str'))
File "/usr/share/gdb-heap/heap/__init__.py", line 117, in field
return self._gdbval[attr]
gdb.error: There is no member named str.
Error occurred in Python: There is no member named str. I patched the corresponding part: Lines 279 to 284 in b0a6efc
And provided an alternative implementation: def categorize_refs(self, usage_set, level=0, detail=None):
usage_set.set_addr_category(self.as_address(), # << directly obtain as an address
Category('cpython', 'PyUnicodeObject buffer', detail),
level)
return True That lead to another issue spotted: (gdb) heap
Blocks retrieved 10000
Blocks retrieved 20000
Blocks retrieved 30000
Traceback (most recent call last):
File "/usr/share/gdb-heap/heap/commands.py", line 34, in g
return f(self, args, from_tty)
File "/usr/share/gdb-heap/heap/commands.py", line 56, in invoke
usage_list = list(lazily_get_usage_list())
File "/usr/share/gdb-heap/heap/__init__.py", line 504, in lazily_get_usage_list
categorize_usage_list(usage_list)
File "/usr/share/gdb-heap/heap/__init__.py", line 529, in categorize_usage_list
if u.obj.categorize_refs(usage_set):
File "/usr/share/gdb-heap/heap/cpython.py", line 286, in categorize_refs
level)
File "/usr/share/gdb-heap/heap/__init__.py", line 365, in set_addr_category
if level <= u.level:
TypeError: '<=' not supported between instances of 'int' and 'NoneType'
Error occurred in Python: '<=' not supported between instances of 'int' and 'NoneType'
(gdb) After changing the condition: Lines 364 to 365 in b0a6efc
to: if u.level is not None and level <= u.level: I obtained the following error: (gdb) heap
Blocks retrieved 10000
Blocks retrieved 20000
Blocks retrieved 30000
Blocks analyzed 10000
Traceback (most recent call last):
File "/usr/share/gdb-heap/heap/commands.py", line 34, in g
return f(self, args, from_tty)
File "/usr/share/gdb-heap/heap/commands.py", line 56, in invoke
usage_list = list(lazily_get_usage_list())
File "/usr/share/gdb-heap/heap/__init__.py", line 503, in lazily_get_usage_list
categorize_usage_list(usage_list)
File "/usr/share/gdb-heap/heap/__init__.py", line 528, in categorize_usage_list
if u.obj.categorize_refs(usage_set):
File "/usr/share/gdb-heap/heap/cpython.py", line 297, in categorize_refs
ma_table = int(self.field('ma_table'))
File "/usr/share/gdb-heap/heap/__init__.py", line 117, in field
return self._gdbval[attr]
gdb.error: There is no member named ma_table.
Error occurred in Python: There is no member named ma_table. To my understanding, gdb-heap is not compatible with dict implementation provided by cpython interpreter version I'm running (Python 3.6). Any pointers or comments welcomed. |
Yes, the dict implementation has changed. I patched things enough at https://github.com/edmcman/gdb-heap to avoid crashing, though I didn't fully iterate through the new data structures. |
I've tried top setup gdb-heap on my Fedora:31 machine. It feels to me gdb-heap initializes correctly and I'm able to attach to an existing process, gdb-heap commands are registered and most of them work. The issue is when I'm trying to obtain memory information using
heap
command:Installed packages:
Running Python3.6.
Thanks for any pointers.
The text was updated successfully, but these errors were encountered: