`

使用Flex Debugger 命令行 工具

    博客分类:
  • Flex
阅读更多
 

使用Flex Debugger  命令行 工具

 

    如果你想调试你的应用程序的话,你可以使用Flex Builder进行本地或远程进行调试,但是如果你的机子上没有装Flex Builder的话,你就可以使用命令行 工具 fdb,来进行调试。

 

   为了能够被调试,你首先要做的就是要编译一个debug 版本的swf,这个debug版本的 swf 包含了调试信息,然后你就可以使用一般在C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\bin\fdb.exe (window xp)的 fdb进行调试。

 

   (fdb) help

   (fdb) tutorial

   (fdb) run

   (fdb) set $ invokegetters = 0

   (fdb) set  $listsize= 0

Command

Description

continue

Continues running the application.

file [file]

Specifies an application to be debugged, without starting it. This command does not cause the application to start; use the run command without an argument to start debugging the application.

finish

Continues until the function exits.

next [N]

Continues to the next source line in the application. The optional argument N means do this N times or until the program stops for some other reason.

quit

Exits from the debug session.

run [file]

Starts a debugging session by running the specified file. To run the application that the file command previously specified, execute the run command without any options.

The run command starts the application in a browser or stand-alone Flash Player.

step [N]

Steps into the application. The optional argument N means do this N times or until the program stops for some other reason.

These commands are nonblocking, which means that when they return, the client has at least begun the operation, but it has not necessarily finished it.


 

The following example shows a sample application after it starts:

(fdb) continue 
[trace] ComboBase: y = undefined text_mc.bl = undefined
[trace] ComboBase: y = undefined text_mc.bl = undefined
[trace] ComboBase: y = undefined text_mc.bl = undefined
[trace] ComboBase: y = undefined text_mc.bl = undefined
[trace] ComboBase: y = undefined text_mc.bl = undefined
[trace] ComboBase: y = undefined text_mc.bl = undefined
[trace] ComboBase: y = undefined text_mc.bl = undefined
[trace] RadioButtonGroup.addInstance: instance = _level0._VBox0._Accordion0._For
m2._FormItem3._RadioButton1 data = undefined label = 2005
[trace] RadioButtonGroup.addInstance: instance = _level0._VBox0._Accordion0._For
m2._FormItem3._RadioButton2 data = undefined label = 2004
[trace] RadioButtonGroup.addInstance: instance = _level0._VBox0._Accordion0._For
m2._FormItem3._RadioButton3 data = undefined label = 2005
[trace] RadioButtonGroup.addInstance: instance = _level0._VBox0._Accordion0._For
m2._FormItem3._RadioButton4 data = undefined label = 2006
[trace] ComboBase: y = 0 text_mc.bl = 12
[trace] ComboBase: y = 0 text_mc.bl = 12
[trace] ComboBase: y = 0 text_mc.bl = 12
[trace] ComboBase: y = 0 text_mc.bl = 14
 

 

    设置断点:

Command

Description

break [args]

Sets a breakpoint at the specified line or function. The argument can be a line number or function name. With no arguments, the break command sets a breakpoint at the currently stopped line (not the currently listed line).

If you specify a line number, fdb breaks at the start of code for that line. If you specify a function name, fdb breaks at the start of code for that function.

clear [args]

Clears a breakpoint at the specified line or function. The argument can be a line number or function name.

If you specify a line number, fdb clears a breakpoint in that line. If you specify a function name, fdb clears a breakpoint at the beginning of that function.

With no argument, fdb clears a breakpoint in the line that the selected frame is executing in.

Compare the delete command, which clears breakpoints by number.

commands [breakpoint]

Sets commands to execute when the specified breakpoint is encountered. If you do not specify a breakpoint, the commands are applied to the last breakpoint.

condition bnum [expression]

Specifies a condition that must be met to stop at the given breakpoint. The fdb debugger evaluates expression when the bnum breakpoint is reached. If the value is true or nonzero, fdb stops at the breakpoint. Otherwise, fdb ignores the breakpoint and continues execution.

To remove the condition from the breakpoint, do not specify an expression.

You can use conditional breakpoints to stop on all events of a particular type. For example, to stop on every initialize event, use the following commands:

(fdb) break UIEvent:dispatch Breakpoint 18 at 0x16cb3: file UIEventDispatcher.as, line 190 (fdb) condition 18 (eventObj.type == 'initialize')
delete [args]

Deletes breakpoints. Specify one or more comma- or space-separated breakpoint numbers to delete those breakpoints. To delete all breakpoints, do not provide an argument.

disable breakpoints [bp_num]

Disables breakpoints. Specify one or more space-separated numbers as options to disable only those breakpoints.

enable breakpoints [bp_num]

Enables breakpoints that were previously disabled. Specify one or more space-separated numbers as options to enable only those breakpoints.

 

 

The following example sets a breakpoint on the myFunc()

method, which is triggered when the user clicks a button:

 

 

(fdb) break myFunc

Breakpoint 1 at 0x401ef:file file1.mxml, line 5

(fdb) continue

Breakpoint 1, myFunc() at file1.mxml:5

5ta1.text = "Clicked";

(fdb)
 

 

(fdb) commands 1 
Type commands for when breakpoint 1 is hit, one per line.
End with a line saying just 'end'.
>print ta1.text 
>where 
>continue 
>end 
(fdb) cont 
Breakpoint 1, myFunc() at file1.mxml:5
 5ta1.text = "Clicked";
$1 = ""
#0 [MovieClip 1].myFunc(event=undefined) at file1.mxml:5
#1 [MovieClip 1].handler(event=[Object 18127]) at file1.mxml:15
 

 

  

(fdb) bt

 

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics