Giter VIP home page Giter VIP logo

Comments (9)

ilovenwd avatar ilovenwd commented on August 14, 2024 1

build gdb from source with python2.7 support fix this.

from pyringe.

thomasj02 avatar thomasj02 commented on August 14, 2024

FYI that caret on the line just above the SyntaxError points to the L in 1L on the terminal

from pyringe.

TehMillhouse avatar TehMillhouse commented on August 14, 2024

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.

thomasj02 avatar thomasj02 commented on August 14, 2024

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.

TehMillhouse avatar TehMillhouse commented on August 14, 2024

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.

thomasj02 avatar thomasj02 commented on August 14, 2024

I'll give the LD_PRELOAD a try. It's Ubuntu 13.10, gdb version 7.6.1-ubuntu

from pyringe.

TehMillhouse avatar TehMillhouse commented on August 14, 2024

Btw, did the LD_PRELOAD-hack work? In that case I'd like to close this issue for now.

from pyringe.

ilovenwd avatar ilovenwd commented on August 14, 2024

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.

posita avatar posita commented on August 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.