Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Stepping through an application – PB Docs 125 – PowerBuilder Library

Stepping through an application – PB Docs 125

Stepping through an application

When you have stopped execution at a breakpoint, you can use
several commands to step through your application code and use the
views to examine the effect of each statement. As you step through
the code, the debugger views change to reflect the current context
of your application and a yellow arrow cursor indicates the next
statement to be executed.

note.png Updating the Source view

When the context of your application changes to another script,
the Source view is updated with the new context. If you have multiple
Source views open, only the first one opened is updated.

Single-stepping through an application

You can use either Step In or Step Over to step through an
application one statement at a time. They have the same result except
when the next statement contains a call to a function. Use Step
In if you want to step into a function and examine the effects of
each statement in the function. Use Step Over to execute the function
as a single statement.

proc.png To step through an application entering functions:

  1. Click the Step In button in the PainterBar,
    or select Debug>Step In from the menu bar.

proc.png To step through an application without entering
functions:

  1. Click the Step Over button in the PainterBar,
    or select Debug>Step Over from the menu bar.

note.png Using shortcut keys

To make it easier to step through your code, the debugger
has standard keyboard shortcuts for Step In, Step Out, Step Over,
Run To Cursor, and Continue. If you prefer to use different shortcut
key combinations, select Tools>Keyboard Shortcuts to define
your own.

Stepping out of a function

If you step into a function where you do not need to step
into each statement, use Step Out to continue execution until the
function returns.

proc.png To step out of a function:

  1. Click the Step Out button in the PainterBar,
    or select Debug>Step Out from the
    menu bar.

Stepping through multiple statements

As you step through an application, you might reach sections
of code that you are not interested in examining closely. The code
might contain a large loop, or it might be well-tested code that
you are confident is free of errors. You can use Run To Cursor to
select a statement further down in a script or in a subsequent script
where you want execution to stop.

proc.png To step through multiple statements:

  1. Click on the line in the script where you
    want to resume single stepping.

  2. Click the Run To Cursor button in the PainterBar,
    or select Debug>Run To Cursor from the menu bar.

    PowerBuilder executes all intermediate statements and the
    yellow arrow cursor displays at the line where you set the cursor.

Bypassing statements

You can use Set Next Statement to bypass a section of code
that contains a bug, or to test part of an application using specific
values for variables. Execution continues from the statement where
you place the cursor. Be cautious when you use Set Next Statement,
because results may be unpredictable if, for example, you skip code
that initializes a variable.

proc.png To set the next statement to be executed:

  1. Click on the line in the script where you
    want to continue execution.

  2. Click the Set Next Statement button in the PainterBar,
    or select
    Debug>Set Next Statement from the menu
    bar.

  3. If necessary, change the values of variables.

  4. Continue execution using Continue, Step In, or
    Step Over.

    If you select Continue, PowerBuilder begins execution at the
    statement you specified and continues to the next breakpoint. If
    you select Step In or Step Over, PowerBuilder sets the next statement
    and displays the yellow arrow cursor at the line where you set the
    cursor.

Changing a variable’s value

As you step through the application, you can change the values
of variables that are in scope. You may want to do this to examine
different flows through the application, to simulate a condition
that is difficult to reach in normal testing, or if you are skipping
code that sets a variable’s value.

note.png Limitations

You cannot change the values of enumerated variables, and
you cannot change the value of any variable when you are debugging
a remote component.

proc.png To change the value of a variable:

  1. Select the variable in the Variables view
    or the Watch view.

  2. From the pop-up menu, select Edit Variable.

  3. Type a value for the variable or select the Null
    check box and click OK.

    The value you enter must conform to the type of the variable.
    If the variable is a string, do not enclose the string in quotes.
    When you continue execution, the new value is used.

Fixing your code

If you find an error in a script or function during a debugging
session, you must close the debugger before you fix it. After you
have fixed the problem, you can reopen the debugger and run the
application again in debug mode. The breakpoints and watchpoints
set in your last session are still defined.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x