Prev Next

The Mono Debugger

Mono is a software platform sponsored by the .NET Foundation to facilitate cross-platform development. It is popular with 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 modeling and developing software. Existing Projects can be imported, built and debugged natively on Linux as well as on Windows.

Overview

Debugging under Mono involves the cooperation of three processes.  The Mono runtime manages the application and communicates using a socket protocol with the Enterprise Architect debugger, which in turn communicates with Enterprise Architect acting as the front end.  When you launch Mono you need to direct it to support debugging. This is achieved through a command line directive in which you name the host and port number that Mono should listen on. The host 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.  Fields that are not listed here are not required.

Field

Description

See also

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 always attach 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.

Command Line Arguments

Any parameters to pass to the program. Surround the parameters in double quotes if they contain spaces.

Debugger Configuration (Linux)

This section describes the Debug Section of an Analyzer Script in respect to debugging Mono under Linux.  Fields that are 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 Architect debugger is started. After the debugger connects, it resumes the Mono runtime, which has been started as suspended. If the 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 configuring the '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

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 that location. 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).