You may wonder what happens
when a user requests a page
that is being debugged. He’ll
generally see the page request
waiting in the browser, as if the
request is just taking a long
time.
Both CFML debuggers can
intercept a request from any
user, not just the user who
initiated the debugging session. This is a two-edged sword:
The good news is that you can use this feature to intercept a request other than one you yourself
initiated. How often have you tried to understand why a problem was happening to a user in
production or testing, but been unable to recreate it locally? Or, the debugger can intercept a
request made by something other than a browser, such as web services, Flex, Ajax, and more.
More on all that in the sidebar, “Why Use a Step Debugger?”
Using this feature also means that anyone on that server being debugged will be aected
when you set a breakpoint. This certainly speaks to taking caution about setting breakpoints in
production. Still, it’s nifty that you can. But remember – with power comes responsibility.
Here’s another area where the CF8 debugger diers from FusionDebug. As I explained in my
FusionDebug article, FusionDebug intercepts all requests from all such users, which means
you may see several dierent requests piling up in the interface, ready for you to debug. The
CF8 debugger works dierently; it stops only the rst request it receives for a given page.
All other requests for that page are ignored by the debugger while the rst request is being
debugged.
Observing Program State Information (Variables)
Being able to stop the program in its tracks may seem only mildly interesting, but the real
power lies in your ability to learn a lot about what was going on in the program while you
are stopped at a breakpoint in the debugger. For instance, you can see all the variables that
may have been set either in the program or perhaps in other templates before this one
executed.
The CF8 debugger (again, just like FusionDebug) provides a Variables view, which in the
case of the code as seen in Figure 1, would show the following:
You can see (in Figure 2) that a
structure with a key and an array
has been created. You can expand
the local
Variables
scope, and
any
Application
,
Session
,
Server
, or
other scopes. (You can congure
which scopes are viewable in
the Debug Settings preferences
page, as discussed in the Adobe
documentation mentioned above
and later in this article.) If you were
stopped within a method, you
could also see the local
Var
and
This
scopes. Isn’t that a whole lot easier
Figure 1: Simple sample code
Figure 2: Variables view
The Fusion Authority Quarterly Update Tools 91
Comentarios a estos manuales