234
Visual Execuon Analysis The Sparx Systems Enterprise Architect Visual Execution Analyzer provides tools to build, debug, record, profile and simulate software while keeping code and model tightly integrated. The VEA has rich support for Java, .Net and Microsoft Windows C++. Enterprise Architect User Guide Series Author: Sparx Systems Date: 2020-01-20 Version: 15.1 CREATED WITH

Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

  • Upload
    others

  • View
    63

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis

The Sparx Systems Enterprise Architect Visual Execution Analyzer provides tools to build,debug, record, profile and simulate software while keeping code and model tightly integrated.

The VEA has rich support for Java, .Net and Microsoft Windows C++.

Enterprise Architect

User Guide Series

Author: Sparx Systems

Date: 2020-01-20

Version: 15.1

CREATED WITH

Page 2: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Table of Contents

Visual Execution Analysis 5Build and Debug 9

Analyzer Scripts 11Managing Analyzer Scripts 13Analyzer Script Editor 16Build Scripts 19Cleanup Script 21Test Scripts 23Testpoints Output 25Debug Script 27

Operating System Specific Requirements 28UAC-Enabled Operating Systems 29WINE Debugging 30

Java 32General Setup for Java 33Advanced Techniques 35

Attach to Virtual Machine 36Internet Browser Java Applets 37

Working with Java Web Servers 38JBOSS Server 40Apache Tomcat Server 41Apache Tomcat Windows Service 42

.NET 43General Set up for .NET 44Debugging an Unmanaged Application 45Debug COM Interop 46Debug ASP .NET 47

The Mono Debugger 48The PHP Debugger 51

PHP Debugger - System Requirements 54PHP Debugger Checklist 55

The GNU Debugger (GDB) 57The Android Debugger 59Java JDWP Debugger 62Tracepoint Output 64Workbench Set Up 65

Microsoft C++ and Native (C, VB) 66General Set Up 67Debug Symbols 69

Code Miner Script 70Services Script 73Run Script 74Deploy Script 75Recording Scripts 77Merge Script 79

Build Application 80Locate Compiler Errors in Code 81

Page 3: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Debugging 82Run the Debugger 84Breakpoint and Marker Management 87

Setting Code Breakpoints 89Trace Statements 90Break When a Variable Changes Value 92Trace When Variable Changes Value 95Detecting Memory Address Operations 96Breakpoint Properties 98Failure to Bind Breakpoint 100

Debug a Running Application 101View the Local Variables 102

View Content Of Long Strings 105View Debug Variables in Code Editors 107Variable Snapshots 108

Actionpoints 110View Variables in Other Scopes 114

View Elements of Array 115View the Call Stack 116

Create Sequence Diagram of Call Stack 118Inspect Process Memory 120Show Loaded Modules 121Process First Chance Exceptions 122Just-in-time Debugger 123

Services 124Profiling 126

System Requirements 131Getting Started 132Call Graph 134Stack Profile 136Memory Profile 138Memory Leaks 140Setting Options 142Start & Stop the Profiler 144Function Line Reports 146Generate, Save and Load Profile Reports 149Save Report in Team Library 154

Recording 155How it Works 159

The Recording History 161Diagram Features 163

Setup for Recording 164Control Stack Depth 165

Place Recording Markers 166Set Record Markers 167Marker Types 168The Breakpoints & Markers Window 170Working with Marker Sets 171

Control the Recording Session 173Recorder Toolbar 174Working With Recording History 176

Page 4: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Start Recording 178Step Through Function Calls 179Nested Recording Markers 180

Generating Sequence Diagrams 181Reporting State Transitions 183

Reporting a StateMachine 184Recording and Mapping State Changes 186

State Analyzer 187Synchronization 194

Testpoints 196Test Domain Diagram 200

Test Cut 202Test Set 203Test Suite 204

The Testpoints Window 205Testpoints Toolbar 207Testpoint Editor 209Testpoint Constraints 211

Object Workbench 214Using the Workbench 215Creating Objects 216Invoking Methods 218Setting Properties 220Debugging and the Workbench 221Recording and the Workbench 222Deleting Objects 224Closing the Workbench 225

Visualize Run State 226Unit Testing 227

Set Up Unit Testing 228Run Unit Tests 230Record Test Results 231

Samples 232

Page 5: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Visual Execution Analysis

The Visual Execution Analyzer (VEA) is made up of an advanced and powerful suite of tools that allow you to build,debug, record, profile, simulate and otherwise construct and verify your software development while keeping the codetightly integrated with your model. Enterprise Architect has rich support for a wide range of popular compilers andplatforms, in particular the Java, .Net and Microsoft Windows C++ environments. Software development becomes ahighly streamlined visual experience, quite unlike working in traditional environments.

Enterprise Architect is itself modeled, built, compiled, debugged, tested, managed, profiled and otherwise constructedtotally within the Visual Execution Analyzer built into Enterprise Architect. While the VEA can be used to complementother tool suites, it also shines when used as the primary development IDE in close coupling with the model and projectmanagement capabilities provided by Enterprise Architect.

Access

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Tools > Analyzer

Keyboard Shortcuts Shift+F12

Execution Analyzer Features

Feature Description

Build and Debug Using Analyzer Scripts linked to Model Packages, it is possible to tightly integratethe code/build/debug cycle into Enterprise Architect. For Java, .Net and MicrosoftC++ in particular, it is simple to link to project code bases and take over thebuilding and debugging within Enterprise Architect's Model Driven DevelopmentEnvironment. In addition to standard debugging features, the strong coupling withthe model and the use of advanced debugging features such as Action Points makesEnterprise Architect the ideal platform from which to both design and constructyour software application.

Simulation Bring your behavioral models to life with instant, real-time behavioral modelexecution. Coupled with tools to manage triggers, events, guards, effects,breakpoints and simulation variables, plus the ability to visually track execution atrun-time, the Simulator is a powerful means of 'watching the wheels turn' byvisualizing execution of your behavioral models.

Profiling Lift the hood on software performance and see what is actually going on. Quicklygain a clear picture of why certain tasks behave poorly or worse than expected.

(c) Sparx Systems 2019 Page 5 of 234 Created with Enterprise Architect

Page 6: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Whether its Microsoft .NET, native C++ or Java, use profiles to effectively judgechanges in performance over your software lifecycle.

Recording Execution Record the execution of code without the need for instrumentation. Control theamount of detail through filters and stack depth. Generate beautiful Sequencediagrams and diagrams that illustrate Class collaboration. Use recording to createTest Domain diagrams that can be used with the VEA Testpoints feature.

Testing Create and manage test scripts for model elements. Explore the Testing interface,supporting unit, integration, scenario, system, inspection and acceptance tests.Employ programming by contract methodology with the Testpoints facility.

Object Workbench Workbench Class behavior on the fly, by instantiating them in the ObjectWorkbench and then invoking their operations. You can even pass objects on theworkbench as parameters to other workbench objects.

Visual Execution AnalyzerSamples

Try our sample patterns to set up and explore some of the powerful features of theVisual Execution Analyzer.

Benefits of the Execution Analyzer

The Execution Analyzer provides an integrated development and testing environment for multiple platforms, includingMicrosoft .NET, Java, Native C++, Mono and Android. It includes a feature-rich debugger, execution recording andprofiling, and Testpoint management.

It helps you to generate Sequence, Test Domain Class and Collaborative Class diagrams from a single recording. This isa great way to understand and document your application.

Visualize program execution·

Optimize existing system resources and understand resource allocation·

Verify that the system is following the rules as designed·

Produce high quality documentation that more accurately reflects system behavior·

Understand how and why systems work·

Train new employees in the structure and function of a system·

Provide a comprehensive understanding of how existing code works·

Identify costly or unnecessary function calls·

Illustrate interactions, data structures and important relationships within a system·

Trace problems to a specific line of code, system interaction or event·

Establish the sequence of events that occur immediately prior to system failure·

Simulate the execution of behavior models including StateMachines, Activities and Interactions·

(c) Sparx Systems 2019 Page 6 of 234 Created with Enterprise Architect

Page 7: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Operations

Operation Description

Simulate Behavior Simulate UML behavior models to verify their logical and design correctness, for:

Activities·

Interactions and Sequences·

StateMachines·

Record execution Record executing programs and represent the behavior as a UML Sequencediagram; recording is supported for:

Microsoft Windows Native C, C++, Visual Basic·

Microsoft .NET Family (C#, J#, VB)·

Java·

Mono·

Android·

PHP·

Profile behavior Quickly view / report on behaviors of running applications. Profiling is supportedfor these platforms:

Microsoft Native C, C++, Visual Basic·

Microsoft .NET Family (C#, J#, VB) (including any unmanaged / managed·code mix)

Java·

Mono·

Test Use Cases withTestpoints system

Testpoints Management provides a facility to define the constraints on a Classmodel as contracts. The contracts provide the assets on which to create Testdomains. A single Testpoint domain can then be used to test and report the behaviorof multiple applications. You can also use the Execution Analyzer to record a UseCase and generate a Test Domain diagram with very little effort. Any existingTestpoints are automatically linked to the generated domain or the Test Domaindiagram can be used as the context for new contract compositions. How anapplication behaves for a given Test domain can be seen immediately in real time!Results are displayed in the Testpoint report window every time a contract is passedor failed. The decoupling of test measurement from the code-base has a number ofbenefits, one of which is aiding the reconciliation of multiple systems with acommon Test domain, rather than one another.

The Testpoint system supports these contracts:

Class invariants·

Method pre-conditions·

Method post-conditions·

Line conditions·

Object Workbench Create and work with objects created within the Enterprise Architect modelingenvironment using a dynamic Object Workbench.

Create objects from Class model·

Invoke methods and view results·

Workbench Class collaboration·

(c) Sparx Systems 2019 Page 7 of 234 Created with Enterprise Architect

Page 8: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Pass objects as parameters to other objects·

Full debugging features including recording·

Run xUnit tests Run nUnit and jUnit tests for Java and Microsoft .NET

Record and document results.

Import code from analysis Execution Recording and Profiling both acquire a collection of relevant code files,which you can reverse-engineer to the current model in a single operation.

(c) Sparx Systems 2019 Page 8 of 234 Created with Enterprise Architect

Page 9: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Build and Debug

Enterprise Architect builds on top of its already exceptional code generation, diagramming and design capabilities with acomplete suite of tools to build, debug, visualize, record, test, profile and otherwise construct and verify softwareapplications. The toolset is intimately connected to the modeling and design capabilities and provides a unique andpowerful means of constructing software from a model and keeping model and code synchronized.

Enterprise Architect helps you define 'Analyzer Scripts' linked to Model Packages that describe how an application willbe compiled, which debugger to use and other related information such as simulation commands. The Analyzer Script isthe core configuration item that links your code to the build, debug, test, profiling and deployment capabilities withinEnterprise Architect.

As a measure of how competent the toolset is, it should be noted that Enterprise Architect is in fact built, debugged,profiled, tested and otherwise constructed fully within the Enterprise Architect development environment. Many of theadvanced debugging tools such as 'Action Points' have been developed to solve problems inherent in the construction oflarge and complex software applications (such as Enterprise Architect) and are routinely used on a daily basis by theSparx Systems development team.

It is recommended that new users take the time to fully understand the use of the Analyzer Scripts and how they tie themodel to the code, to the compilers and to other tools necessary for building software.

Integrating Model and Code

Model Driven Engineering is a modern approach to software development and promises greater productivity and higherquality code, resulting in systems getting to market faster and with fewer faults. What makes this approach compelling isthe ability for the architecture and the design of a system to be described and maintained in a model, and then generatedto programming code and schemas that can be synchronized with and visualized within the model.

Enterprise Architect's Model Driven Development Environment (MDDE) supports this approach and provides a set offlexible tools to increase productivity and reduce errors. These include the ability to define the architecture and design in

(c) Sparx Systems 2019 Page 9 of 234 Created with Enterprise Architect

Page 10: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

models, generate code from these models, synchronize the code with the models and maintain the code in sophisticatedcode editors. Source code or binaries can also be imported, and users can record and document pre-existing or recentlydeveloped code. The Analyzer Script tool helps you to describe how to build, debug, test and deploy an application.

Facility Description

Model DrivenDevelopment

Model Driven Development provides a more robust, accessible and fasterdevelopment cycle than traditional coding-driven cycles.

A well constructed model, intimately linked with source code build, run, debug, testand deploy capabilities provides a rich, easily navigated and easily understoodtarget architecture. Traceability, linkage to Use Cases, Components and othermodel artifacts, plus the ability to readily record and document pre-existing orrecently developed code, make Enterprise Architect's development environmentuniquely powerful.

Enterprise Architect incorporates industry standard intelligent editing, debuggersand modeling languages.

The Model DrivenDevelopment Environment(MDDE)

The MDDE provides tools to design, visualize, build and debug an application:

UML technologies and tools to model software·

Code generation tools to generate/reverse engineer source code·

Tools to import source code and binaries·

Code editors that support different programming languages·

Intelli-sense to aid coding·

Analyzer scripts that enable a user to describe how to build, debug, test and·deploy the application

Integration with compilers such as Java, .Net, Microsoft C++·

Debugging capabilities for Java, .NET, Microsoft C++ and others·

Advanced visualization, recording, inspection, testing and profiling capabilities·

(c) Sparx Systems 2019 Page 10 of 234 Created with Enterprise Architect

Page 11: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Analyzer Scripts

Analyzer Scripts are used by the Execution Analyzer. You do not need to worry about creating these. They are not thesame type of script as JavaScript or PHP, but are managed using a familiar user interface - a tree view - and you canquickly locate the feature to change. Analyzer Scripts can be shared by users of a community model and are easilyimported and exported as XML files.

A single project can have multiple configurations and these can be found grouped together in the Analyzer window.

(c) Sparx Systems 2019 Page 11 of 234 Created with Enterprise Architect

Page 12: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Each Analyzer Script is defined for a Package, so projects can co-exist quite happily. In many organizations, theprocedures to manage systems are distributed, and vary from individual to individual and group to group. AnalyzerScripts in an Enterprise Architect model can provide some peace of mind to these organizations, by trusting a single,shared and accountable procedure for building and deploying any variety of configurations. All aspects of a script areoptional. You can, for instance, debug without one; however, with a few lines they can enable these powerful features:

Building·

Testing·

Debugging·

Recording·

Execution·

Deployment·

Simulation·

Remote Script Execution

Various Analyzer Script sections such as Build and Run, provide a 'Remote Host' field. This field is used to describe thecomputer on which the script should run. In order to use this feature, the Sparx Satellite service must be running on themachine. The format of this field is hostname:port, where hostname is the IP address or network name of a Windows orLinux machine and port is the Port number that the Satellite service is listening on. The primary goal of this feature is toallow a user of Enterprise Architect running on Linux to execute commands native to Linux.

(c) Sparx Systems 2019 Page 12 of 234 Created with Enterprise Architect

Page 13: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Managing Analyzer Scripts

The Execution Analyzer window enables you to manage all Analyzer scripts in the model. You can use the windowtoolbar buttons or script context menu options to control script tasks. Scripts are listed by Package; the list only showsPackages that have Analyzer scripts defined against them. Each user can set their own active script, independent of otherusers of the same model; one user activating a script does not impact the currently active scripts for other users or affectthe scripts available to them. The active script governs the behavior of the Execution Analyzer; when choosing the buildcommand from a menu, for example, or clicking the Debug button on a toolbar.

There can be a lot of Packages with scripts listed in the window. To help you locate and isolate a particular Package, usethe 'Filter Packages' context menu options, described in the Context Menu Options table in this topic.

Access

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Tools > Analyzer

Keyboard Shortcuts Shift+F12

Toolbar Options

Toolbar Button Action

Quick access to the Analyzer core windows such as Call Stack or Local Variables,plus the power features:

Profiling·

Recording·

Testpoints·

Simulation·

Create and edit a new Analyzer Script for the selected Package, under either Linuxor WindowsTM.

Export Scripts.

Export one or more Analyzer Scripts to an XML file, which can be used to importthe scripts into another model.

The 'Execution Analyzer: Export' dialog displays from which you select the scriptor scripts to export, followed by a prompt for the target file name and location.

Import Scripts.

Import one or more Analyzer Scripts into the current model from a previouslyexported XML file.

The 'Find Package' dialog displays, on which you select the Package into which toimport the scripts, followed by a prompt for the source filename and location.

Execute the 'Build' command of the active script.

(c) Sparx Systems 2019 Page 13 of 234 Created with Enterprise Architect

Page 14: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Cancel the 'Build' command currently in progress.

Execute the 'Run' command of the active script.

Execute the 'Test' command of the active script.

Execute the 'Deploy' command of the active script.

Display the Help topic for this window.

Context Menu Options

Right-click on the required script or Package to display the context menus.

Option Action

Add New Script Add a new script to the selected Package.

The Execution Analyzer window displays, showing the 'Build' page.

Paste Script Paste a copied script from the Enterprise Architect clipboard into the selectedPackage.

You can paste the copied script several times; each copy has the suffix 'Copy'.

To rename the copied script, press F2 and overtype the script name.

Export Scripts Export scripts from the selected Package.

The 'Execution Analyzer: Export' dialog displays, from which you select the scriptor scripts to export, followed by a prompt for the target filename and location.

Import Scripts Import scripts from a .XML file into the selected Package.

A prompt displays for the source filename and location.

Filter Packages Displays a submenu of options to:

Enter the Package path against which to filter the list of Packages - when you·select the 'Filter Packages' option, a prompt displays to accept thecurrently-selected Package path, or you can remove the end elements of thepath to specify a larger set of Packages; when you click on the OK button thefirst Package in the list is expanded to list the scripts it contains

Switch between hiding the full list of Packages to expose only the·currently-selected Package, and showing the full list

Remove the currently-active filter to show the full list of Packages·

Select In Project Browser Highlight the selected Package in the Browser window.

Display the Browser window, which is now expanded to show the highlightedPackage.

Help Display the Help topic for this window.

(c) Sparx Systems 2019 Page 14 of 234 Created with Enterprise Architect

Page 15: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Build Execute the 'Build' command of the selected script.

Clean Execute the 'Clean' command of the selected script.

Rebuild Execute the 'Clean' and 'Build' commands of the selected script.

Debug Execute the 'Debug' command of the selected script.

Run Execute the 'Run' command of the selected script.

Test Execute the 'Test' command of the selected script.

Deploy Execute the 'Deploy' command of the selected script.

Merge Execute the 'Merge' source control command of the selected script.

Changes Execute the 'Changes' source control command of the selected script.

History Execute the 'History' source control command of the selected script.

Commit Execute the 'Commit' source control command of the selected script.

Working Copy Execute the 'Working Copy' source control command of the selected script.

Repository Execute the 'Repository' source control command of the selected script.

Run Javascript Execute the 'Run Javascript' command of the selected script.

Start Simulation Start the simulation referenced by the 'Analyzer Script Simulation' page.

Run ExecutableStatemachine

Start a simulation of the selected Executable Statemachine Artifact.

Edit Open the selected script in the 'Analyzer Scripts Editor'.

Copy Copy the selected script to the Enterprise Architect clipboard.

Paste Paste the most-recently copied script to the same Package as the selected script.

You can paste the copied script several times; each copy has the suffix 'Copy'.

To rename the copied script, press F2 and overtype the script name.

Delete Delete the selected script; there is no prompt for confirmation.

To delete a Package from the Execution Analyzer window, delete the scripts fromthe Package. When the last script is deleted, the Package is no longer listed.

Package Default Set the selected script as the default script for the Package.

The icon to the left of the script changes color; any previous Package default revertsto normal.

(c) Sparx Systems 2019 Page 15 of 234 Created with Enterprise Architect

Page 16: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Analyzer Script Editor

The Analyzer Script Editor has a straightforward user interface with a tree view of the scripts on the left enabling easynavigation of the script groups, and a content view on the right in which you define and configure the scripts.

Access

From the 'Execution Analyzer' window, either:

Double-click on a script to edit it or·

Right-click on a script and select the 'Edit' option·

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Tools > Analyzer

Keyboard Shortcuts Shift+F12

Execution Analyzer Scripts

Task - Page Action

Build - Build Enter the script or command to build the application. This can be an Apache Ant orVisual Studio command, but can also be tailored depending on your developmentenvironment. Note: Remember to select a parser to get directly to the source codein the event of any errors. The parser field is on the same page and offers supportfor many languages.

Build - Clean Enter the script or command to clean the previous build. This is the command line

(c) Sparx Systems 2019 Page 16 of 234 Created with Enterprise Architect

Page 17: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

you would normally issue to build your system. This can be an Apache Ant orVisual Studio command depending on your development environment.

Test - Test Enter the script or command to test the application. This is typically where an nUnitor jUnit invocation might be configured, but it just as easily could be any procedureor program.

Test - Testpoints Specify where the output from a Testpoint run is sent.

Debug - Platform Specify the debugging platform, the application to be debugged, and the mode ofdebugging (attach to process or run).

Debug - Tracepoints Specify where the output from Tracepoints encountered during a debug session aresent.

Debug - Workbench For .NET projects, the assembly to load. Not required for Java.

Debug - Runtime Host Specify the Runtime Host.

Source Control - Merge

Source Control - Changes

Source Control - History

Source Control - Commit

Source Control -Repository

Code Miner - Service

Code Miner - Libraries

Private Options - Services

Run JavaScript

Source Control - WorkingCopy

Run Enter a script or command to run the application.

Deploy Enter a script or command to deploy the project. Build your jar file. Deploy to yourdevice, an emulator or Tomcat server.

Publish a web site. Its up to you.

Recording Does your Sequence diagram resemble the national grid? Reduce the clutter withfilters. Filters define exclusion zones in your code base that can cut downdramatically on any 'noise' that is being recorded. Even accurate noise is not alwayshelpful.

Simulation Complete the configuration for Simulation Control.

(c) Sparx Systems 2019 Page 17 of 234 Created with Enterprise Architect

Page 18: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

(c) Sparx Systems 2019 Page 18 of 234 Created with Enterprise Architect

Page 19: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Build Scripts

The 'Build' page enables you to enter commands to build your project. You can use Enterprise Architect Local Paths andenvironment variables in composing your command line(s). You can choose to create your own build script, enteringvarious shell commands. You can also choose to simply run an external program or batch file such as an Ant script.

Access

On the Execution Analyzer window, either:

Locate and double-click on the required script and select the 'Build > Build' page or·

Click on in the window Toolbar, select the Package in which to create a new script, and select the 'Build >·Build' page

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Tools > Analyzer

Analyzer Context Menu Build

Keyboard Shortcuts Ctrl+Shift+F12

Build

Write your script in this text box, using the windows shell commands; the format and content of this section depends onthe actual compiler you use to build your project. If the path or arguments contain spaces, surround them with quotes; forexample: "c:\program files (x86)\java\bin\javac.exe".

Here are some examples:

Visual Studio:

"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.com" /Rebuild Debug RentalSystem.sln

Visual Studio using a Local Path:

"%VsCompPath%\devenv.exe" /build Debug Subway.sln

Java:

C:\Program Files (x86)\Java\jdk1.6.0_22\bin\javac.exe" -g -cp "%classpath%;." %r*.java

Java using a Local Path:

"%JAVA%\bin\javac.exe" -g -cp "%classpath%;." %r*.java

Wildcard Java Builds (%r) - Source files in sub-folders can be built using the %r token. The token has the effect ofcausing a recursive execution of the same command on any files in all sub-folders, as shown in the example.

Execute Command as

Click on the drop down arrow and select the mode of executing the script:

Batch File - Use this option to execute a shell script in a system command window; environment variables can be·accessed by commands in this script

(c) Sparx Systems 2019 Page 19 of 234 Created with Enterprise Architect

Page 20: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Process - Use this option to execute the command as a single program; the command should specify the path to the·program, plus any command line arguments

Default Directory

Browse for or type in the default directory path in which the build script process will run.

Parse Output

Click on the drop-down arrow and select a method for automatically parsing the compiler output.

If you select this option, output from the script is logged in the System Output window; Enterprise Architect parses theoutput according to the syntax you specify.

Remote Host

Type in the ID of the remote host system and its port; for example, mypc01:7777.

If you set this property to #SYSTEMHOST#, the script is sent to the Windows Satellite Service when running onWindows, and the Linux Satellite Service when running under Wine. The service IDs and Ports are defined in the'Private Options - Services' section of the Analyzer Scripts Editor.

Deploy after Build

Check this box to cause the Deploy script to be executed immediately after this Build script completes.

Notes

To execute the Build script, click on the Package in the Browser window and either:

Right-click on any Toolbar and select 'Analyzer Toolbars | Build', or·

Press Ctrl+Shift+F12 or·

Select the 'Execute > Source > Build > Build' ribbon option·

(c) Sparx Systems 2019 Page 20 of 234 Created with Enterprise Architect

Page 21: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Cleanup Script

Incremental builds are the practice of only building those assets that have changed in some way. There are times,however, when there is cause to build everything again from scratch. This command is used for those occasions, toremove the binaries and intermediary files associated with a particular build or configuration. The project can then berebuilt. When you execute the 'Rebuild' menu option on a script, the command(s) you specify in this field are executed,followed immediately by the 'Build' command from the same Analyzer script. Some compilers have options do this foryou. Visual studio for example has the "/clean" command line switch.

This is an example script: devenv.com /Clean Debug MyProject.sln

Access

On the Execution Analyzer window, either:

Locate and double-click on the required script and select the 'Build > Clean' page or·

Click on in the window Toolbar, select the Package in which to create a new script, and select the 'Build >·Clean' page

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Source > Build > Clean

Analyzer Context Menu Clean

Keyboard Shortcuts Shift+F12

Aspects

Aspect Detail

Clean Enter the command to be executed when you select 'Clean' from the script contextmenu.

Execute Command as Click on the drop-down arrow and select the appropriate option:

Batch File - Use this option to create a shell script that is executed in a system·command window; environment variables can be accessed by commands inthis script

Process - Use this option to run a single program - the command should specify·the path to the program, plus any command line arguments; - if the path orarguments contain spaces, surround them with quotes - for example:"c:\program files (x86)\java\bin\javac.exe"

Default Directory Defaults to the value entered for the Build script. If a value has not been set for theBuild script, browse for or type in the default directory path in which the Cleanscript process will run.

Parse Output Click on the drop-down arrow and select a method for automatically parsing thecompiler output.

If you select this option, output from the script is logged in the System Output

(c) Sparx Systems 2019 Page 21 of 234 Created with Enterprise Architect

Page 22: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

window; Enterprise Architect parses the output according to the syntax you specify.

Remote Host Type in the ID of the remote host system and its port; for example, mypc01:7777.

If you set this property to #SYSTEMHOST#, the script is sent to the WindowsSatellite Service when running on Windows, and the Linux Satellite Service whenrunning under Wine. The service IDs and Ports are defined in the 'Private Options -Services' section of the Analyzer Scripts Editor.

(c) Sparx Systems 2019 Page 22 of 234 Created with Enterprise Architect

Page 23: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Test Scripts

These sections explain how to configure the 'Test' page of an Analyzer Script for performing unit testing on your code.Most users will apply this to NUnit and JUnit test scenarios. Enterprise Architect accepts the output from these systemsand can automatically add to and manage each unit test case history. To view the case history, you would select the testcase Class element and press Alt+2 > Testing.

Access

On the Execution Analyzer window, either:

Locate and double-click on the required script and select the 'Test > Test' page or·

Click on in the window Toolbar, select the Package in which to create a new script, and select the 'Test >·Test' page

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Tools > Analyzer

Analyzer Context Menu Test

Keyboard Shortcuts Shift+F12

Actions

Test Type the Test command or script in this field. For example:

NUnit - "C:\Program Files\NUnit\bin\nunit-console.exe"·"bin\debug\Calculator.exe"

JUnit - java junit.textui.Testrunner %N·

The command listed in this field is executed as if from the command prompt; as aresult, if the executable path or any arguments contain spaces, they must besurrounded in quotes.

If you include the string %N in your test script it is replaced by the fullynamespace-qualified name of the currently selected Class when the script isexecuted.

Execute Command As Click on the drop-down arrow and select the appropriate option:

Batch File - Use this option to create a shell script that is executed in a system·command window; environment variables can be accessed by commands inthis script

Process - Use this option to run a single program - the command should specify·the path to the program, plus any command line arguments; if the path orarguments contain spaces, surround the path with quotes - for example:"c:\program files (x86)\java\bin\javac.exe"

Default Directory Defaults to the value entered for the Build script. If a value has not been set for theBuild script, browse for or type in the default directory path in which the Cleanscript process will run.

(c) Sparx Systems 2019 Page 23 of 234 Created with Enterprise Architect

Page 24: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Parse Output When a parser is selected, output of nUnit and jUnit tests can be parsed, saved andmanaged from the model; (Alt+2 > Testing). Be aware that output is only capturedwhen a parser is selected.

Remote Host Type in the ID of the remote host system and its port; for example, mypc01:7777.

If you set this property to #SYSTEMHOST#, the script is sent to the WindowsSatellite Service when running on Windows, and the Linux Satellite Service whenrunning under Wine. The service IDs and Ports are defined in the 'Private Options -Services' section of the Analyzer Scripts Editor.

Build First Select to ensure that the Package is compiled each time you run the test.

(c) Sparx Systems 2019 Page 24 of 234 Created with Enterprise Architect

Page 25: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Testpoints Output

The 'Testpoints' page of the Analyzer Script helps you to configure the output of a Testpoint run.

By default the output is logged to the System Output window, as in this example.

Access

On the Execution Analyzer window, either:

Locate and double-click on the required script and select the 'Test > Testpoints' page or·

Click on in the window Toolbar, select the Package in which to create a new script, and select the 'Test >·Testpoints' page

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Tools > Analyzer

Keyboard Shortcuts Shift+F12

Options

Option Description

Output You can select from two options:

'Screen' (the default) - The output is directed to the 'Testpoints' tab of the·System Output window

'File' - The output is directed to file·

Folder Click on the folder to use for Testpoint log files.

Filename Enter the name to use for the Testpoint log files.

(c) Sparx Systems 2019 Page 25 of 234 Created with Enterprise Architect

Page 26: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Overwrite When this option is selected, the file specified is overwritten each time a Testpointrun is performed.

Auto Number When this option is selected, the Testpoint output is composed of the filename youspecify and the number of the Test run; each time you perform a Test run thenumber is incremented.

Prefix trace output withfunction

When this option is selected, any trace statements executed during the Testpoint runare prefixed with the current function call.

(c) Sparx Systems 2019 Page 26 of 234 Created with Enterprise Architect

Page 27: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Debug Script

The process of configuring the Debug section of an Analyzer Script is usually a one-time affair that rarely has to berevisited. So once you have your script working, you probably won't have to think about it again. The details you provideare not complicated, yet defining a script provides access to a great many benefits such as:

Debugging·

Sequence diagram recording·

Executable StateMachine execution and simulation·

Test domain authoring and recording·

Behavioral profiling of processes on a variety of runtimes·

All you need to do is select the appropriate platform and enter some basic details. The debugger platforms you can useinclude:

Java·

Java Debug Wire Protocol (JDWP)·

Microsoft .NET Debugger·

Microsoft Native Code Debugger (C++, C, VB)·

Mono·

The PHP Debugger·

The GNU Debugger (GDB)·

Access

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Tools > Analyzer

Keyboard Shortcuts F6

Notes

An Analyzer script is not necessary for debugging Enterprise Architect model scripts such as JavaScript or·VBScript

(c) Sparx Systems 2019 Page 27 of 234 Created with Enterprise Architect

Page 28: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Operating System Specific Requirements

The Enterprise Architect debugger is able to operate on a number of different platforms. This table describes theindividual requirements for debugging on each platform.

Platforms

Platform Detail

Microsoft .NET Microsoft™ .NET Frameworks 4.0, 3.5 and 2.0·

Language support: C, C#, C++, J#, VB.NET·

Java Java SE Development Kit from Oracle™ (version 5.0 minimum) (either 32-bit·or 64-bit JDK)

The Java Platform Debugger Architecture (JPDA) was introduced in Java SEversion 5.0. The JPDA provides two protocols for debugging; the Java VirtualMachine Tools Interface (JVMTI), and the Java Debug Wire Protocol (JDWP).

Enterprise Architect's debugger supports both protocols.

GNU Debugger (GDB) Enterprise Architect supports debugging using the GNU Debugger, which enablesyou to debug your applications under Linux either locally or remotely.

Requires GDB version 7.0 or higher.

The source code file path must not contain spaces.

Windows for NativeApplications

Enterprise Architect supports debugging native code (C, C++ and Visual Basic)compiled with the Microsoft™ compiler where an associated PDB file is available.

PHP Enterprise Architect enables you to perform local and remote debugging of PHPscripts in web servers.

Requires web server to be configured to support PHP.

Requires PHP to be configured to support XDebug PHP (3rd party PHP extension).

Notes

The debugging facility is available in all editions of Enterprise Architect·

Debugging under Windows Vista (x64) - if you encounter problems debugging with Enterprise Architect on a 64-bit·platform, you should build a platform specific configuration in Visual Studio; that is, do not specify the AnyCPUconfiguration, specify either Win32 or x64 explicitly

(c) Sparx Systems 2019 Page 28 of 234 Created with Enterprise Architect

Page 29: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

UAC-Enabled Operating Systems

The Microsoft operating systems Windows Vista and Windows 7 provide User Account Control (UAC) to managesecurity for applications.

The Enterprise Architect Visual Execution Analyzer is UAC-compliant, and users of UAC-enabled systems can performoperations with the Visual Execution Analyzer and related facilities under accounts that are members of only the Usersgroup.

However, when attaching to processes running as services on a UAC-enabled operating system, it might be necessary tolog in as an Administrator.

Log in as Administrator

Step Action

1 Before you run Enterprise Architect, right-click on the Enterprise Architect icon on the desktop and selectthe 'Run as administrator' option.

Alternatively

Edit or create a link to Enterprise Architect and configure the link to run as an Administrator.

Step Action

1 Right-click on the Enterprise Architect icon and select the 'Properties' option.

The Enterprise Architect 'Properties' dialog displays.

2 Click on the Advanced button.

The 'Advanced Properties' dialog displays.

3 Select the 'Run as administrator' checkbox.

4 Click on the OK button, and again on the 'Enterprise Architect Properties' dialog.

(c) Sparx Systems 2019 Page 29 of 234 Created with Enterprise Architect

Page 30: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

WINE Debugging

Configure Enterprise Architect to debug under WINE

Step Action

1 At the command line, run $ winecfg.

2 Select the 'Applications' tab. Add the Enterprise Architect executable 'EA.exe' from the EnterpriseArchitect installations folder. Then add these programs from the VEA sub directories:

SSampler32.exe·

SSampler64.exe·

SSProfiler32.exe·

SSProfiler64.exe·

3 Select each program in turn, then switch to the 'Libraries' tab. Ensure these values are listed with a (native,built-in) precedence:

dbghelp·

msxml4·

msxml6·

4 Copy the application source code plus executable(s) to your bottle.

The path must be the same as the compiled version; that is:

If Windows source = C:\Source\SampleApp, under Crossover it must be C:\Source\SampleApp.

5 Copy any Side-By-Side assemblies that are used by the application.

Permissions

An installation of Enterprise Architect contains some native Linux programs that provide building and debuggingservices to Enterprise Architect under Wine. These programs need to checked using the Linux file system or shell toensure they have the 'Execute' permission set appropriately. The programs are located in the "VEA/x86/linux"subdirectory of the Enterprise Architect installation.

Access Violation Exceptions

Due to the manner in which WINE handles direct drawing and access to DIB data, an additional option is provided onthe drop-down menu on the Debug window toolbar to ignore or process access violation exceptions thrown when yourprogram directly accesses DIB data.

Select this option to catch genuine (unexpected) access violations; deselect it to ignore expected violations.

As the debugger cannot distinguish between expected and unexpected violations, you might have to use trial and error tocapture and inspect genuine program crashes.

(c) Sparx Systems 2019 Page 30 of 234 Created with Enterprise Architect

Page 31: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Notes

If WINE crashes, the back traces might not be correct·

If you are using MFC remember to copy the debug side-by-side assemblies to the C:\window\winsxs directory·

To add a windows path to WINE, modify the Registry entry:·HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment

(c) Sparx Systems 2019 Page 31 of 234 Created with Enterprise Architect

Page 32: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Java

This section describes how to set up Enterprise Architect for debugging Java applications and Web Servers.

(c) Sparx Systems 2019 Page 32 of 234 Created with Enterprise Architect

Page 33: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

General Setup for Java

The general setup for debugging Java Applications supports two options:

Debug an Application·

Attach to an application that is running·

Option 1 - Debug an Application

Field Action

Debugger Select Java.

x64 Select this checkbox if you are debugging a 64-bit application.

Deselect the checkbox if you are debugging a 32-bit application.

Mode Select Run.

Default Directory This path is added to the class path property when the Java Virtual Machine iscreated.

Application Class Identify the fully qualified Class name to debug; the Class must have a methoddeclared with this signature:

public static void main(String());

Command Line Arguments Specify any parameters to be passed to the main method of the Application Class.

Parameters containing spaces should be surrounded with double quotes.

Java Virtual MachineOptions

Specify command line options for Virtual Machine creation.

You also must provide a parameter (JRE) as the path to be searched for the jvm.dll;this is the DLL supplied as part of the Java runtime environment or Java JDK fromSun MicrosystemsTM.

The JRE parameter can be either:

An Enterprise Architect-defined Local Path·

An absolute file path (with no double quotes) to the installation folder of the·Java JDK to be used for debugging

The JRE parameter must point to the installation folder for the Java JDK. A JDKinstallation is necessary for debugging to succeed. The JRE should not point to theinstallation of the public Java Runtime Environment, if that is installed.Environment variables can be used when specifying the VM startup options, suchas classpath.

For example, using:

An Enterprise Architect Local Path JAVA and an environment variable·classpath:

(c) Sparx Systems 2019 Page 33 of 234 Created with Enterprise Architect

Page 34: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Or an absolute path to the JDK installation directory and an environment·variable classpath:

In these two examples, the debugger will create a virtual machine using the JDKlocated at the value of the JRE parameter.

If no classpath is specified, the debugger always creates the virtual machine with aclass path property equal to any path contained in the environment variable plus thepath entered in the default working directory of this script.

If source files and .class files are located under different directory trees, theclasspath property MUST include both root path(s) to the source and root path(s) tobinary class files.

Option 2 - Attach to Virtual Machine

There is very little to specify when attaching to a VM; however, the VM must have the Sparx Systems debugging agentloaded.

Field Action

Debugger Select Java

Mode Select Attach to Virtual Machine

(c) Sparx Systems 2019 Page 34 of 234 Created with Enterprise Architect

Page 35: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Advanced Techniques

In addition to the standard Java debugging techniques, you can:

Attach to Virtual Machine·

Internet Browser Java Applets·

(c) Sparx Systems 2019 Page 35 of 234 Created with Enterprise Architect

Page 36: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Attach to Virtual Machine

You can debug a Java application by attaching to a process that is hosting a Java Virtual Machine; you might want to dothis for attaching to a webserver such as Tomcat or JBOSS.

The Java Virtual Machine Tools Interface from Sun Microsystems is the API used by Enterprise Architect; it allows adebugging agent to be specified when the JVM is created.

To debug a running JVM from Enterprise Architect, the Sparx Systems' debugging agent must have been specified as astartup option to the JVM when it was started; how this is accomplished for products such as Tomcat and JBOSS shouldbe provided by that product's own documentation.

For java.exe, the command line option to load the Enterprise Architect debugging agent could be (depending on yourenvironment):

-agentpath:"c:\program files\sparx systems\ea\VEA\x86\SSJavaProfiler32"·

-agentpath:"c:\program files (x86)\sparx systems\ea\VEA\x86\SSJavaProfiler32"·

-agentpath:"c:\program files (x86)\sparx systems\ea\VEA\x64\SSJavaProfiler64"·

The appropriate option will depend on your operating system and whether you are working on a 32-bit application or a64-bit application.

Alternatively, if you add the appropriate VEA directory to your PATH environment variable you can choose to use:

-agentlib:SSJavaProfiler32·

-agentlib:SSJavaProfiler64·

It is not necessary to configure an Analyzer Script when you attach to a Virtual Machine; you can just use the Attachbutton on one of the Analyzer toolbars.

If you configure an Analyzer Script, there are only two things that must be selected:

Select 'Java' as the debugging platform·

Choose the 'Attach to Virtual Machine' option·

(c) Sparx Systems 2019 Page 36 of 234 Created with Enterprise Architect

Page 37: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Internet Browser Java Applets

This topic describes the configuration requirements and procedure for debugging Java Applets running in a browser fromEnterprise Architect.

Attach to the browser process hosting the Java Virtual Machine (JVM) fromEnterprise Architect

Step Action

1 Ensure binaries for the applet code to be debugged have been built with debug information.

2 Configure the JVM using the Java Control Panel.

3 In the 'Java Applet Runtime Settings' panel, click on the View button.

4 On the installed version to use, include one of these options in the 'Runtime Parameters' field, dependingon your environment and whether you are working on a 32-bit application or a 64-bit application:

-agentpath:"c:\program files\sparx systems\ea\VEA\x86\SSJavaProfiler32"

-agentpath:"c:\program files (x86)\sparx systems\ea\VEA\x86\SSJavaProfiler32"

-agentpath:"c:\program files (x86)\sparx systems\ea\VEA\x64\SSJavaProfiler64"

5 In this field add the required Class paths.

At least one of these paths should include the root path of the source files to use in debugging.

6 Set breakpoints.

7 Launch the browser.

8 Attach to the browser process from Enterprise Architect.

(c) Sparx Systems 2019 Page 37 of 234 Created with Enterprise Architect

Page 38: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Working with Java Web Servers

If you are debugging Java web servers such as JBOSS and Apache Tomcat (both Server configuration and WindowsService configuration) in Enterprise Architect, apply these configuration requirements and procedures.

Note: The debug and record features of the Visual Execution Analyzer are not supported for the Java server platform'Weblogic' from Oracle.

Attach to process hosting the Java Virtual Machine from Enterprise Architect

Step Action

1 Build binaries for the web server code to be debugged, with debug information.

2 Launch the server with the 'Virtual Machine startup' option, described in Server Configuration.

3 Import source code into the Enterprise Architect Model, or synchronize existing code.

4 Set breakpoints.

5 Launch the client.

6 Attach to the process from Enterprise Architect.

Server Configuration

The configuration necessary for the web servers to interact with Enterprise Architect must address these two essentialpoints:

Any VM to be debugged, created or hosted by the server must have the Sparx Systems Agent command line option·specified or in the VM startup option (that is: -agentlib:SSJavaProfiler32 or -agentlib:SSJavaProfiler64)

The CLASSPATH, however it is passed to the VM, must specify the root path to the Package source files·

The Enterprise Architect debugger uses the java.class.path property in the VM being debugged, to locate the source filecorresponding to a breakpoint occurring in a Class during execution; for example, a Class to be debugged is called:

a.b.C

This is located in physical directory:

C:\source\a\b

So, for debugging to be successful, the CLASSPATH must contain the root path:

c:\source

Analyzer Script Configuration

Using the 'Debug' tab of the 'Build Script' dialog, create a script for the code you have imported and:

Select the 'Attach to process' radio button and, in the field below it, type 'attach'·

(c) Sparx Systems 2019 Page 38 of 234 Created with Enterprise Architect

Page 39: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

In the 'Use Debugger' field, click on the drop-down arrow and select 'Java'·

All other fields are unimportant; the 'Directory' field is normally used in the absence of any Class path property.

Run the Debugger

The breakpoints could show a question mark. In this case the Class might not have been loaded yet by the VM. If thequestion mark remains even after you are sure the Class containing the breakpoint has been loaded, then either:

The binaries being executed by the server are not based on the source code·

The debugger cannot reconcile the breakpoint to a source file (check Class paths), or·

The JVM has not loaded the Sparx Systems agent·

Step Action

1 Run the server and check that the server process has loaded the Sparx Systems Agent:

DLL SSJavaProfiler32.DLL or SSJavaProfiler64

Use 'Process Explorer' or similar tools to prove that the server process has loaded the agent.

2 In Enterprise Architect, open the source code and set some breakpoints.

3 Click on the Run Debug button in Enterprise Architect.

The 'Attach To Process' dialog displays.

4 Select the server process hosting the application.

5 Click on the OK button.

A confirmation message displays in the Debug window, stating that the process has been attached.

(c) Sparx Systems 2019 Page 39 of 234 Created with Enterprise Architect

Page 40: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

JBOSS Server

In this JBoss example, for a 32-bit application, the source code for a simple servlet is located in the directory location:

C:\Benchmark\Java\JBOSS\Inventory

The binaries executed by JBOSS are located in the JAW.EAR file in this location:

C:\JBOSS\03b-dao\build\distribution

The Enterprise Architect debugger has to be able to locate source files during debugging; to do this it also uses theCLASSPATH, searching in any listed path for a matching JAVA source file, so the CLASSPATH must include a path tothe root of the Package for Enterprise Architect to find the source during debugging.

This is an excerpt from the command file that executes the JBOSS server; the Class to be debugged is at:

com/inventory/dto/carDTO

Therefore, the root of this path is included in the JBOSS_CLASSPATH.

Example Code

RUN.BAT

-------------

set SOURCE=C:\Benchmark\Java\JBOSS\Inventory

set JAVAC_JAR=%JAVA_HOME%\lib\tools.jar

if "%JBOSS_CLASSPATH%" == ""

(

set JBOSS_CLASSPATH=%SOURCE%;%JAVAC_JAR%;%RUNJAR%;

)

else

(

set JBOSS_CLASSPATH=%SOURCE%;%JBOSS_CLASSPATH%;%JAVAC_JAR%;%RUNJAR%;

)

set JAVA_OPTS=%JAVA_OPTS% -agentpath:"c:\program files\sparx systems\vea\x86\ssjavaprofiler32"

(c) Sparx Systems 2019 Page 40 of 234 Created with Enterprise Architect

Page 41: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Apache Tomcat Server

The Apache Tomcat Server can be configured for debugging using the Java debugger in Enterprise Architect. Thisexample shows the configuration dialog for Apache Tomcat 7.0 on a PC running Windows 7.

These three points are important:

The 'Java Virtual Machine' specifies the runtime from an installation of the Java JDK·

The source path to any servlet to be debugged is added to Java Classpath; in this case we add the path to the Tomcat·servlet:c:\tomcat\webapps\servlet\WEB-INF\src

The 'Java Options' include the path to the Sparx Systems debugging agent:·-agentpath:c:\program files (x86)\sparx systems\vea\x86\ssjavaprofiler32

(c) Sparx Systems 2019 Page 41 of 234 Created with Enterprise Architect

Page 42: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Apache Tomcat Windows Service

Configuration

For users running Apache Tomcat as a WindowsTM service, it is important to configure the service to enable interactionwith the Desktop; failure to do so causes debugging to fail within Enterprise Architect.

Select the 'Allow service to interact with desktop' checkbox.

(c) Sparx Systems 2019 Page 42 of 234 Created with Enterprise Architect

Page 43: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

.NET

This section describes how to configure Enterprise Architect for debugging .NET applications. It includes:

General Set up for .NET·

Debugging an Unmanaged Application·

Debug COM Interop·

Debug ASP .NET·

(c) Sparx Systems 2019 Page 43 of 234 Created with Enterprise Architect

Page 44: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

General Set up for .NET

This is the general set up for debugging Microsoft .NET applications. You have two options when debugging:

Debug an application·

Attach to an application that is running·

Option 1 - Debug an application

Field Action

Debugger Select Microsoft .NET as the debugging platform.

x64 Select this checkbox if you are debugging a 64-bit application.

Deselect the checkbox if you are debugging a 32-bit application.

Mode Select the Run radio button.

Default Directory This is set as the default directory for the process being debugged.

Application Path Select and enter either the full or the relative path to the application executable.

If the path contains spaces, specify the full path; do not use a relative path·

If the path contains spaces, the path must be enclosed by quotes·

Command Line Arguments Parameters to pass to the application at start up.

Show Console Create a console window for the debugger; not applicable to attaching to a process.

Symbol Search Paths Specify any additional paths to locate debug symbols for the debugger; separate thepaths with a semi-colon.

Option 2 - Attach to an application that is running

Field Action

Debugger Select Microsoft .NET as the debugging platform.

x64 Select this checkbox if you are debugging a 64-bit application.

Deselect the checkbox if you are debugging a 32-bit application.

Mode Select the Attach to Process radio button.

(c) Sparx Systems 2019 Page 44 of 234 Created with Enterprise Architect

Page 45: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Debugging an Unmanaged Application

If you are debugging managed code using an unmanaged application, the debugger might fail to detect the correctversion of the Common Language Runtime (CLR) to load.

You should specify a config file if you don’t already have one for the debug application specified in the Debug commandof your script.

The config file should reside in the same directory as your application, and take the format:

name.exe.config

where 'name' is the name of your application.

The version of the CLR you specify should match the version loaded by the managed code invoked by the debuggee.

This is a sample config file:

<configuration>

<startup>

<requiredRuntime version="version "/>

</startup>

</configuration>

'Version' is the version of the CLR targeted by your plug-in or COM code.

(c) Sparx Systems 2019 Page 45 of 234 Created with Enterprise Architect

Page 46: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Debug COM Interop

Enterprise Architect enables you to debug .NET managed code executed using COM in either a Local or an In-Processserver.

This feature is useful for debugging Plug-ins and ActiveX components.

Debug .NET Managed Code Executed Using COM

Step Action

1 Create a Package in Enterprise Architect and import the code to debug.

2 Ensure the COM component is built with debug information.

3 Create a Script for the Package.

4 In the 'Debug | Platform' page, you can select to either attach to an unmanaged process or specify the pathto an unmanaged application to call your managed code.

5 Add breakpoints in the source code to debug.

Attach to an Unmanaged Process

If you are using:

An In-Process COM server, attach to the client process·

A Local COM Server, attach to the server process·

Click on the Debug window Run button (or press F6) to display a list of processes from which you can choose.

Notes

Detaching from a COM interop process you have been debugging terminates the process; this is a known issue for·Microsoft .NET Framework, and information on it can be found on many of the MSDN .NET blogs

(c) Sparx Systems 2019 Page 46 of 234 Created with Enterprise Architect

Page 47: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Debug ASP .NET

Debugging for web services such as ASP requires that the Enterprise Architect debugger is able to attach to a runningservice.

Begin by ensuring that the directory containing the ASP .NET service project has been imported into EnterpriseArchitect and, if required, the web folder containing the client web pages.

If your web project directory resides under the website hosting directory, you can import from the root and include bothASP code and web pages at the same time.

It is necessary to launch the client first, as the ASP .NET service process might not already be running; load the clientusing your browser - this ensures that the web server is running.

In the debug set up you would then select the 'Attach' radio button. When this choice is selected, the debugger willprompt you each time for the process to debug.

Click on the Debug window Run button to start the debugger; the 'Attach To Process' dialog displays.

The name of the process varies across Microsoft operating systems, as explained in the ASP .NET SDK; for example,under Windows Vista the name of the IIS process is w3wp.exe.

On Windows XP, the name of the process resembles aspnet_wp.exe, although the name could reflect the version of the.NET framework that it is supporting.

There can be multiple ASP.NET processes running under XP; you must ensure that you attach to the correct version,which would be the one hosting the .NET framework version that your application runs on; check the web.config file foryour web service to verify the version of .NET framework it is tied to.

The Debug window Stop button should be enabled and any breakpoints should be red, indicating they have been bound.

You can set breakpoints at any time in the web server code. You can also set breakpoints in the ASP web page(s) if youimported them.

Notes

Some breakpoints might not have bound successfully, but if none at all are bound (indicated by being dark red withquestion marks) something has gone out of synchrony; try rebuilding and re-importing source code

(c) Sparx Systems 2019 Page 47 of 234 Created with Enterprise Architect

Page 48: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

The Mono Debugger

Mono is a software platform sponsored by the .NET Foundation to facilitate cross-platform development. It is popularwith game developers for its rich gaming API-based and portability features.

Enterprise Architect provides support to the Mono community by providing a modern environment for both modelingand developing software. Existing Projects can be imported, built and debugged natively on Linux as well as onWindows.

Overview

Debugging under Mono involves the cooperation of three processes. The Mono runtime manages the application andcommunicates using a socket protocol with the Enterprise Architect debugger, which in turn communicates withEnterprise Architect acting as the front end. When you launch Mono you need to direct it to support debugging. This isachieved through a command line directive in which you name the host and Port number that Mono should listen on. Thehost can be omitted, in which case Mono will accept connections from any IP address. The host can have the value'localhost' to restrict connections to the same machine. The Port number is a number of your choosing.

The host and Port number are the import pieces of information, as they are used when configuring the Analyzer Script.

Requirements for Windows

Enterprise Architect (version 14 minimum)·

Mono for Windows (version 5.4 minimum)·

Requirements for Linux

Enterprise Architect (version 14 minimum)·

Mono for Linux (version 5.4 minimum)·

Wine for Linux·

Debugger Configuration (Windows)

This section describes the Debug Section of an Analyzer Script in respect to debugging Mono under Windows. Fieldsthat are not listed here are not required.

Field Description

Debugger Select 'Mono'.

x64 Select if the program to be debugged is a 64bit executable.

Run or Attach Choose 'Run' to name the program to launch. Choose 'Attach' if you will alwaysattach to a running process.

Default Directory The default directory that the program will take when it is run.

Application Path The full path of the Mono application.

(c) Sparx Systems 2019 Page 48 of 234 Created with Enterprise Architect

Page 49: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Command Line Arguments Any parameters to pass to the program. Surround the parameters in double quotes ifthey contain spaces.

Debugger Configuration (Linux)

This section describes the Debug Section of an Analyzer Script in respect to debugging Mono under Linux. Fields thatare not listed here are not required.

Debugger Select 'Mono'.

Default Directory This is the fully qualified native Linux path where the application is located.

Connection port: the debugging port·

host: the name or ip address of the machine where mono runs ('localhost' if the·machine is the same)

localpath: the Wine / Windows root path of the source code·

remotepath: the native Linux root path of the source code·

shutdown: (true or false); when true the VM is terminated when the debugger·is stopped

timeout: the timeout in milliseconds for socket calls·

output: the Wine / Windows path of the log file to write to·

logging: (true or false); when true, extra messages are logged in the Debug·window and socket messages are logged to the specified output file

The DebugRun Page

This page is optional and is only useful where Mono and Enterprise Architect will be running on the same machine.What it provides is the ability to run Mono first with the required debugging directives, before the Enterprise Architectdebugger is started. After the debugger connects, it resumes the Mono runtime, which has been started as suspended. Ifthe application runs on a different machine from the Enterprise Architect you are using, you should clear this section.

Starting Mono with Debugger Support using an Analzyer Script

You can configure Enterprise Architect to start Mono for you when you start the debugger. You do this by configuringthe 'DebugRun' page of your Analyzer Script. The format of the commands is described here:

Linux:

cd path-to-program

/usr/bin/mono --debug --debugger-agent=transport=dt_socket,address=host:port,server=y,suspend=y program

Windows:

cd path-to-program

mono --debug --debugger-agent=transport=dt_socket,address=host:port,server=y,suspend=y program

(c) Sparx Systems 2019 Page 49 of 234 Created with Enterprise Architect

Page 50: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

where:

- path-to-program is the directory path where the program is located

- host is one of these:

localhost·

an ip address·

a networked machine name·

- port is the Port for the socket and

- program is the name of the application (such as MonoProgram.exe)

Starting Mono with Debugger Support from the Command Line

You can start Mono manually from a console. Locate the program in your file explorer, then open a console at thatlocation. The format of the command line is described here:

Linux:

/usr/bin/mono --debug --debugger-agent=transport=dt_socket,address=host:port,server=y,suspend=y program

Windows:

mono --debug --debugger-agent=transport=dt_socket,address=host:port,server=y,suspend=y program

where host is one of these:

localhost·

an ip address·

a networked machine name·

port is the Port for the socket and program is the name of the application (for example, MonoProgram.exe).

(c) Sparx Systems 2019 Page 50 of 234 Created with Enterprise Architect

Page 51: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

The PHP Debugger

The Enterprise Architect PHP Debugger enables you to debug PHP.exe scripts. This section discusses basic set up andthe various debugging scenarios that are commonly encountered; the scenarios concern themselves with the mapping offile paths, which is critical to the success of a remote debugging session.

Script Setup·

Local Windows Machine (Apache Server)·

Local Windows Machine (PHP.exe)·

Remote Linux Machine (Apache Server)·

Remote Linux Machine (PHP.exe)·

Setup and Scenarios

Scenario Details

Script Setup An Analyzer Script is a basic requirement for debugging in Enterprise Architect;you create a script using the toolbar of the Execution Analyzer.

Select PHP.XDebug as the debugging platform; when you select this platform theproperty page displays these connection settings:

host - localhost - The adaptor that Enterprise Architect listens on for incoming·connections from PHP

localpath - %LOCAL% - Specifies the local file path to be mapped to a remote·file path; this is a remote debugging setting - for local debugging, clear thevalue, the value is a placeholder and you should edit it to fit your particularscenario

remotepath - %REMOTE% - Specifies the remote file path that a local file path·is to be mapped to; this is a remote debugging setting - for local debugging,clear the value, the value is a placeholder and you should edit it to fit yourparticular scenario

logging - Enter true or false to enable logging of communication from XDebug·server

output - names the file path on the remote machine to be used with the logging·option; this file will always be overwritten

Local Machine ApacheServer

In this situation, consider this configuration:

O/S: Windows7·

Network computer name: MyPC·

Network share MyShare mapped to c:\myshare·

Source files in Enterprise Architect have been imported from·c:\myshare\apache\myapp\scripts

Apache document root is set to //MyPC/MyShare/apache·

In this scenario an Analyzer Script for the connection parameters might beconfigured as:

host: localhost·

port: 9000·

localpath: c:\myshare\apache\·

remotepath: MyPC/MyShare/apache/·

(c) Sparx Systems 2019 Page 51 of 234 Created with Enterprise Architect

Page 52: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Local Machine PHP.EXE In this scenario an Analyzer Script for the connection parameters might beconfigured as shown, as file paths always map to same physical path:

host: localhost·

port: 9000·

localpath:·

remotepath:·

Remote Linux MachineApache Server

In this situation consider this configuration:

Local Machine:

O/S: Windows7·

Source files in Enterprise Architect have been imported from·c:\myshare\apache\myapp\scripts

Remote Machine:

O/S: Linux·

Apache document root is set to home/apache/htdocs·

Source files in Apache are located at home/apache/htdocs/myapp/scripts·

In this scenario an Analyzer Script for the connection parameters might beconfigured as:

host: localhost·

port: 9000·

localpath: c:\myshare\apache\·

remotepath: home/apache/htdocs/·

Remote Linux MachinePHP.exe

In this situation consider this configuration:

Local Machine·

O/S: Windows7·

Source files in Enterprise Architect have been imported from·c:\myshare\apache\myapp\scripts

Remote Machine·

O/S: Linux·

Source files in Apache located at home/myapp/scripts·

In this scenario an Analyzer Script for the connection parameters might beconfigured as:

host: localhost·

port: 9000·

localpath: c:\myshare\apache\·

remotepath: home/·

PHP Global variables When you are at a breakpoint, you can examine the values of PHP globals using theAnalyzer Watch window. To list every global, type either 'globals' or 'superglobals'into the field. To show an individual item, enter its name. This image shows thevalue of the PHP environment variable $_SERVER being displayed.

(c) Sparx Systems 2019 Page 52 of 234 Created with Enterprise Architect

Page 53: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

(c) Sparx Systems 2019 Page 53 of 234 Created with Enterprise Architect

Page 54: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

PHP Debugger - System Requirements

This topic identifies the system requirements and operating systems for the Enterprise Architect PHP debugger.

System Requirements:

Enterprise Architect version 9·

PHP version 5.3 or above·

PHP zend extension XDebug 2.1 or above·

For web servers such as Apache, a server version that supports the PHP version·

Supported Operating Systems:

Client (Enterprise Architect)·

Microsoft Windows XP and above·

Linux running Crossover Office·

Server (PHP)·

Microsoft Windows XP and above·

Linux·

(c) Sparx Systems 2019 Page 54 of 234 Created with Enterprise Architect

Page 55: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

PHP Debugger Checklist

This topic provides a troubleshooting guide for debugging PHP scripts in Enterprise Architect.

Check Points

Check Point Details

System Requirements Apache HTTP Web Server version 2.2·

PHP version 5.3 or above·

XDebug version 2.1.1·

Enterprise Architect The model has an Analyzer Script configured to use the PHP XDebug platform·

PHP source code has been imported into the model (for recording and·testpoints)

When the PHP XDebug platform is selected from the 'Analyzer Script' dialog,·default runtime settings are listed in the 'Connection' field:

localpath:%LOCAL%

remotepath:%REMOTE%

Either define local paths for these default variables or edit the script to provideactual paths.

For example: local source, remote source

localpath:c:\code samples\vea\php\sample

remotepath:webserver/sample

'webserver' is a network or local share·

'sample' is a folder below share·

PHP In order to debug PHP scripts in Enterprise Architect, it is a requirement that thePHP is configured properly to load the XDebug extension.

Settings similar to these should be used:

[xdebug]·

xdebug.extended_info=1·

xdebug.idekey=ea·

xdebug.remote_enable=1·

xdebug.remote_handler=dbgp·

xdebug.remote_autostart=1·

xdebug.remote_host=X.X.X.X·

xdebug.remote_port=9000·

xdebug.show_local_vars=1·

The IP address X.X.X.X refers to and should match the host specified in the modelAnalyzer Script.

The IP address is the address XDebug connects with and the same address theEnterprise Architect PHP agent listens on.

Apache For debugging using Apache, these lines should be present in the Apacheconfiguration file, httpd.conf:

(c) Sparx Systems 2019 Page 55 of 234 Created with Enterprise Architect

Page 56: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

LoadModule php5_module "php_home/php5apache2_2.dll"

AddHandler application/x-httpd-php .php

PHPIniDir "php_home"

The value "php_home" is the PHP installation path (the path where php.ini andapache dll exist).

Troubleshooting To prevent both PHP and Apache timeouts during a debugging session, thesesettings might require modification.

The settings were used while developing the PHP Debugging agent in EnterpriseArchitect.

PHP File: php.ini

; Enterprise Architect prevents PHP timeouts when debugging PHP extensions

max_execution_time = 0

; Enterprise Architect prevents web server timeouts when debugging PHPextensions

max_input_time = -1

; Enterprise Architect logs errors

display_errors = On

; Enterprise Architect displays startup errors

display_startup_errors = On

Apache File: httpd.conf

; Enterprise Architect prevents timeouts while debugging php extensions

Timeout 60000

(c) Sparx Systems 2019 Page 56 of 234 Created with Enterprise Architect

Page 57: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

The GNU Debugger (GDB)

When debugging your applications you can use the GNU Debugger (GDB), which is portable and runs on Unix-likesystems such as Linux, as well as on Windows. The GDB works for many programming languages including Ada, Java,C, C++ and Objective-C. Using the GDB, you can debug your applications either locally or remotely.

Access

On the Execution Analyzer window, either:

Locate and double-click on the required script and select the 'Debug > Platform' page or·

Click on in the window Toolbar, select the Package in which to create a new script, and select the 'Debug >·Platform' page

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Tools > Analyzer

Context Menu Browser window | Right-click on Package | Execution Analyzer

Keyboard Shortcuts Shift+F12

Set up the GNU Debugger

Task Details

Set up Script An Analyzer Script is a basic requirement for debugging in Enterprise Architect;you create a script using the Execution Analyzer toolbar.

On the 'Platform' page of the Execution Analyzer Script Editor, in the 'Debugger'field click on the drop-down arrow and select 'GDB'.

Define Connection Settings The property panel displays a number of connection settings for which you providevalues.

path - <path> - The complete file path of the GDB executable; you only·specify this if the GDB cannot be found in the system path

source - <path>, <path> - The path in which the debugger will search for·source files, if they do not reside in the executable directory

remote - F - Set for remote debugging; otherwise leave blank·

port - <nnnnn> - The Port to connect to on the remote server·

host - localhost - The host name to connect to·

fetch - T - Set to retrieve the binary from the remote system·

dumpgdb - <path> - The filename to write the GDB output to·

initpath - <path> - The complete file path to the gbinit file·

Notes

(c) Sparx Systems 2019 Page 57 of 234 Created with Enterprise Architect

Page 58: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

A requirement of the GDB is that your source code file path does not contain spaces; the debugger will not run·correctly with spaces in the file path

(c) Sparx Systems 2019 Page 58 of 234 Created with Enterprise Architect

Page 59: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

The Android Debugger

If you are developing Java applications running on Android devices or emulators, you can also debug them. The Localand Remote machines can be on either a 32-bit platform or a 64-bit platform.

Remote Machine

ExecutionEnvironment

Port ForwardingSoftware

Android DebugBridge (ADB) «device»

Android Emulator

Local Machine

ExecutionEnvironment

EnterpriseArchitect

Android Device

ExecutionEnvironment

«executionEnvironment»Java

App

System Requirements

On the Remote machine, this software is required:

Android SDK, which includes the android debug bridge, ADB (you need to be familiar with the SDK and its tools)·

Java JDK (32 and 64 bit support)·

Port Forwarding software (3rd party)·

On the Local machine, this software is required:

Enterprise Architect Version 10 or higher·

Analyzer Script Settings

Field/Button Action

(c) Sparx Systems 2019 Page 59 of 234 Created with Enterprise Architect

Page 60: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Debugger Click on the drop-down arrow and select Java (JDWP).

Run Click on this radio button.

Default Directory Not applicable - leave blank.

Application path Not applicable - leave blank.

Command Line Arguments Not applicable - leave blank.

Build first Not applicable - leave blank.

Show console Not applicable - leave blank.

Show diagnostic messages Not applicable - leave blank.

Connection Not applicable - leave blank.

Port This is the application port, forward-assigned using adb or other means, throughwhich Enterprise Architect and the Android Virtual Machine (VM) cancommunicate.

Host Host computer (defaults to localhost)

If Android is running on an emulator on a device attached to a networked computer,enter the network name here.

By default, debugging will attempt to connect to the Port you specify on the localmachine.

Source This is the source equivalent of the classpath setting in Java.

The root to each source tree should be listed. If more than one is specified, theyshould be separated by a semi-colon; that is:

c:\myapp\src;c:\myserver\src

You must specify at least one root source path.

When a breakpoint occurs the debugger searches for the java source in each of thesource trees listed here.

Logging Enables logging additional information from debugger

possible values: true,false,1,0,yes,no

Output Specifies the full name of the local log file to be written.

The folder must exist or no log will be created.

The log file typically contains a dump of bytes sent between debugger and VM.

Platform If you are debugging Java running under any android scenario, select Android.

For all other scenarios, select Java.

(c) Sparx Systems 2019 Page 60 of 234 Created with Enterprise Architect

Page 61: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Configure Ports for Debugging - Port Forwarding (Local)

The debugger can only debug one VM at a time; it uses a single Port for communication with the VM. The Port for theapplication to be debugged can be assigned using ADB, which is supplied with the Android SDK.

Before debugging, start the application once in the device. When the app starts, discover its process identifier (pid):

adb jdwp

The last number listed is the pid of the last application launched; note the pid and use it to allow the debugger to connectto the VM:

adb forward tcp:port jdwp:pid· - port = Port number listed in analyzer script - pid = process id of the application on the device

Configure Ports for Debugging - Port Forwarding (Remote)

To debug remotely, the same procedure should be followed as for the local machine, but the communication requiresadditional forwarding as the socket created using the adb forward command will only listen on the local adapter. Thesocket is bound to the localhost, and attempts to connect to this Port will be met with 'connection refused' messages.

In order to achieve remote debugging it is necessary to have a proxy running on the remote machine that listens to allincoming connections and forwards all traffic to the adb Port; there are numerous software products available to do this.

Remote debugging with Enterprise Architect will not work unless you have configured a proxy Port forwarder.

(c) Sparx Systems 2019 Page 61 of 234 Created with Enterprise Architect

Page 62: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Java JDWP Debugger

Java provides two main debugging technologies: an in-process agent-based system called the Java Virtual Machine ToolsInterface (JVMTI) and a socket-based paradigm called the Java Debug Wire Protocol (JDWP). A Java Virtual Machinecan name either one of these but not both, and the feature must be configured when the JVM is started.

System Requirements

The Enterprise Architect JDWP debugger will only be able to communicate with a JVM started with the 'JDWP'1.option. Here is an example of the command line option: java -agentlib:jdwp=transport=dt_socket,address=localhost:9000,server=y,suspend=n -cp"c:\java\myapp;%classpath%" demo.myApp "param1" "param2"

The Virtual Machine should not be currently attached to a debugger.2.

It is not possible for a VM to be debugged by Enterprise Architect and Eclipse at the same time.3.

Analyzer Script Settings

Field/Button Action

Debugger Click on the drop-down arrow and select Java (JDWP).

Run Click on this radio button to run the debugger when the script is executed.

Default Directory Not applicable - leave blank.

Application path Not applicable - leave blank.

Command Line Arguments Not applicable - leave blank.

Build first Not applicable - leave blank.

Show console Not applicable - leave blank.

Show diagnostic messages Not applicable - leave blank.

Connection Not applicable - leave blank.

Port Set the application Port forward-assigned to the VM process during start-up, in theJava command-line options.

Host Set the host computer (defaults to localhost)

If VM is running on a networked computer, enter the network name or url here.

By default debugging will attempt to connect to the Port you specify on the localmachine.

Source This is the source equivalent of the classpath setting in Java.

List the root to each source tree; specify at least one root source path. If you specifymore than one, separate them with a semi-colon; for example:

(c) Sparx Systems 2019 Page 62 of 234 Created with Enterprise Architect

Page 63: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

c:\myapp\src;c:\myserver\src

When a breakpoint occurs the debugger searches for the Java source in each of thesource trees listed here.

Logging Enable or disable logging of additional information from the debugger.

Possible values include:

true·

false·

yes·

no·

Output Specify the full name of the local log file to be written. If the folder does notalready exist, no log will be created.

The log file typically contains a dump of bytes sent between the debugger and VM.

Platform Select Java.

Configure Ports for Debugging

The debugger can only debug one VM at a time; it uses a single Port for communication with the VM. The Port for theapplication to be debugged is assigned when the VM is created.

Local Debugging

Where both Enterprise Architect and the Java VM are running on the same machine, you can perform local debugging. Itis necessary to launch the VM with the JDWP transport enabled - see the documentation on Java Platform DebuggerArchitecture (JPDA) at Oracle for the command line option specifications. For example:

java -agentlib:jdwp=transport=dt_socket,address=localhost:9000,server=y,suspend=n -cp"c:\samples\java\myapp;%classpath%" samples.MyApp "param1" "param2"

In this example the values for the Analyzer script would be 'host: localhost' and 'port:9000'.

Remote Debugging

Where Enterprise Architect is running on the local machine and the Java VM is running on a remote machine, you canperform remote debugging. It is necessary to launch the VM with the JDWP transport enabled - see the documentationon JPDA at Oracle for the command line option specifications. Here is an example, where the remote computer has thenetwork name testmachine1:

java -agentlib:jdwp=transport=dt_socket,address=9000,server=y,suspend=n -cp"c:\samples\java\myapp;%classpath%" samples.MyApp "param1" "param2"

Note the absence of a host name in the address. This means the VM will listen for a connection from any machine. In thisexample the values for the Analyzer script would be 'host: testmachine1' and 'port: 9000'.

(c) Sparx Systems 2019 Page 63 of 234 Created with Enterprise Architect

Page 64: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Tracepoint Output

The Tracepoints page of the Analyzer Script enables you to direct where the output from any Trace statements goesduring a debug session.

Access

On the Execution Analyzer window, either:

Locate and double-click on the required script and select the 'Debug > Tracepoints' page or·

Click on in the window Toolbar, select the Package in which to create a new script, and select the 'Debug >·Tracepoints' page

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Tools > Analyzer > select and run script

Context Menu Browser window | Right-click on Package | Execution Analyzer

Keyboard Shortcuts Shift+F12

Tracepoint properties

Field Detail

Output You can select from two options:

'Screen' (the default) - The output is directed to the Debug window·

'File' - The output is directed to file·

Folder Enter the folder to use for Trace statement log files.

Filename Enter the name to use for the Trace statement log files.

Overwrite If selected, the specified file is overwritten each time a debug session is started.

Auto Number If selected, the Trace log file is composed of the filename you specify and anumber.

Each time you start a debug session, the number is incremented.

Prefix trace output withfunction

If selected, any Trace statements executed during the debug session run areprefixed with the current function call.

(c) Sparx Systems 2019 Page 64 of 234 Created with Enterprise Architect

Page 65: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Workbench Set Up

This topic describes the requirements for setting up the Object Workbench on Java and Microsoft .NET.

Access

On the Execution Analyzer window, either:

Locate and double-click on the required script and select the 'Debug > Workbench' page or·

Click on in the window Toolbar, select the Package in which to create a new script, and select the 'Debug >·Workbench' page

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Tools > Analyzer

Keyboard Shortcuts Shift+F12

Platforms

Platform Detail

Platforms Supported The Workbench supports these platforms:

Microsoft .NET (version 2.0 or later)·

Java (JDK 1.4 or later)·

Microsoft .NETWorkbench

The .NET workbench requires an assembly, which is used to create the workbenchitems.

You specify the path to the assembly on the 'Workbench' page of the AnalyzerScript.

There are two constraints in using the .NET workbench:

Members defined as struct in managed code are not supported·

Classes defined as internal are not supported·

Java Workbench The Java workbench uses the Virtual Machine settings configured in the AnalyzerScript 'Debug' page to create the JVM.

(c) Sparx Systems 2019 Page 65 of 234 Created with Enterprise Architect

Page 66: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Microsoft C++ and Native (C, VB)

You can debug native code only if there is a corresponding PDB file for the executable. A PDB file is created as a resultof building the application.

The build should include full debug information and there should be no optimizations set.

The script must specify two things to support debugging:

The path to the executable·

Microsoft Native as the debugging platform·

(c) Sparx Systems 2019 Page 66 of 234 Created with Enterprise Architect

Page 67: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

General Set Up

This is the general set up for debugging Microsoft Native Applications (C++, C, Visual Basic). You have two optionswhen debugging:

Debug an application·

Attach to an application that is running·

Option 1 - Debug an application

Field Action

Debugger Select Microsoft Native as the debugging platform.

x64 Select this checkbox if you are debugging a 64-bit application.

Deselect the checkbox if you are debugging a 32-bit application.

Mode Select the Run radio button.

Default Directory This is set as the default directory for the process being debugged.

Application Path Select and enter either the full or the relative path to the application executable.

If the path contains spaces, specify the full path; do not use a relative path·

If the path contains spaces, the path must be enclosed by quotes·

Command Line Arguments Parameters to pass to the application at start up.

Show Console Create a console window for the debugger; not applicable for attaching to a process.

Symbol Search Paths Specify any additional paths to locate debug symbols for the debugger; separate thepaths with a semi-colon.

Option 2 - Attach to an application that is running

Field Action

Debugger Select Microsoft Native as the debugging platform.

x64 Select this checkbox if you are debugging a 64-bit application.

Deselect the checkbox if you are debugging a 32-bit application.

Mode Select the Attach to Process radio button.

Symbol Search Paths Specify any additional paths to locate debug symbols for the debugger.

You could specify a symbol server here if you prefer; separate the paths with asemi-colon or comma.

(c) Sparx Systems 2019 Page 67 of 234 Created with Enterprise Architect

Page 68: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

(c) Sparx Systems 2019 Page 68 of 234 Created with Enterprise Architect

Page 69: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Debug Symbols

For applications built using Microsoft Platform SDK, Debug Symbols are written to an application PDB file when theapplication is built.

The Debugging Tools for Windows, an API used by the Visual Execution Debugger, uses these symbols to presentmeaningful information to Execution Analyzer controls.

These symbols can easily get out of date and cause aberrant behavior - the debugger might highlight the wrong line ofcode in the editor whilst at a breakpoint; it is therefore best to ensure the application is built prior to any debugging orrecording session.

The debugger must inform the API how to reconcile addresses in the image being debugged; it does this by specifying anumber of paths to the API that tell it where to look for PDB files.

For system DLLs (kernel32, mfc90ud) for which no debug symbols are found, the Call Stack shows some frames withmodule names and addresses only.

You can supplement the symbols translated by passing additional paths to the API; you pass additional symbol paths in asemi-colon separated list in the 'Debug' tab.

(c) Sparx Systems 2019 Page 69 of 234 Created with Enterprise Architect

Page 70: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Code Miner Script

The Code Miner system uses a set of databases to provide fast and comprehensive access to information derived fromexisting source code. The Intelli-sense features of Enterprise Architect's code editors and its search tools can make use ofthe information mined from these databases.

Through the Code Miner script pages, you can specify which Code Miner databases to use with a particular project andyou can create, update and add new databases to the Code Miner library. The 'Services' page allows you to specify alocal Code Miner library, or that you wish to access the library available through a Code Miner Service.

Different Code Miner details can be specified for each Analyzer Script, so the Code Miner libraries that are used aredetermined by the active Analyzer Script.

Access

On the Execution Analyzer window, either:

Locate and double-click on the required script and select the 'Code Miner' page or·

Click on in the window Toolbar, select the Package in which to create a new script, and select the 'Code·Miner' page

Ribbon Execute > Tools > Analyzer, or

Develop > Preferences > Analyzer > Edit Analyzer Scripts

Keyboard Shortcuts Shift+F12

Code Miner Service

A Code Miner Library can be used locally, or it can be deployed to a server location where it can service multiple clients.You select the scenario to use on the 'Code Miner Service' page of the Analyzer Script.

(c) Sparx Systems 2019 Page 70 of 234 Created with Enterprise Architect

Page 71: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Code Miner Libraries

The Code Miner Database Libraries are a collection of databases containing information derived from source code.Together, these databases form the Code Miner Library used by the Intelli-sense features of Enterprise Architect.Usually, a library would be created for each framework or project. The Code Miner Libraries page allows new databasesto be created, and existing databases to be added, updated or removed from a library.

Code Miner Query Libraries are a collection of functions, written in Code Miner's mFQL language, bundled together intoone source file.

The Code Miner Database Library and Query Library for a given Analyzer Script are specified on the 'Code Miner |Libraries' page of the Script Editor.

(c) Sparx Systems 2019 Page 71 of 234 Created with Enterprise Architect

Page 72: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

(c) Sparx Systems 2019 Page 72 of 234 Created with Enterprise Architect

Page 73: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Services Script

The 'Services' page of an Analyzer Script describes the default ports used when scripts are created by various VisualExecution Analyzer functions (Import project, Generate Executable StateMachine).

Access

On the Execution Analyzer window, either:

Locate and double-click on the required script and select the 'Private Options | Services' page or·

Click on in the window Toolbar, select the Package in which to create a new script, and select the 'Private·Options | Services' page

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Tools > Analyzer

Keyboard Shortcuts Shift+F12

(c) Sparx Systems 2019 Page 73 of 234 Created with Enterprise Architect

Page 74: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Run Script

This section describes how to create a command for running your executable code.

Access

On the Execution Analyzer window, either:

Locate and double-click on the required script and select the 'Run' page or·

Click on in the window Toolbar, select the Package in which to create a new script, and select the 'Run' page·

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Tools > Analyzer

Keyboard Shortcuts Ctrl+Alt+N

Script elements

Element Description

Command This is the command that is executed when you select the 'Execute > Run > Start'ribbon option; at its simplest, the script would contain the location and name of thefile to be run.

Examples These two examples show scripts configured to run a .Net and a Java application inEnterprise Architect.

.Net:

C:\benchmark\cpp\example_net_1\release\example.exe

Java:

customer

The command listed in this field is executed as if from the command prompt; as aresult, if the executable path or any arguments contain spaces, they must beenclosed by quotes.

Notes

Enterprise Architect provides the ability to start your application normally OR with debugging from the same script;·the 'Analyzer' menu has separate options for starting a normal run and a debug run

(c) Sparx Systems 2019 Page 74 of 234 Created with Enterprise Architect

Page 75: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Deploy Script

These sections explain how to create a command script for deploying the current Package. The script can be executed byselecting the 'Execute > Source > Build > Deploy' ribbon option or by pressing Ctrl+Shift+Alt+F12.

Access

On the Execution Analyzer window, either:

Locate and double-click on the required script and select the 'Deploy' page or·

Click on in the window Toolbar, select the Package in which to create a new script, and select the 'Deploy'·page

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Tools > Analyzer

Keyboard Shortcuts Ctrl+Shift+Alt+F12

Actions

Action Detail

Execute Command as: Process

If the deployment is handled externally, enter the path to the program or batch fileto run, followed by any parameters; the program is launched in a separate process.

Example:

C:\apache-ant-1.7.1\bin\ant.cmd myproject deploy

Batch File

When using this option, you can enter multiple commands that are then executed asa single script in a command console; you have access to any environment variablesavailable in a standard command console.

Example:

@echo on

IF NOT EXIST "%1%" GOTO DEPLOY_NOWAR

IF "%APACHE_HOME%" == "" GOTO DEPLOY_NOAPACHE

xcopy /L "%1%" "%APACHE_HOME%\webapps"

GOTO DEPLOY_END

rem

rem NO WAR FILE

rem

:DEPLOY_NOWAR

echo "%1% WAR file not found"

GOTO DEPLOY_END

(c) Sparx Systems 2019 Page 75 of 234 Created with Enterprise Architect

Page 76: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

rem

rem NO APACHE ENVIRONMENT VARIABLE

rem

:DEPLOY_NOAPACHE

echo "APACHE_HOME environment variable not found"

:DEPLOY_END

pause

Parse Output Selecting a Parser from the list causes output of the deploy script to be captured; theoutput is parsed according to the syntax selected from the list.

To display the System Output window, select the 'Start > Desktop > Design >System Output' ribbon option.

(c) Sparx Systems 2019 Page 76 of 234 Created with Enterprise Architect

Page 77: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Recording Scripts

The beauty of recording is not really that we always get to see the bigger picture, but a chance to see a smaller picturethat has some truth to tell. We have all seen Sequence diagrams that are less than helpful. (The same message appearing100 times in succession on a diagram does tell us something, but not much.) Fortunately Enterprise Architect takes careof this first point through the use of fragments. Repeating behaviors are identified as Patterns and represented once as afragment on the Sequence diagram. The fragment is labeled according to the number of iterations. The recording history,of course, always shows the entire history. We also need tools to help us focus the recording on particular areas ofinterest and reduce the noise from others. We can use filters to do this. With filters, you can exclude any Classes,functions, or even modules from any recording. You can create multiple sets of filters and use them with marker sets totarget different Use Cases.

Access

On the Execution Analyzer window, either:

Locate and double-click on the required script and select the 'Recording' page or·

Click on in the window Toolbar, select the Package in which to create a new script, and select the 'Recording'·page

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Tools > Analyzer

Keyboard Shortcuts Shift+F12

Filter Strings

Element Discussion

Filtering If the 'Enable Filter' checkbox is selected on the 'Recording' page of the ExecutionAnalyzer Script Editor, the debugger excludes calls to matching methods from therecording. The comparison is case-sensitive.

To add a value, click on the 'New' ('Insert') icon in the right corner of the 'ExclusionFilters' box, and type in the comparison string; each filter string takes the form:

class_name_token::method_name_token

The class_name_token excludes calls to all methods of a Class or Classes that havea name matching the token; the string can contain the wildcard character *(asterisk).

The method_name_token excludes calls to methods having a name that matches thetoken; again, the string can contain the wildcard character *.

Both tokens are optional; if no Class token is present, the filter is applied only toglobal or public functions (that is, methods not belonging to any Class).

Example In this Java example, the debugger would exclude:

Calls to the OnDraw method for the Class Example.common.draw.DrawPane·

Calls to any method of any Class having a name beginning with·Example.source.Collection

(c) Sparx Systems 2019 Page 77 of 234 Created with Enterprise Architect

Page 78: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Calls to any constructor for any Class (such as <clint> and <init>)·

In this Native Code example, the debugger would exclude:

Calls made to Standard Template Library namespace·

Calls to any Class beginning with TOb·

Calls to any method of Class CLock·

Calls to the method GetLocation for Class CTrain·

Calls to any Global or Public Function with a name beginning with Get·

Filters

Use Filter Entry To Filter

::Get* All public functions having a name beginning with 'Get' from the recording session(for example, GetClientRect in Windows API).

*::Get* All methods beginning with 'Get' in any Class.

CClass::Get* All methods beginning with Get for the CClass Class.

CClass::* All methods for CClass Class.

ATL*

std*

All methods for Classes belonging to Standard Template and Active TemplateLibraries.

CClass::GetName The specific method(s) GetName for the CClass Class.

(c) Sparx Systems 2019 Page 78 of 234 Created with Enterprise Architect

Page 79: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Merge Script

A Merge command in an Analyzer Script gives users an additional command to perform some action. The merge actionis dependent on your requirements.

Access

On the Execution Analyzer window, either:

Locate and double-click on the required script and select the 'Merge' page or·

Click on in the window Toolbar, select the Package in which to create a new script, and select the 'Merge'·page

Ribbon Develop > Preferences > Analyzer > Edit Analyzer Scripts

Execute > Source > Merge

Keyboard Shortcuts Ctrl+Alt+M

(c) Sparx Systems 2019 Page 79 of 234 Created with Enterprise Architect

Page 80: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Build Application

This topic explains how to execute a Build script on your application, within Enterprise Architect.

Access

Ribbon Execute > Source > Build > Build

Keyboard Shortcuts Ctrl+Shift+F12

Other 'Build' toolbar >

Execution Analyzer window |

Action

When you select the 'Build' option, it executes the 'Build' command in the script selected in the Execution Analyzerwindow. The progress and outcome of the build operation are displayed in the 'Build' tab of the System Output window.

You can quickly visit the line of code for any compilation error appearing by double-clicking the error.

(c) Sparx Systems 2019 Page 80 of 234 Created with Enterprise Architect

Page 81: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Locate Compiler Errors in Code

When you build an application using an Analyzer Script, compiler output is logged in the System Output window. Youcan double-click on any error message that appears here and be taken to the source code. When you do, the cursor ispositioned on the line containing the error.

Tip

If output is missing, check that a language parser is mentioned in the Analyzer Script (Shift+F12).

Access

Ribbon Start > Desktop > Design > System Output

Keyboard Shortcuts Ctrl+Shift+8

(c) Sparx Systems 2019 Page 81 of 234 Created with Enterprise Architect

Page 82: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Debugging

Enterprise Architect is more than a drawing tool. Every feature that you might expect in an IDE is also available.Comprehensive debugging environments and tools for many major platforms are provided. By integrating debuggingcapability within the modeling tool allows code to be developed, built and managed by its authors, working andcollaborating in an integrated model has made actions count and every action accountable in ways that are just notpossible using other tool chains.

Features

Speed

Debuggers in Enterprise Architect are quick! Stepping through programs will not take all day.

The Recording program execution can be done without manual stepping.

Support

C++, C and Visual Basic·

Microsoft .NET, ASP.NET WCF·

Java, using socket transport (JDWP) or in memory model (JVMIT)·

Android on an emulator or device·

JavaSscript, VBScript and JScript·

PHP scripts on Apache web servers·

Remote Linux GDB processes using Enterprise Architect on Windows·

Simulation - debug simulations in UML and BPMN·

Executable StateMachines - debug an executing StateMachine·

Isolation

The debuggers operate out of process from Enterprise Architect, isolating it from side effects.

Efficiency

(c) Sparx Systems 2019 Page 82 of 234 Created with Enterprise Architect

Page 83: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Starting and stopping the debugger is quick and painless. It does not hold you back. Designed to be a responsive UI, themain UI thread is isolated from duties that are not its responsibility.

Productivity

Switch from modeling to requirements, from raising a change request to tracking code changes in a model shared acrossan organization, to profiling recent code changes. All in the one tool.

Notes

The debug and record features of the Visual Execution Analyzer are not supported for the Java server platform·'Weblogic' from Oracle

(c) Sparx Systems 2019 Page 83 of 234 Created with Enterprise Architect

Page 84: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Run the Debugger

Enterprise Architect provides a number of ways to start and control a debug session. There is the main Debug window, aswell as a Debug toolbar and the 'Run' panel in the 'Execute' ribbon. It is always best to display the Debug windowwhenever you are running a debug session, as this is where all debug output is captured.

Access

Ribbon Execute > Run > Start

Execute > Tools > Debugger > Start Debugging

Keyboard Shortcuts Alt+8 (displays the Debug window)

F6 (begins execution of the application being debugged)

Toolbar Explore > Portals > Show Toolbar > Debug

Using the Debug window

Action Detail

Start the Debugger When an Analyzer script has been configured to support debugging, you can startthe debugger in these ways:

From the ribbon, select 'Execute > Run > Start > Run'·

From the ribbon, select 'Execute > Tools > Debugger > Start Debugging'·

On the 'Debug' toolbar, click on the button, or·

Press F6·

You can also launch the debugger for any script through its context menu in the'Analyzer Script Window', or press Shift+F12

If you have no Analyzer Script, it is still possible to debug a running application byattaching to that process directly:

From the ribbon, select 'Execute > Tools > Debugger > Attach to Process', or·

On the 'Debug' toolbar, click on the (Attach) button and choose the·debugging platform manually

Pause/Resume Debugging You can pause a debugging session, or resume the session after pausing, in theseways:

From the ribbon, select 'Execute > Run > Pause'·

On the 'Debug' toolbar, click on the button·

Stop the Debugger To stop debugging, either:

From the ribbon, select 'Execute > Run > Stop'·

On the 'Debug' toolbar, click on the (Stop) button·

(c) Sparx Systems 2019 Page 84 of 234 Created with Enterprise Architect

Page 85: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Press Ctrl+Alt+F6·

The debugger normally ends when the current debug process terminates; however,some applications and services (such as Java Virtual Machine) might require thedebugger to be manually stopped.

Step Over Lines of Code To step over the next line of code:

From the ribbon, select 'Execute > Run > Step Over', or·

On the 'Debug' toolbar, click on the (Step Over) button, or·

Press Alt+F6·

Step Into Function Calls To step into a function call:

From the ribbon, select 'Execute > Run > Step In', or·

On the 'Debug' toolbar, click on the (Step In) button, or·

Press Shift+F6·

If no source is available for the target function then the Debugger returnsimmediately to the caller.

Step Out Of Functions To step out of a function:

From the ribbon, select 'Execute > Run > Step Out'·

On the 'Debug' toolbar, click on the (Step Out) button, or·

Press Ctrl+F6·

If the debugger steps out into a function with no source code, it will continue tostep out until a point is found that has source code.

Show Execution Point While the Debugger is paused, to return to the source file and line of code that theDebugger is about to execute:

From the ribbon, select 'Execute > Run > Start > Show Execution Point'·

On the 'Debug' toolbar, click on the (Show Execution Point) button.·

The appropriate line is highlighted, with a pink arrow in the left margin of thescreen.

Output During a debug session, messages display in the Debug window detailing:

Startup of session·

Termination of session·

Exceptions·

Errors·

Trace messages, such as those output using Java System.out or .NET·System.Diagnostics.Debug

If you double-click on a debug message, either:

A pop-up displays with more complete message text, or·

If there has been a memory leak, the file is displayed at the point at which the·error occurred

Save Output (and Clear You can save the entire contents of the Debug output to an external .txt file, or you

(c) Sparx Systems 2019 Page 85 of 234 Created with Enterprise Architect

Page 86: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Output) can save selected lines from the output to the Enterprise Architect clipboard.

To save all of the output to file, click on the (Save output to file) button.

To save selected lines to the clipboard, right-click on the selection and select the'Copy Selected to Clipboard' option.

When you have saved the output or otherwise do not want to display it any more,right-click on the current output and select the 'Clear Results' option.

Switch to Profiler If you are running a debug session on code, you can stop the debug session andimmediately switch to a Profiling session.

To switch from the Debugger to the Profiler:

From the ribbon, select 'Execute > Tools > Debugger > Switch to Profiler'·

On the Debug window, click on the ' | Switch to Profiler' option, or·

On the Debug toolbar, click on the ' | Switch to Profiler' option·

The Profiler attaches to the currently-running process.

This facility is not available for the Java debuggers.

(c) Sparx Systems 2019 Page 86 of 234 Created with Enterprise Architect

Page 87: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Breakpoint and Marker Management

Breakpoints work in Enterprise Architect in the same way as in any other Debugger. Markers are similar to breakpoints,but in Enterprise Architect they have special powers. Simply put, markers perform actions - such as recording executionand analysis - that breakpoints do not. The action of a breakpoint is always to stop the program.

You set any marker or breakpoint in the Source Code editor, where they are visible in the left margin. Clicking in thismargin will add a breakpoint at that line. Breakpoints and markers are interchangeable - you can change a breakpointinto a marker and vice versa, using its 'Properties' dialog. You can quickly view and edit a breakpoint or marker'sproperties using Ctrl+click either on its icon in the editor margin or in the Breakpoints and Markers window.

Breakpoints are maintained in sets. There is a default set for each model and each breakpoint typically resides there, butyou can save the current breakpoint configuration as a named set, create a new set and switch between them. Breakpointsets are shared; that is, they are available to the model community. The exception is the Default set which is a private andpersonal set allocated to each user of any model.

Access

Ribbon Execute > Windows > Breakpoints

Simulate > Dynamic Simulation > Breakpoints

Breakpoint and Marker Options

Option Detail

Delete a breakpoint ormarker

To delete a specific breakpoint:

If the breakpoint is enabled, click on the red breakpoint circle in the left margin·of the Source Code Editor, or

Right-click on the breakpoint or marker in the Source Code Editor, the·Breakpoints folder or the Breakpoints & Markers window and select the'Delete' option, or

Select the breakpoint in the 'Debug Breakpoints' tab and press the Delete key·

Delete all breakpointsClick on the Delete all breakpoints button ( ).

Breakpoint properties In the Breakpoints window or code editor, use the marker's context menu to bringup the properties. Here you can change the marker type, add or modify constraintsand enter trace statements. (Useful shortcut: hold the Ctrl key while clicking themarker, to quickly show its properties.)

Disable a breakpoint Deselect the checkbox against the breakpoint or marker.

Enable a breakpoint ormarker

Select the checkbox against the breakpoint or marker.

Disable all breakpointsClick on the button

(c) Sparx Systems 2019 Page 87 of 234 Created with Enterprise Architect

Page 88: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Enable all breakpointsClick on the Enable all breakpoints button ( ).

Break when memoryaddress is modified

Click on the Data breakpoint button ( ).

Identify or change themarker set Check the field in the Breakpoints & Events window

toolbar.

If necessary, click on the drop down arrow and select a different marker set.

The Default set is normally used for debugging and is personal to your user ID;other marker sets are shared between all users within the model.

Change how breakpointsand markers are groupedon the Breakpoints &Events window

The breakpoints and markers can be grouped by Class or by code file. To group the

items, click on the down arrow on the icon in the toolbar, and click on theappropriate option. If you do not want to group the items, click on the selectedoption to deselect it; the breakpoints and markers are then listed by line number.

Breakpoint States

State Remarks

Debug Running: Bound

Debug Not Running: Enabled

Debug Running: Disabled

Debug Not Running: Disabled

Debug Running: Not bound - this usually means that a module is yet to be loaded.Also, dlls are unloaded from time to time.

Debug Not Running: N/a

Debug Running: Failed - this means the debugger was unable to a match this line ofcode to an instruction in any of the loaded modules. Perhaps the source is fromanother project or the project configuration is out of date. Note, that if the moduledate is earlier than the breakpoint's source code date you will see a notification inthe debugger window. The text is red in color so they will stand out. This is clearsign that the project requires building.

Debug Not Running: N/a

(c) Sparx Systems 2019 Page 88 of 234 Created with Enterprise Architect

Page 89: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Setting Code Breakpoints

Normal Breakpoints are typically set on a line of source code. When the Debugger hits the indicated line during normalexecution, the Debugger halts execution and displays the local variables, call stack, threads and other run-timeinformation.

Set a breakpoint on a line of code

Step Action

1 Open the source code to debug in the integrated source code editor.

2 Find the appropriate code line and click in the left margin column - a solid red circle in the marginindicates that a breakpoint has been set at that position.

If the code is currently halted at a breakpoint, that point is indicated by a blue arrow next to the marker.

Alternatively, you can set the Breakpoint marker (or other marker) by right-clicking on the left margin onthe required line, to display the breakpoint/marker context menu; select the appropriate marker type.

(c) Sparx Systems 2019 Page 89 of 234 Created with Enterprise Architect

Page 90: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Trace Statements

A Trace Statement is a message that is output during execution of a debug session. Trace statements can be defined inEnterprise Architect without requiring any changes to your application source code.

Tracepoint Markers are set in the code editor. Like breakpoints, they are placed on a line of code. When that line of codeexecutes, the debugger evaluates the statement, the result of which is logged to the Debug window (or to file ifoverridden by the Analyzer script).

Access

Any existing Trace statements can be viewed and managed in the Breakpoints & Markers window. The Breakpoints &Markers window can be displayed using either of the methods outlined here.

Ribbon Execute > Windows > Breakpoints

Add a Tracepoint Marker

Step Action

1 Open the source code to debug in the source code editor.

2 Find the appropriate code line, right-click in the left margin and select the 'Add Tracepoint Marker'option.

If a marker is already there, press Ctrl+click to show the Breakpoint Properties window.

3 Ensure the 'Trace statement' checkbox is selected.

4 In the text field under the 'Trace statement' checkbox, type the required Trace statement.

5 Click on the OK button. A Tracepoint Marker is shown in the left margin of the code editor.

Specifying a Trace Statement

(c) Sparx Systems 2019 Page 90 of 234 Created with Enterprise Architect

Page 91: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

A trace statement can be any freeform text. The value of any variables currently in scope can also be included in a tracestatement by prefixing the variable name with a special token.

The available tokens are:

$ - when the variable is to be interpreted as a string·

@ - when the variable is a primitive type (int, double, char)·

Using our example in the image, we could output the number of people getting off a train by using this statement:

There were @Passengers before @PeopleOFF got off the train at $Arriving.Name Station

In addition to tracing the values of variables from your code, you can use the $stack and $frame keywords in your Tracestatement to print the current stack trace; use:

$stack - to print all frames, or·

$frame[start](count) - print a specific number of frames from the stack starting at a given frame; for example,·$frame[0](5) will print the current frame and 4 ancestors

Notes

Trace statements can be included on any type of breakpoint or marker.·

(c) Sparx Systems 2019 Page 91 of 234 Created with Enterprise Architect

Page 92: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Break When a Variable Changes Value

Data breakpoints can be set on a pre-determined memory variable to cause the debugger to halt execution at the line ofcode that has just caused the value of the variable to change. This can be useful when trying to track down the point atwhich a variable is modified during program execution, especially if it is not clear how program execution is affecting aparticular object state.

Access

Ribbon Execute > Windows > Local Variables : Right-click on variable > Break WhenVariable is Modified or

Execute > Windows > Watches : Right-click on variable > Break When Variable isModified

Other In a code editor window: Right-click on the variable of interest | Break when itemmodified

Capture changes to a variable using data breakpoints

Steps Detail

1 Set a normal breakpoint in the code so you can choose a variable. Then run the debugger (F6).

2 When the program has hit the breakpoint, select the variable of interest and from its context menu, selectthe 'Break When Variable is Modified' option.

(c) Sparx Systems 2019 Page 92 of 234 Created with Enterprise Architect

Page 93: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

3 There are no breakpoint indicators in the code, but data breakpoints are easily recognizable in theBreakpoints & Events window, being a blue icon with a white diamond. Enterprise Architect displays thename of the variable and its address instead of a line number.

4 With the data breakpoint set, you can disable any other breakpoints you might have. The program willstop at any line of code that changes this variable's value. Now run your program.

5 When this variable is modified, the debugger halts and displays the current line of code in the editor. Thisis not the line that caused the break, but the line of code following the event. The event is logged to theDebug window.

Now we know how and where this value (its State) has changed. For example, the statement at line 58 hasjust updated the number of Passengers.

6 Having discovered this and other places where this value is being changed, be sure to get rid of thenotification before moving on. You can delete the data breakpoint quickly by selecting it in theBreakpoints window and pressing the Delete key.

You can also use the right-click context menu to do this.

(c) Sparx Systems 2019 Page 93 of 234 Created with Enterprise Architect

Page 94: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Notes

This feature is not presently supported by the Microsoft .NET platform·

(c) Sparx Systems 2019 Page 94 of 234 Created with Enterprise Architect

Page 95: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Trace When Variable Changes Value

When your code executes, it might change the value of a variable. It is possible to capture such changes and thevariable's new value, on the Debug window. You can then double-click on the change record to display the line of codethat caused the change, in the Code Editor.

Access

Ribbon Execute > Windows > Local Variables : Right-click on variable > Trace WhenVariable is Modified or

Execute > Windows > Watches : Right-click on variable > Trace When Variable isModified

Other In Code Editor | Right-click on variable | Trace When Variable Modified

Set up Trace

The variable you are tracing must be in scope, so to identify and select it, set a normal breakpoint on the line of codewhere you know that the variable will exist. When the debugger reaches this breakpoint, locate the variable and use itscontext menu to enable the trace.

To locate a variable:

If you see the variable in the source code, hover over it, right-click and select the 'Display variable' option;·Enterprise Architect will locate it

If the variable is in scope (a local, or 'this' or a member of 'this'), look for it in the Locals Window ('Execute >·Windows > Local Variables')

If the variable is global (C, C++), display the Watches window ('Execute > Windows > Watches') and search for it·by name

If the variable is a Class static member, display the Watches window ('Execute > Windows > Watches') and enter its·fully qualified name

Once trace is enabled, you can disable all other breakpoints and let the program run. Each time the variable changesvalue, it will be logged to the 'Output' tab of the debugger. Check the change in value and double-click on the line todisplay the code in the Code Editor.

Notes

The debugger does not halt when the change event occurs, it only logs the change·

This facility is available on the Microsoft Native and Java platforms·

Microsoft .NET does not support breakpoints on values·

(c) Sparx Systems 2019 Page 95 of 234 Created with Enterprise Architect

Page 96: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Detecting Memory Address Operations

Being able to detect where and when an area of memory is being read or written can be a great help for investigators,even when the code base is well understood. Without this tool, a C++ developer could have a potentially daunting task oftracking where and when a global variable is accessed, and debugging those functions. Data breakpoints allow a C++programmer to track when a variable / memory location is read or when it is written. When the operation is detected, thedebugger will halt the execution and the line of code following the operation will be displayed in the code editor.

Access

Ribbon Execute > Windows > Breakpoints

Detect operation on memory address

Step Action

1 Click the button.

2 Enter the memory address to watch. You can copy an address from the Locals (Local Variables) window.

3 Select the operation to detect. If you select 'Write', the debugger will break when the address is written to.If you choose 'Read / Write', the debugger will notify you when the address is read or when it is written.

4 Select the action to perform. If you choose 'Break', the debugger will halt the program and the line of codewill be shown in the editor. If you choose 'Trace', the debugger will not halt execution, but log anyoperation on the address as it occurs. This output is displayed in the Debugger Window.

5 The data breakpoint is added to the Breakpoints and Markers window.

(c) Sparx Systems 2019 Page 96 of 234 Created with Enterprise Architect

Page 97: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

6 You can use the context menu on the data breakpoint to check the value at the memory address.

7 To delete a data breakpoint, select it in the Breakpoints and Markers window and press the Delete key.Alternatively, deselect the checkbox next to it. Data breakpoints are deleted when they are disabled; theydo not persist as other breakpoints do.

System Requirements

Memory address breakpoints are supported in the C/C++ native debugger.

(c) Sparx Systems 2019 Page 97 of 234 Created with Enterprise Architect

Page 98: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Breakpoint Properties

Breakpoints have a number of additional properties that determine what occurs when executing the line of code that thebreakpoint applies to.

These properties define:

The action to be performed·

The line of code that the breakpoint applies to·

Constraints that determine whether or not the action is performed when the breakpoint is hit·

Trace information to be output when the breakpoint is hit·

Access

There are several ways to display the 'Breakpoint Properties' dialog:

Code Editor Right-click on a breakpoint marker | Properties or·

Ctrl+Click on breakpoint marker or·

Right-click on code that has a breakpoint marker | Breakpoint | Properties·

Breakpoints & Markerswindow

Right-click on breakpoint | Properties·

Options

Field Details

Action The behavior when the breakpoint is hit.

(c) Sparx Systems 2019 Page 98 of 234 Created with Enterprise Architect

Page 99: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Line The line of source code that this breakpoint applies to.

Stack Height For Stack Capture markers, the number of caller frames to record. To record theentire Stack, set the value to 0.

Constraints Defines the condition under which the breakpoint action will be taken. For normalbreakpoints this would be the condition that halts execution. In this example, for anormal breakpoint, execution would stop at this line when the condition evaluatesto True. Constraints are evaluated each time the line of code is executed.

(this.m_FirstName="Joe") AND (this.m_LastName="Smith")

Trace statement A message output to the Debug window when the breakpoint is hit. Variablescurrently in scope can be included in a trace statement output by prefixing thevariable name with a $ token for string variables, or an @ token for primitive typessuch as int or long. For example:

Account $pAccount->m_sName has a balance of @pAccount->m_fBalance

(c) Sparx Systems 2019 Page 99 of 234 Created with Enterprise Architect

Page 100: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Failure to Bind Breakpoint

A breakpoint failure occurs if there is a problem in binding the breakpoint. Breakpoint failures are most often caused bysource files being changed without the application being rebuilt. Breakpoints can sometimes bind to a different line,causing them to be moved. If a breakpoint cannot be bound to the binary at this line or the three lines following it, it isdisplayed with a question mark.

A warning message displays in the 'Details' column of the Breakpoints & Events window, identifying the type ofproblem:

The source file for the breakpoint does not match the source file used to build the application image·

The time date stamp on the file is greater than that of the image·

A warning message is also output to the Debug window.

(c) Sparx Systems 2019 Page 100 of 234 Created with Enterprise Architect

Page 101: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Debug a Running Application

Rather than starting a process explicitly from within Enterprise Architect, you might want to debug an application(process) that is already running on your system.

In this case you can use the debugging capability to attach to the process that is already running. Provided you have theappropriate debug information written into the running process, and/or associated debug files (such as .PDB files), thedebugger binds to that process and initiates a debug session.

You can also 'detach' from the process after you have completed your inspection and leave the process to run as normal.

Access

Ribbon Execute > Run > Start > Attach to Process

Debugger Window The debugger window toolbar has an Attach button

Stages

Stage Description

Show Processes When you select to debug another process, the 'Attach To Process' dialog displays.

You can limit the processes displayed using the radio buttons at the top of thedialog; to find a service such as Apache Tomcat or ASP.NET, select the Systemradio button.

Select Debugger When you select a process, you might have to choose the debugger from theDebugger dropdown list; however, if the selected Package has already beenconfigured in an Analyzer Script, then the debugger listed in the script is preset onthe dialog.

Process Selection Once you double-click on a process containing debug information, and EnterpriseArchitect is attached to the process:

Any breakpoints encountered are detected by the debugger·

The process is halted when a breakpoint is encountered, and·

The information is available in the Debug window·

Detach From ProcessTo detach from a process, click on the (Debug Stop) button.

(c) Sparx Systems 2019 Page 101 of 234 Created with Enterprise Architect

Page 102: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

View the Local Variables

The Locals window displays variables of the executing system. Whether you are recording C#, debugging Java, C++ orVBScript, debugging an Executable StateMachine, or running a simulation, this window is where the system's variablesare located. Current values are only displayed when a program is halted. This occurs when a breakpoint is encounteredduring debugging, when you step over a line of code or when you step between States in a simulation.

Access

Ribbon Execute > Windows > Local Variables

Simulate > Dynamic Simulation > Local Variables

Context Menu In Code Editor | Right-click on any variable identifier > Display Variable

Icons

The value and type of any in-scope variable is displayed in a tree; each variable has a colored box icon that identifies thetype of variable:

Blue - Object with members·

Green - Arrays·

Pink - Elemental types·

Yellow - Parameters·

Red - Workbench instance·

Finding variables

The easiest way to find a variable is to first locate it in the code editor and use the right-click context menu on thevariable, selecting 'Display Variable'. Enterprise Architect will find and reveal any variable in scope, including deeplynested members. If the variable is found in a different scope (global, file, module, static), it will be displayed in theWatches window (see View Variables in Other Scopes).

(c) Sparx Systems 2019 Page 102 of 234 Created with Enterprise Architect

Page 103: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Persistent View

The examination of variables usually involves digging around in the tree to expose the values of interest. It can beannoying then, having gone through that trouble, to step to the next line of code, only to have those variables buried fromsight again due to a change in context. The Locals window has a persistent view that lingers for a while after a run orstep command. When you step through a function in Enterprise Architect, the variables structure persists line after line.This makes stepping through a function quick and easy.

What changed

As part of the persistent view, the Locals window tracks changes to values and highlights them.

Context Menu

Facility Detail

(c) Sparx Systems 2019 Page 103 of 234 Created with Enterprise Architect

Page 104: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Break When Variable isModified

Set data breakpoints on the selected memory variable to halt debugger execution atthe line of code that has just caused the value of the variable to change.

View Memory at Address Display the raw values in memory at the selected address, in hex and ASCII.

Show in String Viewer Display the variable string in the 'String Viewer' dialog.

Dump Variable Membersto File

Capture and store the selected variables to a separate location; a browser displays toselect the appropriate .txt file name and file path.

Save Snapshot of Variable Capture the value of a variable at a specific point in the life of that variable.

Compare VariableSnapshots

Compare the values of a variable at different points in the life of that variable.

Copy Copy the selected variable to the Enterprise Architect clipboard.

Add Instance Run State toDiagram

If you have opened a model diagram containing an Object of the Class for whichthe source code is being debugged, this option updates that Object with the RunState represented by the variable value.

Set Conditional Breakpoint Add a breakpoint at the current execution position with a constraint for this variablematching its current value.

(c) Sparx Systems 2019 Page 104 of 234 Created with Enterprise Architect

Page 105: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

View Content Of Long Strings

For efficiency, the Locals window only shows partial strings. However, you can display the entire contents of a stringvariable using the 'String Viewer'.

This example shows the value of a variable holding the contents of an XML schema file.

Access

From Code Editor or

(c) Sparx Systems 2019 Page 105 of 234 Created with Enterprise Architect

Page 106: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Locals window Right-click on string variable | Show in String Viewer

(c) Sparx Systems 2019 Page 106 of 234 Created with Enterprise Architect

Page 107: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

View Debug Variables in Code Editors

When a breakpoint occurs, you will see all the local variables in that window. You can also inspect variables in theSource Code Editor by hovering your mouse over the reference. Here are some examples.

Note: The variable does not have to be one of the local variables. It can have a file or module scope.

(c) Sparx Systems 2019 Page 107 of 234 Created with Enterprise Architect

Page 108: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Variable Snapshots

It is possible to take a 'snapshot' of a variable when your program hits a breakpoint and use this snapshot to see how thevalue of the variable changes at different points in its life. The debugger does not copy the value of the selected variableonly; for complex variables it copies the values of the selected variable and of each of its hierarchy of members until itcan no longer find any more debug information for a member or no more members can be found.

Capture Variable Snapshot

Step Action

1 In the Code Editor, set two breakpoints: one at the start of a function and another at the end of thefunction.

2 At the start breakpoint, right-click on a variable in the Locals window and select the 'Save VariableSnapshot' menu option.

3 Run the application.

4 When the end breakpoint is reached, right-click on the variable in the Locals window and select the'Compare Variable Snapshots' option.

A dialog displays that shows the original value from the first snapshot and the current value from thesecond snapshot as illustrated in this diagram taken from the EA.Example model.

Save Variable Snapshot to File

You can save the state of a variable to file using its right-click context menu.

(c) Sparx Systems 2019 Page 108 of 234 Created with Enterprise Architect

Page 109: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

This is an excerpt of the file contents.

(c) Sparx Systems 2019 Page 109 of 234 Created with Enterprise Architect

Page 110: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Actionpoints

Actionpoints are breakpoints that can perform actions. When a breakpoint is hit, the actionpoint script is invoked by thedebugger, and the process continues to run. Actionpoints are sophisticated debugging tools, and provide expertdevelopers with an additional command suite. With them, a developer can alter the behavior of a function, capture thepoint at which a behavior changes, and modify/detect an object's state. To support these features, Actionpoints can alterthe value of primitive local and member variables, can define their own 'user-defined-variables' and alter programexecution.

User-Defined Variables in Actionpoints and Breakpoints

User Defined Variables (UDVs):

Provide the means for setting a UDV primitive or string in Actionpoint statements·

Can be used in condition statements of multiple markers/breakpoints·

Can be seen easily in the same Local Variables window·

The final values of all UDVs are logged when debugging ends.·

In the UDV syntax, the UDV name:

Must be preceded by a # (hash) character·

Is case-insensitive·

Actionpoint Statements

Actionpoint statements can contain set commands and goto commands.

set command

Sets variable values. An Actionpoint statement can contain multiple 'set' commands, all of which should precede any'goto' command.

The 'set' command syntax is:

set LHS = RHS

Where:

LHS = the name of the variable as a:· - user defined variable (UDV) such as #myval - local or member variable such as strName or this.m_strName

RHS = the value to assign:· - As a literal or local variable - If a literal, as one of: integer, boolean, floating point, char or string

set command - Variable Examples

UDV Examples Local Variable Examples

(c) Sparx Systems 2019 Page 110 of 234 Created with Enterprise Architect

Page 111: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

set #mychar = 'a' set this.m_nCount=0

set #mystr = "a string" set bSuccess=false

set #myint = 10

set #myfloat = 0.5

set #mytrue = true

goto command

goto command - switches execution to a different line number in a function. An Actionpoint statement can contain onlyone goto command, as the final command in the statement.

The goto command syntax is:

goto L

Where L is a line number in the current function.

Integer operators

Where a UDV exists and is of type int, it can be incremented and decremented using the ++ and -- operators. Forexample:

Create a UDV and set its value and type to a local integer variable.1. AP1: set #myint = nTotalSoFar

Increment the UDV.2. AP2: #myint++

Decrement the UDV.3. AP3: #myint--

Timer operations

Actionpoints can report elapsed time between two points. There is only one timer available, which is reset or started withthe startTimer command. The current elapsed time can then be printed with the printTimer command. Finally, the totalelapsed time is printed and the timer ended with the endTimer command.

Example Actionpoint Conditions

With Literals and constants:

(#mychar='a')·

(#mystr <> "")·

(#myint > 10)·

(#myfloat > 0.0)·

(c) Sparx Systems 2019 Page 111 of 234 Created with Enterprise Architect

Page 112: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

With Local Variables:

(#myval == this.m_strValue)·

(#myint <> this->m_nCount)·

(#myint != this->m_nCount)·

Instruction Recording

Instruction recording can be useful for detecting changes to a known behavior; the point in execution (B) that divergesfrom a previous execution(s) (A). The commands are:

recStart - starts recording or starts comparing if a previous recording exists·

recStop - ends recording·

recPause - pause recording·

recResume - resumes recording·

The recStart command begins recording instructions. Executed instructions are then stored. When a recStop commandis encountered, the recording is saved. There can only be one saved recording at any one time between two Actionpoints.When a recStart is encountered and a previous recording exists, the debugger will begin comparing each subsequentinstruction with its recording. It could perform many comparisons. If and when a difference is detected, the debuggerwill break and the line of code where the behavior changed will be displayed in the code editor. The iteration of thecomparison is also printed.

The recording is stored in memory by default, but it can also be stored to a file with the command syntax:

recStart filesspec

For example:

recStart c:\mylogs\onclickbutton.dat

When a recStart command is encountered that specifies a file, and that file exists, it is loaded into memory and thedebugger will immediately enter comparison mode.

Expressions

There is no implicit precedence in Breakpoint, Actionpoint and Testpoint conditional expressions. In complexexpressions, the use of parentheses is mandatory. See these examples:

Type Example

Actionpoint UDV example (#myint=1) AND (#mystr="Germany")

Local variables examples (this.m_nCount > 10) OR (nCount%1)

(this.m_nCount > 10) OR (bForce)

Equality operators inconditional expressions

<> - Not Equal

!= - Not Equal

== - Equal

= - Equal

Assignment operator inActionpoint

= - Assigns RHS to LHS

Arithmetic operators in / - division

(c) Sparx Systems 2019 Page 112 of 234 Created with Enterprise Architect

Page 113: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

conditional expressions + - plus

- - minus

* - multiplication

% - modulus

Logical operators inconditional expressions

AND - both must be true

OR - one must be true

&& - both must be true

|| - one must be true

^ - exclusive OR (only one must be true)

(c) Sparx Systems 2019 Page 113 of 234 Created with Enterprise Architect

Page 114: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

View Variables in Other Scopes

Access

Ribbon Execute > Windows > Watches

OtherExecution Analyzer window toolbar : | Watches

Views

View Description

Watches The Watches window is most useful for native code (C, C++, VB) where it can beused to evaluate data items that are not available as Local Variables - data itemswith module or file scope and static Class member items.

You can also use the window to evaluate static Class member items in Java and.NET

To add a watch, type the name of the variable to watch in the toolbar, and press theEnter key.

To examine a static Class member variable in C++, Java or Microsoft .NET, enterits fully qualified name:

CMyClass::MyStaticVar

To examine a C++ data symbol with module or file scope, just enter its name.

Variables are evaluated by looking at the current scope; that is, the module of thecurrent stack frame (you can change the scope at a breakpoint by double-clickingthe frame in the Call Stack).

If the global variable exists in a different module, you can examine the variable byprefixing the module name to the variable

modulename!variable_name

History The history of items entered is maintained. Previously entered names or expressionscan be selected again using the Up arrow key and Down arrow key inside thetoolbar text box. The history will also persist for the user across any instance ofEnterprise Architect or model on the same machine.

(c) Sparx Systems 2019 Page 114 of 234 Created with Enterprise Architect

Page 115: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

View Elements of Array

You can use the Watches window to inspect one or more specific elements of an array.

In the field to the left of the Watches window toolbar, type the variable name of the array followed by the start elementand the number of elements to display. The start element is enclosed in square brackets and the count of elements isenclosed in parentheses; that is:

variable[start_element](count_of_elements)

For example, Points[3](2) displays the fourth and fifth elements of the Points array, as illustrated.

If you entered Points[3] the Watches window would show the third array element only.

Access

Ribbon Execute > Windows > Watches

OtherExecution Analyzer window toolbar : | Watches

(c) Sparx Systems 2019 Page 115 of 234 Created with Enterprise Architect

Page 116: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

View the Call Stack

The Call Stack window is used to display all currently running threads in a process. It can be used to identify whichthread is operational, immediately before program failure occurs.

When a Simulation is active, the Call Stack will show the current execution context for the running simulation. This willinclude a separate context stack for each concurrent simulation 'thread'.

A stack trace is displayed whenever a thread is suspended, through one of the step actions or through encountering abreakpoint. The Call Stack window can record a history of stack changes, and enables you to generate Sequencediagrams from this history.

Access

Ribbon Execute > Windows > Call Stack

OtherExecution Analyzer window toolbar : | Call Stack

Use to

View stack history to understand the execution of a process·

View threads·

Save a call stack for later use·

Record call stack changes for Sequence diagram generation·

Generate a Sequence diagram from the call stack·

View the related code line in the Source Code Editor·

Facilities

Facility Description

Indicators A pink arrow highlights the current stack frame·

A blue arrow indicates a thread that is running·

A red arrow indicates a thread for which a stack trace history is being recorded·

Save a Call Stack to a.TXT File

Not currently available.

Record a Thread in aDebug Session

To record the execution of a thread and direct the recording to the Record &Analyze window, right-click on the thread in the Call Stack and select theappropriate context menu option:

'Record' - to manually record the current thread during the debug session·Used in conjunction with the 'step' buttons of the debugger; each function thatis called due to a step command is logged to the Record & Analyze window

'Auto-Record' - to perform auto-recording during a debug session·

(c) Sparx Systems 2019 Page 116 of 234 Created with Enterprise Architect

Page 117: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

When you select this icon, the Analyzer begins recording and does not stopuntil either the program ends, you stop the debugger or you click on the 'Stop'icon

Stop Recording If you have started a manual or automatic recording of a thread you can stop itbefore completion; select the thread (indicated by a red arrow) and either:

Click on the (Stop Recording) button in the toolbar or·

Right-click and select the 'Stop' option·

Generate a SequenceDiagram from the CallStack

To generate Sequence diagram from the Call Stack trace, either:

Click on the (Generate Sequence Diagram of Stack) button, or·

Right-click and select the 'Generate Sequence Diagram' option·

Copy Stack to RecordingHistory

To add the stack details immediately to the Record & Analyze window (for latergeneration of Sequence diagrams) either:

Click on the button, or·

Right-click and select the 'Copy Stack to Record History' option·

Toggle Stack Depth To toggle between showing the full stack and showing only frames with source,

click on the (Toggle Stack Depth) button.

Display Related Code inSource Code Editor

Double-click on a thread/frame to display the related line of code in the SourceCode Editor; local variables are also refreshed for the selected frame.

(c) Sparx Systems 2019 Page 117 of 234 Created with Enterprise Architect

Page 118: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Create Sequence Diagram of Call Stack

The Call Stack window records a history of stack changes from which you can generate Sequence diagrams.

Access

Ribbon Execute > Windows > Call Stack

OtherExecution Analyzer window toolbar : | Call Stack

Use to

Record Call Stack changes for Sequence diagram generation·

Generate a Sequence diagram from the Call Stack·

To generate a Sequence diagram from the current Stack, click on the (Generate Sequence Diagram of Stack) buttonon the Call Stack window toolbar.

This immediately generates a Sequence diagram in the Diagram View.

(c) Sparx Systems 2019 Page 118 of 234 Created with Enterprise Architect

Page 119: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

(c) Sparx Systems 2019 Page 119 of 234 Created with Enterprise Architect

Page 120: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Inspect Process Memory

Using the Memory Viewer, you can display the raw values of memory in hex and ASCII. You can manually define thememory address in the 'Address' field (top right), or right-click on a variable in the Locals window or Watches windowand select the 'View Memory at Address' option.

Access

Ribbon Execute > Windows > Memory Viewer

OtherExecution Analyzer window toolbar : | Memory Viewer

From Locals window or Watches window : Right-click on a variable | ViewMemory at Address

Notes

The Memory Viewer is available for debugging Microsoft Native Code Applications (C, C++, VB) running on·Windows or within WINE on Linux

(c) Sparx Systems 2019 Page 120 of 234 Created with Enterprise Architect

Page 121: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Show Loaded Modules

For .NET and native Windows applications, you can list the DLL's loaded by the debugged process, using the Moduleswindow. This list can also include associated symbolic files (PDB files) used by the debugger.

Access

Ribbon Execute > Windows > Modules

Modules Window display

Column Description

Path Shows the file path of the loaded module.

Load Address Shows the base memory address of the loaded module.

Modified Date Shows the local file date and the time the module was modified.

Debug Symbols Shows:

The debug symbols type·

Whether debug information is present in the module, and·

Whether line information is present for the module (required for debugging)·

Symbol File Match Indicates the validity of the symbol file; if the value is false, the symbol file is outof date.

Symbol Path Shows the file path of the symbol file, which must be present for debugging towork.

Modified Date Shows the local file date and time the symbol file was created.

(c) Sparx Systems 2019 Page 121 of 234 Created with Enterprise Architect

Page 122: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Process First Chance Exceptions

Access

Ribbon Execute > Tools > Debugger > Process First Chance Exceptions

OtherDebug window toolbar : | Process First Chance Exceptions

Processing Elements

Element Description

Debug Process When an application is being debugged and the debugger is notified of anexception, the application is paused and the debugger responds in the way it isconfigured to do; it either:

Resumes the application and leaves the exception to the application to manage,·or

Keeps the application suspended and passes the exception to the appropriate·routines for automatic resolution or manual intervention

Second Chance Exceptions The Enterprise Architect debugger defaults to the first listed behavior.

If the application can handle the exception, it continues to process; if it cannothandle the exception, the debugger is notified again and this time it must suspendthe application and resolve the exception condition.

In this behavior, because the debugger has encountered the exception twice, it isknown as a second-chance exception; in this case, if the exception does not haltexecution, it is ignored and you avoid spending time on conditions that do notimpact the overall outcome of processing.

You might work this way on large or complex systems that invariably involveexception conditions somewhere in the processing paths.

First Chance Exceptions However, if you want to examine every exception that occurs as soon as it occurs,you can set the debugger to adopt the second behavior.

Because the debugger responds to the exception on first contact, it is known as afirst-chance exception.

You might work this way with individual functions or routines that must workcleanly or not at all.

Selection Select the 'Process First Chance Exceptions' option to debug exceptions on firstcontact.

Deselect the option to process exceptions only if the application fails when theyoccur.

(c) Sparx Systems 2019 Page 122 of 234 Created with Enterprise Architect

Page 123: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Just-in-time Debugger

You can register the Enterprise Architect debugger as the operating system Just-in-time debugger, to be invoked when anapplication running outside Enterprise Architect on the system either encounters an exception or crashes. When you doso, an application crash will cause Enterprise Architect to be opened, and the source and reason for the crash displayed.

Access

Ribbon Execute > Tools > Debugger > Set as JIT Debugger

(c) Sparx Systems 2019 Page 123 of 234 Created with Enterprise Architect

Page 124: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Services

Enterprise Architect provides two services to facilitate remote script execution and remote debugging. The servicesprimarily support Enterprise Architect running on Linux to allow users to run native Linux shell scripts and debug Linuxprograms. The Satellite service supports Analyzer Scripts while the Agent service supports debugging.

Access

Ribbon Execute > Tools > Services

The Satellite Service

The Satellite service is responsible for executing Analyzer Scripts on the machine on which it is running. The feature canhelp Linux users to execute native Linux programs and shell commands directly, bypassing Wine. The service can bemanaged from the ribbon. It can also be run independently from a terminal.

The Linux Shell

The default shell used by Enterprise Architect is 'bash'. To override the Linux Shell used by Enterprise Architect, open aLinux terminal, run 'wine regedit ' and add a string value to this registry key:

HKEY_CURRENT_USER\Software\Sparx Systems\EA400\EA\Options

where:

key name: "LINUX"·

key value: path·

and path is the Linux path to the shell program "/bin/bash", for example.

Permissions

Under Linux you must check that the service programs have the appropriate permissions. The programs are located underthe Enterprise Architect installation folder. The sub directory "VEA/x86/linux". Check that each of the programs in thisdirectory has the execute permission set for the owner.

Notes

The Satellite services are enabled in the Unified and Ultimate editions of Enterprise Architect·

The Agent Service

The Agent service is responsible for managing debugging sessions for Enterprise Architect's GDB debugger. The serviceallows Enterprise Architect users to debug Linux programs. The service can be managed from the ribbon. It can also be

(c) Sparx Systems 2019 Page 124 of 234 Created with Enterprise Architect

Page 125: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

run independently from a terminal.

The Services Menu

Start Satellite Service Starts the service. The service listens on the Satellite Port configured in anyAnalyzer Script Services Page.

Stop Satellite Service Stops the service.

Test Satellite Service Tests whether the service is running or not.

Start Agent Service Starts the service. The service listens on the Agent Port configured in an AnalyzerScript Services Page.

Stop Agent Service Stops the service.

Test Agent Service Tests whether the service is running or not.

(c) Sparx Systems 2019 Page 125 of 234 Created with Enterprise Architect

Page 126: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Profiling

During the lifetime of software applications, it is not uncommon to investigate application tasks that are determined to beperforming slower than expected. You might also simply want to know what is going on when you 'press this button'!You can work this out quite quickly in Enterprise Architect by using its Profiler. Results can usually be produced in afew seconds and you will quickly be able to see the actions that are consuming the application and the functionsinvolved. In the Execution Analyzer, The feature employs two separate strategies; Process Sampling and ProcessHooking. In one, samples are taken at regular intervals to identify CPU-intensive patterns, while in the other, the processis hooked to record demands made on memory. Data is analyzed to produce a weighted Call Graph. Behaviors areusually identifiable as root nodes (entrypoints) in the graph, or branches near these points. All reports can be reviewed ondemand. They can be saved to file within the model, both as Artifact elements and as Team Library posts.

Access

Ribbon Execute > Tools > Profiler

Other Execution Analyzer toolbar : Analyzer Windows | Profiler

Call Sampling

(c) Sparx Systems 2019 Page 126 of 234 Created with Enterprise Architect

Page 127: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

The Profiler is controlled using its toolbar buttons. Here you can attach the Profiler to an existing process (or JVM), orlaunch the application for the active Analyzer Script. The Profiler window displays the details of the target process as itis profiled. These details provide feedback, letting you see the number of samples taken. You also have options forpausing and resuming capture, clearing captured data and generating reports. You can gain access to the reporting featureby pausing the capture - the reporting feature is disabled whilst data capture is in progress.

Weighted Call Graph

This detailed report shows the unique set of Call Stacks/behaviors as a weighted Call Graph. The weight of each branch

(c) Sparx Systems 2019 Page 127 of 234 Created with Enterprise Architect

Page 128: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

is depicted by a hit count, which is the total hits of that branch plus all branches from this point. By following the hittrail, a user can quickly identify the areas of code that occupied the program the most during the capture period.

Stack Profile

Stack Profiles are a taken to discover the different ways (stacks) and the count of ways that a particular function isinvoked during the running of the program. Unlike other the other profiler modes, this profile is activated through the useof a Profile Point, which is a special kind of breakpoint marker. The marker is set in the source code like any otherbreakpoint. When the breakpoint is encountered by the program, the stack is captured. When you later produce thereport, the stacks are analyzed and a weighted call graph produced. The graph shows the unique stacks that wereinvolved in that function during the time the profiler was running, The 'Hit Count' column indicates the count of timesthat same stack occurred.

Memory Profiles

(c) Sparx Systems 2019 Page 128 of 234 Created with Enterprise Architect

Page 129: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

The Memory profile tracks allocations, ignoring when memory is freed. It uses this information to rate the executingcode's demands for memory, in terms not of the amount of memory but of the frequency of demands. The Allocationsfigure is the total number of memory allocations requested. The Stack Holdings is the number of stack traces taken atthose times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that profiling canbe turned on and off on demand. There is also no need to rebuild your program to get it to work as there is no linkageinvolved.

Memory Graph

This example is of a report produced from Profiling a demonstration program in the Xerces project from Apache. Theprogram iterates over the Document Object Model (DOM) for a provided XML file.

Function Summary Report

(c) Sparx Systems 2019 Page 129 of 234 Created with Enterprise Architect

Page 130: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

This summary report lists the functions and only those functions executed during the sample period. Functions are listedby total invocations, with a function that presents twice in separate Call Stacks appearing before a function that appearsjust the once.

Function Line Report

This detailed report shows the source code for a function line by line displaying beside it the total times each wasexecuted. We uncovered code using this report, that exposed case statements in code that never appeared to be executed.

Support

The Profiler is supported for programs written in C, C++, Visual Basic, Java and the Microsoft .NET languages. Memoryprofiling is currently available for native C and C++ programs.

Notes

The Profiler is available in Enterprise Architect Professional editions and above·

The Profiler can also be used under WINE (Linux and Mac) for Profiling standard Windows applications deployed·in a WINE environment

(c) Sparx Systems 2019 Page 130 of 234 Created with Enterprise Architect

Page 131: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

System Requirements

Using the Profiler, you can analyze applications built for these platforms:

Microsoft TM Native (C++, C, Visual basic)·

Microsoft .NET (supporting a mix of managed and unmanaged code)·

Java·

Microsoft Native applications

For C, C++ or Visual Basic applications, the Profiler requires that the applications are compiled with the Microsoft TM

Native compiler and that for each application or module of interest, a PDB file is available. The Profiler can sample bothdebug and release configurations of an application, provided that the PDB file for each executable exists and is up todate.

Microsoft .NET applications

For Microsoft .NET applications, the Profiler requires that the appropriate Microsoft .NET framework is installed, andthat for each application or module to be analyzed, a PDB file is available.

Java

For Java, the Profiler requires that the appropriate JDK from Oracle is installed.

The classes of interest should also have been compiled with debug information. For example: "java -g *.java"

New instance of application VM is launched from Enterprise Architect - no other action is required·

Existing application VM is attached to from within Enterprise Architect - the target Java Virtual Machine has to·have been launched with the Enterprise Architect profiling agent

These are examples of command lines to create a Java VM with a specific JVMTI agent:

java.exe -cp "%classpath%;.\" -agentpath:"C:\Program Files (x86)\Sparx Systems\EA\vea\x86\ssamplerlib32"1.myapp

java.exe -cp "%classpath%;.\" -agentpath:"C:\Program Files (x86)\Sparx Systems\EA\vea\x64\ssamplerlib64"2.myapp

(Refer to the JDK documentation for details of the -agentpath VM startup option.)

(c) Sparx Systems 2019 Page 131 of 234 Created with Enterprise Architect

Page 132: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Getting Started

The Profiler can be used to investigate performance issues, providing four separate tools for you to choose from, namely:

Call Graph·

Stack Profile·

Memory Profile·

Memory Leaks·

You select these tools from the Profiler toolbar.

Access

Ribbon Execute > Tools > Profiler

Tools

Tool Description

Call Graph Analyzes performance by taking samples during an activity in a program. Eachsample represents a stack. The samples are taken at intervals controlled using thetoolbar. In this scenario, poor performance is rated by the patterns of behavior thatrepeat the most during the sample time period. This figure is used to weight the CallGraph produced.

Memory Profile Analyzes performance by hooking the memory allocations made by a program. Inthis scenario, poor performance is rated by the activities making the most requestsfor memory. This figure is used to weight the Call Graph produced.

Stack Profile The Stack Profiler enables you to set a marker in your source code so that wheneverexecution hits that marker, a full stack trace is captured. As the applicationcontinues executing and the marked position is accessed from a variety of placeswithin the running executable, a very detailed and useful picture is built up showinghot spots and usage scenarios for a particular point in code.

The Stack Profile report, like the Memory Profile report, is displayed in 'reversestack' order. This means that the root of the report is always a single node (in thiscase the marker) and the tree then fans out to show all the various places themarked position has been accessed from.

Memory Leaks Analyzes memory leaks by hooking the memory operations performed by aprogram. What is produced is a Call Graph presenting the Call Stacks that allocatedmemory for which a free operation was not detected.

Toolbar Buttons

(c) Sparx Systems 2019 Page 132 of 234 Created with Enterprise Architect

Page 133: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Button Action

Displays a menu of options for managing your Profiling session.

Launches the configured application to be profiled. By default, this is theapplication configured in the active Analyzer Script.

Indicates the state of the sampler. When green, sampling is enabled; when red,sampling is disabled.

Stops the Profiler process; if any samples have been collected, the Report buttonand Discard Data button are active.

Generates a report from the current data collection.

Displays the Profiling tool in use, which determines the fields shown in the Profilerwindow. Click on the drop-down arrow and select a different tool, which changesthe window fields.

Discards the collected data. You are prompted to confirm the discard.

Displays the Help topic for this window.

(c) Sparx Systems 2019 Page 133 of 234 Created with Enterprise Architect

Page 134: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Call Graph

Quickly discover what a program is doing at any point in time·

Easily identify performance issues·

Be surprised how quickly you can realize improvements·

See your improvements at work and have the evidence·

Support for C/C++, .NET and Java platforms·

Usage

The 'Call Graph' option is typically used in situations where an activity is performing slower than expected, but it canalso be used simply to better understand the patterns of behavior at play during an activity.

Operation

The Profiler operates by taking samples - or Call Stacks - at regular intervals over a period of time; the interval is setusing the Profiler toolbar. You use the Profiler to run a particular program, or you can attach to an existing process. TheProfiler capture is controlled, and you can pause and resume capture at any time. You can also elect to have captureinitiated immediately when the Profiler is started. If necessary, you can discard any captured samples and start againduring the same session. If you cannot continue with the same session, restarting the Profiler is quick and easy.

Results

(c) Sparx Systems 2019 Page 134 of 234 Created with Enterprise Architect

Page 135: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Results can be produced at any time during the session; however, capture must be disabled in order for the Report buttonto become active. It is up to you to decide how long you let the Profiler run. You might know when an activity isfinished, or it might be apparent for other reasons. The reason you are here might be that an activity is not completing atall.

You enable the Report button by either pausing capture or stopping the Profiler altogether.

Results are displayed in a Report view. The report opens with two tabs initially visible: the Call Graph and the FunctionSummary. The reports can be saved to file, stored in the model as Artifacts or posted in the Team Library.

(c) Sparx Systems 2019 Page 135 of 234 Created with Enterprise Architect

Page 136: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Stack Profile

The Stack Profiler enables you to set a marker in your source code so that whenever execution hits that marker, a fullstack trace is captured. As the application continues executing and the marked position is accessed from a variety ofplaces within the running executable, a very detailed and useful picture is built up showing hot spots and usage scenariosfor a particular point in code.

The Stack Profile report, like the Memory Profile report, is displayed in 'reverse stack' order. This means that the root ofthe report is always a single node (in this case the marker) and the tree then fans out to show all the various places themarked position has been accessed from.

Usage

Use the Stack Profile mode to produce a report that shows the unique ways in which a function can be invoked during therunning of a program. Determine the parts of the model that rely on this function and their frequency.

Operation

(c) Sparx Systems 2019 Page 136 of 234 Created with Enterprise Architect

Page 137: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Profiler modes are selected using the Profiler control Toolbar. If a Profiler Point is already created, it is displayed. TheProfiler Point is the point at which stack traces are captured. You can set the Profiler Point using the Set button on thecontrol itself, once the mode is selected. After deciding on the Profile Point, build the project to be sure everything is upto date, then start the Profiler. The number of unique stack holdings detected is visible during the run.

Results

A results can be produced by clicking the report button on the Profiler control Toolbar. This button is enabled wheneither:

Capture is turned off (using the Pause Button) or·

The Profiler is stopped (using the Stop Button)·

The results produced are displayed as a weighted call graph, where the lines on the graph represent a unique stack, andweighted to show the higher frequency stacks first. The report can then be saved, either to file or to the model, using thecontext menu of the report itself.

(c) Sparx Systems 2019 Page 137 of 234 Created with Enterprise Architect

Page 138: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Memory Profile

Quickly rate performance of activities that interest you·

Nothing influences a discussion more than evidence·

Reward your efforts by working in those areas that will make a difference·

Surprise yourself by delivering optimizations you might not have known existed·

Usage

The Memory Profile can be used to reveal how activities perform in regard to memory consumption. Using this mode, auser would be interested in questioning the frequency of demands made for memory during a task. They would be lessinterested in the actual amount consumed. A well managed activity might make relatively few calls to allocate resourcesbut allocate enough memory to do its job efficiently. Other activities might make many thousands of requests, and thattypically makes them less efficient. This mode is useful for detecting those scenarios.

Operation

(c) Sparx Systems 2019 Page 138 of 234 Created with Enterprise Architect

Page 139: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

The Memory Profile works by hooking the process in question, so that program has to be launched using the tool inEnterprise Architect. Unlike the Call Graph option, you cannot attach to an existing process. When the program isstarted, hooking mechanisms track the allocation of memory; this information is collected and collated in EnterpriseArchitect. You can easily monitor the number of allocations being made. Also, the process is controlled; that is, thememory hooks can be turned on and off on demand. If you might have mistimed some action, you can pause capture,discard the data and resume capture again easily.

Results

Results can be produced at any time during the session; however, capture must be disabled in order for the Report buttonto become active. It is your decision how long you let the Profiler run. You enable the Report button by either pausingcapture or stopping the Profiler altogether.

Results are displayed in a Report view. The report initially opens with two tabs visible; a single weighted Call Graph anda Function Summary. The Call Graph depicts all the Call Stacks that led to memory allocations, which are aggregatedand weighted according to the frequency of the pattern.

Requirements

For best results, the image and its modules should be built with debug information included, and without optimizations.Any module with the Frame Pointer Omission (FPO) optimization is likely to produce misleading results.

(c) Sparx Systems 2019 Page 139 of 234 Created with Enterprise Architect

Page 140: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Memory Leaks

The Profiler control, showing the count of memory allocations and the count of operations that are memory free.

A well behaved program.

Memory leak detection is a road well traveled. Although many other good options are available, we believe our approachhas major benefits, such as:

No changes at all to existing project build·

No header files required by the project code·

No runtime dependencies to worry about·

No system configuration to think about·

Usage

A person would use this mode to track memory leaks in an application or in an activity within the application. A memoryleak from the Profiler's point of view is a successful call made to a memory allocation function that returns a memoryaddress for which no matching call is made to free that address.

(c) Sparx Systems 2019 Page 140 of 234 Created with Enterprise Architect

Page 141: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Operation

The Memory Leak detection works through hooking. The memory routines of the process are hooked to track whenmemory is both allocated and freed. Call Stacks are captured at the point of the allocation and this information is collatedin Enterprise Architect to produce a report in the form of a Call Graph. Capture is controlled; that is, the hookingmechanisms can be enabled or disabled on demand.

Depending on the type of program and its memory consumption, you could employ an appropriate strategy. For smallprograms, you might track the program from start to finish. For larger windowed programs, you would probably do betterby toggling capturing before and after a specific task to avoid tracking too much data.

Results

Results can be produced at any time during the session; however, capture must be disabled in order for the Report buttonto become active. It is your decision how long you let the Profiler run. You enable the Report button by either pausingcapture or stopping the Profiler altogether.

Results are displayed in a Report view. The report initially opens with two tabs visible; a single weighted Call Graph anda Function Summary. The Call Graph depicts all the Call Stacks that led to memory allocations, and are aggregated andweighted according to the frequency of the pattern.

Reports can contain a variable amount of 'noise'. To focus on an area you have specific concerns for, locate a functionknown to you in the summary report and use that to navigate directly into the line in the graph where it is featured.

Requirements

For best results, the image and its modules should be built with debug information included, and without optimizations.Any module with the Frame Pointer Omission (FPO) optimization is likely to produce misleading results.

(c) Sparx Systems 2019 Page 141 of 234 Created with Enterprise Architect

Page 142: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Setting Options

The first icon on the Profiler window toolbar displays a list of options that you can set to tailor your Profiling session.

Options

Option Description

Attach to Running Process Select this option to display the 'Attach to Process' dialog, from which you choosean active process to Profile.

Switch to Debugger Select this option to change operations from Profiling to Debugging. The Debuggerhas an equivalent drop-down menu option that you can use to switch fromDebugging to Profiling.

Load Report Select this option to load a previously saved report from the file system.

Analyzer Scripts Select this option to open the Analyzer Script window, which is the modelrepository for configuring builds, debugging, and all other Visual ExecutionAnalyzer options.

Delay Sampling Select this option to set a delay between clicking on a 'Start Profiling' option andthe Profiling actually beginning. The delay can be 3, 5 or 10 seconds. Select 'None'to cancel any delay set.

CallGraph AggregatesMethod

When this option is selected, instances of the identical stack sequences areaggregated by method. That is to say, line numbers / instructions within a methodare ignored, so two stacks will be counted as one where they differ only by linenumber in their final frame.

CallGraph Samples IncludeWait State

When this option is selected, the Profiler will sample all threads, including those inWait states. When unselected, the Profiler only samples threads that haveaccumulated CPU time since the last interval expired.

(c) Sparx Systems 2019 Page 142 of 234 Created with Enterprise Architect

Page 143: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Start SamplingImmediately

Select this option to trigger Data Collection immediately on launch. You wouldtypically use this option to profile a process during start up.

Discard Fragments When stacks cannot be reconciled to the entry point of a thread they are referred toas fragments. The number of fragments encountered during sampling is displayedin the sampler Summary window. You can set this option to collect or discardfragments; when the Discard Fragments option is:

Selected, fragments do not appear in the reports, although the number·encountered is still updated

Deselected, a special collection named 'fragments' is created in the call graph to·house them, and to ensure they data is not mixed in with the complete samples

Capture Debug Output (Applies to Process Sampling). When selected, output normally visible duringdebugging is captured and displayed in the Debug window. Note that only debugbuilds will typically emit debug output.

Stop Process on Exit This option determines termination behavior for the Profiler. When the option isselected, the target process will terminate when the Profiler is stopped.

(c) Sparx Systems 2019 Page 143 of 234 Created with Enterprise Architect

Page 144: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Start & Stop the Profiler

Profiling is a two stage process of data collection and reporting. In Enterprise Architect the data collection has theadvantage of being a background task - so you are free to do other things while it runs. The information sent back toEnterprise Architect is stored until you generate a report. To view a report, the capture must be turned off. After thereport is produced you can resume capture with the click of a button. If, for some reason, you decide to scrap your dataand start again, you can do so easily and without having to stop and start the program again.

Access

Ribbon Execute > Tools > Profiler > Open Profiler

Other Execution Analyzer toolbar : Analyzer Windows | Profiler

Actions

Action Detail

Toolbar

Strategy Selection Select the Profiling strategy from the available options on the Toolbar.

Start the Profiler Click the Run button on the Profiler window

Stop the Profiler The process exits if:

You click on the Stop button·

The target application terminates, or·

You close the current model·

If you stop the Profiler and the process is still running, you can quickly attach to itagain.

Pause and Resume Capture You can pause and resume capture at any time during a session.

When capture is turned on, samples are collected from the target. When paused, theProfiler enters and remains in a wait state until either capture is enabled, the

(c) Sparx Systems 2019 Page 144 of 234 Created with Enterprise Architect

Page 145: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Profiler is stopped or the application finishes.

Generate Reports The Report button is disabled during capture but is available when capture is turnedoff.

Clear Data Collection You can clear any data samples collected and resume at any time. First suspendcapture by clicking on the Pause button. The Discard button, as for the Reportbutton, is enabled whenever capture is turned off. In clicking on the Discard buttonyou will be asked to confirm the operation. This action cannot be undone.

(c) Sparx Systems 2019 Page 145 of 234 Created with Enterprise Architect

Page 146: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Function Line Reports

After you have run the Profiler on an executing application and generated a Sampler report, you can further analyze theactivity of a specific function listed in the report by generating a Function Line report from that item. A Function Linereport shows the number of times each line of the function was executed. You produce one Function Line report at atime, on any method in the Sampler report that has a valid source file. The Function Line report is particularly useful forfunctions that perform loops containing conditional branching; the coverage can provide a picture of the most frequentlyand least frequently executed portions of code within a single method.

The line report you generate is saved when you save the Sampler report. The body of the function is also saved with theFunction Line report to preserve the function state at that time.

Platforms supported

Java, Microsoft .NET and Microsoft native code

Create a Line Report

In the Sampler report, right-click on the name of the function to analyze, and select the 'Create Line report for function'option.

Once the Profiler binds the method, the Function Line report is opened on the Sampler Report window. The report showsthe body of the function, including line numbers and text. As each line is executed a hit value will accumulate againstthat line. A timer will update the report approximately once every second.

(c) Sparx Systems 2019 Page 146 of 234 Created with Enterprise Architect

Page 147: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

End Line Report Capture

Once enough information is captured, or the function has ended, click on the Profiler toolbar Stop button to stoprecording the capture.

Save Reports

Use the Save button on the Call Stack toolbar to save the Sampler report and any Function Line reports to a file.

Delete Line Reports

Closing the 'Line Report' tab will close that report but the report data will only be deleted when the report is saved.

(c) Sparx Systems 2019 Page 147 of 234 Created with Enterprise Architect

Page 148: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

(c) Sparx Systems 2019 Page 148 of 234 Created with Enterprise Architect

Page 149: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Generate, Save and Load Profile Reports

Reports can be produced at any time during a session, or naturally when a program ends. To enable the Report buttonwhile the program is running, however, you need to suspend Profiling by toggling the Pause/Resume button, or byterminating the Profiler with the Stop button. You have some options for reviewing and sharing the results:

View the report·

Save the report to File·

Distribute the report as a Team Library resource·

Attach the report as a document to an Artifact element·

Synchronize the model by reverse engineering the source code that participated in the profile·

Access

Ribbon Execute > Tools > Profiler > Create Report from Current Data

ProfilerFrom the Profiler window, click on the icon in the toolbar.

Load Report from File

The option is available from the drop down menu of the Profiler Window

Generate Report

From the Profiler window, click on the icon in the toolbar.

CallFrequency Report

(c) Sparx Systems 2019 Page 149 of 234 Created with Enterprise Architect

Page 150: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Function Summary

Unfiltered Summary Report listing all participating functions in order of inclusive hits.

(c) Sparx Systems 2019 Page 150 of 234 Created with Enterprise Architect

Page 151: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

You can filter and reorganize the information in the report, in the same way as you do for the results of a Model Search.

Report Options

Right-click on the report to display the context menu.

Action Detail

Show Source for Function For the selected frame, select this option to display the corresponding line of codein a code editor. Frames that have source available are identifiable by their icon.

Find in Summary Window Select this option to locate the function in the Summary View.

Collapse Graph Select this option to collapse the entire graph including child nodes, visible or not.

Collapse to Node Select this option to collapse the entire graph, then expand and set the focus to the

(c) Sparx Systems 2019 Page 151 of 234 Created with Enterprise Architect

Page 152: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

selected node.

Follow Max Allocations Select this option to expand an entire line in the graph.

Create Line Report forFunction

Select this option to launch the Profiler (if it is not already running), immediatelybind the selected function and ready it for recording. Once bound, an extra tab isopened in the current Report View. This report will update instantaneously,showing the number of times each line executed. Of course, the report will continueto record activity in the function even if is not visible.

Note: In windowed programs, it is usually necessary to take some action in theapplication to cause the function to be invoked.

Create Function Graph Select this option to create an additional tab, which shows the selected function inisolation. For a Call Frequency Profile, this produces a graph showing all the linesthat led to this function being called (that is, the callers). For a Memory Profile, thisproduces a graph showing all lines that emanate from this function (that is, thecallees).

Mark Initial Frame for CallStack Diagram

Use prior to creating a Call Stack sequence diagram to limit the stack length. Whenthis option is selected, the frame is marked and its text is highlighted. Frames abovethis one will then be excluded from any Sequence diagram produced.

Remove Mark Removes the mark from a frame that was previously marked as 'Initial'.

Create Call Stack Diagram Generates a sequence diagram for a single stack in the graph. The selected frame isdepicted as the terminal frame in the stack. The initial frame of the stack defaults tothe root node if no 'Initial' frame has been marked.

Create Weighted CallGraph Diagram

Generates a sequence diagram that presents a sequence for each visible stackbranching from the selected frame. By expanding and collapsing the nodes ofinterest, a user can tailor the sequence diagram content to their liking.

Display the HeaviestWeighted Use

Select this option to display the line in the graph with the highest weight in whichthis function appears.

Display the Next WeightedUse

Select this option to navigate to the next line in the graph where the functionappears.

You can use the shortcut key combination Ctrl+Down Arrow.

Display the PreviousWeighted Use

Select this option to navigate to the previous line in the graph where this functionappears.

You can also use the shortcut key combination Ctrl+Up Arrow

Save Report to File Select this option to display the 'Save As' dialog, allowing you to choose where tostore the report.

Save Report to Artifact Note: Before selecting this option, go to the Browser window and select thePackage or element under which to create the Artifact element.

You are prompted to provide a name for the report (and element); type this in andclick on the OK button.

The Artifact element is created in the Browser window, underneath the selectedPackage or element.

If you add the Artifact to a diagram as a simple link, when you double-click on theelement the report is re-opened.

(c) Sparx Systems 2019 Page 152 of 234 Created with Enterprise Architect

Page 153: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Team Library Options

Option Description

Make Report a TeamLibrary Resource

You can save any current report as a resource for a Category, Topic or Post in theTeam Library to share and review at any time, as it is saved with the model. Thereport can also be compared with future runs.

To begin this process, on the 'Team Library context menu select the menu option'Share Resource | Add Active Profiler Report'.

Notes

If you add the Profiler report to an Artifact element and also attach a Linked Document, the Profiler report takes·precedence and is displayed when you double-click on the element; you can display the Linked Document using the'Edit Linked Document' context menu option

(c) Sparx Systems 2019 Page 153 of 234 Created with Enterprise Architect

Page 154: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Save Report in Team Library

You can save any current report as a resource for a Category, Topic or Document in the Team Library. The report canthen be shared and reviewed at any time as it is saved with the model. This helps you to:

Preserve a Profiler report to compare against future runs·

Allow other people to investigate the profile·

Access

Context Menu Right-click in Team Library window | Share Resource | Active Profiler Report

(c) Sparx Systems 2019 Page 154 of 234 Created with Enterprise Architect

Page 155: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Recording

Sequence diagrams are a superb aid to understanding behavior. Class Collaboration diagrams also can be helpful. Inaddition to these, sometimes a Call Graph is just what we need. Then again, if you have this information available, youcould use it to document a Use Case, and why not build a Test domain while you are at it? The Enterprise ArchitectAnalyzer can generate all of these for you and from a single recording. It does this by recording a running program, andit works on all of the most popular platforms.

Access

Ribbon Execute > Tools > Recorder

Overview

At its simplest, a Sequence diagram can be produced in very few steps, using even a brand new model. You do not evenhave to configure an Analyzer Script. Open the Enterprise Architect code editor (Ctrl+Shift+O), place a recordingmarker in a function of your choice, and then attach the Enterprise Architect Debugger to a program running that code.Any time that function is called, its behavior will be captured to form a recording history. From this history thesediagrams can be easily created.

(c) Sparx Systems 2019 Page 155 of 234 Created with Enterprise Architect

Page 156: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Broker: Broker Exchange.Exchange Exchange.Stock: Stock Exchange.Account:Account

Exchange.Sector

Sequence diagram generated in Enterprise Architect using recording marker in a Use Case

1.7 GetSector(): ESector

1.1 FindAccount(1): Account*

1.3 GetStockVolume(): UINT

1.9 GetSector(secEquities): Sector*

1.6 Credit(2, 100, -100)

1.2 FindStock(2):Stock*

1.8 UpdateSector(secEquities, 100)

1.5 GetBalance(): INT

1.0 Buy(1, 2, 100): bool

1.4 GetStockCost(): FLOAT

1.10 Move(100)

The Sequence diagram from the Example Model recording.

Broker

+ Broker()+ ~Broker()- GetNext(Exchange::TAccountID): Exchange::Transaction*+ Trade(Exchange::Exchange*): void

Exchange

+ Buy(TAccountID, TStockID, UINT): bool+ Close(): void+ Exchange(LPCTSTR)+ ~Exchange()- FindAccount(CString): Account*- FindStock(CString): Stock*- FreeAccounts(): void- FreeSectors(): void- FreeStocks(): void+ GetAccount(TAccountID): Account*- GetSector(ESector): Sector*+ GetStock(TStockID): Stock*+ Open(): bool+ RegisterAccount(Account*): TAccountID+ RegisterStock(Stock*): TStockID+ Sell(TAccountID, TStockID, UINT): bool+ TransmitStock(IStock*): TStockID- UpdateSector(ESector, INT): void

Stock

+ Create(IExchange*, LPCTSTR, FLOAT, UINT, ESector): IStock*+ GetName(): LPCTSTR+ GetSector(): ESector+ GetStockCost(): FLOAT+ GetStockID(): TStockID+ GetStockVolume(): UINT+ Stock(LPCTSTR, FLOAT, UINT, ESector)

Account

- Account(LPCTSTR, UINT)+ Create(IExchange*, LPCTSTR, UINT): IAccount*+ Credit(TStockID, UINT, INT): void+ Credit(Stock*, UINT, INT): void+ Debit(TStockID, UINT, INT): void+ Debit(Stock*, UINT, INT): void+ GetAccountID(): TAccountID+ GetBalance(): INT+ GetName(): LPCTSTR- Register(IExchange*): void

Transaction

+ GetAmount(): INT+ GetStock(): TStockID+ Transaction(TAccountID, TStockID, INT)

Sector

+ BeginDay(int): void+ EndDay(): int+ Move(int): void+ Sector(ESector)

-m_exchSectors

The Class Collaboration diagram from the same recording.

(c) Sparx Systems 2019 Page 156 of 234 Created with Enterprise Architect

Page 157: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

«testset»

Buy Stock

«testcut»Buy Account

«testcut»Buy Exchange

«testcut»Buy Sector

«testcut»Buy Broker

«testcut»Buy Stock

The Test Domain diagram from the same recording.

Of course, an Analyzer Script is still the best idea, and opens up an incredibly rich development environment, but it isworth noting that significant results can be obtained without one. This is also true of the Enterprise Architect Debuggerand Profiler tools.

A point of interest: you can view a thread's behavior while it is recorded. Showing the Call Stack during a recording willshow updates to a thread's stack in real-time, much like an animation. It is a good feedback tool and in somecircumstances it might be all that is required.

Features at a glance

Diagram Generation

Sequence diagram·

Class Collaboration diagram·

Test Domain diagram·

State Transition capture·

Call Graph·

Control

Support multi-threaded and single-threaded models·

Support stack depth control ·

Support filters to restrict capture·

Filter wildcard support·

(c) Sparx Systems 2019 Page 157 of 234 Created with Enterprise Architect

Page 158: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Real-time stack update·

Integration

Class Model·

Test Domain·

StateMachine·

Executable StateMachines·

Unit Tests·

Platforms

Microsoft .NET·

Microsoft Native·

Java·

PHP·

GDB·

Android·

Requirements

Recording is available to users of all editions of Enterprise Architect·

Notes

The debug and record features of the Visual Execution Analyzer are not supported for the Java server platform·'Weblogic' from Oracle

(c) Sparx Systems 2019 Page 158 of 234 Created with Enterprise Architect

Page 159: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

How it Works

This topic explains how the Visual Execution Analyzer generates Sequence diagrams.

Explanation

Points Detail

Usage The Visual Execution Analyzer enables you to generate a Sequence diagram fromrecordings of the live execution of an application. As the application runs, thehistory of each thread is recorded. This history can be used to generate theSequence diagram.

This is a Sequence diagram generated from a program that calculates the price ofbooks:

How does the recorder know what to record?

The recorder works from recording markers; these are placed by you in the·functions of interest

Call Stacks in Java can stretch further than the eye can see. How can we restrict therecording to just ten frames?

The recorder is controlled by the depth either set on the recorder toolbar or·associated with a Marker Set stored in the model

Its the real thing In recording, the target application is not modified; no instrumentation of anyimage or module occurs at all. A recording produced using a 'Release' build of aprogram is a trustworthy document of what a program did.

Where do you start We have a very large server application; so where do we start? If you have little orno understanding of the program you intend to record and little or no model tospeak off, you might be best starting with the Profiler. Running the Profiler whilstusing a program in a specific manner can quickly identify Use Cases from the entry

(c) Sparx Systems 2019 Page 159 of 234 Created with Enterprise Architect

Page 160: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

points and Call Graphs presented. Having that knowledge can enable you to focuson areas that are uncovered and record those functions.

If you have the source code, all you need to do is place a recording marker in afunction that interests you. We recommend against placing multiple recordingmarkers in multiple functions at the same time. In practice this has shown to be lesshelpful. Where do you place a recording marker? For windows UI programs, and inrelation to some business use case, you might start by placing one in the eventhandlers for a message that seems most pertinent. If you are investigating a utilityfunction, just set a method recording marker at or somewhere near the start.

For services, daemons and batch processes you might want to profile the programonce for each behavior of interest and use the report to explore those areasuncovered.

Tip It's a good idea to have a quick glance at the Breakpoints and Markers windowbefore debugging, and check that the markers listed here are what you areexpecting.

Scenarios Microsoft Native C and C++, VB·(Windows programs, Window Services, Console programs, COM servers, IISISAPI modules, Legacy)

Microsoft .NET·(ASP.NET, Windows Presentation Foundation (WPF), Windows Forms,Workflow Services, devices, emulators)

Java·(Apps, Applets, Servlets, Beans)

Android·(using Android debug bridge for devices and emulators)

PHP·(Web site scripts)

GDB·(Windows / Linux interopability)

(c) Sparx Systems 2019 Page 160 of 234 Created with Enterprise Architect

Page 161: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

The Recording History

When the execution analysis of an application encounters user-defined recording markers, all information recorded isheld in the Record & Analyze window.

Access

Ribbon Execute > Tools > Recorder > Open Recorder

Facilities

Facility Information/Options

Information Display The columns in the Record & Analyze window are:

Sequence - The unique sequence number·

Threads - The operating system thread ID·

Delta - The elapsed thread CPU time since the start of the sequence·

Method - There are two Method columns: the first shows the caller for a call or·for a current frame if a return; the second shows the function called or thefunction it is returning to

Direction - Stack Frame Movement, can be Call, Return, State, Breakpoint or·Escape (Escape is used internally when producing a Sequence diagram, tomark the end of an iteration)

Depth - The stack depth at the time of a call; used in the generation of·Sequence diagrams

State - The state between sequences·

Source - There are two Source columns: the first shows the source filename·and line number of the caller for a call or, if a return, for a current frame; thesecond shows the source filename and line number of the function called orfunction returning

Instance - There are two Instance columns, which only have values when the·Sequence diagram produced contains State Transitions; the values consist oftwo items separated by a comma - the first item is a unique number for theinstance of the Class that was captured, and the second is the actual instance ofthe Class

For example: supposing a Class 'CName' has an internal value of 4567 and theprogram created two instances of that Class; the values might be: - 4567,1 - 4567,2The first entry shows the first instance of the Class and the second entry showsthe second instance

Operations on Information The Record & Analyze window toolbar provides a range of facilities for controllingthe recording of the execution of an Analyzer script.

You can perform a number of operations on the results of a recording, using theRecord & Analyze window context menu, once the recording is complete.

(c) Sparx Systems 2019 Page 161 of 234 Created with Enterprise Architect

Page 162: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Notes

The checkbox against each operation is used to control whether or not this call can be used to create a Sequence,·Test Domain Class or Collaborative Class diagram from this history

In addition to enabling or disabling the call using the checkbox, you can use context menu options to enable or·disable an entire call, all calls to a given method, or all calls to a given Class

(c) Sparx Systems 2019 Page 162 of 234 Created with Enterprise Architect

Page 163: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Diagram Features

When you generate a Sequence diagram, it includes these features:

Features

Feature Detail

References When the Visual Execution Analyzer cannot match a function call to an operationwithin the model, it still creates the Sequence but also creates a reference for anyClass that it cannot locate.

It does this for all languages.

Fragments Fragments displayed in the Sequence diagram represent loops or iterations of asection(s) of code.

The Visual Execution Analyzer attempts to match function scope with method callsto as accurately as possible represent the execution visually.

States If a StateMachine has been used during the recording process, any transitions inState are presented after the method call that caused the transition to occur.

States are calculated on the return of every method to its caller.

(c) Sparx Systems 2019 Page 163 of 234 Created with Enterprise Architect

Page 164: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Setup for Recording

This section explains how to prepare to record execution of the application.

Steps

Step

Prerequisites - To set up the environment for recording Sequence diagrams you must:

Have completed the basic set up for Build & Debug and created Execution Analysis scripts for the Package·

Be able to successfully debug the application·

Narrow the focus of a recording by applying filters.

Control the detail of a recording by adjusting the stack depth.

(c) Sparx Systems 2019 Page 164 of 234 Created with Enterprise Architect

Page 165: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Control Stack Depth

When recording particularly high-level points in an application, the Stack Frame count can result in a lot of informationbeing collected; to achieve a quicker and clearer picture, it is better to limit the stack depth on the toolbar of either:

The Breakpoint and Markers window or·

The Record & Analyze window·

Access

Ribbon Execute > Tools > Recorder > Open Recorder

Set the recording stack depth

You set the recording stack depth in the numerical field on the toolbar of the Breakpoints & Markers window or theRecord & Analyze window:

By default, the stack depth is set to three frames. The maximum depth that can be entered is 30 frames.

The depth is relative to the stack frame where a recording marker is encountered; so, when recording begins, if the stackframe is 6 and the stack depth is set to 3, the Debugger records the frames 6 through 8.

For situations where the stack is very large, it is recommended that you first use a low stack depth of 2 or 3. From thereyou can gradually increase the stack recording depth and insert additional recording markers to expand the picture untilall the necessary information is displayed.

(c) Sparx Systems 2019 Page 165 of 234 Created with Enterprise Architect

Page 166: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Place Recording Markers

This section explains how to place recording markers, which enable you to silently record code execution between twopoints. The recording can be used to generate a Sequence diagram.

As this process records the execution of multiple threads, it can be particularly useful in capturing event drivensequences (such as mouse and timer events).

Access

Ribbon Execute > Windows > Breakpoints

Actions

Action

Different recording markers can be used for recording the execution flow; see the related links for information onthe properties and usage of these markers.

Manage breakpoints in the Breakpoint & Markers window.

Activate and deactivate markers.

Working with Marker Sets - when you create a breakpoint or marker, it is automatically added to a marker set, eitherthe Default set or a set that you create for a specific purpose.

Notes

The Breakpoint and Marker Management topic (Software Engineering) describes a different perspective·

(c) Sparx Systems 2019 Page 166 of 234 Created with Enterprise Architect

Page 167: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Set Record Markers

Markers are set in the source code editor. They are placed on a line of code; when that line of code executes, theExecution Analyzer performs the recording action appropriate to the marker.

Access

Use one of the methods outlined here, to display the Code Editor window and load the source code associated with theselected Class or Class element.

Ribbon Execute > Source > Edit > Edit Element Source

Execute > Source > Edit > Open Source File

Keyboard Shortcuts On an element press Ctrl+E or F12

To bring up file dialog Ctrl+Alt+O

Set a recording marker

Step Action

1 Open the source code to debug, in the integrated source code editor.

2 Find the appropriate code line and right-click in the left (Breakpoint) margin to bring up thebreakpoint/marker context menu; select the required marker type:

3 If a Start Recording Marker has been set, you must also set an End Recording Marker.

(c) Sparx Systems 2019 Page 167 of 234 Created with Enterprise Architect

Page 168: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Marker Types

Markers are really fantastic. Unusual by their very light footprint when used with care, their impact on the performanceof the programs being recorded can be negligible. Markers come in several flavors (well colors actually) and more arealways being added. They are placed and are visible in the left margin of the editor, so you will need to have some sourcecode.

Use to

Record a single function·

Record parts of a function·

Use Cases spanning multiple functions·

Record call stacks·

Generate Sequence diagrams·

Generate Test Domain diagrams·

Generate Class Collaboration diagrams·

Reference

Marker Detail

Start / End Recordingmarkers

Place the markers at the start and end lines of the code to record. These need not bewithin the same function.

When the program encounters a start recording marker, a new recording is initiated(the camera starts rolling!). When an end marker is encountered, the currentrecording ends (it's a take). How you use these markers is up to you and yourknowledge of the system under your care.

Advanced Stuff (nested markers):

If a Start recording marker is encountered while a recording is in progress, butwhere capture is inhibited by the Stack depth value in use, a separate recording willbe initiated. Each recording is kept on a stack. When one ends, it is removed. Thistechnique can be used in Enterprise Architect to record and render scenes in verycomplex systems. It resembles splicing short scenes from a video to create a trailer.If you only want to record a single function, you should use an Auto record marker.

Method Auto Record A Method Auto Record marker enables you to record a particular function. Thedebugger will automatically end the recording when the function completes. This is

(c) Sparx Systems 2019 Page 168 of 234 Created with Enterprise Architect

Page 169: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

marker good because recording is an intensive operation.

The function marker combines a Start Recording marker and an End Recordingmarker in one, so recording is executed after the marker point, and always stopswhen this function exits.

Recording markers can be nested. When a new Method Auto Record marker is hitwhile recording, the stack depth to record to will be extended to include the currentmethod and the required depth from that function.

Stack Auto-Capture marker

Stack markers enable you to capture any unique stack traces that occur at a point inan application; they provide a quick and useful picture of where a point in anapplication is being called from.

To insert a marker at the required point in code, right-click on the line and selectthe 'Add Stack Auto Capture Marker' option.

Each time the debugger encounters the marker it performs a stack trace; if the stacktrace is not in the recording history, it is copied, and the application continuesrunning.

Limiting the recordingdepth

You can limit the depth of frames in any recording using the stack depth control oneither the recorder and breakpoints toolbars.

(c) Sparx Systems 2019 Page 169 of 234 Created with Enterprise Architect

Page 170: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

The Breakpoints & Markers Window

Using the Breakpoints & Markers window, you can apply control to Visual Execution Analysis when recordingexecution to generate Sequence diagrams; for example, you can:

Enable, disable and delete markers·

Manage markers as sets·

Organize how markers are displayed, either in list view or grouped by file or Class·

Access

Ribbon Execute > Windows > Breakpoints

(c) Sparx Systems 2019 Page 170 of 234 Created with Enterprise Architect

Page 171: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Working with Marker Sets

Marker sets enable you to create markers as a named group, which you can reapply to a code file for specific purposes.

You can perform certain operations from the Breakpoints & Markers window alone, but to understand and use markersand marker sets you should also display the appropriate code file in the 'Source Code Viewer' (click on the Class elementand press F12).

Access

RibbonExecute > Windows > Breakpoints : toolbar icon

Using Marker Sets

Action Details

Example of Use You might create a set of Method Auto Record markers to record the action ofvarious functions in the code, and a set of Stack Capture markers to record thesequence of calls that cause those functions to be called.

You could then create Sequence diagrams from the recordings under each set.

Create a Marker Set To create a marker set from the Breakpoints & Markers window, click on the

drop-down arrow on the icon and select the 'New Set' option.

The 'New Breakpoint Marker Set' dialog displays; in the 'Enter New Set Name'field, type a name for the set, and click on the Save button.

The set name displays in the text field to the left of the 'Set Options' icon.

Alternatively, you can select the 'Save as Set' option from the 'Set Options'drop-down to make an exact copy of the currently-selected set, which you can thenedit.

Accessing Sets To access a marker set, click on the drop-down arrow on the text field to the left ofthe 'Set Options' icon, and select the required set from the list.

The markers in the set are listed in the Breakpoints & Markers window.

You would normally load a marker set prior to the point at which an action is to becaptured.

For example, to record a sequence involving a particular dialog, when you begindebugging you would load the set prior to invoking the dialog; once you bring upthe dialog in the application, the operations you have marked are recorded.

Add Markers to Set To add markers to a marker set, add each required marker to the appropriate line ofcode in the 'Source Code Viewer'.

The marker is immediately added to whichever set is currently listed in theBreakpoints & Markers window.

Each marker listed on the dialog has a checkbox in the 'Enabled' column;newly-added markers are automatically enabled, but you can disable and re-enablethe markers quickly as you check the code.

(c) Sparx Systems 2019 Page 171 of 234 Created with Enterprise Architect

Page 172: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Storage of Sets When you create a marker set it is immediately saved within the model; any userusing the model has access to that set.

However, the Default set, which always exists for a model, is a personal workspace,is not shared and is stored external to the model.

Delete a Marker from a Set Right-click on the marker and select the 'Delete Breakpoint' option.

Delete a Set If you no longer require a marker set, access it on the Breakpoints & Markerswindow and select the 'Delete Selected Set' option from the 'Set Options'drop-down list.

You can also clear all user-defined marker sets by selecting the 'Delete all sets'option; a prompt displays to confirm the deletion.

Notes

Marker Sets are very simple and flexible but, as they are available for use by any user of the model, they can be·easily corrupted; consider these guidelines: - When naming a set, use your initials in the name and try to indicate its use, so that other model users can recognize its owner and purpose - When using a set other than Default, avoid excessive experimentation so that you don't add lots of ad-hoc markers to the set - Make sure you are aware of which marker set is exposed in the Breakpoints & Markers window as you can easily inadvertently add markers to the set that are not relevant to the code file the set was created for - In any set, if you have added markers that don't have to be kept, delete them to maintain the purpose of the set; this is especially true of the Default set, which can quickly accumulate redundant ad-hoc markers

(c) Sparx Systems 2019 Page 172 of 234 Created with Enterprise Architect

Page 173: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Control the Recording Session

The Record & Analyze window enables you to control a recording session. The control has a toolbar, and a historywindow that displays the recording history as it is captured. Each entry in this window represents a call sequence madeup of one or more function calls.

Access

Open the Record & Analyze window using one of the methods outlined here.

You must also open the Execution Analyzer window ('Execute > Analyzer | Analyzer Scripts'), which lists all the scriptsin the model; you must select and activate the appropriate script for the recording.

Ribbon Execute > Tools > Recorder > Open Recorder

(c) Sparx Systems 2019 Page 173 of 234 Created with Enterprise Architect

Page 174: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Recorder Toolbar

You can access facilities for starting, stopping and moderating an execution analysis recording session through theRecord & Analyze toolbar.

Access

Ribbon Execute > Tools > Recorder > Open Recorder

Explore > Portals > Show Toolbar > Record

Buttons

Button Description

Display a menu of options for defining what the recording session operates on.

Attach to Process - enabled even if no Analyzer Script exists, this option·displays a dialog through which you select a process to record and a debuggingplatform to use; you can also optionally select a record marker set and/or aStateMachine to use during the recording

Generate Sequence Diagram from Recording - generate a Sequence/State·diagram from the Execution Analyzer trace

Generate Testpoint Diagram from History - generate a Test Domain diagram·from the Execution Analyzer trace, that can be used with the Testpoint facility

Generate Class Diagram from History - generate a Collaboration Class diagram·from the Execution Analyzer trace, depicting only those Classes and operationsinvolved in the recorded action (Use Case)

Generate Call Graph from History - generate a dynamic Call Graph from the·recording history, as you might see in the VEA Profile workspace executionanalysis layout; this can be more useful than the Sequence diagram inidentifying the unique call stacks involved

Generate All - generate the Sequence, Testpoint and Collaboration Class·diagrams together from the Execution Analyzer trace

Save as Artifact - create an Artifact element that contains the current recording·history, under the currently-selected Package in the Browser window; if yousubsequently drag this Artifact element onto a Class diagram and double-clickon it, the history recorded in the Artifact is copied back into the Record &Analyze window

Load Sequence History from file - select an XML file from which to restore a·previously-saved recording history

Save Sequence History to file - save the recording history to an XML file·

Select the recording stack depth for the marker set; that is, the number of framesfrom the point at which recording began.

Launch and record the application described in the script; you can optionally selecta record marker set and/or a StateMachine to use during the recording.

(c) Sparx Systems 2019 Page 174 of 234 Created with Enterprise Architect

Page 175: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

The icon is enabled when the active Analyzer Script is configured for debugging.

Perform ad-hoc manual recording of the current thread during a debug session.

Use this function with the 'step' buttons of the debugger; each function that is calleddue to a step command is logged to the history window.

The icon is enabled if no recording is taking place and you are currently at abreakpoint (that is, debugging).

Perform ad-hoc auto-recording during a debug session.

When you click on this icon, the Analyzer begins recording and does not stop untileither the program ends, you stop the debugger or you click on the Stop icon.

This icon is enabled if no recording is taking place and you are currently at abreakpoint (that is, debugging).

Step into a function, record the function call in the History window, and step backout.

Enabled for manual recording only.

Stop recording the execution trace.

Display the 'Synchronize Model' dialog through which you can synchronize themodel with the code files generated during a Record Profile operation.

(c) Sparx Systems 2019 Page 175 of 234 Created with Enterprise Architect

Page 176: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Working With Recording History

You can perform a number of operations on or from the results of a recording session, using the Record & Analyzewindow context menu.

Options

Option Action

Show Source for Caller Display the source code, in the Source Code Viewer, for the method calling thesequence.

Show Source for Callee Display the source code, in the Source Code Viewer, for the method being called bythe sequence.

Generate Diagram forSelected Sequence

Generate a Sequence diagram for a single sequence selected in the recordinghistory.

Generate SequenceDiagram

Generate a Sequence diagram including all sequences in the recording history.

Clear Clear the recording history currently displayed in the Record & Analyze window.

Save Recording History toFile

Save the recording history to an XML file.

A browser window displays, on which you specify the file path and name for theXML file.

Load Recording HistoryFrom File

Load a previously saved recording history from an XML file.

A browser window displays, on which you specify the file path and name for theXML file to load.

Disable All Calls Disable every call listed in the Record & Analyze window.

Disable This Call Disable the selected call.

Disable This Method Disable the selected method.

Disable This Class Disable the selected Class.

Disable All Calls OutsideThis Call

Disable every call listed in the Record & Analyze window except for the selectedcall.

Enable All Calls Enable every call listed in the Record & Analyze window.

Enable This Call Enable the selected call.

Enable This Method Enable the selected method.

Enable This Class Enable the selected Class.

(c) Sparx Systems 2019 Page 176 of 234 Created with Enterprise Architect

Page 177: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Help Display the Help topic for the Record & Analyze window.

(c) Sparx Systems 2019 Page 177 of 234 Created with Enterprise Architect

Page 178: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Start Recording

When you are recording execution flow as a Sequence diagram, you start the recording by selecting the 'Recording' iconon the Record & Analyze window toolbar. The 'Record' dialog displays with the recording options set to the defaults;that is, the current Breakpoint and Markers Set, the filters defined in the current Analyzer Script and the recording modeas basic.

Access

RibbonExecute > Tools > Recorder > Open Recorder :

Record Dialog Options

Field/Button Detail

Recording Set Recording markers determine what is recorded.

If you have a recording set to use, click on the drop-down arrow and select it.

Additional Filters Filters are used by the debugger to exclude matching function calls from therecording history. Recording filters are defined in the Analyzer Script.

In the 'Additional Filters' field you can add other filters for this specific run. if youspecify more than one filter, separate them with a semi-colon.

Basic Recording Mode In basic mode the debugger records a history of the function calls made by theprogram whenever it encounters an appropriate recording marker.

Track Instances of NamedClasses

In Track Instances mode the debugger also captures the creation of instances of theClasses you specify. It then includes that information in the history. The resultingSequence diagram can then show lifelines for each instance of that Class with,where appropriate, function calls linked to the lifeline.

Track State Transitions The recording can also capture changes in State using a specified StateMachinediagram. The StateMachine diagram must exist as a child of a Class.

The Execution Analyzer captures instances of that Class and calculates the State ofeach instance whenever a function in the current recording sequence returns.

OK Click on this button to start the debugger.

(c) Sparx Systems 2019 Page 178 of 234 Created with Enterprise Architect

Page 179: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Step Through Function Calls

The 'Step Through' command can be executed by clicking on the Step Through button on the Record & Analyze windowtoolbar.

Alternatively, press Shift+F6 or select the 'Execute > Run > Step In' ribbon option.

The 'Step Through' command causes a 'Step Into' command to be executed; if any function is detected, then that functioncall is recorded in the History window.

The Debugger then steps out, and the process can be repeated.

This button enables you to record a call without having to actually step into a function; the button is only enabled whenat a breakpoint and in manual recording mode.

(c) Sparx Systems 2019 Page 179 of 234 Created with Enterprise Architect

Page 180: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Nested Recording Markers

When a recording marker is first encountered, recording starts at the current stack frame and continues until the framepops, recording additional frames up to the depth defined on the Recording toolbar. Consider this call sequence:

A -> B -> C -> D -> E -> F -> G -> H -> I -> J -> K -> L -> M -> N -> O -> P -> Q -> R -> S -> T -> U -> V -> W -> X-> Y -> Z

If you set a recording marker at K and set the recording depth to 3, this would record the call sequence:

K -> L -> M

If you also wanted to record the calls X, Y and Z as part of the Sequence diagram, you would place another recordingmarker at X and the analyzer would record:

K -> L -> M -> X -> Y -> Z

However, when recording ends for the X-Y-Z component (frame X is popped), recording will resume when frame M ofthe K-L-M sequence is re-entered. Using this technique can help where information from the recorded diagram would beexcluded due to the stack depth, and it lets you focus on the particular areas to be captured.

(c) Sparx Systems 2019 Page 180 of 234 Created with Enterprise Architect

Page 181: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Generating Sequence Diagrams

This topic describes what you might do with the recording of an execution analysis session.

Access

Ribbon Execute > Tools > Recorder > Open Recorder

Reference

Action Detail

Generate a diagram Select the appropriate Package in the Browser window, in which to store theSequence diagram.

To create the diagram from all recorded sequences, either:

Click on the 'Recorder Menu' icon ( ) in the Record & Analyze window·toolbar, and select the 'Generate Sequence Diagram from Recording' option, or

Right-click on the body of the window and select the 'Generate Sequence·Diagram' option

To create the diagram from a single sequence, either:

Click on the 'Recorder Menu' icon ( ) in the Record & Analyze window·toolbar, and select the 'Generate Sequence Diagram from Recording' option, or

Right-click on the sequence and select the 'Generate Diagram from Selected·Sequence' option

Save a recorded sequenceto an XML file Click on the sequence, click on the 'Recorder Menu' icon ( ) in the Record &

Analyze window toolbar, and select the 'Save Sequence History to File' option.

Access an existingsequence XML file

Either:

Click on the in the Record & Analyze window toolbar, and select the·'Load Sequence History from File' option, or

Right-click on a blank area of the screen and click on the 'Load Sequence From·File' option

The 'Windows Open' dialog displays, from which you select the file to open.

Use to

Generate a Sequence diagram from a recorded execution analysis session, for:·

all recorded sequences or·

(c) Sparx Systems 2019 Page 181 of 234 Created with Enterprise Architect

Page 182: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

a single sequence in the session·

Save the recorded sequence to file·

Retrieve the saved recording and load it into the Record & Analyze window·

(c) Sparx Systems 2019 Page 182 of 234 Created with Enterprise Architect

Page 183: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Reporting State Transitions

This section describes how you can generate Sequence diagrams that show transitions in state as a program executes.

Use to

Generate Sequence diagrams that report user-defined transitions in state as a program executes (as shown in the·example generated diagram)

Topic

Create a StateMachine under the Class to be reported.

Set the constraints against each State to define the change in state to be reported.

(c) Sparx Systems 2019 Page 183 of 234 Created with Enterprise Architect

Page 184: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Reporting a StateMachine

The Execution Analyzer can record a Sequence diagram, we know that. What you might not know is that it can use aStateMachine at the same time to detect State transitions that might occur along the way. These States are represented atthe point in time on the lifeline of the object. The transitions also are apparent from the lifelines. Any invalid or illegaltransition will be highlighted with a red border. Have a look.

Process

Firstly you model a StateMachine for the appropriate Class element.

You then compose the expressions that define each State using the 'Constraints' tab of each State.

These simple expressions are formed using attribute names from Class model and actual code base. They are not OCLstatements. Each expression should appear on a separate line.

m_strColor == "Blue"

You then use the Recorder window to launch the debugger.

The Recorder window Run button is different from the button on other debugger toolbars.

The Recorder window will allow you to browse for a StateMachine if you do not know the StateMachine name. The'State Transition' dialog presents a list of StateMachines for the entire model, in which you locate and select theappropriate diagram (see the example).

When you generate the Sequence diagram, it depicts not only the sequence but changes in State at the various points inthe sequence; each Class instance participating in the detection process is displayed with its own lifeline.

Example

The Stations StateMachine shows the different States within the Melbourne Underground Loop subway system.

A train traveling on the subway network can be stopped at any of the stations represented on the StateMachine.

The Stations StateMachine is a child of the CTrain Class.

When you browse for the diagram in the 'State Transition Recorder' dialog, the hierarchy shows only the root Package,parent Class and child SubMachine and diagram; no other model components are listed.

(c) Sparx Systems 2019 Page 184 of 234 Created with Enterprise Architect

Page 185: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

(c) Sparx Systems 2019 Page 185 of 234 Created with Enterprise Architect

Page 186: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Recording and Mapping State Changes

This topic discusses how to set constraints against each State in the StateMachine under a Class, to define the change instate to be recorded.

Example

This example of a State 'Properties' dialog is for the State called Parliament; the 'Constraints' tab is open to show how theState is linked to the Class CXTrain.

A State can be defined by a single constraint or by many; in the example, the Parliament State has two constraints:

The values of constraints can only be compared for elemental, enum and string types

The CXTrain Class has a member called Location of type int, and a member called Departing.Name of type CString;what this constraint means is that this State is evaluated to True when:

an instance of the CXTrain Class exists and·

its member variable Location has the value 0 and·

the member variable Departing.Name has the value Parliament·

Operators in Constraints

There are two types of operator you can use on constraints to define a State:

Logical operators AND and OR can be used to combine constraints·

Equivalence operators {= and !=} can be used to define the conditions of a constraint·

All the constraints for a State are subject to an AND operation unless otherwise specified; you can use the OR operationon them instead, so you could rewrite the constraints in the example as:

Location=0 OR

Location=1 AND

Departing.Name!=Central

Here are some examples of using the equivalence operators:

Departing.Name!=Central AND

Location!=1

Notes

Quotes around strings are optional; the comparison for strings is always case-sensitive in determining the truth of a·constraint

(c) Sparx Systems 2019 Page 186 of 234 Created with Enterprise Architect

Page 187: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

State Analyzer

The State Analyzer is a feature that can analyze, detect and record states for instances of a Class. The feature works bycombining a state definition, defined on a Class as a constraint, and markers called State points. It is available on anylanguages supported by the Execution Analyzer, including Microsoft. NET, Mono, Java and native C++.

We begin by selecting a Class and composing our state definition.

We can get a picture of all the state definitions we've defined by placing the Class on a diagram and linking notes to theClass that themselves link to a particular state definition constraint. We explain how to do that in a later section.

(c) Sparx Systems 2019 Page 187 of 234 Created with Enterprise Architect

Page 188: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

State points are set by placing one or more markers in relevant source code.

The program to be analyzed is run using the State Analyzer control. When the Execution Analyzer encounters any Statepoint, the current instance of the Class is analyzed. Where the value domain of the instance matches the state definition,a state is recorded. Each time the instance varies, new states are thus detected. The control lists each state as it isdiscovered. Under each state the control lists the discrete set of transitions to other states made by instances of the class.

(c) Sparx Systems 2019 Page 188 of 234 Created with Enterprise Architect

Page 189: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

The information can be used to create a State Machine.

Using the same information we can easily produce a Heat Map. This example shows a 'Train' Class, its 'Bulletin' StateDefinition (as a linked note), and the Heat Map it produced. The Figures in the map are percentages. From the map wecan observe that trains were in the 'In Transit' state 46% of the time.

(c) Sparx Systems 2019 Page 189 of 234 Created with Enterprise Architect

Page 190: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

This is the analysis for the 'Bulletin' State Definition that produced our Heat Map.

Access

Ribbon Execute > Tools > Recorder > Open Recorder > State Analyzer

Design > Element > Editors > Constraints

State Definitions

State Definitions are composed in the Constraints properties of a Class element. The constraint type should be namedStateDefinition.name, where 'name' is your choice of title for the definition. These titles are listed in the combo box ofthe State Analyzer whenever a Class is selected. You select a single definition from this combo box prior to running theprogram. The State Definition in our example is named 'StateDefinition.Location'. It defines states based on the locationof instances of the CTrain Class.

(c) Sparx Systems 2019 Page 190 of 234 Created with Enterprise Architect

Page 191: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

State Definitions are composed of one or more specifications. Each state specification begins with the keyword 'statedef'which is then followed by one or more statements. Statements define the constraints that describe the state, andoptionally a variable whose value can be used to name the state. Statements are enclosed in curly brackets and areterminated with a semi colon as shown:

statedef {

Location=0;

Departing.Name;

}

Naming states using variables

In this example, 'Location' is a constant and 'Departing.name' is a variable. An additional statement follows theconstraints and instructs the name of the State to be assigned from the variable value. Here is the definition with thenaming directive.

statedef {

Location=0;

Departing.Name;

}

name=Departing.Name;

Naming states using literals

In this example the State Definition only contains constants and the state is named using a literal.

statedef {

Location=100;

}

name='Central';

A single State Definition defining multiple State specifications.

statedef {

Passengers > 100;

}

name=Busy;

statedef {

Passengers >= 50;

}

name=Quiet;

statedef {

Passengers < 50;

}

name=Very Quiet;

statedef {

Passengers = 0;

(c) Sparx Systems 2019 Page 191 of 234 Created with Enterprise Architect

Page 192: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

}

name=Idle;

Default State

A State definition can specify a default 'catch all' state that will describe the state of an instance when no other state holdstrue. You define a default state for the definition with a statement resembling this:

statedef {

Location=0;

Departing.Name;

}

name=Departing.Name;

default=Moving;

In this example, while execution is in progress any instance detected having a non-zero 'Location' attribute will berecorded as being in the 'Moving' state.

You can choose to exclude the recording of the default state by disabling the 'Include default state' option on the dropdown menu of the State Analyzer toolbar. This would exclude transitions to any 'default' state being recorded.

Creating Notes on a Class element that display State Definitions

This section describes how to create the Class diagram that shows all the State Definitions defined for the Class.

Actions

Display a Class diagram Open an existing Class diagram or create a new one.

Create a link to the Classelement

Drag the Class of interest on to the diagram as a link.

Create a note element Create a note element on the diagram and link it to the class.

Link the note to the StateDefinition

Select the link between the Note and the Class and, using its context menu, selectthe 'Link Note to Element Feature' option.

Choose the definition todisplay on the Note

From the element dialog, choose 'Constraints' from the drop combo. Any definedState Definitions will be listed for you to choose from.

(c) Sparx Systems 2019 Page 192 of 234 Created with Enterprise Architect

Page 193: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Repeat Repeat the procedure for any other State Definitions on the class.

(c) Sparx Systems 2019 Page 193 of 234 Created with Enterprise Architect

Page 194: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Synchronization

The recording produces a number of assets, the recording history being the main one. Recording also identifies a set ofsource code files. This set can be used to produce Class and Test Domain diagrams, but can also be used to synchronizeyour model.

A synchronized model provides quick and accurate navigation between diagram elements and the Class model.

Access

RibbonExecute > Tools > Recorder > Open Recorder > Toolbar button

Context Menu Right-click on the Record & Analyze window | Synchronize Model with SourceCode

Synchronize Model

Field/Button Action

Package Click on the Select button and select the target Package into which toreverse-engineer the code files.

Files/Action Lists the files identified during one or more recording(s). The appropriate action islisted next to each file.

Select All Click on this button to select the checkbox against every file in the 'Files' list.

Select None Click on this button to clear the checkbox against every file in the 'Files' list.

OK Click on this button to start the operation. The progress of the synchronization will

(c) Sparx Systems 2019 Page 194 of 234 Created with Enterprise Architect

Page 195: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

be displayed.

Cancel Click on this button to abort synchronization and close the dialog.

(c) Sparx Systems 2019 Page 195 of 234 Created with Enterprise Architect

Page 196: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Testpoints

Testpoints present a scheme by which constraints and rules governing the behavior of objects can be taken from themodel and applied to one or more applications. The advantages that schemes such as this offer are tolerance to codechanges - adding and subtracting lines from a function has no effect on the constraints that govern it. Another advantageis that changes to the behavioral rules do not require a corresponding change to any source code; meaning nothing has tobe re-compiled!

Also, the ability to verify multiple applications using a single test domain is a simple rather than onerous matter. TheTest Domain is a both a logical and relational model; constraints in the Class model can be partitioned with Test Cuts.These can be aggregated simply into Test Sets and Test Suites using connectors. Due to the decoupling of the TestDomain from the codebase, it is a simple choice of buttons to run a program normally, or run it for a specific TestDomain. This system also delivers practical benefits in that no instrumentation is required at all. Test results aredisplayed in the report window during the run, in real-time, as the program runs. These results can be retained, andreviewed at any time in the 'Test Details' dialog or using Enterprise Architect's documentation features.

Features

Feature Details

Testpoint Composition Testpoint composition is performed using the Testpoints window. The Testpointswindow is context-sensitive and displays the Test Domain for the selected elementin either the Browser window or diagram. Selecting a single Class will display theClass structure. A 'pencil' icon is displayed against Classes and methods that haveexisting constraints.

When you select a Test Cut, Set or Suite Test, the Testpoints window displays theentire Domain structure, including all the Classes that make up the domain. Note:You can navigate the domain hierarchy using the 'Navigation' pane on the right.Testpoints are composed as expressions, using the variable names of the Classmembers. The Intelli-sense shortcut Ctrl+Space is available within the editor tohelp you find these. Expressions that evaluate to True are taken to mean a pass.Returning False is taken to mean a fail.

(c) Sparx Systems 2019 Page 196 of 234 Created with Enterprise Architect

Page 197: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

You can add or edit an existing Invariant by double-clicking the Class.

You can add or edit an existing pre- or post-condition similarly by double-clickingthe method.

Double-clicking a Testpoint will automatically display the source code if it isavailable.

Line conditions are best added from within the code editor using its shortcut menus.

This image is of a pre-condition in the Test domain.

Testpoint Trace Statements Each Testpoint can have its own Trace statement. The Trace statement is a dynamicmessage that can reference variables in its object or local scope. They are outputduring the evaluation of a test. They can be configured to be output every time aconstraint is evaluated, or more usually when a test has failed. Trace statements canbe directed to the 'Testpoints' tab of the System Output Window, or to an externalfile. You can configure this in any Analyzer Script.

Test Domain Composition The Test Domain diagram is a dynamic medium where Testpoints are assembled totest Use Cases. Use Cases in a Test Domain diagram are provided in three differentstereotypes: Test Cut, Test Set and Test Suite. Management of the domain is as

(c) Sparx Systems 2019 Page 197 of 234 Created with Enterprise Architect

Page 198: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

easy as modeling on any diagram. The toolbox and shortcut menus provide accessto any Test Domain Artifacts. In brief, Testpoints from multiple Classes areaggregated into Test Sets. Test Sets are then linked to form Test Suites. Both TestCuts and Test Sets are re-usable assets. Linking the same Test Set to the one ormore Test Suites is a matter of drawing connectors.

«testset»

Sell Stock

«testcut»Sell Account

«testcut»Sell Broker

«testcut»Sell Stock

Account StockBroker

Test Domain and the ClassModel

Rarely would a Use Case involve all the methods of a single Class. Most likely it isrealized using a variety of methods from collaborating Classes. We call this subsetof methods a 'cut', and the Test Cut Artifact is the tool we use to make these cuts.The Testpoints window will adapt depending on the context, to be that for a TestDomain or Class element. This image shows the Testpoints window when a TestCut has been selected. Note the checkboxes, which are only visible for a Test Cut.They denote the methods (Test Cuts) that are contributing to a Test Set. In thisexample the Test domain was generated by the Execution Analyzer, which did themethod identification work for us.

Testpoint Evaluation The Testpoints window is used to evaluate Test domains. The window has a toolbarfor starting or attaching to the target application. The domain to test is alwaysreflected by the element that has context, so if you select a Class the window willshow only the Class structure and Testpoints of that Class. If you select a TestSuite, the window will display the entire domain hierarchy and all the Testpointsincluded in it. Clicking on the Run button will load the Testpoint domain in theExecution Analyzer, which will then evaluate, collect and update the report windowas Use Cases pass or fail each test. The exact details of each constraint type and thewhen and how of that constraint's capture are:

(c) Sparx Systems 2019 Page 198 of 234 Created with Enterprise Architect

Page 199: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

A Class Invariant is evaluated by the Analyzer whenever any method called on·an object of this Class type is completed; the invariant serves to test that thestate of a complying object is both known and permitted

Pre-conditions are evaluated immediately before an operation is called·

Post-conditions are evaluated (at the same time as a Class invariant) when the·method is completed

Line-conditions are evaluated if and when their specific line of code comes into·scope during program execution

(c) Sparx Systems 2019 Page 199 of 234 Created with Enterprise Architect

Page 200: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Test Domain Diagram

The Test Domain diagram is the medium where you assemble and group test cases for a particular domain. An exampleof a Test domain might be 'Customer'. The breadth and depth of the domains you assemble is up to you. You might haveseparate domains for 'Add Customer' and 'Delete Customer', depending entirely on how you consider best to balance thedomain hierarchy. The Diagram Toolbox and Shortcut menu provide a number of Artifacts to help model the domain.Because the medium is dynamic, allowing you to revisit and build on relationships between Test domains, the system is agreat model for delivering reusable assets to an organization that are low overhead and integrate with both the UML viewof the world, and the Software Engineering nuts and bolts of daily life.

Facilities

Facility Details

Test Domain Generation If you think the process of composing a Test Domain is complex, it can be, but helpis at hand! The Execution Analyzer can produce a Test Domain diagram for you. Itcannot write the Tests for you, but it can do some of the leg work. It can identifythe Classes and pick out only those methods that participated in a Use Case. Andthis is not guesswork. The Analyzer Test Domain is obtained from a runningprogram. This image shows the Test Domain generated by the Execution Analyzerfrom recording an Example Model program.

«testset»

Buy Stock

«testcut»Buy Account

«testcut»Buy Exchange

«testcut»Buy Sector

«testcut»Buy Broker

«testcut»Buy Stock

And this is the recording itself (as a Sequence diagram) from which the TestDomain was generated.

Broker: Broker Exchange.Exchange Exchange.Stock: Stock Exchange.Account:Account

Exchange.Sector

Sequence diagram generated in Enterprise Architect using recording marker in a Use Case

1.5 GetBalance(): INT

1.0 Buy(1, 2, 100): bool

1.6 Credit(2, 100, -100)

1.2 FindStock(2):Stock*

1.9 GetSector(secEquities): Sector*

1.4 GetStockCost(): FLOAT

1.8 UpdateSector(secEquities, 100)

1.3 GetStockVolume(): UINT

1.1 FindAccount(1): Account*

1.7 GetSector(): ESector

1.10 Move(100)

The first task on a Test Domain diagram is to create the Use Cases (Test Sets).

(c) Sparx Systems 2019 Page 200 of 234 Created with Enterprise Architect

Page 201: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Test Domain Composition These define this particular domain's responsibility. The Diagram Toolbox andshortcut menu provide Artifacts to help you achieve this. The first of these elementsis the Test Cut, which is used in the next step; identifying those methods (from theClass model) that you consider to be participants in the Use Case. The Test CutArtifact is useful because it allows us to partition a Class, selecting only thosemethods that are relevant. Test Cuts can be run individually or linked to one ormore Test Sets. Test Sets in turn can be linked to one or more Test Suites. In anycase, any element of the Test Domain tree can be run individually or as a whole.

«testsuite»

Trade Stock

(from Buy)

«testset»

Buy Stock

(from Sell)

«testset»

Sell Stock Test Set generated from recording history of the Exchange::Sell Use Case

Test Set generated from recording history of Exchange:Buy Use Case

(c) Sparx Systems 2019 Page 201 of 234 Created with Enterprise Architect

Page 202: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Test Cut

Description

A Test Cut element is a stereotyped Object element, used internal to Enterprise Architect for defining Test Sets using theTestpoint code testing facilities.

A task, such as 'Print', might involve operations on different Classes. In order to create a 'Print' test, you would want toinclude only the 'Print' operations of these Classes and exclude any other operations.

A Test Cut enables you to capture only the operations that represent the behavior (in this case, 'Print') defined for a singleClass. You might then place the Test Cut from each of several Classes into a single task as a Test Set.

When you drag a Test Cut element onto a Test Domain diagram, you create a Dependency relationship with the requiredClass element. As a result, when you select the Test Cut element on the Testpoints window, the operations of the Classare listed in the window, each with a checkbox. You then select the checkbox against each Class operation to include inthe Test Cut.

Toolbox icon

(c) Sparx Systems 2019 Page 202 of 234 Created with Enterprise Architect

Page 203: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Test Set

Description

A Test Set element is a stereotyped Use Case element used to aggregate one or more groups of methods (Test Cuts),which perhaps span multiple Classes, into a single task. Test Sets can also be aggregated into Test Suites.

You link the Test Cut elements to the Test Set using Dependency connectors.

Toolbox icon

(c) Sparx Systems 2019 Page 203 of 234 Created with Enterprise Architect

Page 204: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Test Suite

Description

A Test Suite element is a stereotyped Use Case element, used to aggregate one or more groups of tasks (Test Sets).

You link the Test Set elements to the Test Suite using Dependency connectors.

Toolbox icon

(c) Sparx Systems 2019 Page 204 of 234 Created with Enterprise Architect

Page 205: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

The Testpoints Window

The Testpoints Window is the hub where Test Domain constraints are composed. It is also the control that lets you verifya particular Test Domain on a program. The program might be already running or it can be launched using the control'sToolbar. Here you will also be able to see the results of your tests, as they happen. This control is context-sensitive,responding to the selection of elements in the Browser window or on a diagram. Depending on the selection, tests can becarried out on a single Class, a Use Case (Test Set) or a collection of Use Cases (A Test Suite).

Access

Ribbon Execute > Tools > Tester > Show Testpoint Window

Testpoints Window Columns

Column Usage

Tests Displays the name of the selected Testpoint object and the hierarchy of objectsbeneath it.

The selected object can be a:

Class·

Operation·

Test Cut·

Test Set or·

Test Suite·

Id For an Operation, this column shows a Testpoint marker icon ( ) when theAnalyzer has successfully bound this operation in the target application. If no iconappears in this column during a run, it indicates that the model and code base mightnot be synchronized; perhaps the signature of the function has changed, or theoperation is a new method you are working on that exists in the source code but notyet in your model.

For a Testpoint, this column shows a generated id number. This id number is usedin trace output to indicate which constraint is being referenced.

Constraints A pencil icon ( ) in this column indicates that one or more constraints are definedfor this Class or Operation.

Status During a test run, indicates these possible statuses:

( ) Failed - Constraint has evaluated as false one or more times.·

( ) Invalid Statement - Constraint failed to parse due to invalid syntax.·

( ) Variable not found - A referenced variable name was not found at the·location where the constraint was evaluated.

No icon is shown if a constraint has Passed.

(c) Sparx Systems 2019 Page 205 of 234 Created with Enterprise Architect

Page 206: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Evals During a test run, indicates the number of times the Execution Analyzer hasevaluated this constraint.

Passes During a test run, indicates the number of times the test passed.

Fails During a test run, indicates the number of times the test failed.

Last Run By Displays the username of the last person to run this test. (Values are derived fromthe Project Author definitions in the 'People' dialog - 'Configure > Reference Data >Model Types > People > Project Authors'.)

Last Run Date Displays the date and time this test was last evaluated.

Last Run Result Displays the result of the last test run.

Parent Collections Pane Lists any parent collections that include the selected object as part of their design.

Double-click this collection to make it the selected object in the left pane.

The Parent Collections pane can be hidden by clicking the Show / Hide ParentCollections pane button on the Testpoints Window Toolbar.

(c) Sparx Systems 2019 Page 206 of 234 Created with Enterprise Architect

Page 207: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Testpoints Toolbar

The Testpoints Window Toolbar provides options to execute configured tests on the currently selected Testpoint object,stop a test run currently in progress, filter the displayed items, and save the results of a completed test run.

Access

Ribbon Execute > Tools > Tester > Show Testpoint Window

Testpoints toolbar options

Toolbar Button Action

Field showing the name of the currently selected Testpoint object.

Execute the test run.

Stop the test run currently in progress.

Toggle between showing all items and showing only those items that haveconstraints defined.

Toggle between showing all items and showing only operations that have beenmarked for inclusion in this Test Cut; this button is only enabled when a Test Cutobject is selected.

When a Test Cut is selected, each of the operations of its associated Class aredisplayed with a checkbox; you use this checkbox to mark the operations that applyto this Test Cut.

Click on the drop arrow next to this icon to display the 'Test Run Options' menu,providing these options:

'Prefix Trace output With Function Call' - Prefix all trace output lines with the·executing function name

'Enable Standard Breakpoints during Testing' - When not checked, the test run·ignores any breakpoints in the current breakpoint set, and any attempts to setbreakpoints during the run are ignored

'View Trace output' - Display the 'Testpoints' tab of the System Output window·

Click on this icon after completion of a test run to save the results to Test item onthe current object. Saved tests can be viewed using the Testing Workspace.

A prompt displays to select the Test Class - Unit, Integration, System, Inspection,Acceptance or Scenario. Select the appropriate Test Class and click on the OKbutton.

(c) Sparx Systems 2019 Page 207 of 234 Created with Enterprise Architect

Page 208: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Display the Testpoint Management Help topic.

Show or hide the Parent Collections pane.

(c) Sparx Systems 2019 Page 208 of 234 Created with Enterprise Architect

Page 209: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Testpoint Editor

The Testpoint Editor is used to compose constraints for Classes and Operations. The types of constraint permitted aredependent on the selected object. For Classes, the type will always be Invariant. For operations, the type can be eitherPre-Condition, Post-Condition or Line-Condition.

Invariants are evaluated by the Analyzer when any method called on an object of the selected Class type completes.Pre-conditions are evaluated at the beginning of each call to the specified operation. Post-conditions are evaluated uponcompletion of each call to the specified operation. Line-conditions are evaluated each time the specified line of code isexecuted.

Access

Ribbon Execute > Tools > Tester > Show Testpoint Window.1.

In the Testpoints window, double-click on a Class or Operation to display the2.'Testpoint Editor' dialog.

Constraint Group fields

Field Usage

Type The type of constraint for the selected Class or Operation:

Invariant - Evaluated after any method called on the specified Class has·completed

Pre-Condition - Evaluated at the beginning of each call to a specific Operation·

Post-Condition - Evaluated after completion of each call to a specific·

(c) Sparx Systems 2019 Page 209 of 234 Created with Enterprise Architect

Page 210: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Operation

Line-Condition - Evaluated upon execution of a specific line of code within an·Operation

Offset For Line-Conditions only, the Line number within the specified operation uponwhich to evaluate the constraint.

An offset value is automatically set if the Testpoint was created using the CodeEditor context menu.

Condition The constraint to be evaluated when this Testpoint is triggered. A status of pass orfail will be recorded depending upon whether this constraint condition evaluates astrue or false.

Action on Fail Click on the drop-down arrow and select from the three options:

'Continue' - ignore failure of this constraint and continue execution·

'Break execution' - halt execution and display the Stack trace·

'Disable on fail' - do not execute the constraint again after failing once·

Evaluate When (Optional) An additional constraint which must be met before the main TestpointCondition is evaluated, providing greater control over test coverage.

Trace Group fields

Option Action

Level Specifies when the trace statement (if defined) will be output. Available optionsare:

'Fail Only' - Output trace statement only when this Testpoint condition fails·

'Always' - Output trace statement every time this Testpoint is evaluated·

Statement (Optional) A message to be output when this Testpoint is evaluated.

Variables currently in scope can be included in a trace statement output byprefixing the variable name with a $ token for string variables, or a @ token forprimitive types such as int or long.

Output from a Trace Statement can be directed either to the 'Testpoints' tab of theSystem Output Window, or to an external file, as configured by the Analyzer Scriptfor the parent Package.

(c) Sparx Systems 2019 Page 210 of 234 Created with Enterprise Architect

Page 211: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Testpoint Constraints

A Constraint is typically composed using local and member variables in expressions, separated by operators to defineone or more specific criteria that must be met. A constraint must evaluate as true to be considered as Passed. If aconstraint evaluates as false, it is considered as Failed.

Any variables referenced within the constraint must be in scope at the position where the Testpoint or Breakpoint isevaluated.

General/Arithmetic Operators

Operator Description

+ Add

Example: a + b > 0

- Subtract

Example: a - b > 0

/ Divide

Example: a / b == 2

* Multiply

Example: a * b == c

% Modulus

Example: a % 2 == 1

() Parentheses - Used to define precedence in complex expressions.

Example: ((a / b) * c) <= 100

[ ] Square Brackets - Used for accessing Arrays.

Example: Names[0].Surname == "Smith"

. Dot operator - Used to access member variables of a Class.

Example: Station.Name == "Flinders"

-> Alternative notation for the Dot operator.

Example: Station->Name == "Flinders"

Comparison Operators

Operator Description

= Equal To

(c) Sparx Systems 2019 Page 211 of 234 Created with Enterprise Architect

Page 212: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Example: a = b

== Equal To

Example: a == b

!= Not Equal To

Example: a != b

<> Not Equal To

Example: a <> b

> Greater Than

Example: a > b

>= Greater Than or Equal To

Example: a >= b

< Less Than

Example: a < b

<= Less Than or Equal To

Example: a <= b

Logical Operators

Operator Description

AND Logical AND

Example: (a >= 1) AND (a <= 10)

OR Logical OR

Example: (a == 1) OR (b == 1)

Bitwise Operators

Operator Description

& Bitwise AND

Example: (1 & 1) = 1

(1 & 0) = 0

| Bitwise OR

Example: (1 | 1) = 1

(c) Sparx Systems 2019 Page 212 of 234 Created with Enterprise Architect

Page 213: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

(1 | 0) = 1

^ Bitwise XOR (exclusive OR)

Example: (1 ^ 1) = 0

(1 ^ 0) = 1

Additional Examples

Example Description

((m_nValue &0xFFFF0000) == 0)

Use a Bitwise AND operator (&) with a hexadecimal value as the right operand totest that no bits are set in high order bytes of the variable.

((m_nValue &0x0000FFFF) == 0)

Use a Bitwise AND operator (&) with a hexadecimal value as the right operand totest that no bits are set in low order bytes of the variable.

m_value[0][1] = 2 Accessing a multi-dimensional array

a AND (b OR c) Combining AND and OR operators, using parentheses to ensure precedence. In thisexample, variable 'a' must be true, and either 'b' or 'c' must be true.

Notes

String comparisons are case-sensitive·

(c) Sparx Systems 2019 Page 213 of 234 Created with Enterprise Architect

Page 214: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Object Workbench

The Object Workbench is an Enterprise Architect debugging tool that helps you create objects from your Class model.The Workbench allows multiple instances of any Class to coexist in the same session. Each Object can serve as the targetof a method you want to invoke. They can also participate as parameters in methods you invoke. The Object Workbenchis supported for the Java and Microsoft .NET platforms.

Workbench Tasks

Task

Provides a guide and the requirements for using the Object Workbench.

Explains what Workbench objects are, and how to create them.

Explains how to execute methods on a Workbench Object and provides information on passing arguments.

Explains stepping through a method's execution using the Debugger.

Explains how to record a method and produce a Sequence diagram.

Explains how to delete a Workbench Object once you are finished with it.

Explains how to shut down the Debugger and close the Workbench once you have finished with it.

(c) Sparx Systems 2019 Page 214 of 234 Created with Enterprise Architect

Page 215: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Using the Workbench

Using the Object Workbench is straightforward. From your Class model, select the Classes to workbench and drag themindividually on to the Workbench window. You might have to choose a constructor if more than one exists, then simplygive the variable a name. The Object workbench prepares the required runtime, loads any required modules andinstantiates the objects for you. Executing a method is a matter of selecting from a list. Parameters can be entered whererequired. Workbench objects themselves can be used as parameters either singly or as object arrays.

Access

Ribbon Execute > Tools > Tester > Open Object Workbench

Analyzer Script Requirements

An Analyzer Script that has been configured for debugging is required. It should specify this information:

The debugger to match your project·

For Microsoft .NET, the location of the assembly that will be hosted by the Object Workbench·

For Java, the location of the JDK and additional class paths to use·

Checklist

Select the intended Workbench Class and press F12; the source code should be displayed in a code editor·

Press Shift+F12 to build the project; the output from the build should show successful compilation·

(c) Sparx Systems 2019 Page 215 of 234 Created with Enterprise Architect

Page 216: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Creating Objects

This topic explains how to create a workbench instance for a Class from your model.

Access

Ribbon Execute > Tools > Tester > Open Object Workbench

Keyboard Shorcuts Ctrl+Shift+J

Other Drag a Class directly from the Browser window onto the Workbench window

Tasks

Task Detail

Creating an Object on theWorkbench

Select the Class in the Browser window and drag it on to the Workbench window.

The 'Workbench' dialog displays.

Type in a name for the new instance. The name should be unique for theWorkbench.

Click on the Create button.

Choosing a Constructor The 'Constructor' dialog is displayed where a choice of constructor exists.

Select the constructor from the drop-down list.

Enter Parameters Provide values for the selected constructor's parameters:

Strings as arguments - Surround values with quotes where appropriate, or·

(c) Sparx Systems 2019 Page 216 of 234 Created with Enterprise Architect

Page 217: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

where the value would conflict with the name of a Workbench object

Objects as arguments - Enter the name of the Workbench object·

String array arguments take text values separated by commas:·

one,two,three,"a book","a bigger book"

Object arrays as arguments take object names separated by commas; supply the·named Workbench objects separated by commas, for example:

Tom,Dick,Harry

Invoke Constructor Click on the Invoke button to create the instance. The object can be recognized byits name in the Workbench window.

(c) Sparx Systems 2019 Page 217 of 234 Created with Enterprise Architect

Page 218: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Invoking Methods

Access

On the Workbench window, right-click on the instance on which to execute a method, and select 'Invoke'.

Ribbon Execute > Tools > Tester > Open Object Workbench

Actions

Action Details

Choose Method Select a method from the list and click on the Invoke button.

Note that all methods listed are public; private methods are not available.

Provide Arguments In this image, the method to be invoked takes an array of objects as its onlyargument. You construct this argument by naming the other instances on yourWorkbench that you want to pass to the method.

Argument Types These are the parameter types supported by the Workbench:

Strings·

Numbers·

(c) Sparx Systems 2019 Page 218 of 234 Created with Enterprise Architect

Page 219: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Objects·

String Arrays·

Object Arrays·

Argument Syntax Strings as arguments - Surround strings with quotes where necessary; for·example, to avoid conflict with Workbench object names

String Arrays as arguments - Enter the elements that compose the array,·separated by commas; for example:

"A maths book","A geography book","A computer book"

Objects as arguments - Type the Workbench object name as the argument; the·debugger checks any name entered in an argument against its list ofWorkbench instances, and will substitute that instance in the actual call to themethod

Object Arrays as arguments - Enter the Workbench objects' names to satisfy·the argument, separated by commas:

Tom,John,Peter

Invoke Click on the Invoke button to execute the method.

Output confirming this action is displayed in the Debug window.

(c) Sparx Systems 2019 Page 219 of 234 Created with Enterprise Architect

Page 220: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Setting Properties

For languages that support properties, we can set the value of an Object's property in the same manner in which weinvoke a method. Select the instance in the Workbench, and use its context menu to select the 'Invoke' option. You willfind the properties exposed by the Class listed alphabetically, along with its methods. You will be prompted to providethe new value of the property. Type the value as you would have entered it for the parameter in a method call. Thisimage demonstrates changing the Occupation property of a Person called Bertie; Bertie being a type of Person.

(c) Sparx Systems 2019 Page 220 of 234 Created with Enterprise Architect

Page 221: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Debugging and the Workbench

While you are working in the Workbench, you might want to debug one or more methods you are developing orinvestigating. This can easily be accomplished. The same features of Enterprise Architect's Execution Analyzer areavailable to users of the Object Workbench. Debugging can be performed during object construction and destruction aswell as during the execution of a method. To gain access to the debugger, simply place a breakpoint at the points atwhich to step through the code. You could also set the condition on these breakpoints to only break under certainconditions.

When debugging, the states of objects are inspected using the debugger controls. Here we use the Locals window toexamine the state of our object while execution is halted.

When the program resumes, the Object on the Workbench will reflect any changes in state.

(c) Sparx Systems 2019 Page 221 of 234 Created with Enterprise Architect

Page 222: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Recording and the Workbench

While you are working in the Workbench, you might want to produce a Sequence diagram for one or more methods youare developing or investigating. This can easily be accomplished. The same features of Enterprise Architect's ExecutionAnalyzer are available in the Object Workbench. You might even begin a Workbench session by recording a Sequencediagram first off, as a means of visualizing what you plan to work on.

Set the Recording Marker

Invoke the Method

View the Recording History

(c) Sparx Systems 2019 Page 222 of 234 Created with Enterprise Architect

Page 223: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Generate the Sequence Diagram

(c) Sparx Systems 2019 Page 223 of 234 Created with Enterprise Architect

Page 224: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Deleting Objects

You can easily delete an object by selecting it in the Workbench, right-clicking on it and selecting the 'Delete' option.

(c) Sparx Systems 2019 Page 224 of 234 Created with Enterprise Architect

Page 225: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Closing the Workbench

To shut down the Workbench perform any of these actions:

Choose 'Reset' from the Object Workbench context menu·

Press the Stop button on any debugger toolbar·

Delete all objects on the Workbench·

(c) Sparx Systems 2019 Page 225 of 234 Created with Enterprise Architect

Page 226: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Visualize Run State

You can record the state transitions of a single object by taking multiple snapshots of the object's run state at key pointsin its lifetime. To do this simply drag the local or member variable on to an Object diagram.

(c) Sparx Systems 2019 Page 226 of 234 Created with Enterprise Architect

Page 227: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Unit Testing

Enterprise Architect supports integration with unit testing tools in order to make it easier to develop good qualitysoftware.

In sequence:

You download and install the NUnit and JUnit applications (NUnit - http://www.nunit.org/ JUnit -·http://www.junit.org/ ); Enterprise Architect does not include these applications in the installer

Enterprise Architect helps you to create test Class stubs with the NUnit and JUnit transformations·

You define your test code within the Class stubs·

You set up and run a test script against any Package·

All test results are automatically recorded inside Enterprise Architect·

(c) Sparx Systems 2019 Page 227 of 234 Created with Enterprise Architect

Page 228: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Set Up Unit Testing

This topic explains the actions you should take in setting up Unit Testing, after having downloaded and installed theJUnit and/or NUnit applications.

Actions

Action Details

Create Unit Test Stubs By using the JUnit or NUnit transformations and code generation you can createtest method stubs for all of the public methods in each of your Classes.

(TestFixture)

public class CalculatorTest

{

(Test)

public void testAdd(){

}

(Test)

public void testDivide(){

}

(Test)

public void testMultiply(){

}

(Test)

public void testSubtract(){

}

}

Define Test Cases Write your unit test in the generated code stubs (either in Enterprise Architect or inyour preferred IDE).

This is an NUnit example in C#, although it could also be any other .NET language,or Java and JUnit.

(TestFixture)

public class CalculatorTest

{

(Test)

public void testAdd(){

Assert.AreEqual(1+1,2);

}

(Test)

public void testDivide(){

Assert.AreEqual(2/2,1);

}

(c) Sparx Systems 2019 Page 228 of 234 Created with Enterprise Architect

Page 229: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

(Test)

public void testMultiply(){

Assert.AreEqual(1*1,1);

}

(Test)

public void testSubtract(){

Assert.AreEqual(1-1,1);

}

}

Alternatively, if you have not performed an xUnit transformation, you can reverseengineer the code into Enterprise Architect so that the system can record all testresults against this Class.

Compile Your Code Check that the source code being tested compiles without errors, so that the testscripts can be run against it.

Set up the Test Scripts Set up the Test scripts against the required Package, and then run the tests.

(c) Sparx Systems 2019 Page 229 of 234 Created with Enterprise Architect

Page 230: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Run Unit Tests

On running a test script you generate test results that are stored as Test Cases against the Classes being tested.

Access

Ribbon Execute > Run > Start > Test

Execution AnalyzerWindow

ToolBar > Run Test Script

Context Menu > Test

Tasks

Task Details

Run Tests Select the appropriate Package in the Browser window.

Select the 'Run Test Script' option to run the test script you previously set up forthat Package, in the Execution Analyzer.

View Results The results of xUnit tests are displayed in the System Output window, identifyingwhich tests have run and which of these have failed.

The results also show which method failed, and the file and line number the failureoccurred at.

Double-click on an error message; Enterprise Architect opens the editor to that lineof code, enabling you to quickly find and fix the error.

Enterprise Architect also records the run status of each test against the Class beingtested; these are stored in the element Test Cases.

A diagram containing the Class can be set to display these Test Cases, by exposingthe test scripts compartment on the diagram elements.

(c) Sparx Systems 2019 Page 230 of 234 Created with Enterprise Architect

Page 231: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Record Test Results

Enterprise Architect is able to automatically record all results from tests through a testing script in Enterprise Architect.

Process

In order to use this feature, you must reverse engineer the test Class into the Package containing your test script.

Once your model contains your test Class, on the next run of the test script Enterprise Architect adds Test Cases to theClass for each test method found; on this and all subsequent test runs all Test Cases are updated with the current run timeand whether they passed or failed, as shown:

The error description for each failed test is added to any existing results for that Test Case, along with the current dateand time.

Over time this provides a log of all test runs where each Test Case has failed, which can then be included in generateddocumentation, resembling this:

Failed at 05-Jul-2006 1:02:08 PM

expected: <0>

but was: <1>

Failed at 28-Jun-2006 8:45:36 AM

expected: <0>

but was: <2>

(c) Sparx Systems 2019 Page 231 of 234 Created with Enterprise Architect

Page 232: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Samples

Enterprise Architect enables you to easily import complete sample models (Packages), including all necessary modelinformation, code and build scripts. These sample Patterns make it simple to explore and try out the Visual ExecutionAnalyzer. You can generate an example model for:

Java·

Microsoft.NET·

Microsoft C++·

PHP Apache·

Access

Ribbon Design > Model > Add > Insert > Model Wizard > VEA Examples

Keyboard Shortcuts Ctrl+Shift+M > VEA Examples

OtherBrowser window header bar : | New Model from Pattern > VEA Examples

Display Samples

Field Action

Technology Select the appropriate technology.

Name Displays the samples available for the selected technology; select the requiredsample to import.

description field Displays a description of the selected sample.

Destination folder Browse for and select the directory in which to load the source code for the sample.

Use Local Path Enable the selection of an existing local path to place the source code under;changes the 'Destination folder' field to a drop-down selection.

Compiler command Displays the default compiler command path for the selected technology; you musteither:

Confirm that the compiler can be found at this path, or·

Edit the path to the compiler location·

Edit Local Paths Many VEA examples specify their compiler using a local path.

The first time you use any sample you must click on this button to display the'Local Paths' dialog, on which you check and - if necessary - correct the local pathpointing to the correct compiler location.

(c) Sparx Systems 2019 Page 232 of 234 Created with Enterprise Architect

Page 233: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

Notes

If required, you can define custom samples by adding files to the AppSamples directory in which Enterprise·Architect is installed; top-level directories are listed as Technologies and can contain an icon file to customize theicon displayed for the technologyDirectories below this are defined as groups in the Patterns list; the Patterns are defined by the presence of four fileswith a matching name: a zip file (.zip), XMI file (.xml), config file (.cfg) and optional icon (.ico)

The config file supports these fields:· - [provider], [language], [platform], [url], [description], [version] - all displayed in the 'description' field - [xmirootpaths] - the root path of the source code in the exported XMI; this is replaced with the selected destination folder when the user applies the application pattern

(c) Sparx Systems 2019 Page 233 of 234 Created with Enterprise Architect

Page 234: Visual Execution Analysis · Managing Analyzer Scripts 13 Analyzer Script Editor 16 Build Scripts 19 Cleanup Script 21 Test Scripts 23 Testpoints Output 25 Debug Script 27 Operating

Visual Execution Analysis - Visual Execution Analysis 20 January, 2020

(c) Sparx Systems 2019 Page 234 of 234 Created with Enterprise Architect