• Stars
    star
    123
  • Rank 290,145 (Top 6 %)
  • Language
    Python
  • License
    BSD 2-Clause "Sim...
  • Created almost 14 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Wrapper around pdb allowing remote debugging via netcat or telnet. This is especially useful in a Tomcat/Jython environment where little debugging tools are available.

rpdb - remote debugger based on pdb

rpdb is a wrapper around pdb that re-routes stdin and stdout to a socket handler. By default it opens the debugger on port 4444:

import rpdb; rpdb.set_trace()

But you can change that by simply instantiating Rpdb manually:

import rpdb
debugger = rpdb.Rpdb(port=12345)
debugger.set_trace()

It is known to work on Jython 2.5 to 2.7, Python 2.5 to 3.1. It was written originally for Jython since this is pretty much the only way to debug it when running it on Tomcat.

Upon reaching set_trace(), your script will "hang" and the only way to get it to continue is to access rpdb using telnet, netcat, etc..:

nc 127.0.0.1 4444

Installation in CPython (standard Python)

pip install rpdb

For a quick, ad hoc alternative, you can copy the entire rpdb subdirectory (the directory directly containing the __init__.py file) to somewhere on your $PYTHONPATH.

Installation in a Tomcat webapp

Just copy the rpdb directory (the one with the __init__.py file) in your WEB-INF/lib/Lib folder along with the standard Jython library (required).

Trigger rpdb with signal

set_trace() can be triggered at any time by using the TRAP signal handler. This allows you to debug a running process independantly of a specific failure or breakpoint:

import rpdb
rpdb.handle_trap()

# As with set_trace, you can optionally specify addr and port
rpdb.handle_trap("0.0.0.0", 54321)

Calling handle_trap will overwrite the existing handler for SIGTRAP if one has already been defined in your application.

Known bugs

  • The socket is not always closed properly so you will need to ^C in netcat and Esc+q in telnet to exit after a continue or quit.
  • There is a bug in Jython 2.5/pdb that causes rpdb to stop on ghost breakpoints after you continue ('c'), this is fixed in 2.7b1.

Author(s)

Bertrand Janin <[email protected]> - http://tamentis.com/

With contributions from (chronological, latest first):

This is inspired by:

More Repositories

1

cartman

Command line Trac tools
Python
22
star
2

mdp

minimalist password safe
C
13
star
3

tbclock

tbclock is a dirty little app that displays a full screen binary clock in your terminal (using curses). It is quite simple and features modules like "guessbin" a little time guessing game and "chrono" an accurate timer with tenth of seconds.
C
11
star
4

ksh

Port of the OpenBSD ksh shell
C
10
star
5

prwd

prwd is a replacement for your shell's PS1, it provides a simple templating language with commands to customize your prompt.
C
10
star
6

go-mplayer

MPlayer wrapper for Go
Go
8
star
7

uncsv

command-line filter converting to or from a CSV stream
C
5
star
8

sleepuntil

sleep until a given time (at syntax)
C
4
star
9

pyjdwp

Python module used to access the standard Java debugging framework via JDWP. It comes with pyjdb, a Java debugger written in Python (with proper readline support).
Python
4
star
10

rezerwar

rezerwar is a puzzle game that could be described as the illegitimate child of a known tetromino game and the average pipe game. It runs on Linux, Windows, Nintendo Wii (homebrew), FreeBSD, Amiga OS, etc. The whole game was created with open-source software including graphics, sounds and musics.
C
4
star
11

openscrolls

Miscellaneous tools to handle data files of Daggerfall from Bethesda.
Python
3
star
12

curfuel

Arduino based heating fuel tank monitoring system.
C
3
star
13

pg_trace

Trace PostgreSQL processes, translating file descriptors into objects (tables, indexes, etc.)
C
3
star
14

nzbsort

Small Python tool to sort an NZB file by subject (files) alphabetically. This comes in handy if you want to pipe the files in order as they come.
Python
3
star
15

meteoglobal

Community forecast
Python
2
star
16

psutil

Clone of the psutil SVN repository on Google Code
Python
2
star
17

libtaiga

CGI C toolkig, a.k.a. buffer overflow galore
C
1
star
18

tmux

Clone of tmux from OpenBSD's CVS
C
1
star
19

rsthome

Restructured Text Based Homepage
Python
1
star
20

tictactroll

Inverted Tic Tac Toe game using the Pyramid framework.
Python
1
star
21

requests_port

OpenBSD py-requests port
1
star
22

envoy_port

OpenBSD py-envoy port
1
star
23

vimpaste

Paste system for Vim users
Python
1
star
24

termentis

Monospace bitmap font for X11/X.org
1
star
25

hle

hle stands for hiveland explorer, it will be an attempt to render the site hiveland.com in OpenGL.
C
1
star
26

gunicorn_port

OpenBSD py-gunicorn port
1
star
27

akimwtk

Alex Kidd in Miracle World Toolkit
Python
1
star
28

walseq

Print sequential WAL segment filenames
Go
1
star
29

mrsplitman

Experimental Erlang IRC bot
Erlang
1
star
30

chartesque

Attempt at creating a small and fast data plotting library in C using Cairo.
C
1
star
31

desktitle

Module for the Enlightenment (E17) desktop displaying the name of the current desktop as a widget on your wallpaper.
C
1
star