Pykdump-0.1 - Python extension and scripting support
LinuxDump-0.1 - Extra modules and examples for Pykdump
------------------------------------------------------------------
This is the initial release of framework that embeds the Python interpeter in
a dynamically-loadable 'crash' extension and lets you run Python scripts,
e.g.
crash32> extend /usr/local/lib/pykdump32.so
/usr/local/lib/pykdump32.so: shared object loaded
crash32> epython test.py
...
'Pykdump' module provides basic functionality and consists of C-extension and
pure Python module. 'LinuxDump' includes an additional library and some
examples: emulating 'dev' command, printing routing table and
emulating 'netstat -an'.
This is an early release - documentation is not complete yet, some
functionality is missing (e.g. proper access to multidimensional arrays),
performance can be further improved. But it is already quite usable for
practical purposes (as demonstrated by several real cases we worked on in
HP).
There are functions to execute GDB/crash commands and get their output, but it
is better to use highlevel API that maps C-structures to Python objects, here
is an example:
--------------------test.py------------------------------------------
#!/usr/bin/env python
# This imports all the functions you can use from pykdump
from pykdump.API import *
# Check whether symbol exists
if (symbol_exists('all_bdevs')):
print "all_bdevs exists"
# Read the contents of 'tcp_hashinfo' table. The result type is chosen
# automatically according to symbol definition
tcp_hashinfo = readSymbol('tcp_hashinfo')
# Print the size of ESTABLISHED hash-table
print tcp_hashinfo.tcp_ehash_size
---------------------------------------------------------------------
You can download the packages (sources only, no binaries yet) from
http://sourceforge.net/projects/pykdump
The framework has been successfully built and used on IA32, AMD64 (64-bit) and
IA64, adding support for other platforms should be easy but has not been done
yet. The documentation is included in Pykdump module (written using LyX,
converted to HTML and PDF).
Any help/feedback will be appreciated.
Regards,
Alex
------------------------------------------------------------------
Alexandre Sidorenko email: alexs(a)hplinux.canada.hp.com
Global Solutions Engineering: Unix Networking
Hewlett-Packard (Canada)
------------------------------------------------------------------