QSPY  5.8.0
QSPY Host Application

About QSPY

As described in the previous section, QSPY is the host-resident component in the Q-SPY software tracing system. QSPY is a plain console application without a GUI, because its main purpose is to provide the parsing of the Q-SPY Data Protocol and displaying the data in a simple human-readable format. QSPY can also export the data in various other formats, such as format suitable for MATLAB/GNU-Octave, and format suitable for generating message sequence diagrams with MscGen. Additionally, QSPY can also save the symbolic information about the Target objects in form of QSPY dictionaries.

Starting with version 5.5.0, QSPY can serve a "Back-End" for attaching various GUI-based or head-less "Front-Ends" (such as the QSpyView Front-End).

The fact that QSPY is a simple console application allows it to be "platform-neutral". QSPY is written in portable C with ports to Windows and Linux provided. QSPY is also designed to be adaptable to various target-host communication links. Out of the box, the QSPY host application supports serial (RS232), TCP/IP, and file communication links. Adding other communication links is straightforward, because the data link is accessed only through a generic Platform Abstraction Layer (PAL).

QSPY Command-Line Parameters

The QSPY application accepts several command-line parameters to configure the data link to the Target, backwards-compatibly with previous versions, and target dependencies, such as pointer sizes, signal sizes, etc. This means that the single QSPY host application can process data from any Target running the QS component. QSPY has been tested with wide range of 8-, 16-, 32-, and 64-bit CPUs.

The general form of invoking QSPY is as follows:

qspy [options]

where options are described in the following table:

You should not insert spaces between an option and the argument:
qspy -t 6602 <-- INCORRECT!!
qspy -t6602 <-- CORRECT
 Option  Example  Default
 Must match QP macro
(QP port header file)


-h -h

Help. Prints the summary of options

-q -q (key-q)

Quiet mode (no stdout output)

-u[port] -u 7701

UDP socket for "Front-Ends"

-v -v 5.5 5.0

Compatibility with QS version

-o -o (key-o)

Produce output to the specified file

-s -s (key-s)

Save the binary input to a file. Not compatible with -f

-m -m (key-m)

Produce MATLAB/GNU-Octave output to a file

-g -g (key-g)

Produce MscGen output to a file

-c<port> -cCOM2 COM1

COM port selection. Not compatible with -t, -p, -f

-b<baud> -b38400 115200

Baud rate selection. Not compatible with -t, -p, -f

-t<port> -t 6601

TCP/IP input selection. Not compatible with -c, -b, -f

-f<file> -fqs.spy

File input selection. Not compatible with -c, -b, -t, -p

-d<file> -dqspy150831_144229.dic

Read dictionaries from a file.

Options for configuring Target object sizes:
Starting with QS/QSPY 5.5.0, the Target can report it's configuration to QSPY, which means that you don't need to provide any upper-case options (such as: -T, -O, -F, etc.).

-T<size> -T2 4 QS_TIME_SIZE

Time stamp size in bytes. Valid values: 1, 2, 4

-O<size> -O2 4 QS_OBJ_PTR_SIZE

Object pointer size in bytes. Valid values: 1, 2, 4, 8

-F<size> -F2 4 QS_FUN_PTR_SIZE

Function pointer size in bytes. Valid values: 1, 2, 4, 8

-S<size> -S1 2 Q_SIGNAL_SIZE

Signal size in bytes. Valid values: 1, 2, 4

-E<size> -E1 2 QF_EVENT_SIZ_SIZE

Event-size size in bytes (i.e., the size of variables that hold event size). Valid values: 1, 2, 4


Queue counter size in bytes. Valid values 1, 2, 4

-P<size> -P4 2 QF_MPOOL_CTR_SIZE

Pool counter size in bytes. Valid values: 1, 2, 4

-B<size> -B1 2 QF_MPOOL_SIZ_SIZE

Block size size in bytes. (i.e., the size of variables that hold memory block size). Valid values 1, 2, 4

Time event counter size. Valid values: 1, 2, 4

Your main concern when invoking QSPY is to match exactly the target system you are using. The fourth column of the table above lists the configuration macros used by the target system as well as the platform-specific QP header files where those macros are defined. You need to use the corresponding QSPY command-line option only when the QP macro differs from the default. The default values assumed by QSPY are consistent with the defaults used in QP.

When you do not match the QSPY host application with the QS target component, the QSPY application will be unable to parse correctly the mismatched trace records and will start generating the following errors:
********** 028: Error xx bytes unparsed
********** 014: Error -yy bytes unparsed

The number in front of the error indicates the Record ID of the trace record that could not be parsed.

QSPY Keyboard Commands

Starting from version 5.5.0, QSPY accepts keyboard input. The following table shows the currently supported key-strokes:

Key Action
<Esc> Exit QSPY
h display keyboard help and QSPY status
c clear the screen
q toggle quite mode (no Target output to the screen
r send RESET command to the Target
i send the INFO request to the Target (see also QSPY Dictionaries)
t send TIKC[0] command to the Target
u send TICK[1] command to the Target
d save Q-SPY Dictionaries to a file
o toggle QSPY Human-Readable Output to a file (open/close)
s/b toggle binary file output (open/close)
m mtoggle MATLAB Output to a file (open/close)
g toggle MscGen Output to a file (open/close)
QSPY can send many more sophisticated commands to the Target by means of the Front-End extension mechanism.

Saving Files from QSPY

QSPY can save the tracing data from the Target in various formats into files. QSPY assigns file names automatically. Also, QSPY can open/close various files multiple times in a single session, so it is no longer necessary to exit QSPY and launch it again with different command-line parameters to save data to a different file.

QSPY saves all files into the current directory from which qspy has been launched.

QSPY uses a very simple naming convention to assign file names. All names start with qspy<time-stamp>, where the time-stamp format is: YYMMDD_hhmmss, where YY is 2-digit year, MM is a 2-digit month, DD is a 2-digit day of the month, hh is a 2-digit hour, mm is a 2-digit minute, and ss is a 2-digit second. The time-stamp is accurate to a one second, so its virtually impossible to have name conflicts for files generated on the same machine. The various types of files are distinguished by the following extensions:

Extension Example Comment
.txt qspy150914_132234.txt text (screen) output
.dic qspy150901_101203.dic dictionary output
.qs qspy150914_132234.qs raw binary output (Q-SPY protocol)
.mat qspy150914_132234.mat MATLAB output
.msc qspy150914_132234.msg MscGen output
All files except the dictionary output are time-stamped with the local time of the Host. The dictionary output is time-stamped with the build-time of the Target image.

Next: QSPY Screen Output