リモートデバッグ設定の苦難

「リモートデバッグ設定の苦難」の編集履歴(バックアップ)一覧はこちら

リモートデバッグ設定の苦難」(2011/04/11 (月) 01:46:11) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

**恐ろしきpydevd pydevd.pyとはリモートデバッグサーバ機能を有するpythonモジュール。 これを動かすのは超簡単。 しかし、リモートのクライアントからこのサーバに向けたtcp通信を確立するのが超大変だった。 まず、forwardingはクライアントからサーバに向けてやらなければならないことに気付かなかった。。 気づいてもそのあとが大変。。 リモートクライアントがubuntuなのだが、なぜかサーバにフォワードされているゲートウェイの5678ポートにtcpが確立できない。。orz [root@remotehost]telnet ゲートウェイIP 5678 [root@remotehost]telnet localhost 5678 としてもconnection refusedされてしまうのである。 dportが5678のものは遮断されてしまうのかと推測してuwf(ubuntuのファイアウォールらしい)をinactiveにしてもダメですた。 ubuntuのセキュリティは盤石なので、sshで5678のポートフォワードを試みる! pydevd.settrace('192.168.0.1', port=5678, stdoutToServer=True, stderrToServer=True) これは相手先のソケットアドレスを指定しているが、自ポートはどこを指定すれば? ここでもしかしてサーバとクライアントを間違えていたことに気付く。以下pydevd_file_utiles.py @note: in this context, the server is where your python process is running#サーバはパイソンが走っている方、クライアントはエクリプスの方 and the client is where eclipse is running. E.g.: If the server (your python process) has the structure /user/projects/my_project/src/package/module1.py #例えばlinuxの方でこうなってるんなら and the client has: c:\my_project\src\package\module1.py #同じモジュールを同じ階層で置かなくてはならない? the PATHS_FROM_ECLIPSE_TO_PYTHON would have to be: PATHS_FROM_ECLIPSE_TO_PYTHON = [(r'c:\my_project\src', r'/user/projects/my_project/src')] でもこの条件だとexlipseの方でDebug Serverが動いているから矛盾を感じる。。 よく分からなくなったのでpydevd.pyのsettraceの宣言部分を読んでみると興味深い説明が! def settrace(host=None, stdoutToServer=False, stderrToServer=False, port=5678, suspend=True, trace_only_current_thread=True): '''Sets the tracing function with the pydev debug function and initializes needed facilities. @param host: the user may specify another host, if the debug server is not in the same machine (default is the local host)#ホストを省略するとlocalhostに(つまり通常のデバッグ) @param stdoutToServer: when this is true, the stdout is passed to the debug server @param stderrToServer: when this is true, the stderr is passed to the debug server so that they are printed in its console and not in this process console. @param port: specifies which port to use for communicating with the server (note that the server must be started in the same port). @note: currently it's hard-coded at 5678 in the client#クライアントのポートはハードコーディングでサーバ側と同じ5678 @param suspend: whether a breakpoint should be emulated as soon as this function is called. #settraceはブレークポイントと同義 @param trace_only_current_thread: determines if only the current thread will be traced or all future threads will also have the tracing enabled.#スレッドに関すること? ''' 分かったこと -いかなる場合もpydevd.pyがデバッグサーバのクライアントとして働いている。つまりpydevd.pyは -pydevd_file_utiles.pyの中身はサーバとeclipse(client)が別ホストで動いている場合だから考慮する必要なし? -とりあえずリモートのubuntuでpydevdが使える環境にする! 何も設定しなくてもpydevd普通に使えた!sshでポートフォワーディングしたら5678も通った。 ssh -L 5678:133.31.55.237:5678 omori@192.168.0.1 ----
**恐ろしきpydevd pydevd.pyとはリモートデバッグサーバ機能を有するpythonモジュール。 これを動かすのは超簡単。 しかし、リモートのクライアントからこのサーバに向けたtcp通信を確立するのが超大変だった。 まず、forwardingはクライアントからサーバに向けてやらなければならないことに気付かなかった。。 気づいてもそのあとが大変。。 リモートクライアントがubuntuなのだが、なぜかサーバにフォワードされているゲートウェイの5678ポートにtcpが確立できない。。orz [root@remotehost]telnet ゲートウェイIP 5678 [root@remotehost]telnet localhost 5678 としてもconnection refusedされてしまうのである。 dportが5678のものは遮断されてしまうのかと推測してuwf(ubuntuのファイアウォールらしい)をinactiveにしてもダメですた。 ubuntuのセキュリティは盤石なので、sshで5678のポートフォワードを試みる! pydevd.settrace('192.168.0.1', port=5678, stdoutToServer=True, stderrToServer=True) これは相手先のソケットアドレスを指定しているが、自ポートはどこを指定すれば? ここでもしかしてサーバとクライアントを間違えていたことに気付く。以下pydevd_file_utiles.py @note: in this context, the server is where your python process is running#サーバはパイソンが走っている方、クライアントはエクリプスの方 and the client is where eclipse is running. E.g.: If the server (your python process) has the structure /user/projects/my_project/src/package/module1.py #例えばlinuxの方でこうなってるんなら and the client has: c:\my_project\src\package\module1.py #同じモジュールを同じ階層で置かなくてはならない? the PATHS_FROM_ECLIPSE_TO_PYTHON would have to be: PATHS_FROM_ECLIPSE_TO_PYTHON = [(r'c:\my_project\src', r'/user/projects/my_project/src')] でもこの条件だとexlipseの方でDebug Serverが動いているから矛盾を感じる。。 よく分からなくなったのでpydevd.pyのsettraceの宣言部分を読んでみると興味深い説明が! def settrace(host=None, stdoutToServer=False, stderrToServer=False, port=5678, suspend=True, trace_only_current_thread=True): '''Sets the tracing function with the pydev debug function and initializes needed facilities. @param host: the user may specify another host, if the debug server is not in the same machine (default is the local host)#ホストを省略するとlocalhostに(つまり通常のデバッグ) @param stdoutToServer: when this is true, the stdout is passed to the debug server @param stderrToServer: when this is true, the stderr is passed to the debug server so that they are printed in its console and not in this process console. @param port: specifies which port to use for communicating with the server (note that the server must be started in the same port). @note: currently it's hard-coded at 5678 in the client#クライアントのポートはハードコーディングでサーバ側と同じ5678 @param suspend: whether a breakpoint should be emulated as soon as this function is called. #settraceはブレークポイントと同義 @param trace_only_current_thread: determines if only the current thread will be traced or all future threads will also have the tracing enabled.#スレッドに関すること? ''' 分かったこと -いかなる場合もpydevd.pyがデバッグサーバのクライアントとして働いている。つまりpydevd.pyは -pydevd_file_utiles.pyの中身はサーバとeclipse(client)が別ホストで動いている場合だから考慮する必要なし? -とりあえずリモートのubuntuでpydevdが使える環境にする! 何も設定しなくてもpydevd普通に使えた!sshでポートフォワーディングしたら5678も通った。 ssh -L 5678:localhost:5678 omori@192.168.0.1 ※リモートにログインしてそこからみたlocalhost:5578へポートフォワード ssh -R 5678:localhost:5678 root@133.31.55.237 ※リモートにログインしてそこからみたlocalhost:5678からポートフォワード(root権限が必要?じゃなきゃやばいことになる) ※localhostをIPアドレスに変えるとうまくいかない。セキュリティのため? *結果 一度Gnuradio端末にログインし、そこからssh -L 5678:localhost:5678 omori@192.168.0.1をすればOK! ----

表示オプション

横に並べて表示:
変化行の前後のみ表示: