Comments (7)
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.
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.
@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.
@jmpews 不怎么用微博:(,欢迎多多交流~
from libheap.
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.
@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.
@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)
- problem when installed in virtualenv HOT 1
- Unable to import from gdb HOT 1
- how to use it with diffirent glibc version HOT 13
- Lots of Python runtime error HOT 3
- where is the definition of c_none, c_title, c_header? HOT 2
- Colorful print issue with peda HOT 3
- ImportError: No module named pyptmalloc HOT 4
- libheap fails to load any heap status HOT 3
- gdb.error 'Cannot find thread-local storage' HOT 18
- ERROR - Run command HOT 2
- Exception HOT 1
- Python Exception <class 'AttributeError'> HOT 2
- heap.png issue
- Infinite Loop when Double Free
- How can use it in Kali 2.0-64bit? HOT 1
- Which package install on archlinux instead of libc6-dbg HOT 1
- Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'address': HOT 2
- heap.png how to extend? HOT 5
- sbrk_base is the same as sbrk_end HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libheap.