1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.11 $ -->
<appendix id="debugger">
<title>PHPのデバッグ</title>
<sect1 id="debugger-about">
<title>デバッガについて</title>
<simpara>
PHP 3ではネットワーク対応のデバッガがサポートされています。
</simpara>
<simpara>
PHP 4内部の機能としてはデバッガはサポートされていませんが、
外部デバッガモジュールを使用することが出来ます。
<ulink url="&url.zend.ide;">Zend IDE</ulink>にはデバッガが
付属していますしDBG(<ulink url="&url.dbg;">&url.dbg;</ulink>)
や<ulink url="&url.apd;">Advanced PHP Debugger</ulink>(APD)
といったフリーの外部デバッガモジュールもあります。
</simpara>
</sect1>
<sect1 id="debugger-using">
<title>デバッガの使用法</title>
<para>
PHP 3の内部デバッガはバグを追跡し、回避するのに役立ちます。この
デバッガは、PHP 3が開始されるたびに<acronym>TCP</acronym>ポートに
接続することにより動作します。そのリクエストからのすべての
エラーメッセージはこのTCPコネクションに送られます。この情報は
<acronym>IDE</acronym> や(Emacs のような)プログラマブル・エディタの
中で動作する「デバッグ用サーバ」のために使われます。
</para>
<para>
デバッガの設定方法:
<orderedlist>
<listitem>
<simpara>
<link linkend="configuration.file">設定ファイル</link>
(<link linkend="ini.debugger.port">debugger.port</link>)
でデバッガ用のTCPポートを設定し、それを
(<link linkend="ini.debugger.enabled">debugger.enabled</link>)
で有効にします。
</simpara>
</listitem>
<listitem>
<simpara>
どこかでそのポートに対してTCPリスナを設定します。
(たとえば、UNIXでは<command>socket -l -s 1400</command>)
</simpara>
</listitem>
<listitem>
<simpara>
コードの中で"debugger_on(<replaceable>host</replaceable>)"
を実行します。ここで<replaceable>host</replaceable>は
<acronym>TCP</acronym>リスナが動作しているホストのIPアドレス
又はホスト名です。
</simpara>
</listitem>
</orderedlist>
これで、すべての警告や通知などがそのリスナのソケット上に表示されます。
<emphasis>
この表示は、この後<function>error_reporting</function>でエラー出
力を抑制しても、有効のままです。
</emphasis>
</para>
</sect1>
<sect1 id="debugger-protocol">
<title>デバッガのプロトコル</title>
<para>
PHP 3のデバッガのプロトコルは行ベースです。各行には<emphasis>
タイプ</emphasis>を持ち、また<emphasis>メッセージ</emphasis>
を構成する行もあります。各メッセージはタイプ<literal>start
</literal>を持つ行で始まり、タイプ<literal>end</literal>を持つ
行で終わります。PHP 3は異なったメッセージを持つ行を同時に送ることが
あります。
</para>
<para>
各行のフォーマット:
<informalexample>
<literallayout>
<replaceable>日付</replaceable>
<replaceable>時刻</replaceable>
<replaceable>ホスト</replaceable>
(<replaceable>プロセスID</replaceable>)
<replaceable>タイプ</replaceable>:
<replaceable>メッセージデータ</replaceable>
</literallayout>
</informalexample>
<variablelist>
<varlistentry>
<term><replaceable>日付</replaceable></term>
<listitem>
<simpara>ISO 8601フォーマットの日付
(<replaceable>yyyy</replaceable>-<replaceable>mm</replaceable>-<replaceable>dd</replaceable>)
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>時刻</replaceable></term>
<listitem>
<simpara>マイクロ秒単位の時刻:
<replaceable>hh</replaceable>:<replaceable>mm</replaceable>:<replaceable>uuuuuu</replaceable>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>ホスト名</replaceable></term>
<listitem>
<simpara>
スクリプト・エラーを生成したホストのDNS名
またはIPアドレス。
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>プロセスID</replaceable></term>
<listitem>
<simpara>
<replaceable>ホスト</replaceable>において
このエラーを生成したPHP 3スクリプトのプロセスID
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>タイプ</replaceable></term>
<listitem>
<para>
行のタイプ。以降に続くデータをどう解釈すべきかを、
受信プログラムに知らせます。
<table>
<title>デバッガの行タイプ</title>
<tgroup cols="2">
<thead>
<row>
<entry>名前</entry>
<entry>意味</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>start</literal></entry>
<entry>
デバッガ・メッセージがここから始まることを受信プログラムに
伝える役割をします。<replaceable>データ</replaceable> の内容
は、以下に示すエラーメッセージのタイプです。
</entry>
</row>
<row>
<entry><literal>message</literal></entry>
<entry>PHP 3エラーメッセージ</entry>
</row>
<row>
<entry><literal>location</literal></entry>
<entry>
エラーが発生したファイル名と行番号。最初の
<literal>location</literal>行は常に最上位レベルの位置が
入っています。<replaceable>データ</replaceable>は
<literal><replaceable>ファイル名</replaceable>:
<replaceable>行番号</replaceable></literal>のようになります。
<literal>message</literal> の後、および、すべての
<literal>function</literal> の後の行には常に
<literal>location</literal> が付きます。
</entry>
</row>
<row>
<entry><literal>frames</literal></entry>
<entry>
後に続くスタックダンプの中のフレーム数。もし4フレームあれば、
4レベルに渡ってコールされた関数の情報があることになります。
"frames" 行がない場合は、ネストの深さは0
(エラーはトップレベルで起こった)と仮定されます。
</entry>
</row>
<row>
<entry><literal>function</literal></entry>
<entry>
エラーが発生した関数名。関数コール・スタックにおいて、各レベル
毎に繰り返されます。
</entry>
</row>
<row>
<entry><literal>end</literal></entry>
<entry>
受信プログラムに対して、デバッガのメッセージがここで終わる
ことを知らせます。
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>データ</replaceable></term>
<listitem>
<simpara>行データ</simpara>
</listitem>
</varlistentry>
</variablelist>
<table>
<title>デバッガのエラータイプ</title>
<tgroup cols="2">
<thead>
<row>
<entry>デバッガ</entry>
<entry>PHP 3内部</entry>
</row>
</thead>
<tbody>
<row>
<entry><errortype>警告</errortype></entry>
<entry><errortype>E_WARNING</errortype></entry>
</row>
<row>
<entry><errortype>エラー</errortype></entry>
<entry><errortype>E_ERROR</errortype></entry>
</row>
<row>
<entry><errortype>パース</errortype></entry>
<entry><errortype>E_PARSE</errortype></entry>
</row>
<row>
<entry><errortype>通知</errortype></entry>
<entry><errortype>E_NOTICE</errortype></entry>
</row>
<row>
<entry><errortype>コア・エラー</errortype></entry>
<entry><errortype>E_CORE_ERROR</errortype></entry>
</row>
<row>
<entry><errortype>コア警告</errortype></entry>
<entry><errortype>E_CORE_WARNING</errortype></entry>
</row>
<row>
<entry><errortype>未定義</errortype></entry>
<entry>(その他)</entry>
</row>
</tbody>
</tgroup>
</table>
<example>
<title>デバッガメッセージの例</title>
<literallayout>
1998-04-05 23:27:400966 lucifer.guardian.no(20481) start: notice
1998-04-05 23:27:400966 lucifer.guardian.no(20481) message: Uninitialized variable
1998-04-05 23:27:400966 lucifer.guardian.no(20481) location: (&null;):7
1998-04-05 23:27:400966 lucifer.guardian.no(20481) frames: 1
1998-04-05 23:27:400966 lucifer.guardian.no(20481) function: display
1998-04-05 23:27:400966 lucifer.guardian.no(20481) location: /home/ssb/public_html/test.php3:10
1998-04-05 23:27:400966 lucifer.guardian.no(20481) end: notice
</literallayout>
</example>
</para>
</sect1>
</appendix>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
|