Giter Club home page Giter Club logo

Comments (7)

BrieflyX avatar BrieflyX commented on May 29, 2024

You could just cast gdb.Value to int, just replace m.address to int(m.address).
There are several same problems in the whole script, not working on gdb compiled with python 3.

from libheap.

cloudburst avatar cloudburst commented on May 29, 2024

I committed a fix for the first one in 5a3b70f

I'm not sure where the second one is occurring. Do you maybe have an old git checkout? As I don't see the line "{:#x}".format(self.val['top']) anywhere in current code. Thanks for the report.

from libheap.

jmpews avatar jmpews commented on May 29, 2024

@BrieflyX Yes, i just replace all gdb.Value with int. i just found all gdb.Value object with __str__ attribute, so... (最近在研究 heap 相关的, 你平时用 weibo 么? 希望可以多交流.)
@cloudburst https://github.com/cloudburst/libheap/blob/master/prettyprinters.py#L60, most in prettyprinters.py.

def pretty_print_heap_lookup(val):
    "Look-up and return a pretty printer that can print val."

    val_type = val.type

    # If it points to a reference, get the reference.
    if val_type.code == gdb.TYPE_CODE_REF:
        val_type = val_type.target()

    # Get the unqualified type, stripped of typedefs.
    val_type = val_type.unqualified().strip_typedefs()

    # Get the type name.
    typename = val_type.tag
    if typename == None:
        return None
    elif typename == "malloc_par":
        return malloc_par_printer(val)
    elif typename == "malloc_state":
        return malloc_state_printer(val)
    elif typename == "malloc_chunk":
        return malloc_chunk_printer(val)
    elif typename == "_heap_info":
        return heap_info_printer(val)
    else:
        print(typename)

    # Cannot find a pretty printer for type(val)
    return None

gdb.pretty_printers.append(pretty_print_heap_lookup)

gdb print is enough for me, so i just #gdb.pretty_printers.append(pretty_print_heap_lookup).

from libheap.

BrieflyX avatar BrieflyX commented on May 29, 2024

@jmpews 不怎么用微博:(,欢迎多多交流~

from libheap.

cloudburst avatar cloudburst commented on May 29, 2024

I just tried this with gdb 7.11.1 (64bit/python3) on Ubuntu 16.04 LTS and I can't reproduce the pretty printer errors.

(gdb) python print(malloc_state(0xdeadbeef)), etc works fine for me.

Please reopen if you can show a sample command that will trigger the second error. Thank you.

from libheap.

cloudburst avatar cloudburst commented on May 29, 2024

@jmpews The pretty printers error is now fixed in 63b3dd2

Sorry I couldn't originally understand how to reproduce. I am working on fixing other errors as well. Thank you for opening an issue!

from libheap.

cloudburst avatar cloudburst commented on May 29, 2024

@jmpews I've now tested the library rewrite on Ubuntu 14.04 and 16.04 on both 32bit and 64bit. I think all of the casting errors should be gone now.

Please let me know if you have any more issues with the latest git checkout!

from libheap.

Related Issues (20)

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.