Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom Debugger Guide - use the print command to prompt for an expression and then print it to the http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Use the Print command to prompt for an expression and then print it to the
log window.  Use this command to examine the values of variables and
expressions.  The Print command is:


     Print [/Window|/Program] [<printlist>]

/Window
    open up a watch window containing the listed expressions.

/Program
    print the results to the application's screen.

<printlist>
    is [<format>] [<expr> [,<expr> [...]]]

<format>
    is a printf like format string.  It consists of plain text intermixed
    with control sequences, which will be substituted with values from the
    expression list.  The control sequences are:

    %i
        The corresponding argument is printed out as a signed decimal
        integer value.

    %d
        The corresponding argument is printed out as a signed decimal
        integer value.

    %u
        The corresponding argument is printed out as an unsigned decimal
        integer value.

    %x
        The corresponding argument is printed out as an unsigned hexadecimal
        integer value.  Letter digits are printed in lower case (a-f).

    %X
        The corresponding argument is printed out as an unsigned hexadecimal
        integer value.  Letter digits are printed in upper case (A-F).

    %o
        The corresponding argument is printed out as an unsigned octal
        integer value.

    %p
        The corresponding argument is printed out as a pointer
        (segment:offset) value in hexadecimal notation.

    %c
        The corresponding argument is printed out as a single character
        value.

    %s
        The corresponding argument is printed out as a C/C++ string value.
         The argument must point to a string of characters terminated by a
        byte whose value is zero.

    %%
        To print out a percentage symbol, the "%" must be doubled up (i.e.,
        %%).

    %f
        The corresponding argument is printed out in floating-point
        representation.  If the floating-point value has a very large or
        small magnitude, you should use one of "g", "G", "e" or "E"
        formatting.

    %g
        The corresponding argument is printed out in floating-point
        representation.  Numbers of very large or small magnitude are
        printed out in scientific "E" notation (e.g., 1.54352e+16).  The
        exponent letter is printed in lower case.

    %G
        The corresponding argument is printed out in floating-point
        representation.  Numbers of very large or small magnitude are
        printed out in scientific "E" notation (e.g., 1.54352E+16).  The
        exponent letter is printed in upper case.

    %e
        The corresponding argument is printed out in scientific "E" notation
        (e.g., 1.23456e+02).  The exponent letter is printed in lower case.

    %E
        The corresponding argument is printed out in scientific "E" notation
        (e.g., 1.23456E+02).  The exponent letter is printed in upper case.

    %r
        The corresponding argument is printed out in the current default
        numeric radix.

    %a
        The corresponding argument is printed out as a symbol reference
        (symbol_name+offset) when possible; otherwise it is printed out as a
        pointer (segment:offset) value in hexadecimal notation.

    %l
        The corresponding argument is printed out as a line number reference
        (module_name@line_number+offset) when possible; otherwise it is
        printed out as a pointer (segment:offset) value in hexadecimal
        notation.


Some examples of the print command follow.  This command prints the value of
"i":


     ? i

This command prints "decimal=100 hex=0x64":


     print {decimal=%d hex=%x} 100,100

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson