[英]Pydbg response xml, how to log it like xdebug?
我有一個關於DBGp和調試python腳本的noob問題。
我試圖讓調試會話記錄在一個文件中,我發送給服務器的每個命令都有xml響應 。
(xdebug做的很簡單,這是我想要實現的)。
我在Mac上並下載了pydbg: http ://code.activestate.com/komodo/remotedebugging/
調試工作正常,但即使我將日志記錄級別設置為DEBUG
我也只記錄發送的命令。
即:
_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']
我想記錄這樣的事情:
<- 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>
(因此記錄了xml返回值)。
我做的。
在上面url的最新pydbg中,有這個文件dbgp/client.py
。
它定義了類dbgpSocket
和方法send_response
。
在2245
行附近有:
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()
我只需要從#log.debug('sending [%r]', response)
刪除注釋到log.debug('sending [%r]', response)
,它就可以了!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.