setting breakpoints, debug swf via console / terminal /prompt with fdb
August 13, 2009 – 12:00 amFinally found a nice article that explains how flex sdk's fdb command line debug tool works
Reminder for myself:
Got into it for a moment ----> this will be a messy post
found some extra info / commands within fdb now:
New to fdb? Do 'tutorial' for basic info.
List of fdb commands:
bt (bt) Print backtrace of all stack frames
break (b) Set breakpoint at specified line or function
cf (cf) Display the name and number of the current file
clear (cl) Clear breakpoint at specified line or function
condition (cond) Apply/remove conditional expression to a breakpoint
continue (c) Continue execution after stopping at breakpoint
commands (com) Sets commands to execute when breakpoint hit
delete (d) Delete breakpoints or auto-display expressions
directory (dir) Add a directory to the search path for source files
disable (disab) Disable breakpoints or auto-display expressions
disassemble (disas) Disassemble source lines or functions
display (disp) Add an auto-display expressions
enable (e) Enable breakpoints or auto-display expressions
file (fil) Specify application to be debugged.
finish (f) Execute until current function returns
handle (han) Specify how to handle a fault
help (h) Display help on fdb commands
home (ho) Set listing location to where execution is halted
info (i) Display information about the program being debugged
kill (k) Kill execution of program being debugged
list (l) List specified function or line
next (n) Step program
print (p) Print value of variable EXP
pwd (pw) Print working directory
quit (q) Exit fdb
run (r) Start debugged program
set (se) Set the value of a variable
source (so) Read fdb commands from a file
step (s) Step program until it reaches a different source line
tutorial (t) Display a tutorial on how to use fdb
undisplay (u) Remove an auto-display expression
viewswf (v) Set or clear filter for file listing based on swf
what (wh) Displays the context of a variable
where (w) Same as bt
Type 'help' followed by command name for full documentation.
(fdb)
Start an application with 'run'.
View file names with 'info sources'.
List a file with 'list'.
Set breakpoints with 'break'.
Execute program with 'continue' until a breakpoint is hit.
Examine state of program with 'where', 'print', 'info locals'.
Execute individual statements with 'next', 'step', and 'finish'.
Resume execution with 'continue'.
Quit fdb with 'quit'.
It boils down to launching FDB.EXE in your flexsdk's 'bin' dir.
- Typing run:
(fdb) run
- Open a debug-enabled swf (preferably on http in your browser since that ads-in network access if you don't have security configured for that local swf path)
- set a breakpoint via a functionname (even if it is in another file, the name will match when fdb hits it), so for example type:
(fdb) b registerModule<enter>
You have now set a breakpoint for that function name that will be resolved later, linenumbers / filenames must be possible too.
And then type continue + <enter> ( add more breakpoints if you like) and again continue + <enter>
The swf will now run until it hits the breakpoint marked functionname 'registerModule':
Resolved breakpoint 1 to registerModule() at ModuleManager.as:23
(fdb) continue + <enter>
Breakpoint 1, registerModule() at ModuleManager.as:23 (yeahaa!)
23 public function registerModule(modRegName:String,instance:IModule):void {
now by command p we want to know what the variable 'instance' holds
( note (!) if you end the variable name with a dot (.) you get more info) !:
(fdb) p instance.
outputs:
$7 = instance = [Object 758409729, class='nl.greenberry.gogeo.app::App']
_appController = [Object 757300145, class='nl.greenberry.gogeo.app::AppController']
_appDisplayModel = null
_appEventModel = null
_appModuleManager = null
_appSoundModel = null
_eventModel = [Object 758625729, class='nl.greenberry.gogeo.app::EventModel']
_modelLocator = [Object 758703937, class='nl.greenberry.gogeo.app::ModelLocator']
_moduleManager = [Object 760443361, class='nl.greenberry.gogeo.app::ModuleManager']
_moduleName = null
_stage = [Object 756722513, class='flash.display::Stage']
displayModel = [Object 757301009, class='nl.greenberry.gogeo.app::DisplayModel']
eventModel = [Object 758625729, class='nl.greenberry.gogeo.app::EventModel']
moduleManager = [Object 760443361, class='nl.greenberry.gogeo.app::ModuleManager']
moduleName = null
NAME = "Go-Geo"
soundModel = [Object 758409793, class='nl.greenberry.gogeo.app::SoundModel']
stage = [Object 756722513, class='flash.display::Stage']
VERSION = "0.0.1"
and the rest you will find out !
by the way you can alter variables realtime, and it displays your traces too:
[trace] sayHello
cheers !
Flashdevelop now complete for me ![]()