                PDBX

What is it
----------
pdbx: A remote pdb debugger Base on pdb
It's:
1) be compatible with pdb
2) remote debug supported
3) xq/xquit commands supported
    quit safely from debugger, the program being executed is continued(not abored)
4) redebug supported
5) suspend mode supported
6) pystack(like jstack) supported


Installing pdbx
---------------
1) Download pdbx from https://code.google.com/p/stonelab/downloads/list or https://pypi.python.org/pypi 
2) Unpack the archive
    tar xvf pdbx-x.x.x.tar.gz
3) Install pdbx
    sudo python setup.py install


How to use pdbx
---------------
1) Add pbdx in python scripts
e.g.
from pdbx import Rpdb
rpdb = Rpdb()                # Debugger started. Port is 8787(Default Value),   Suspend is True(Default Value)
rpdb = Rpdb(9898)            # Debugger started. Port is 9898(Specified Value), Suspend is True(Default Value)
rpdb = Rpdb(suspend=False)   # Debugger started. Port is 8787(Default Value),   Suspend is False(Specified Value) 
rpdb = Rpdb(9898, False)     # Debugger started. Port is 9898(Specified Value), Suspend is False(Specified Value) 
rpdb.set_trace()

2) Remote debug with telnet
e.g.
telnet xxx.xxx.xxx.xxx 8787

3) Interact with pdb commands
Documented commands (type help <topic>):
========================================
EOF    bt         cont      enable  jump  pp       run      unt     xq   
a      c          continue  exit    l     q        s        until   xquit
alias  cl         d         h       list  quit     step     up    
args   clear      debug     help    n     r        tbreak   w     
b      commands   disable   ignore  next  restart  u        whatis
break  condition  down      j       p     return   unalias  where

xq/xquit are new commands in pdbx
it's used to quit safely from debugger, the program being executed is continued(not abored)

4) Re-Remote debug with telnet
telnet again.

5) use pystack
enable pystack in python scripts and then run the scripts
e.g.
import pdbx
pdbx.enable_pystack()

use kill -30 pid, then scripts will print python thread stack info:
"CP Server Thread-4" tid=4369723392
    at self.__bootstrap_inner()(threading.py:525)
    at self.run()(threading.py:552)
    at conn = self.server.requests.get()(__init__.py:1367)
    at self.not_empty.wait()(Queue.py:168)
    at waiter.acquire()(threading.py:244)

"CP Server Thread-7" tid=4382343168
    at self.__bootstrap_inner()(threading.py:525)
    at self.run()(threading.py:552)
    at conn = self.server.requests.get()(__init__.py:1367)
    at self.not_empty.wait()(Queue.py:168)
    at waiter.acquire()(threading.py:244)

"MainThread" tid=140735286018432
    at app.run()(raspctl.py:173)
    at return wsgi.runwsgi(self.wsgifunc(*middleware))(application.py:313)
    at return httpserver.runsimple(func, validip(listget(sys.argv, 1, '')))(wsgi.py:54)
    at server.start()(httpserver.py:157)
    at self.tick()(__init__.py:1765)
    at s, addr = self.socket.accept()(__init__.py:1800)
    at sock, addr = self._sock.accept()(socket.py:202)
    at pystack()(pdbx.py:179)
    at for filename, lineno, _, line in traceback.extract_stack(stack):(pdbx.py:168)


Release Notes
-------------
V0.1.0
1) remote debug supported

V0.2.0
1) xq/xquit supported
2) redebug supported
3) suspend mode supported
4) add setup.py

v0.3.0
1) pystack supported

Author Info
-----------
author: stone2083<Stone.J>
email:  stone2083@yahoo.cn
blog:   http://www.blogjava.net/stone2083
site:   https://code.google.com/p/stonelab
