1

I have a noob question regarding DBGp and debugging a python script.

I am trying to make the debugging session logged in a file, with the xml response for every command I send to server.

(xdebug does that trivially and it's what I am trying to achieve).

I'm on a mac and downloaded pydbg: http://code.activestate.com/komodo/remotedebugging/

The debugging is working, but even when I set the logging level to DEBUG I get to log only the commands sent.

i.e.:

_getIncomingDataPacket getting data...
    33['property_get -i 6 -n A -d 0 -p 0\x00']
    put data in queue ['property_get -i 6 -n A -d 0 -p 0']

I want to log something like this:

<- breakpoint_set -i 1 -t line -f file:///Users/teixeira/etudes_php/vdebug.php -n 9 -s enabled
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="1" state="enabled" id="183320001"></response>

(so the xml return is logged).

Niloct
  • 9,491
  • 3
  • 44
  • 57

1 Answers1

0

I did it.

In latest pydbg from above url, there is this file dbgp/client.py.

It defines class dbgpSocket, and a method send_response.

Around line 2245 there is:

def send_response(self, response):
    if self._stop:
        return
    header = u'<?xml version="1.0" encoding="utf-8"?>\n'
    response = (header+response)
    try:
        response = response.encode('utf-8')
    except (UnicodeEncodeError,UnicodeDecodeError), e:
        pass
    #log.debug('sending [%r]', response)
    try:
        self._socket.send(_encode_response(response))
    except socket.error, e:
        self.stop()

I just had to remove comment from line #log.debug('sending [%r]', response), to log.debug('sending [%r]', response), and it worked!

Niloct
  • 9,491
  • 3
  • 44
  • 57