QEF home page
10. Building -g, -pg, and -O Versions and QHY

In this page we build a debugging, profiling, and optimized versions of a program and demonstrate the QEF history mechanism.


Table of Contents
Previous Page
Next Page

Building the debugging version

Let us now build the debugging version of etoc.

% qef -LDEBUGGING etoc
#{ -LDEBUGGING etoc @gobo 2003/07/19 08:58:08
# QEFHALTFILE: /g/dt/cook/obj/ctoe/%qef28568b.hlt
+ cc -c -g -I. -I/g/dt/cook/work/ctoe -I/p/cook/s3.4/ctoe \
        -I/p/qtree/9.1/linux2_0i/include etoc.c
+ cc -o etoc -g etoc.o /p/qtree/9.1/linux2_0i/lib/libdt_g.a \
        /p/qtree/9.1/linux2_0i/lib/libl.a
#} E0 gobo@/g/dt/cook/obj/ctoe 2003/07/19 08:58:09(1)

The --LDEBUGGING option sets the qvrs variable DEBUGGING. This setting is in effect just for the qef session.

Temporary settings via a leaf.vrs file To make the setting be in effect for every build we could create a leaf.vrs file containing:
set DEBUGGING 1
# or
options DEBUGGING  # equivalent to the above

The leaf.vrs file is meant to be temporary and as such is not stored in the source tree. If we were going to be working exclusively on etoc, we could also add the line:

set _DefaultArgs_ etoc

to leaf.vrs, which would make etoc the default argument to qef.

qhy was etoc rebuilt?

Getting back to our build, why was etoc rebuilt?

% qhy -r etoc  # -r to recurse through dependencies
etoc @ 2003/07/19 08:58:09 ->
    etoc (2003/07/19 08:57:34)
        < etoc.o (2003/07/19 08:58:08)
        + cc -o etoc -g etoc.o \
	      /p/qtree/9.1/linux2_0i/lib/libdt_g.a \
          /p/qtree/9.1/linux2_0i/lib/libl.a
etoc.o @ 2003/07/19 08:58:08 ->
    etoc.o (2003/07/19 08:57:34)
        Recipe changed: "... -g -I/..." : "... -O -..."
        + cc -c -g -I. -I/g/dt/cook/work/ctoe \
	      -I/p/cook/s3.4/ctoe \
	      -I/p/qtree/9.1/linux2_0i/include \
	      etoc.c

etoc was rebuilt because its dependency etoc.o had changed and etoc.o was rebuilt because its recipe changed (i.e., --g flag added).

Also note that the libraries linked with etoc.o changed in that the debugging version of --ldt (e.g., libdt_g.a) is now used.
Note: qhy is pronounced q'why.

The profiling and optimized versions

What about the profiling version?

% qef -LPROFILING etoc
#{ -LPROFILING etoc @gobo 2003/07/19 21:56:21
# QEFHALTFILE: /g/dt/cook/obj/ctoe/%qef29809b.hlt
+ cc -c -pg -I. -I/g/dt/cook/work/ctoe -I/p/cook/s3.4/ctoe \
        -I/p/qtree/9.1/linux2_0i/include etoc.c
+ cc -o etoc -pg etoc.o \
        /p/qtree/9.1/linux2_0i/lib/libdt_p.a \
        /p/qtree/9.1/linux2_0i/lib/libl.a
#} E0 gobo@/g/dt/cook/obj/ctoe 2003/07/19 21:56:25(4)

Again note that the libraries changed and etoc.o was rebuilt due to the change in the recipe.

What about the optimized version?

% qef -L_Optimize_index_=Max etoc
#{ -L_Optimize_index_=Max etoc @gobo 2003/07/19 22:07:58
# QEFHALTFILE: /g/dt/cook/obj/ctoe/%qef29961b.hlt
+ cc -c -O -I. -I/g/dt/cook/work/ctoe -I/p/cook/s3.4/ctoe \
        -I/p/qtree/9.1/linux2_0i/include etoc.c
+ cc -o etoc etoc.o -L/p/qtree/9.1/linux2_0i/lib -ldt \
        /p/qtree/9.1/linux2_0i/lib/libl.a
#} E0 gobo@/g/dt/cook/obj/ctoe 2003/07/19 22:07:59(1)

Normally one would put the _Optimize_index_ setting in the conf.vrs in the root of the tree. Also note that the optimization level for an individual file can be set, as might be required when the optimizer introduces bugs (a far too often occurrence) using the associative array:

set  _Optimize_index_[file]  Safe

cook20.qh - 1.15 - 03/10/24 QEF home page Table of Contents Previous Page Next Page