Morphine - A Trace Analysis System for Mercury


The Morphine implementation has been Sponsored by ARGo, Esprit Industrial RTD Project No 25503.

Introduction

Mercury is a new logic programming language. Its type, mode and determinism declarations enable codes to be generated that is at the same time more efficient and more reliable than with current logic programming languages. The deterministic parts of Mercury programs are as efficient as their C counterparts. Moreover, numerous mistakes are detected at compilation time. However, our industrial partner experience shows that the fewer remaining mistakes, the harder they are to be diagnosed. A high-level debugging tool was thus necessary.

Program execution traces given by traditional debuggers provide programmers with useful pieces of information. However, using them requires to analyse by hand huge amounts of information.

Morphine is connected to the traditional tracer of Mercury, it allows execution trace analyses to be automated. It provides a relational trace query language based on Prolog which enables users to specify precisely what they want to see in the trace. Morphine, then, automatically filters out information irrelevant for the users. Morphine provides users a language to write their own debugging primitives (Prolog plus an handful of primitives connected to the Mercury trace system) and their own monitors (see the `foldt' command).

Why is it called Morphine?

Morphine is an adaptation to Mercury of Opium, an extensible debugger for Prolog. For that reason, Morphine was originally called Opium-M. As we could not keep that name for copyright reasons, we renamed it Morphine (Although sed has been a very useful tool in this respect, it might happen that some occurrences of Opium-M remains from times to times...). In a sense, Morphine is an Opium derivative.

Documentation

o A little Morphine tutorial

o "Morphine 0.2 User and Reference Manuals". (E. Jahier, M. DucassÚ) PI IRISA N░1234 and RT-INRIA N░0231, IRISA, Rennes, March 1999.

The best thing to have an up-to-date documentation is to use the man/1 and the apropos/1 commands at the Morphine prompt. An up-to-date postscript version of the manual can be generated by the command latex_manual


Installation

To install Morphine:

o If you have not checked out the extras/morphine package of the mercury distribution or if you want the latest snapshot of Morphine:

- Download the extras package (extras.tgz) on the Mercury web site .
- De-tar and unzip it (tar xvfz extras.tgz). Morphine files are in the extras/morphine directory.
o cd extras/morphine/
o Run the script `INSTALL-MORPHINE' (which creates the `morphine' script in the `extras/morphine/scripts/' directory).
o Add directories `morphine/scripts/' and `morphine/bin/' in your `PATH' environment variable. Make sure that the executables `mmc' and `eclipse' are also accessible from your `PATH'.

The current release of Morphine has been tested with the following configurations:

o Architectures: sparc/Solaris2.[5,6,7] and i686/Linux kernel 2.0
o ECLiPSe 4.1 (1). It should work with later releases. Please let me know if it is not the case.
o Mercury: 0.9 .

(1) make sure that the package eclipse_misc.tgz has been downloaded (i.e., make sure there exists a directory named `lib_pd' in the ECLiPSe installation directory); Morphine needs it.



Please send comments about Morphine or about this page to: jahier@imag.fr, ducasse@irisa.fr
Erwan Jahier
Mireille DucassÚ