HomeScreenshotsAbout usDownloadMailing listsBugsFAQNewsLinks


  1. General
    1. What is Insight?
  2. Building and Installing
    1. How do I build and Install Insight?
    2. How do I build and Install Insight for an embedded target?
    3. How do I know what targets are supported by Insight?
    4. Im having problems building Insight, what do I do?
  3. Using Insight
    1. How do I use Insight?
    2. What Environment Variables effect the operation of Insight?
  4. Hacking Insight
    1. I want to do some Insight Development, what can you tell me to get me started?
    2. Is there a list of TODO items?
  5. Other
    1. I still have a Question about insight?

1. General

1.1 What is Insight?

Insight is a version of GDB that uses Tcl/Tk to implement a graphical user inter-face. It is a fully integrated GUI, not a separate front-end program. The interface consists of several separate windows, which use standard elements like buttons, scrollbars, entry boxes and such to create a fairly easy to use interface. Each window has a distinct content and purpose, and can be enabled or disabled individually. The windows contain things like the current source file, a disassembly of the current function, text commands (for things that aren't accessible via a button), and so forth.

2. Building and Installing

2.1 How do I build and Install Insight?

Building Insight is very straightforward. It is configured/built by default when you checkout or download Insight. Right now, Insight MUST be built using the versions of Tcl, Tk, and Itcl that come with the sources. We're working to fix that, but it is going to take a lot of time. (Want to help?)

On Unix machines, you will also need to have X11 (R4/R5/R6) installed (this is a prerequisite to installing Tk).

Insight inherits much of GDB's configuration options (like where it is to be installed). See the GDB README file for more details on configure options and such for GDB.

It is recommended that Insight, like GDB, be built outside of the source directory in order to preserve the integrity of the source directory. This is very useful, for example, when building GDB/Insight for multiple hosts or targets.

For example:

	host> ls
	host> mkdir insight; cd insight
	host> ../src/configure
	host> make
	host> make install

2.2 How do I build and Install Insight for an embedded target?

Building insight for an embedded target is the same as building GDB for an embedded target. You must pass options to configure to set up the build environment for the embedded taget in question.

Usually the only options you need to specify are --target and --prefix
--target specifies the embedded target to configure the build for. For example "powerpc-eabi".
--prefix specifies where you wish the built version of insight to install to. Usually you do not want it to go to the default place, otherwise it will overwrite your native version of insight.

The following is an example for building for embedded powerpc:

	host> ls
	host> mkdir insight-ppc; cd insight-pcc
	host> ../src/configure --target=powerpc-eabi --prefix=/opt/insight-ppc
	host> make
	host> make install

2.3 How do I know what targets are supported by Insight?

There is no definitive list of targets supported by each version of GDB/Insight. The best place to look to find out if your target is supported is in the configure script and the source tree of the particular version of insight you are using.

2.4 Im having problems building Insight, what do I do?

During building, you may run into problems with finding Tcl, Tk or X11. Look in gdb/Makefile, and fix TCL_CFLAGS, TCL, TK_CFLAGS, TK, and ENABLE_CLIBS as appropriate.

If you one of the following messages when you run gdb:

Tcl_Init failed: can't find init.tcl; perhaps you need to install Tcl or set your TCL_LIBRARY environment variable?

Tk_Init failed: can't find tk.tcl; perhaps you need to install Tk or set your TK_LIBRARY environment variable?

then you haven't installed Tcl or TK properly. Fix the appropriate environment variable to point at the {tcl tk}/library directory, and restart gdb.

3. Using Insight

3.1 How do I use Insight?

You can start Insight by running the `insight' executable (for cross-platform targets, include the build triple, i.e., `powerpc-elf-insight'). Alternatively start Insight by telling GDB to start it with `gdb -w' or `gdb -i=insight'. If everything goes well, you should have several windows pop up. To get going, hit the Run button, and go exploring.

If you want to use GDB in command line mode, just use the -nw option or the console interpreter (`insight -i=console').

Insight comes with all your standard debugger windows, including:

Insight also has an extensive (if outdated) online help system which describes all the windows and explains how to use them. Users are urged to browse this help system for information on using Insight.

3.2 What Environment Variables effect the operation of Insight?

Insight and all of its support infrastructure read various environment variables for optional startup information. All of these environment variables are optional: Insight and its packages know how to find their files in both the install and the source trees.

Name Description
TCL_LIBRARY The location of the Tcl library files
TK_LIBRARY The location of the Tk library files
TIX_LIBRARY The location of the Tix library files
REDHAT_GUI_LIBRARYThe location of the libgui library files
GDBTK_LIBRARY The location of the Insight library files
INSIGHT_PLUGINS A colon-separated list of directories to search for plugins (see gdb/gdbtk/plugins/HOW-TO)
GDBTK_DEBUG Controls runtime loading of the Debug Window. (This is the most useful debug option.)
GDBTK_TRACE Controls runtime tracing of the tcl code
GDBTK_DEBUGFILE Filename to send debug output
GDBTK_TEST_RUNNINGTestsuite variable. See gdb/testsuite/gdb.gdbtk/README for more information.
DISPLAY The display to use on unix/X platforms. Not used on Windows platforms.

All of the environment variables for controlling Insight are well documented in gdb/gdbtk/library/main.tcl. Search for "env" to find them all.

4. Hacking Insight

4.1 I want to do some Insight Development, what can you tell me to get me started?

The GUI is primarily implemented by Tcl/Tk code which lives in gdb/gdbtk/library and bunch of C files in gdb/gdbtk/generic. The Tcl/Tk code determines the look and feel, the layout, and the functions associated with all of the interface elements. The C code is mostly just glue between GDB internals and Tcl-land. In essence, all of the policy is implemented in Tcl/Tk, and is easily changed without recompiling.

To make more serious changes to the interface, such as adding a new window or changing the framework, you will have to hack the tcl code (and probably the C code as well). The tcl library install directory is $(libdir) (probably /usr/local/lib/insight1.0). But, you will probably want to hack on your own private copy before putting it up for the rest of the users. To find the GDB tcl code, GDB first checks for the environment variable GDBTK_LIBRARY. GDB will check this directory for the file "main.tcl". If GDBTK_LIBRARY is not set, GDB will look for main.tcl in the install directory, and finally it will try to find the tcl directory in the sources.

A word about the different files in Insight is in order. Insight is a hybrid of C code and "Tcl" code (actuall Incr Tcl code). We use the following conventions for naming our tcl files (most of the time!). Any file with a ".tcl" extension is simply vanilla tcl code. Any file ending with ".itcl" is an Itcl file, class definition and implementation all in one. So far so good. Now comes the toughy: Files ending in ".ith" are Itcl class definition files, and they all must have a corresponding implementation file, ending in ".itb". Why do we do this? Simple. With Itcl, one can reread class implementations at runtime, but one cannot change the class definition. So all those ".itcl" files can only be reread be restarting Insight. The same is not true, though, of the ".itb" files. Those files can be changed and immediately reread and used in Insight without having to restart (as long as the class definition doesn't change). This is a nifty Itcl feature which is fully exploited by the Debug Window, which has a "ReSource" menu on it to reread the Tcl files. (To get to the Debug Window, hit Ctrl-Alt-F11 in the Source Window or type "tk ManagedWin::open DebugWin" in the Console Window.)

Internally, Insight is basically GDB, linked with Tcl/Tk, some Tcl/Tk extensions, and some glue code that interfaces GDB internals to Tcl-land. This means that Insight operates as a single program, not a front-end to GDB. All GDB commands, and a great deal of the target program state are accessible to the Tcl programmer. In addition, there are many callbacks from GDB to notify Tcl-land of important events. Many of these are accomplished via "hooks" in GDB, and others are accomplished using event notifications. GDB is slowly deprecating the use of "hooks" in favor of its new event mechanism.

All of the below commands have lots of nice comments before them explaining what they all do, how they are to be used, etc. The source code is the definitive authority (other than a maintainer) for the definition/usage of a command in Insight. Hackers are urged to read through the source code for any commands which may need explaining.

New Tcl Commands:

Here is a brief, if incomplete (and possibly out of date), summary of the Tcl commands that are created by Insight. These are installed into the Tcl interpreter in the C files.

Name Description
gdb_cmd Sends a text command to gdb. Returns the result.
DEPRECATED: Do not use any more.
gdb_loc Returns a list of useful tidbits about the specified GDB linespec
gdb_sourcelines Returns a list of executable lines for a source file
gdb_listfiles Returns a list of all of the source files
gdb_stop Stops the target process (or at least tries to)
gdb_reginfo Returns information about registers (names, numbers, values, size, etc.)
gdb_disassemble Returns the text of a disassembly of the entire function. No longer used.
gdb_load_disassembly Loads the disassembly of a location into a source window's textbox
gdb_eval Returns the value of a given expression
gdb_get_breakpoint_listReturns a list of all breakpoints
gdb_get_breakpoint_infoReturns a list of info about a breakpoint

Tcl procedures that are hooked into GDB:

This is a list, albeit incomplete (and possibly out of date), of the "hook" functions that are installed into GDB. The actual "hooks" are installed/initialized in gdb/gdbtk/generic/gdbtk-hooks.c (and maybe one or two in gdbtk.c). The list below is the Tcl side of the hook.

Name Description
gdb_tcl_fputs Sends output into Tcl for the command window
gdb_tcl_query Pops up a query window
gdbtk_tcl_breakpointNotifies Tcl of changes to a breakpoint
gdbtk_tcl_idle Notifies Tcl that debugged process is now idle
gdbtk_tcl_busy Notifies Tcl that debugged process is now running


Starting with GDB 5.0, GDB has had an event loop. Although largely unused right now, with it came some useful "baggage", especially event notifications, even though they, too, were largely incomplete. The list of events continues to grow, and Insight and GDB often "share" overlapping events, but the list below is complete (since there are only a few defined events). The source for these events can be found in gdb/gdbtk/library/[hb].

Name Description
BreakpointEventA breakpoint has been created/modified/deleted
TracepointEventA tracepoint has been created/modified/deleted
SetVariableEventUser has issued a "set" command in Console
BusyEventThe debugger is "busy"
IdleEventThe debugger is "idle"
UpdateEventThe state of the target has changed (or the GDB's view of the target has changed)
ArchChangedEventThe architecture of the system has changed (this can happen when GDB defaults to using some basic CPU and detects that a more elaborate CPU is actually being used, e.g., SH5)

GDB Commands:

Insight installs a few GDB commands, which are available with the Console Window.
Name Description
tk Executes the arguments in the Insight Tcl interpreter
viewDisplays the given linespec in the Source Window

4.2 Is there a list of TODO items?


  1. Rewrite any code with non FSF Copyright in Insight and assign to FSF.
  2. Get Insight integrated and accepted into the GDB mainline.
  3. Disassembly of code without symbolic information, allowing breakpoints to be set, etc.
  4. Setting Hardware Memory Watchpoints from memory window and/or variable watch window.
  5. Architecture sensitive visual editors/viewers for registers.
  6. Ability to view memory as a graphical bitmap (in a number of formats).
  7. Update/Expand Documentation.
  8. Update this FAQ

5. Other

5.1 I still have a Question about insight?

This Page is always under construction.

Have questions about the Insight GUI for the GDB debugger? Try reading the README or sending mail to

Want to help with this FAQ or Web Site? Send email to the mailing list.

If you need help about Red Hat (Enterprise) Linux, please refer to