Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

QteStartViewCreation - create source debugger views

4 views
Skip to first unread message

Steve Richter

unread,
Jul 11, 2006, 12:30:58 AM7/11/06
to
Anyone have knowledge of creating source debugger views? I am
experimenting with a macro preprocessor for RPG and would like both the
before and after macro expansion source to be available as views in the
debugger.

When are the QteStartViewCreation ... QteEndViewCreation apis supposed
to be called? Before the module is created or after? Within the
QbnStartPreProcessor ... QbnEndPreProcessor set of APIs or outside?
When the CRTRPGMOD command is run what should the DBGVIEW parm be set
to?

The documentation references the *STATEMENT view. Is that something the
compiler creates in this case or once you create one debugger view do
you have to create them all?

The QteAddViewMap API documentation says you have to map a view back to
the statement view. But if the statement view is created by the
compiler, then the creating of other views would have to wait for the
compile to complete. But if you wait for the compile to complete, how
do you store the debug views in the module?

-Steve

Barbara Morris

unread,
Jul 11, 2006, 1:39:16 PM7/11/06
to
Steve Richter wrote:
> ...

> When are the QteStartViewCreation ... QteEndViewCreation apis supposed
> to be called? Before the module is created or after? Within the
> QbnStartPreProcessor ... QbnEndPreProcessor set of APIs or outside?
> When the CRTRPGMOD command is run what should the DBGVIEW parm be set
> to?

QteStartViewCreation is called when you start reading the source file,
and QteEndViewCreation is called after you have finished reading the
source file and writing the output file, and before you call the next
stage in the compile (CRTRPGMOD).

I don't think the Qbn functions are relevant to the debug view
functions. (The RPG preprocessor (which runs before the SQL precompiler
with RPGPPOPT(*LVL1)) doesn't call those functions at all.) I don't
know anything about these functions, but I imagine you would call
QbnStart before you begin preprocessing, and call QbnEnd after the RPG
compiler returns.

When you call CRTRPGMOD, set DBGVIEW to anything that gets the compiler
to create a source view (anything except *LIST). If you don't request a
source view, your debug views would be dropped since the compiler
wouldn't be providing the mapping between your output view and its
source view.

>
> The documentation references the *STATEMENT view. Is that something the
> compiler creates in this case or once you create one debugger view do
> you have to create them all?

The compiler creates the statement view. You only have to create your
source view and your output view; other views are created by earlier or
later stages of the compilation. When your output file is read as an
input file by the next stage in the compile, the debugger will use the
view information to map the statements in the new input file to the
original file.

If you compile a program with CRTSQLRPGI RPGPPOPT(*LVL1)
DBGVIEW(*SOURCE), and look at the various debug views in the debugger,
you will see this list (v5r3):

ILE RPG Root Source View - created by RPG preprocessor for the original
input file
ILE RPG Output View - created by RPG preprocessor for output
tempfile1
SQL Output View - created by SQL precompiler for output
tempfile2
ILE RPG Listing View - created by RPG compiler
ILE RPG Copy View - created by RPG compiler

The SQL precompiler would also have created an input view for tempfile1,
and the RPG compiler would have created an input view for tempfile2.
Since the input view and the previous output view are for exactly the
same source file, the debugger merges these views into one. Each stage
in the compile should assume there may have been previous stages, and
each stage except the final one (the compiler) assumes that there may be
a later stage. So when you call QteStartViewCreation, you would
normally say "*NO" for the discard-previous-views parameter.

If you added "Richter Root Source View" and "Richter Output View", the
views would look like this; "Richter Output View" would be merged with
"ILE RPG Root Source View".

Richter Root Source View
Richter Output View
ILE RPG Output View
SQL Output View
ILE RPG Listing View
ILE RPG Copy View

>
> The QteAddViewMap API documentation says you have to map a view back to
> the statement view. But if the statement view is created by the
> compiler, then the creating of other views would have to wait for the
> compile to complete. But if you wait for the compile to complete, how
> do you store the debug views in the module?
>

I think those references to the statement view in the documentation only
refer to the case where the "To" view is *STATEMENT. Your "To" view
would be a view number that you got from QteAddViewDescription.

Steve Richter

unread,
Jul 13, 2006, 1:48:06 PM7/13/06
to

thanks for the help!

Now that I understand the process better, here are some usage notes:

All the debug view information created within the QteStartViewCreation
and QteEndViewCreation set of APIs is stored in the associated space of
the QteStartViewCreation output file. The magic that causes the debug
views you create to be included with the compiled module is actually
the CRTRPGMOD command checking for this associated space of the source
member being compiled.

Use the QteAddViewFile api when you want the debugger to retrieve the
view text from the source member the module was created from. Use the
QteAddViewText to have that view text permanently stored in the module.
This is the origin of those confusing moments using the debugger when
the system tells you the program source has been changed since the
module was created.

The QteAddViewMap API is used to map lines from the input view to the
output view. Even when the *output view is represented as text lines
from the QteAddViewText ( instead of a QteAddViewFile source member )
the CRTRPGMOD command will magically map the lines of its input file (
the QteStartViewCreation output file ) to the lines of your *output
view.

-Steve

0 new messages