Rochester Institute of Technology
RIT Scholar Works
Theses
Thesis/Dissertation Collections
7-21-1987
Interactive Virtual Debugger for GPSS/H
Eugene Johnson
Follow this and additional works at:
http://scholarworks.rit.edu/theses
This Thesis is brought to you for free and open access by the Thesis/Dissertation Collections at RIT Scholar Works. It has been accepted for inclusion
in Theses by an authorized administrator of RIT Scholar Works. For more information, please contact
Recommended Citation
Approved by:
Rochester Institute of Technology
School of Computer Science
&
Technology
INTERACTIVE VISUAL DEBUGGER FOR GPSS/H
by
Eugene Johnson
A thesis, submitted to the
Faculty of the School of Computer Science and Technology,
in
partial fulfillment of the requirements for the degree of
Master of Science
in
Computer Science
Guy Johnson
Professor Guy Johnson
Peter G. Anderson
Professor Peter Anderson
Chris Comte
Professor Chris Comte
Statement for Granting Permission to Reproduce
Thesis Title:
Interactive Visual Debugger for GPSS/H
I, Eugene Johnson, hereby grant permission to the Wallece
Memorial Library
,
of RIT, to reproduce my thesis in whole
or in part
.
Any reproduction will not be for commercial
use or profit.
ABSTRACT
GPSS (General Purpose System
Simulator)
is
alanguage,
designed
to
aidthe
computermodeling
and simulation of a widevariety
ofdifferent
reallife
systems.As
withany
otherlarge programming
project,
debugging
GPSS
programsis
unavoidable and oftendifficult.
The
presentthesis
describes
anInteractive Visual
Debugging
System
for
GPSS/H
whichattempts
to
simplify
the
debugging
task
by
allowing
the
programmerto
observethe
actualbehavior
ofthe
modelin
simulated realtime,
whilepreserving
alltraditional
interactive
debugging
tools
-breakpoints,
systemtraps,
selectivedisplays,
etc.The
present version ofthe
Interactive Visual Debugger
is developed for
the
UNIX
operating
system andis
writtenin
the
'C programming language. The
system canbe
readily
used on all
terminals
capable ofrunning the
UNIX
'curses'library
package.Because
ofits
modular
design,
the
system canbe
modifiedto
accommodate additionalterminal
types,
orto
COMPUTING
REVIEWS
SUBJECT
CODES
Primary
Code:
D.2.5.
Software
Engineering.
Testing
andDebugging.
Secondary
Codes:
1.3.4.
Computer Graphics.
Graphics
Utilities.
TABLE OF
CONTENTS
1.
Introduction
1
1
.1
.General
Remarks
1
1.2.
History
andEvaluation
ofGPSS
1
1.3. Development
ofGPSS Models
3
1.4. Block Diagrams
andTransactions
4
1.5. Program Verification
4
2. Problem Statement
8
3.
Functional Specification
10
3.1. Functions Performed
_10
3.2. Limitations
andRestrictions
1 1
3.3. User Inputs
13
3.4. User Outputs
13
4. Architectural Design
15
5. System
Specifications
1 7
5.1. Standard GPSS/H I/O Architecture
17
5.2. Visual Debugger I/O Architecture
1
8
5.3. Graphical
GPSS
Block
Symbols
20
6.
GPSS/H Visual Debugger Commands
24
6.1.
Invoking
the
GPSS/H Visual Debugger
24
6.2.
Terminating
the
GPSS/H
Visual Debugger
25
6.3. Debugger Environment Control
Commands
26
6.3.1.
Controlling
the
Terminal
Log (TLOG)
26
26
26
27
27
28
28
6.3.2.
Controlling
theExecution Trace
6.3.3.
Setting
Time Limits
6.3.4.
Recording
Memory
Image
oftheModel
~6.3.5.
Command Procedures
(AT-points)
6.4. Model
Execution
Control Commands
~6.4.
1
.Beginning
andResuming
Model Execution
6.4.2. Suspension
ofModel
Execution
**6.5. Output Control Commands
3
*6.6.
Help
Command
3
1
6.7.
Summary
oftheGPSS/H Visual
Debugger
Commands
31
7. High Level Module Design
-35
7.1. Initialization Module
36
7.2. Block Diagram
Building
Module
37
7.3. Input Command
Interpreter
38
7.4. Interactive
Output Interpreter
39
7.5. Interprocess Communication
40
7.6.
Maintaining
theScreen Image
40
8.
Conclusions
43
9.
Bibliography
46
Appendix A: Sample GPSS Model
49
Appendix B:
Sample Screen Layout
52
Appendix
C: List
ofUnsupported Blocks
_53
1.
INTRODUCTION
1.1.
General Remarks
Simulation is
the technique
ofconstructing
andrunning
a model of a real systemin
order
to
study
the
behavior
ofthat system,
withoutdisrupting
the
environment ofthe
realsystem
[3].
It
is
the tool that
is
used when a problem can notbe
solvedsimply
and satisfactorily
by
analytical methods.Although currendy
there
is
no scientifictheory
to
guaranteethe
validity
of a simulation processbefore
the
actual experimentis
performed,
whenproperly
used simulation can provide valuable
insight
onhow
the
components of a system aregoing
to
behave.
In any
computer simulationthere
aretwo
distinct
stages:first,
systems analysis-to
define
andbuild
a model ofthe
system;
and, second,
computerprogramming
-to
code
the
model
for
data
processing.One
attemptto
simplify
this
processis illustrated
by
the
develop
ment of
the
simulationlanguage
calledGeneral Purpose System Simulator
(GPSS).
GPSS
was notdesigned for any
particular class of systems.Its
goal wasto
define
a certain
basic
set ofcapabilities,
which are characteristic of a widevariety
ofdifferent
systems.The language
canbe
usedaseasily for modeling
the
scheduling
algorithm of aCPU
asit
canbe
usedfor
determining
the
utilizationofthe
cashiersin
agrocery
store.1.2.
History
andEvolution
ofGPSS
GPSS
wasdeveloped
by Geoffrey Gordon,
anIBM employee,
and presentedin
two
papers:
"A General Purpose System
Simulator"
[6]
and"A
General Purpose Digital Simulator
and
Examples
ofits
Application:
Part 1
-Description
of
the
Simulator"[7].
The first
version ofGPSS
defined
a set of25
specificblocks.
Each block
represented a2
was
described
in
terms of a combination of blocks that couldbe
usedrepeatedly.
General
units oftraffic
in
the modeled system (such as vehicles, people, goods, processes,etc.)
wererepresented
by
transactions and these werethe
dynamic
components ofthe
system.The
tran
sactions moved through the
block diagram
under the control of
the
blocks
and were createdand
destroyed
asrequired.During
this process,different
statistics were collected and usedto
evaluatethe performance ofthe systemand
to
draw
appropriate conclusions.The
first
major changesin
the
design
ofthe
language
were madein GPSS
III,
releasedin
1965.
Some
ofthese changeswere:elimination of
the
time
delays
associated withevery block
andintroduction
of a singleADVANCE block
to
model all passages oftime.
removal of selection
factors from
allblocks
andtheir
replacement withthe
singleTRANSFER
block.
introduction
of user chainsin
additionto the
standard current events andfuture
eventschains.
addition of new
blocks
(DEPART,
SPLIT,
GATHER).
increasing
the
power ofthe
HELP
block.
As
a result ofthese
and otherimprovements,
the
efficiency
of execution and power ofthe
language
weregreatly
improved
Some
other versions ofGPSS
since1965
areGPSS/360,
GPSS
V, GPSS/C,
etc.In
allcases
the
basic
structure ofthe
language
remained unaltered sinceGPSS
III
and allfurther
releases are upward-compatible.
The
changes were concerned withenhancing
the
power ofthe
language,
relaxing
the
syntax,
introducing debugging
tools,
improving
the
speed of execution,
etc.The
version of thelanguage
we areinterested in
is
GPSS/H. It
offersexcellent perfor
mance characteristics and
many
extensionsbeyond
previousimplementations. The
principal
advantages are
[9]:
Design for
interactive
use and asimple,
but
powerful commandlanguage for
setting
breakpoints,
stepping
through the model,
selectively
displaying
modeldata,
etc.Many
extensionsbeyond
the
"standard"GPSS,
including
I/O
statements,
dynamic
control
statementlogic
(IF-THEN-ELSE, DO,
GOTO),
and greaterflexibility
in
the
rulesfor coding
statements.13. Development
ofGPSS
Models
The development
of aGPSS
modelusually
goesthroughthe
following
stages[9]:
(1)
Choosing
an appropriatelevel
of abstraction.If
a model ofa systemis
too abstract, the
results
may be
insufficient
to
draw
proper conclusions.On
the
otherhand,
if
a modelis
too
detailed,
completionmay
take too
long
andthe
costs ofdevelopment
may
become
to
high
for
the
modelto
be
of value.(2)
Mapping
the
elements ofthe
systeminto GPSS
entities anddefining
additional entitiesfor performing
computations andcollecting
statistics.GPSS
providesthree
majorentity
classes:Equipment
entities:facilities,
storages,
logic
switches.Computational
entities: arithmetic andboolean
variables,
functions,
etc.Statistical
entities:queues, tables.
(3)
Specifying
the
rulesby
whichthe
particular system operates.The
logic
of a modelis
described
by
using
"blocks",
selectedfrom
a collection ofdifferent block
types.
(In
GPSS/H
there
are over50 block
types.)
The
construction of a modelfrom blocks
is
usually
done
by flowcharting
the
model as aGPSS
Block
diagram,
drawing
eachGPSS
block
witha characteristic shape.(4)
Coding,
compiling
anddebugging
ofthe
GPSS
model.Appendix
A
gives an example of a simpleGPSS
modeltogether
withthe
resultsfrom
the
simulation.It
is
intended for
the
unfamiliar withthe
GPSS language
reader and attempts1.4.
Block Diagrams
andTransactions
The
most obvious characteristic of aGPSS
Block diagram
is
the use ofmany
distinc
tively
shapedblocks. Such
adiagram
provides anextremely
convenient notationfor
express
ing
the rulesby
which the systembeing
modeled operates.Since
the rulesusually
do
notchange
during
the course ofsimulation,
theBlock diagram may
be
consideredto
be
the staticelement of a program.
The dynamic
elements ofthe
GPSS
program which traverse theBlock diagram
arecalled transactions.
The
meaning
of a transactionis
determined
by
the
modeler.At any
giventime
there canbe many
transactions"in
process"at various points of
the
Block diagram. It
must
be
notedthat,
depending
on the systemmodeled,
it
is
possiblefor
the
GPSS Block
diagram
to
have disjoint
segments.IS.
Program Verification
Up
tothis
moment thediscussion
wasprimarily
focused
onthe
GPSS language.
In
this
section a
few
general remarks willbe
made on programdebugging.
Once
a computer programhas been
developed,
it
has
to
be
tested,
orverified,
sothat
eventual errors can
be
corrected.This
processis
commonly
referredto
asdebugging.
It
is
very
wellknown
that this
part ofthe
programdeveloping
cycle consumes alot
oftime
andprogramming
resources.This
is
the
reasonwhy throughout
the
yearsmany
effortshave
been
made to
facilitate
the
debugging
process as much as possible.These
efforts arefocused in
many
different directions
that
canbe
loosely
divided into
two
majorgroups:Error prevention,
andThe
effortsto
prevent errorsfrom
occurring in
the
first
place,
resultedin
the
develop
ment of a wide
variety
ofdifferent
practices.Among
these
are:the
emergence of structured and modularhierarchical
programming,
the
development
ofscientificsoftwareengineering
managementpractices,
the
development
ofstrongly
typed
programming
languages,
the
development
oflanguage
sensitiveeditors,
etc.The
effortsto
facilitate
the
discovery
of errors(whether
syntactical orlogical)
resulted,
among
otherthings, in:
development
oflanguages
withbetter
syntaxdiagnostics.
development
oflanguage
verifiers(for
examplethe
lint
program).including
of specialdebugging
statementsin
some ofthe
languages (for
examplethe
DISPLAY
andWITH
DEBUGGING
statementsin COBOL).
development
ofdump
andtrace
formatting
facilities
(for
examplethe
VM/CMS
operating
system).development
of general and special purposedebuggers.
For
the
purposes ofthis thesis
we areinterested
in
the
development
ofdebuggers. Prac
tically
every operating
system environment provides adebugger
in
oneform
or another.In
the
case ofthe
UNIX
systemwehave
either adb orsdb,
in
the
case ofthe
IBM's VM/SP
it is
a set of control program
(CP)
commands(ADSTOP,
PER, DISPLAY,
etc.),
in
the
case ofthe
VAX/VMS
operating
system-the
VAX/VMS Symbolic Debugger. The
above are all examples of general purpose
debuggers.
Almost
alldebuggers
provide capabilitiesfor memory
dumps,
registerandPSW
display,
selective examination and
altering
ofmemory
locations,
controlledstep
by
step
execution offeatures
is
often not a trivial task. Deliberate efforts were made throughout thelast
twodecades
to make thedebuggers
more-user friendly". The
following is
a
list
ofsome of thefeatures
of theVAX/VMS
Symbolic
Debugger
whichis
considered tobe
representative of
the
latest
trendsin
debugger development
.
The VAX/VMS
Debugger
is
symbolic.This
allows theuser
to
referto memory
loca
tions
by
their symbolic names or as offsetsfrom
symbolic names and notby
theiraDsolute
orvirtual addresses..
The VAX/VMS
Symbolic Debugger
is
multi-language.It
supports all
VAX
"native"
languages;
i.e.,
during
a single session one candebug
a program written inany
number oflanguages. For languages
that are not supported, the Debugger provides an environ ment which acceptscommonly
used operators anddata
types..
The
Debugger
candisplay
the source code ofthe modulebeing
debugged.
It
can also convert the object codeinto
pseudo-assembler, which allowsthe
userto
seethe
assembly
language
equivalent ofthehigh level language
statementsbeing
executed.-
Virtual
addresses(including
registerand stacklocations)
canbe
translatedinto
symbols or offsetsfrom
symbols.Complete
structures(arrays,
records)
canbe displayed
with a single command.The VAX/VMS Symbolic
Debugger
canbe
usedin
screen mode of operation.In
screen mode the user candivide
the screeninto
scrollable windows anddisplay
simultaneously different kinds
ofinformation:
source andassembly
code,
register and stackcontents, debugger
input
and outputThe
selecteddisplays
areautomatically
updated.The
syntax of theDebugger
commandsis
consistent withthe
Digital
Command
Language
(DCL)*
syntax and the syntax of
the
VAX
extensionsin
the
different
languages.
Several DCL features
- commandprocedures,
log
andinitialization
files,
symboldefini
tion-are supported
by
theDebugger
as well.The
Debugger
has
amechanismfor keypad
andfunction
key
definition
which allows aneasy way
ofissuing fairly
elaborate orfrequently
usedcommands.Often,
large
software products will offer specializedbuilt-in
debuggers,
for
example:the
built-in debugger
ofthe
MACRO-11
simulatorMAXIM,
the Execution
Diagnostic
Facility
(EDF)
in
the
CICS-VS
on-line softwaremonitor, the
interactive
debuggers
in
GPSS/C
and2.
PROBLEM STATEMENT
There
aretwo
distinguishing
features
ofGPSS
that shouldbe
pointed out:first,
allblocks in GPSS have
associated with themdistinctive
graphical symbols which allow usto
describe
the modeled system as a connected network ofBlock diagrams
representingthe
sequence of events.
And
second,
thebasic
unitsin
GPSS,
called"transactions",
couldvary
in
nature
depending
on the particular systemto
be
modeled,but
theimportant
thing
for
us isthat
they
always gothrough
the same cycle:they
arecreated,
underthe
control ofdifferent
blocks
they
movethrough themodel(during
which timedifferent
statisticsarecollected),
andthen
they
aredestroyed.
The
abovefeatures
makethe
conceptualinterpretation
of almostevery GPSS Block
diagram
possible.This
canbe
usedfor
facilitating
thedebugging
ofGPSS
programs.As
is
the
casewith all otherprogramming projects,
debugging
GPSS
models canbe
time
consuming,
tedious,
frustrating
and,
atthe
sametime,
unavoidable.Most
modern versions ofGPSS
(including GPSS/H)
providebuilt-in
interactive
debugging
systemsbut
they
arediffi
cult
to use,
if
for
no otherreason,
simply because
of their voluminous output whichvery
quickly becomes
tiresome to
follow.
The
prime objective ofthis thesis
is
to
develop
aninteractive
visualdebugging
systemthat
will allowthe
userto
observe and controlthe
behavior
ofthe
model whilethe
simulationis in
progress.Guided
by
the
ancientChinese
maximthat
a pictureis
worth athousand
words,
the
proposed system enables
the
userto
really
seethe
movement ofthe
separatetransactions
through the model
Some
ofthe moreimportant
statistics(like
clocktime,
utilization offacili
ties,
queue and storagecontents, etc.)
aredisplayed
andconstantly
updated.The
user canspecify
what portion ofthe
model and what set ofstatistics
areto
be displayed
and,
withfew
minor
exceptions,
has
availablethe
full
power andcapabilities
ofthe
existing GPSS/H
debug
In
additionto
puredebugging,
the
proposed systemwillbe helpful in
the more completeevaluation of
the
model.The ability
to
watchthe
dynamic behavior
ofthe
modeled systemduring
the
simulation run canresult,
for
example,
in
the
discovery
oftemporary
bottle-neck
10
3.
Functional Specification
From
this pointon,
it is
assumed that the resident operating systemis
UNIX. Certain
modifications will
be necessary for different
operating
systems,but
keeping
in
mindthat the
underlining
philosophy
ofthe
design
fully
complies with the principles of structured modularprogramming,
such modifications shouldbe
fairly
easy to
make.It
is
assumedthat the
readeris familiar
withthe
UNIX operating
systemand some ofits basic
capabilities.3.1. Functions Performed
The
commandthat
invokes
the
Interactive
Visual
Debugger
is
dependent
onthe
resident
operating
system.For
UNIX,
the
synopsisofthe
commandis:
gpsdbg
[options]
filef.gps]
The
commandis
fully
described
in Section 6.1. The
options provideinformation
such as:type
of
display
device
used,
starting
point oftheBlock diagram
sectionto
be
displayed, delay
fac
tor
for
transactionmovements,
etc.It
shouldbe
notedthat
all optionshave
reasonabledefault
values.This
will allow the systemto
be
used(even
though
notto
its fullest
capabilities)
by
peoplewithlimited knowledge
ofthe
proposed package.After
the
systemhas been
invoked,
the
requested section ofthe
Block diagram
is
drawn
on
the
screen.If
not specifiedotherwise,
the
displayed
section startsfrom
Block 1
in
the
source code.
The
number ofblocks
displayed depends
onthe
device
usedbut usually
is
notless
than1 5.
If
a particularterminal type
is
specified withthe
-T option andthe
Block
symbols areimplemented for
the
requestedterminal,
then the
Block diagram
andthe
restofthe
display
is
11
rest of
the
display
is
done in "character
If
syntax errors are encounteredin
the
sourcecode,
an error messageis
displayed
andthe
sessionterminated.
Simultaneously
withdrawing
the
Block
diagram,
a symboltable
is
created with allnecessary information for
the
subsequent properfunctioning
ofthe
system.All
activitiesdescribed
sofar
canbe
classified asthe
"static" part of adebugging
session.
These
arethings that
are all executed once anddo
not changefor
the remaining
ofthe
session.
The
"dynamic" part starts withthe
automaticinvocation
ofthe
GPSS/H
compilerin
debug
mode(option TEST).
The
user commands are readfrom
the
standardinput,
inter
preted and passed
to the
GPSS/H
system sothat the
process can continue.The
outputfrom
the
standardGPSS/H
is trapped,
interpreted,
and as aresult,
different
modules areinvoked
and appropriate actions
taken to
display
the
information
onthe
standard outputin
a newform.
The
proposed system alsoincorporates
aHELP
function.
When
invoked
by
the user,
it
will
list
the
mostfrequently
used commands together with abrief description
oftheir
func
tion.
A detailed description
ofall commandsis
givenin
the
User's Manual in Section
6.
3.2.
Limitations
andRestrictions
The limitations
and restrictions ofthe
proposed system canbe
divided in
three
majorgroups:
first,
hardware
imposed;
second,
restrictions onthe
originalbuilt-in
debugger;
third,
12
limitations
and restrictionsin
representing
theBlock
diagram.From
thedebugger's
point ofview,
userdisplay
stations(terminals)
canbe
divided
into
the
following
categories:.
High
resolution graphics terminalsimplemented
in
the
proposed system- the
Block
diagram
and the rest ofthe information
from
the debugger
aredisplayed
in graphicsmode.
.
High
resolution graphics terminalsNOT
implemented
in
the
proposedsystem,
but
capable
ofrunning the
package - theBlock diagram
andthe
rest oftheinformation
from
thedebugger
aredisplayed in
character mode.Ordinary
terminals capable ofrunning
thecurses package-
the Block
diagram
andthe
restof
the
information from
thedebugger
aredisplayed
in
charactermode.Ordinary
terminals
NOT
capable ofrunning the
cursespackage,
but implemented in
the
proposed system-the Block
diagram
and therest oftheinformation from
the debugger
are
displayed in
either graphics or charactermode,
depending
onthe
particulardevice
and method ofimplementation.
Ordinary
graphics terminalsNOT
capable ofrunning the
curses package andNOT
implemented
in
the proposed system -the
proposed system can notbe
used with suchdevices.
The limitations
and restrictionsimposed
onthe
originalbuilt-in debugger
are asfollows:
The DX
command(used for
displaying
information
in
hexadecimal
form
andintended
primarily
for
systemsprogrammers)
is
not supported.The
output ofthe
DISPLAY
commandis
limited
to
displaying
information for
only
onemodel statistic at a
time.
In
certain casesthe
outputis limited
to the
mostimportant
information
only.The
reasonfor
imposing
these
restrictionsis
the
limited
space available on the screen.
The
limitations
and restrictionsimposed in
representing
the
Block diagram
are asfol
lows:
13
Certain
blocks (like
SAVEVALUE, BPUTPIC, PRINT,
TRACE,
etc.),
which areeither a
block
form
of control statements or can not refuse entranceto
anddo
not alterthe
dynamic
behavior
of atransaction)
can notbe
representedin
the
Block diagram
drawn
onthe
screen.The
idea is
to
save screen space atthe
expense of"unimportant"blocks.
A
full
list
ofthe
unsupportedblocks
is
givenin
Appendix
C.
Macros
are not supportedin
the
currentversionofthe
debugger.
3.3. User Inputs
The
userinvokes
the
debugger
withthe
gpsdbg
command(see Section 6.1). If
there
aresyntax or other
fatal errors,
the
system willstop
with an appropriate message eitherduring
the
phase ofbuilding
the
Block diagram
orlater, during
compilation or executiontime.
Provided
there
are nofatal
errors, the
useris
expectedto type
in
appropriate commandsfrom
the
setdescribed in Section 6.
Unsupported
commands resultin
either error messagesor are
simply
ignored
by
the
system.The
goal, again,
has been
to
makethe
system as "userfriendly"
as possible.
3.4.
User
Outputs
The
output ofthe
systemcanbe divided
into
two types:
-output
displayed
onthe
terminal,
and
-output written
into
afile.
On
the
screenthe
user seesthe
requested section ofthe
Block
diagram,
the
movementsof
different
transactions(represented
by
ablinking
asterisk ortransaction
number)
and avariety
of model statistics.There
is
spaceleft for
errormessages,
HELP
instructions,
etc.The
actuallayout
varies,
depending
onthe
particularterminal.
Sample
screenlayouts
are14
The
originalGPSS/H
system creates adisk file in
which the source code andthe
result
from
the execution are recorded.This
outputis
often referredto
asbulk
(standard)
output.The
name ofthisfile is
the
same asthe
name ofthefile
containing the sourcecode,
but
withJog
substituting
the
required suffix gps.Using
theSET TLOG=ON
andSET
TLOG=OFF
commands, the user can controlthe
writing
into
thestandardJog
file
alog
oftheinteractive input
and outputfrom
the
debugging
session.
When TLOG
is
ON,
allinput
and outputlines
are writteninto
the
bulk
outputfile.
15
4.
ARCHITECTURAL
DESIGN
During
the
design
anddevelopment
ofthe
presentproject,
adeliberate
attempt wasmade
to
conform as much as possibleto the
established modern softwareengineering
practices
[14],
[15]. The
process wentthrough the
following
main stages:problem
definition
initial
high level design
development
of alimited
version ofthe
system andits testing
enhancing
the
high level design
development
of newfeatures
system
testing
preparation of program
documentation
preparation ofusermanual
The fundamental
principleupon whichthe
design
is
based
is
that the
system shouldbe
made as
easy
to
use as possible.This
includes
keeping
the
syntax ofthe
invoking
commandsimilar
to the
syntax ofthe
rest ofthe
commands ofthe
host operating system,
keeping
the
syntax of
the
Interactive Debugger
commandsas close as possibleto the
syntax ofthe
originalGPSS/H debugger
commands, attempting to
coverfor
the
lack
of experience ofthe
userby
providing
reasonabledefault
settings andactions,
etc.A
secondary,
but
stillvery
important
goal wasbuilding
the
systemin
such away
asto
assure
easy
modification and maintenance.In
accordance withthe
principles ofthe
Top-Down
structureddesign philosophy,
the
16
A.
Block diagram
building
modules,
andB.
Actual
debugging
modules.The
abovedivision is
arrived toeasily because
ofthe nature ofthe problem.The
implementation
ofthefirst
segmentis
relatively
straight-forward andis
discussed
in
more
detail
in
Section
7.2.
The
debugging
part presented someproblems,
primarily because
the
source codefor
the
GPSS/H
compiler was not available.It
wasdecided
to
divide
this
sectioninto
two modules,
positioned
like
filters before
and afterthe
GPSS/H
processor.In
this
mannerthe
actualGPSS/H
processor remainsintact
and canbe
usedin
"normal"debug
mode withoutany
17
5.
SYSTEM
SPECIFICATIONS
This
sectionis
primarily
focused
onthe
data
flow in
the
GPSS/H
Visual
Debugging
System in
relationto the
data flow
ofthe
originalGPSS/H
processor.The
system's modulehierarchy
andinter-module
interfaces
aredescribed
in Section 7.
5.1.
Standard GPSS/H
I/O Architecture
The
standardGPSS/H
I/O
architectureis
depicted in Figure 1.
Source
Program
GPSS/H
Processor
Standard
Output
Fig. 1. Standard GPSS/H I/O
architecture.Typically,
but
notnecessarily
so, the
source program comesfrom
adisk
file
andthe
standard
(bulk)
outputis
directed
to
adisk
file.
When
the
built-in debugger
is
invoked,
the
GPSS/H
module expectsinteractive
commandinput
and producesinteractive
outputThe
I/O
architecture canbe depicted
as shown onFigure
2.
*)
The
standard output consists of compilerlisting
and statistical report generated as a result ofthe
executionofthemodel18
Source
Program
Input
N
Interactive
Command
Input
GPSS/H
Processor
N
Standard
(Bulk)
Output
Interactive
Output
Fig. 2. Standard GPSS/H I/O
architecturein
Debugging
mode.By
default
the
standard output and theinteractive
output are separated andthe
interac
tive
outputis directed
to the
user'sterminal.
(Although,
withthe
help
ofthe
TLOG
command,
GPSS/H
provides meansfor
recording the
interactive
activitiesin
the
standard outputas
well)
5.2.
Visual Debugger I/O Architecture
The
full
screen version ofthe
debugger
introduces
two
new majorinterfaces.
These
arethe
commandinterpreter,
positionedbetween
the
interactive
user commandinput
andthe
GPSS/H processor,
andthe
interactive
outputinterpreter,
positionedbetween
the
GPSS/H
processor and
the
outputdevice
which,
in
this
case,
mustbe
a screenterminal.
The
interac
tive
commandinterpreter
onits
partis in
constant communication withthe
Display
Routines
19
Source
Program
Input
GPSS/H
Processor
Interactive
Command
Interactive
Interactive
Command
Interpreter
Output
Output
Input
Interpreter
s
Standard
(Bulk)
Output
Display
Routines
Library
Fig.
3. GPSS/H Visual Debugger I/O
architecture(simplified).
The diagram
onFigure
3 does
not showthe
modules andinterfaces
ofthe
Visual
Debugger's
preprocessor,
i.e.
the
invoking
commandinterpreter,
the
Block diagram
building
module and
the
Graphic Symbols Library.
The
main role ofthese
modulesis
to
assurethe
proper
invocation
ofthe
mainGPSS/H
processor andthe
building
ofthe
model'sBlock
diagram
in
accordance withthe
specifiedby
the
userinput
parameters or systemdefaults.
Schematically,
the positioning
ofthe
different
modulesthat
comprisethe
Visual Debugger in
relation
to
each other andin
relationthe
userinputs
and systemoutputs,
canbe
depicted
as20
Invoking
Command
Command
Graphic
Interpreter
Symbols
Library
'*-
//
Block Diagram
Building
Module
Source
Program
Input
\
\
\
Standard
Output
^v>s^
GPSS/H
Processor
\
_N*
/
X
Interactive
Command
Input
Command
Interpreter
Interactive
Output
Interpreter
Interactive
Output
' iDisplay
Routines
Library
User
Inputs
Processing
System Outputs
Fig. 4.
GPSS/H Visual Debugger
I/O
architecture.
53.
Graphical GPSS
Block
Symbols
The
blocks
availablein
the
GPSS/H Visual Debugger
arelisted in Table
1.
For
eachblock
are givenits
name andthe
symbol suggestedby
usfor
display
in
character mode.For
a
full description
of eachblock
-function,
operands,
explanation
-see
Chapter
5
ofthe
21
Table 1
GRAPHICAL SYMBOLS
FOR
GPSS
BLOCKS
Block Name
Character Mode
Block
Symbol
i
ADVANCE
, .DEPART
,j
0
\
ENTER
!
!/
\
/
\
/
\
GATE
N
/
\
/!
B
GATE
Facility
GATE Storage
/
\
/
\/\
\
/\/
\
,'\B
/
\
/
\0
\
/
\
/:
b
22
Block Name
Character Mode
Block
Symbol
LEAVE
!
!\
/
PREEMPT
!
!
/\
QUEUE
!
!
RELEASE
!
i\
/
!
\/
RETURN
,
,NN//
:
\/
SEIZE
. , ,,:
!/
\
23
Block
Name
Character Mode
Block Symbol
TEST
f
X
\
/
\
/
/
\
TRANSFER
/
\
\
/
24
6.
GPSS/H Visual
Debugger
Commands
The
following
sectiondescribes
the available commandsin
the
GPSS/H Visual
Debug
ging System
and their usage.It
canalso serve as asimplified user manual.With
the exception ofthe
initiation
command,
it
wasdecided
to
usethe
same conventionsasthe ones employed
in
theGPSS/H
Reference Manual [9].
These
are:Minimal
abbreviations areindicated
by
underscoring.Optional
items
are enclosedin brackets
("[ ]
").
Mandatory
items
may
be
enclosedin braces
("{ }
").
When
more than one choice existsfor
anitem,
choices are shown onthe
sameline
separated
by
"|
"characters,
or choices are shown on separatelines.
An
ellipsis("...")
is
usedto
denote
an optional repetitions of apreceding
item.
Debugger
commands canbe
enteredin
either upper orlower
casecharacters,
orany
combination of
both.
For example,
the
command:BREAK
(block)
...requires at
least
oneblock
to
be
specified(but
allows morethan
1),
andthe
command canbe
abbreviated as
BREA, BRE,
BR
orB.
The
syntax ofthe
invoking
commandis
kept
the
same asthe
syntax ofthe
commandsin
the
host operating
system-in
this
case
UNIX.
6.1.
Invoking
the
GPSS/H
Visual Debugger
The
GPSS/H
Visual
Debugging
System
is invoked
withthe
following
command:25
filegps is
the
name ofthe
file
containing
the
GPSS
source code.The
suffix .gpsis
required
in
the
file
name althoughthe
userdoes
nothave
to
enterit
in
the
commandline.
options
is
any
number ofthe
following
options:-T
ttname
name ofthe
userterminal.
The
name shouldbe
the
same asthe
one usedin
the
/etc/termcap
database. The default
is
the
current value of
the
$TERM
environment variable.-n n
the
starting block
number ofthe
Block diagram
segmentto
be
displayed.
The default
valueis
1.
-d ns
delay
factor
for
transaction
movementdisplay,
nis
the
number of
blinks
and sis
the
pausebetween blinks.
The de
fault
values are101
for
slowtransmission
lines
(300
baud)
and301 for
fast
lines (>
9600
baud).
-t on enable
trace
mode.-t off
disable
trace
mode(default).
-x on
display
transaction
numbers.-x off
do
notdisplay
transaction
numbers(default).
-p str pass
the
optionsin
the
characterstring
strto the
GPSS
com mand processor.6.2.
Terminating
the
GPSS/H Visual Debugger
The
debugging
sessioncanbe
terminated
by
issuing
any
one ofthe
following
commands:STOP
26
63.
Debugger
Environment
Control
Commands
The
GPSS/H Visual
Debugger
provides a number of commandsthat
canbe
usedto
tailor the
Debugger
environmentaccording
to the user's needs.The
user can record alog
ofthe
debugging
session,
enable/disable the executiontrace
facility,
setCPU
time
limits,
save/restore
intermediate
stages ofthe
modelexecution,
anddefine
command sequencesthat
areto
be
executedwhen specifiedBlocks
arereached63.1.
Controlling
the
Terminal
Log
(TLOG)
The
user can record alog
ofthe
debugging
session.If
TLOG is
turned
ON,
allinterac
tive
input
and outputlines
willbe
recordedin
the
bulk
(standard)
outputfile.
In
the
log,
the
input
lines
are prefixedwith an arrow.The
syntax ofthe
commandto
controlthe terminal
log
feature
is:
SET TLOG
{
ON
|
OFF
}
63.2.
Controlling
the
Execution Trace
When executing
multiplesteps,
the
user can requestthe
debugger
to
eitherdisplay
allintermediate
steps,
ordisplay
only
the
last
step.This
is
relevantfor
the
CONTINUE,
NEXT,
RUN
andSTEP
ncommands.The
syntax ofthe
commandto
controlthe
tracing
feature is:
SET
TRACE
{
ON
|
OFF
)
633.
Setting
Time Limits
The
user canspecify
CPU
executiontime
limits
which supercedeany
currently
activetime
limits,
including
limits
setby
SIMULATE
statements
withinthe
model.
The
syntax of27
SET TIME
n.n[
S|M
]
where an
S
suffixindicates
that the time
limit
is
specifiedin
seconds,
and anM
suffix(or
if
no suffix
is
given)
indicates
that the time
limit
is
specifiedin
minutes.6.3.4.
Recording
Memory
Image
ofthe
Model
At any
givenmoment,
the
user canissue
the
CHECKPOINT
command andthe
Debugger
will save amemory
image
ofthe
modelin
adisk
file.
Subsequently,
the
user canissue
the
RESTORE
command andthe
status ofthe
model willbe
restoredto that
which wassaved with
the
most recentCHECKPOINT
command.At
most one modelimage
canbe
saved at
any
giventime.
The
syntax ofthe
commandsis:
CHECKPOINT
RESTORE
63J5.
Command Procedures
(AT-points)
Command
procedures(or
At-points)
in
the
Debugger
environment are sequences of oneor more
Debugger
commandsthat
areto
be
executedevery
time
atransaction
attemptsto
enter a specified
Block
orBlocks.
The
At-points
are specifiedusing the
AT
commandwhichhas
the
following
syntax:AT block
...dbg_command_l
dbg_command_2
dbg_command_n
28
The
syntax oftheindividual
commandsin
a command procedureis
checked at execution time.
Commands
with syntax errors resultin
error messages and execution continueswith thenext command.
TRAP
conditionscan notbe
usedin AT
commands.At-points
are removed withthe
UNBREAK
command(see
Section
6.4.2).
6.4.
Model Execution
Control Commands
The
commandsthat
controlthe
actual execution ofGPSS
Blocks
canbe divided into
two
major subgroups: commandsfor
beginning
andresuming
of modelexecution,
and commands
for
suspending
of model execution.6.4.1.
Beginning
andResuming
Model
Execution
Actual
execution ofGPSS
statementsis
triggered
withthe
STEP, RUN,
CONTINUE
and
NEXT
commands.The
STEP
commandis
usedto
execute a specified number ofblocks.
If
no countis
given, 1 is
assumed.The
syntax ofthe
commandis:
STEP
[
n]
The RUN
commandis
usedto
initialize
normalexecution
of
the
model.Optionally,
the
user can
specify
one or more globalbreakpoints
and/or
trap
conditions.
The
syntax of
the
RUN
commandis:
RUN
block
NEXT
SYSTEM
CLOCK
value29
The
CONTINUE
commandis
usedto
initialize
normal execution ofthe
model.Option
ally,
the
user canspecify
one or morelocal
breakpoints.
The
syntax ofthe
CONTINUE
command
is:
CONTINUE
[block]
...The NEXT
commandis
usedto
continue execution untilthe
simulator picksup the
next active
transaction
from
the
Current
Events
Chain.
The SYSTEM
globaltrap
conditionis ignored
(if active) for
the
duration
ofthe
NEXT
command.The
syntax ofthe
NEXT
command
is:
NEXT
6.4.2.
Suspension
ofModel Execution
Two
mechanisms are offeredfor
controlled suspension of program execution:break
points and
traps.
Local
or globalbreakpoints
canbe
established atany block in
the
model.Local break
points remain
in
effectonly for
the
duration
of a single command.Global
breakpoints
remainin
effect untilthey
areexplicitly
removed.Local
breakpoints
canbe
established withthe
CONTINUE
command(see
Section
6.4.1).
Global breakpoints
canbe
established withthe
RUN
command(see Section
6.4.1),
or withthe
BREAK
command.The
syntax ofthe
BREAK
commandis:
BREAK
{block}
...Associated
with each globalbreakpoint
is
anignore
count.Each
time
abreakpoint is
encountered,
its
ignore
countis
checked andif
it is
greaterthan zero, the
ignore
countis
decremented
by
one andthe breakpoint
ignored.
Thus,
abreakpoint
is
recognizedonly
if its
30
zero,
but
theDebugger
providestheIGNORE
command which canbe
usedto
alterthat.The
syntax ofthe command
is:
IGNORE block
countGlobal breakpoints
canbe
removedusing
theUNBREAK
command.The
syntax ofthe
command
is:
UNBREAK
block
...The
GPSS/H Debugger
provides a mechanismfor
trapping
a number of special conditions.
When
atrap
for
a particular conditionis
enabled andthe
conditionarises,
a messageis
issued
and control returnsto
theuser.The
following
conditions canbe
specified:SYSTEM
triggered when a transaction thatis
moving
troughthe
model can not movefurther.
NEXT
triggered
when the simulator picksup
an activetransaction
from
the
Current
Events
Chain.
CLOCK
triggered
whenthe
Absolute
clock equals or exceeds a specified value.XACT
triggered
every
time
a specifiedtransaction
is
pickedup
as an activefrom
the
Current
Events
Chain.
The
syntax ofthe
TRAP
commandis:
TRAP
NEXT
SYSTEM
CLOCK
valueXACT
nTo disable
apreviously defined
trap
condition,
the
user canissue
the
UNTRAP
com31
UNTRAP
NEXT
SYSTEM
CLOCK
valueXACT
n6.5.
Output Control Commands
The
user candisplay
model status anddata
withthe
help
ofthe
DISPLAY
andcommands.
The DISPLAY
commanddisplays information
onthe screen,
whilethe PRINT
command records
the
information
in
the
standard(bulk)
file.
Both
commands canbe
usedto
display
a widevariety
of model statusinformation
(breakpoints,
storage, clocks, etc.),
dif
ferent
entity
classes(facilities,
queues,
logical
switches,
etc.),
individual
ampervariables, tran
sactions,
etc.For
afull
description
ofthe
different
entitiesthat
canbe displayed
withthe DISPLAY
and
the
GPSS/H User's Manual
[9].
6.6.
Help
Command
The
GPSS/H
Visual Debugger
provides on-linehelp
facility.
When
the
userissues
the
HELP command,
the
Debugger
willdisplay
onthe
screen alist
ofthe
mostcommonly
usedcommands
together
with abrief
explanation oftheir
use.The
syntax ofthe
HELP
commandis:
HELP
6.7.
Summary
ofthe
GPSS/H Visual
Debugger
Commands
32
Table 2
Command
Operands
Explanation
AT
One
or moreBlock
names or numbers
BREAK
One
or moreBlock
names or numbers
CHECKPOINT
noneCONTINUE
Zero
or moreBlock
namesor numbersDISPLAY
HELP
IGNORE
NEXT
> noneA Block
name ornumber,
followed
by
acountnone
The AT
command promptsthe
userfor
alist
ofin
teractive
debugging
commandsto
be
executedevery
time
aTransaction
reachesany
ofthe
designated
Blocks. The list
of commandsis
terminated
by
typ
ing
END.
AT-points
remainin
effect until explicitly
removed withthe
UNBREAK
command.The BREAK
command sets globalbreakpoints
at each ofthe
specifiedBlocks.
Global
breakpoints
remainin
effect until removed withthe
UN-BREAK
command.A
globalbreakpoint
canbe
temporarily
suppressedby
using the
IGNORE
com mand.The
CHECKPOINT
command writesinto
the
checkpoint
file
amemory
image
ofthe
modelbeing
debugged.
The
CONTINUE
commandis
usedto
resume exe cution of a model.Any
Block
names or numbersspecified
in
the
CONTINUE
command are set aslocal
breakpoints,
which remainin
effectonly
for
the
duration
ofthe
CONTINUE
command.The
DISPLAY
command can select a widevariety
of model statistics and other usefulinformation
for
display
onthe
terminal.
The
useris limited
to
onestatisticper call.
The HELP
command resultsin
the
display
onthe
screen of a
list
withthe
mostfrequently
usedde
bugger
commands
and abrief
explanation oftheir
usage.
The
IGNORE
commandis
usedto
temporarily
suppress a global
breakpoint.
The
count specifies
the
numberoftimes the
breakpoint
is
to
be ignored.
The
NEXT
commandspecifies
that
execution ofthe
modelis
to
proceed untilthe
next activeTran
sactionis
pickedfrom
the
Current Events Chain.
If
trap-conditions (with
the
exceptionofthe
SYSTEM
trap),
breakpoints,
orat-points
areencountered
by
the
current
Transaction,
the
NEXT
command
is
33
Table 2
(contd.)
Command
Operands
Explanation
QUIT
> none noneRUN
RESTORE
STEP
Zero
or moreBlock
names ornumbers
SYSTEM
NEXT
CLOCK
[=]
nXACT
[=]
nnone
optionalcount
STOP
noneSET
TIME
[=]
nTIME
[=]
nSTIME
[=]
nMThe PRINT
command can write a widevariety
ofmodel statistics and other useful
information
into
the
standard outputfile
ordevice (not
the
terminal).The
immediate
termination ofa run.
No
checkis
madefor
pending
output.The QUIT
commandis
usedto
terminate a run.If
any
model outputis
pending
atthe time the
QUIT
commandis
issued,
awarning
is
given andthe
command must
be
typed
a secondtime to
suppressthe
output.
The RUN
commandis
usedto
initiate
execution ofa model.
Global
breakpoints
are setfor any Blocks
designated
onthe
RUN
command.Global
trap-conditions
canbe
setby
the
RUN
command.
For
asummary
ofthese conditions,
seethe
description
ofthe
TRAP
command.The RESTORE
commandis
usedto
restore modelstatus
to that
which waspreviously
writteninto
the
checkpointfile
by
means of aCHECKPOINT
command.
The
STEP
commandis
usedto
step
through aspecified numberof
Block
executions.If
no countis
given,
a value of oneis
assumed.The STOP
commandis
usedto terminate
a run.If
any
model outputis
pending
atthe time
the
STOP
commandis
issued,
awarning
is
given andthe
STOP
command mustbe be
typed
a second timeto
suppress
the
output.The SET
command canbe
usedto
set aCPU
time
limit
which supersedesany currently
activetime
limit,
including
time
limits
setby
SIMULATE
state ments within a model.An S
suffixindicates
that the
time
limit
is
specifiedin
seconds.An M suffix,
or nosuffix
indicates
that
the
time
limit
is
specifiedin
minutes.
Non-integral
values(e.g.
SET
34
Table 2
(contd.)
Command
Operands
Explanation
TRAP
UNBREAK
UNTRAP
TLOG
[=]
ON
TLOG
[=]
OFF
TRACE
[=]
ON
TRACE
[=]
OFF
SYSTEM
NEXT
CLOCK
[=]
nXACT
[=]
nOne
or moreBlock
namesornumbers
SYSTEM
NEXT
CLOCK
[=]
nXACT
[=]n
The SET
command canbe
usedto turn the terminal
log
on and off.When
the terminal
log
is
turned
on,
allinteractive
debugging
input
and output are also writteninto
the
standard outputfile
ordevice.
In
put
lines
(commands)
are prefixedby
an arrow.The SET
command canbe
usedto turn the trace
fa
cility
on and off.When TRACE
is
on,
allinter
mediate steps of
the
RUN,
CONTINUE
andSTEP
ncommands aredisplayed
onthe
screen.The TRAP
SYSTEM
command specifiesthat
eachtime the
activeTransaction
comesto
arest,
a message
is
to
be
issued,
and controlis
to
returnto the
user.
The
TRAP NEXT
command specifiesthat
eachtime
a new activeTransaction is
pickedup
in
the
simulator's scan of
the
Current Events
Chain,
a messageis
to
be
issued,
and controlis
to
returnto
the
user.The TRAP
CLOCK
[=]
n command specifiesthat
when
the
Absolute Clock
reaches or exceedsthe
specified
value,
a messageis
to
be
issued,
and control
is
to
returnto the
user.At
most one clocktrap-condition
canbe in
effectat atime.
The TRAP
XACT
[=]
ncommand
specifiesthat
aTransaction
number nis
to
be flagged in
such amanner
that
eachtime
it is
pickedup
as an activeTransaction in
the simulator's
scan ofthe
Current
Events
Chain,
a messageis
to
be
issued,
and controlis
to
returnto the
user.The
UNBREAK
command
is
usedto
removeglobalbreakpoints
andat-points.
The UNTRAP
command
removestraps
set viathe
35
7.
HIGH LEVEL
MODULE
DESIGN
The
mainflow
of controlin
the
GPSS/H
Visual
Debugging
System
is
depicted
onFig
ure
5. There
aretwo
distinctive
stages,
corresponding
to the
"static" and"dynamic"
parts of
the
debugging
session-see
Section 3.1.
(
START
J
INITIALIZING
MODULE
BLOCK DIAGRAM
BUILDING
MODULE
fork
INPUT
COMMAND
INTERPRETER
GPSS/H
PROCESSOR
C
STOP
3
INTERACTIVE
OUTPUT
INTERPRETER
Fig. 5. GPSS/H Visual Debugger
-Main flow
of control
During
the
staticstage, the
flow
of controlhas
the
classical sequential execution nature.The last
step
in
the
static stageis
the
creation ofthe three
separate subprocessesthat
comprise
the
dynamic
part ofthe
system.These
subprocesses executein
paralleland are syn