# jdebug.tcl

## Introduction

The jdebug.tcl library is distributed as part of the jstools package. It consists of a single procedure, `j:debug`, useful for debugging Tkbased applications.

This document describes jdebug.tcl version 4.0/4.0.

## Usage

### Accessing the Library

In order to use the jdebug.tcl library, it (and any other libraries it depends on) must be in your Tcl `auto_path`, described in `tclvars`(n). Information about how to arrange that, and other conventions common to the jstools libraries, is in the Usage section of The jstools Libraries.

###

### The JSTOOLS_DEBUGGING Environment Variable

So as to interfere as little as possible with normal use of applications which call it, `j:debug` is defined as a null procedure under normal circumstances. In order to actually use it, you need to set the `JSTOOLS_DEBUGGING` environment variable before starting an application which autoloads `j:debug`.

## Credits and Copyright

### Author

Jay Sekora

`js@calumet.org`

`http://shore.net/~js/`

### Copyright

The library is copyright © 1992-1995 by Jay Sekora, but may be freely redistributed under the conditions at the top of the file.

## Overview

### Procedure

`j:debug` - record debugging information

## j:debug

### Usage

`j:debug` [string]

### Argument

string is information to display; it defaults to `{j:debug called}`.

### Description

As described in the Usage section above, this procedure does nothing unless the environment variable `JSTOOLS_DEBUGGING` is defined when it is autoloaded. (Essentially, this means that you should set `JSTOOLS_DEBUGGING` before starting an application that you want to debug.) This description assumes that is the case.

The first time it is called, `j:debug` creates a new toplevel window with a text widget, to display the debugging log, and a scrollbar.

Each time it is called, `j:debug` inserts string along with some additional information at the end of the debugging log. The exact format of the information appended to the log is subject to change, but currently it includes the string specified (or `{j:debug called}`), the name of the current procedure, and the names of up to two calling procedures higher on the procedure stack.

Typically, string might include the values of local variables you want to monitor. (You could even arrange to automatically call `j:debug` whenever the value of a variable changes with ``trace variable`'.)

``