Comments (9)
build gdb from source with python2.7 support fix this.
from pyringe.
FYI that caret on the line just above the SyntaxError points to the L in 1L on the terminal
from pyringe.
Could you post the output of ldd
which gdb``? My intuition tells me libpython.py is executed as python 3, so libpython3.X.so should turn up in the output of that.
from pyringe.
Yes, you're right:
linux-vdso.so.1 => (0x00007fff113fe000)
libreadline.so.6 => /lib/x86_64-linux-gnu/libreadline.so.6 (0x00007f3705ad2000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f37058ce000)
libncurses.so.5 => /lib/x86_64-linux-gnu/libncurses.so.5 (0x00007f37056aa000)
libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f3705481000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f3705268000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3704f63000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3704d46000)
libpython3.3m.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython3.3m.so.1.0 (0x00007f370472e000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f3704503000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f37042e1000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3703f19000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3705d38000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f3703d15000)
from pyringe.
Hmm, I didn't know people did that already. I'll be extremely surprised if that works, but try starting pyringe with an appropriate libpython.so LD_PRELOADed:
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libpython2.7.so python -m pyringe
(Adjust the command line appropriately)
Just out of curiosity, which distro (+version), and version of gdb are you running there?
from pyringe.
I'll give the LD_PRELOAD a try. It's Ubuntu 13.10, gdb version 7.6.1-ubuntu
from pyringe.
Btw, did the LD_PRELOAD-hack work? In that case I'd like to close this issue for now.
from pyringe.
I get this error subprocess.CalledProcessError: Command '['gdb', '--version']' returned non-zero exit status -11
when using LD_PRELOAD-hack on ubuntu 14.04
~# LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libpython2.7.so gdb --version
Segmentation fault
~# echo $?
139
~# LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libpython2.7.so python -m pyringe
Pyringe (Python 2.7.6) on linux2
For a list of debugger commands, try "help()". (python's help is available as pyhelp.)
==> pid:[None] #threads:[0] current thread:[None]
>>> attach(17102)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pyringe/repl.py", line 161, in Attach
self.inferior.Reinit(pid)
File "/usr/local/lib/python2.7/dist-packages/pyringe/inferior.py", line 484, in Reinit
self.__init__(pid, auto_symfile_loading, architecture=self.arch)
File "/usr/local/lib/python2.7/dist-packages/pyringe/inferior.py", line 456, in __init__
self.StartGdb()
File "/usr/local/lib/python2.7/dist-packages/pyringe/inferior.py", line 502, in StartGdb
self._gdb = GdbProxy(arch=self.arch)
File "/usr/local/lib/python2.7/dist-packages/pyringe/inferior.py", line 134, in __init__
gdb_version = GdbProxy.Version()
File "/usr/local/lib/python2.7/dist-packages/pyringe/inferior.py", line 240, in Version
output = subprocess.check_output(['gdb', '--version']).split('\n')[0]
File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['gdb', '--version']' returned non-zero exit status -11
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/pyringe/__main__.py", line 19, in <module>
pyringe.interact()
File "/usr/local/lib/python2.7/dist-packages/pyringe/__init__.py", line 25, in interact
DebuggingConsole().interact()
File "/usr/local/lib/python2.7/dist-packages/pyringe/repl.py", line 230, in interact
prompt = self.StatusLine() + '\n' + sys.ps1
File "/usr/local/lib/python2.7/dist-packages/pyringe/repl.py", line 135, in StatusLine
self.inferior.StartGdb()
File "/usr/local/lib/python2.7/dist-packages/pyringe/inferior.py", line 502, in StartGdb
self._gdb = GdbProxy(arch=self.arch)
File "/usr/local/lib/python2.7/dist-packages/pyringe/inferior.py", line 134, in __init__
gdb_version = GdbProxy.Version()
File "/usr/local/lib/python2.7/dist-packages/pyringe/inferior.py", line 240, in Version
output = subprocess.check_output(['gdb', '--version']).split('\n')[0]
File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['gdb', '--version']' returned non-zero exit status -11
~# gdb --version
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
from pyringe.
FWIW, LD_PRELOAD
(unsurprisingly) does not work:
$ ldd $( which gdb ) | grep python
libpython3.5m.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0 (0x00007fe8f156a000)
$ gdb --version
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
…
$ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libpython2.7.so.1 gdb --version
Segmentation fault
from pyringe.
Related Issues (20)
- gdb: unrecognised option '--nh' HOT 6
- attach(): AttributeError: 'module' object has no attribute 'poll' HOT 6
- Python 3 friendly? HOT 3
- Pyringe falls over if something (GdbProxy?) reports a non-numeric version HOT 5
- Debug Symbols on Ubuntu HOT 7
- No way to set log level from debugger repl HOT 1
- Failed to automatically load symbol file HOT 1
- syntax error in libpython.py HOT 8
- attach failed HOT 1
- WindowsError: [Error 2] The system cannot find the file specified HOT 3
- attach failed with TimeoutError exception HOT 1
- ModuleNotFoundError: No module named 'inferior' HOT 2
- Git tags missing?
- Fix simple typo: currenly -> currently
- Arch Linux not supported HOT 3
- Fall back to signal injection if symbol info is partial.
- payload directory should be in setup.py as data files, not submodule
- Support for debugging other versions of cpython
- Investigate PyFrame_FastToLocals
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 pyringe.