Voltron
Voltron is a powerful python front-end for gdb.
References
How to customize/extend Voltron:
Install (manually)
This is the procedure to follow to install Voltron manually, for instance on a custom instance of gdb or on an offline pc. This procedure follows the file install.sh from voltron repository.
- Install apt dependencies
# From voltron/install.sh
sudo apt-get -y install libreadline6-dev python-dev python-setuptools python-yaml python-pip
# To fix error "missing library libncursesw.so.5"
sudo apt-get -y install libncursesw5 # On 32-bit python, use libncursesw5:i386
- Install python dependencies
Here we install in user local site (--user
).
# Extra dependency for requests_unixsocket
pip install --user pbr
# To fix error "ImportError: No module named pkg_resources" when importing scruffy
pip install --user setuptools
# From voltron/install.sh
pip install --user 'scruffington>=0.3.6' flask flask_restful blessed pygments requests requests_unixsocket six pysigset pygments
- Check dependencies
We can check some dependencies before installing voltron. Start your gdb and run the following commands. These should run without errors. If not, check the troubleshooting section.
>>> pi import scruffy
>>> pi import flask
- Install voltron module
Now, we are ready to install voltron module. We use --no-deps
since we installed the dependencies ourselves. Use developer mode if you plan to modify voltron.
git clone https://github.com/snare/voltron
cd voltron
pip install --user --no-deps .
pip install --user --no-deps -e . # To install in "developer mode"
Source voltron from ~/.gdbinit. For the path, either point to the site-package, or to the voltron repository if installed in developer mode.
source /path/to/your/voltron/entry.py
Finally, add the following to ~/.bashrc:
# set PATH to include users' .local/bin if it exists
if [ -d "${HOME}/.local/bin" ] ; then
PATH="${HOME}/.local/bin:${PATH}"
fi
Or alternatively:
alias voltron=~/.local/bin/voltron
- Installing on offline PC
- Use
apt-offline
to transfer apt packages. - Use
pip download
to download pip packages (see Python).
- Troubleshooting
- Error
ImportError: cannot import name md5
.
- This occurs on
import flask
. Running python in debug mode (-v
), we see there is a problem around library file _hashlib.so.
/path/to/your/python -v -c "import flask" 2>&1 | egrep -i "hashlib|error" | head
# # /home/peetersm/stm/stxp70_toolset_2016.1.2/python/lib/python2.7/hashlib.pyc matches /home/peetersm/stm/stxp70_toolset_2016.1.2/python/lib/python2.7/hashlib.py
# import hashlib # precompiled from /home/peetersm/stm/stxp70_toolset_2016.1.2/python/lib/python2.7/hashlib.pyc
# dlopen("/home/peetersm/stm/stxp70_toolset_2016.1.2/python/lib/python2.7/lib-dynload/_hashlib.so", 2);
# ERROR:root:code for hash md5 was not found.
# File "/home/peetersm/stm/stxp70_toolset_2016.1.2/python/lib/python2.7/hashlib.py", line 147, in <module>
# File "/home/peetersm/stm/stxp70_toolset_2016.1.2/python/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
# raise ValueError('unsupported hash type ' + name)
# ValueError: unsupported hash type md5
# ERROR:root:code for hash sha1 was not found.
# File "/home/peetersm/stm/stxp70_toolset_2016.1.2/python/lib/python2.7/hashlib.py", line 147, in <module>
- Looking at the library dependencies using
ldd
, we have:
locate _hashlib.so
ldd /path/to/your/_hashlib.so
# linux-gate.so.1 => (0xf77c3000)
# libssl.so.6 => not found
# libcrypto.so.6 => not found
# libpython2.7.so.1.0 => not found
# libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf776a000)
# libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf75b3000)
# /lib/ld-linux.so.2 (0x5659b000)
- Looking on the internet, we find reference of libssl.so.6 and libcrypto.so.6 on RedHat 6, related to OpenSSL 0.9.8e. On Ubuntu, we find similar libraries in package libssl from Ubuntu Precise LTS 12.04 32-bit.
wget http://security.ubuntu.com/ubuntu/pool/universe/o/openssl098/libssl0.9.8_0.9.8o-7ubuntu3.2_i386.deb
dpkg -x libssl0.9.8_0.9.8o-7ubuntu3.2_i386.deb tmp
sudo cp ./tmp/lib/i386-linux-gnu/libssl.so.0.9.8 /lib/i386-linux-gnu/libssl.so.6
sudo cp ./tmp/lib/i386-linux-gnu/libcrypto.so.0.9.8 /lib/i386-linux-gnu/libcrypto.so.6
rm -rf tmp
- Error
ImportError: No module named pkg_resources
.
- Install python package setuptools (see Python).