Coder Social home page Coder Social logo

Failed to run heap on Fedora:31 about gdb-heap HOT 2 OPEN

rogerhu avatar rogerhu commented on August 21, 2024
Failed to run heap on Fedora:31

from gdb-heap.

Comments (2)

edmcman avatar edmcman commented on August 21, 2024 1

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.

from gdb-heap.

fridex avatar fridex commented on August 21, 2024

After digging further, it looks like the gdb python interface has changed, more precisely native _gdb and its Value has changed and it no longer provides str:

(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:

gdb-heap/heap/cpython.py

Lines 279 to 284 in b0a6efc

def categorize_refs(self, usage_set, level=0, detail=None):
m_str = int(self.field('str'))
usage_set.set_addr_category(m_str,
Category('cpython', 'PyUnicodeObject buffer', detail),
level)
return True

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:

gdb-heap/heap/__init__.py

Lines 364 to 365 in b0a6efc

if level <= u.level:
if debug:

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.

from gdb-heap.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.