今までtraceでデバッグしてきましたが、一度は使ってみようと思い使ってみました。便利ではありませんが、処理の流れを確かめたいというときはよいと思います。
###デバッグの準備:デバッグ用AIRの準備
1つ目のコマンドプロンプト開き、デバッグ用flashを生成します。
shell>>
C:\test_app>amxmlc -debug=true app.mxml
<<--
###デバッグの準備:fdbコマンドラインデバッガ
2つ目のコマンドプロンプト開きます
shell>>
C:\flex_sdk_3\bin>fdb
(fdb) run
Player が接続するのを待っています
<<--
###デバッガーの開始
1つ目のプロンプトで、AIRアプリを実行します
shell>>
C:\test_app>adl app.xml
<<--
2つ目のプロンプトでAIRアプリが接続した旨が表示されます
shell>>
(fdb) run
Player が接続するのを待っています
Player が接続されました。セッションを開始しています。
[SWF] app.swf - 1,177,344 バイト (解凍後)
<<--
###ブレークポイントを設定する
ファイル:app.mxmlの62行目に追加する場合
shell>>
(fdb) b app.mxml:62
(fdb) continue
SWF ファイルまたはフレームから追加の ActionScript コードがロードされました。
現在ロードされているすべてのファイルを表示するには、「info files」と入力してくだ
さい。
ブレークポイント 7 が app.mxml:62 の onAppComplete() に解決されました
<<--
###ブレークポイントの確認
shell>>
(fdb) info breakpoints
Num Type Disp Enb Address What
7 breakpoint keep y 0x00000000 の場所にある onAppComplete() 内 app.mxml:62
<<--
###ブレークポイントの削除
continueを発行してブレークポイントが設定できなかった場合など、下記のように削除します
shell>>
(fdb) delete 2
(fdb) delte 3 6
(fdb) continue
<<--
###スタックトレースの表示
ブレークポイントで停止した際に下記のコマンドでスタックトレースが表示されます
shell>>
(fdb) bt
#0 this = [Object 35225761, class='memoApp'].app/onAppComplete(e=[Object 3
7504001, class='mx.events::AIREvent']) 場所 : app.mxml:62
#1 EventDispatcher/dispatchEventFunction() 場所 : app.mxml:0
#2 this = [Object 35225761, class='memoApp'].EventDispatcher/dispatchEvent(_ar
g1=[Object 37504001, class='mx.events::AIREvent']) 場所 : app.mxml:0
#3 this = [Object 35225761, class='memoApp'].UIComponent/dispatchEvent(event=[
Object 37504001, class='mx.events::AIREvent']) 場所 : UIComponent.as:9051
#4 this = [Object 35225761, class='memoApp'].WindowedApplication/enterFrameHan
dler(e=[Object 37504289, class='flash.events::Event']) 場所 : WindowedApplicati
on.as:2522
<<--
###Refs
http://livedocs.adobe.com/flex/3_jp/html/help.html?content=CommandLineTools_4.html
http://livedocs.adobe.com/flex/3_jp/html/help.html?content=debugging_03.html#240390
http://livedocs.adobe.com/flex/3_jp/html/help.html?content=debugging_02.html#240284
http://www.adamrocker.com/blog/151/actionscript30_flex_debugger_fdb.html