BigEd / python-on-a-chip

Automatically exported from code.google.com/p/python-on-a-chip
Other
1 stars 3 forks source link

improve pmHeapDump.py (64 bits support, incomplete objects description, etc) #136

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
While trying to have it works on amd64, i've found that pmHeapDump.py has some 
limitation:

1) hardcodes pointer size. Ex. in _parse_str:

d['cache_next'] = struct.unpack("P", self.heap[addr + 2 : addr + 6])[0]

assumes that:
- pointer size is 4 bytes => cannot be used on 64bits
- pointer size is the same as on the host => target and host cannot differs

2) objects fields aren't complete

3) HAVE_ features would be necessary to decode objects

4) objects definition are hard to maintain

Original issue reported on code.google.com by monnet.a...@gmail.com on 9 Sep 2010 at 10:48

GoogleCodeExporter commented 9 years ago
Attached is a patch to r595 which improve heapdump:

changes:

* heap.c:
 - added some magic data "PM(DU|UD)MP" to validate the file (and to
get endianess)
 - added architecture adress size
 - added a dump version
 - added a bitarray of features in use
 - changed int to uint16_t / uint32_t for arch independence

* pmHeapDump.py:
 - reads the new information in the dump header to correctly size
pointer length, get endianess, pymite's features.
 - output summary information + object information or a dot file
 - make use of optparse to parse command line
 - _parse_* are replaced by a generic parser + string definition
fields to ease maintenance
 - uses dump's pmfeatures to build correct definition of objects
fields
 - up to date definition of objects fields
 - uses a unpack_fp function to ease unpacking of fields 

Original comment by monnet.a...@gmail.com on 9 Sep 2010 at 10:52

Attachments:

GoogleCodeExporter commented 9 years ago
r597
- Applied the given patch, modified pmHeapDump.py to meed coding conventions  
(no substantive change to the operation of the patch).

Tests pass.  Mainlined directly.

Original comment by dwhall...@gmail.com on 13 Sep 2010 at 10:52

GoogleCodeExporter commented 9 years ago
r602
- Added thanks to README

Post mainline checkin

Original comment by dwhall...@gmail.com on 15 Sep 2010 at 2:22

GoogleCodeExporter commented 9 years ago

Original comment by dwhall...@gmail.com on 29 Sep 2010 at 7:24