DDD Frequently Asked Questions                                  -*- text -*-
******************************

1.  How can I speed up DDD?

    The fastest DDD configuration is obtained as follows:

    * Enable source code and machine code caching.
    * Disable glyphs.
    * Disable machine code.
    * Disable alias detection.
    * Disable all status displays.
    * Delete all displays you do not need.
    * Do not use remote debugging.
    * Use DDD 1.4b or later, compiled with the `-O3' option.


2.  How can I display a multi-length array?

    The problem is that GDB does not know the actual length of the
    array; you have to supply it by hand (i.e. using the keyboard).
    You can use the DDD ``display successive array elements`` or the
    GDB ``artificial array'' mechanism.  If you have a pointer, say:
    
        int *pi;
    
    pointing to an array of 10 ints, you can see the integers by
    entering
    
        graph display pi[0..9]
    
    at the `(gdb)' prompt (or entering `pi[0..9]` in the `Dependent
    Display' dialog).
    
    As an alternative, you can use the GDB ``artificial array'' mechanism
    by entering
    
        graph display pi[0]@10
    
    This will create an array starting with pi showing the first 10
    elements.


3.  In C++, how do I see the *actual* type (derived) type of the
    object rather than the *declared* type?

    Enter `set print object on' at the `(gdb)' prompt, or enter
    `set print object on' in your `~/.gdbinit' file.


4.  Does DDD sit on top of GDB, or is it integrated with gdb source?

    DDD sits on top of a separate GDB process.  Use `ddd --trace' to
    see the interaction.


5.  If it sits on top, how can GDB upgrades be incorporated?

    By getting and installing the new GDB.  No changes to DDD are
    necessary, unless the GDB developers introduce incompatible
    changes - in which case you'll have to wait until we patch DDD.


6.  Which other debuggers are supported by DDD?

    DDD 2.0 has been tested with the following debuggers:

    * GDB from the Free Software Foundation
    * DBX as found on SunOS 4.x (aka Solaris 1.x)
    * DBX as found on SunOS 5.x (aka Solaris 2.x)
    * DBX as found on DEC systems.
    * DBX as found on AIX systems.
    * XDB as found on HP-UX systems.

    DDD functionality largely depends on the capabilities of the
    underlying debugger; best results are obtained with GDB.

    To cope with the large variety of DBX flavours, DDD determines the
    DBX capabilities dynamically at run-rime; DDD should thus adapt
    automatically to other DBX variants.  Please let us know your
    experiences; use `ddd --trace' to see the DDD/DBX interaction.


7.  I don't like the 'break point' symbol.  Can I change it?

    Yes.  See the various `*.xbm' files in the DDD source code.


8.  I compiled DDD on my machine and it fails.  I got the executable
    from an FTP site and it runs.  What is the difference? Is there
    some compilation setup I need to do, or is the executable patched?

    It is a frequently observed effect that our executables work while
    the executables of DDD users fail.  This is simply due to the fact
    that we test them throroughly.  The usual test a new DDD
    distribution has to pass is to configure, compile, and run
    out-of-the-box on half a dozen machines and configurations.
    
    We do not really know why our executables work while others fail,
    although the source code is identical.  A simple explanation may
    be that the compilation environment (C compiler, C++ compiler,
    libraries...) have slight differences (aka bugs) from site to
    site.  We have set up DDD such that it works on our site - for
    instance, some DDD parts work around compiler bugs detected on a
    specific machine.  Users compiling DDD on their local machine will
    encounter other problems, but will not know how to fix them.  That
    is, while the DDD code stays the same, the executables may vary a
    lot.


9.  I have heard that there is a magic command built into DDD.
    Is this true, and what is this magic command for?

    It's an adventurer's secret.  Use the source, Luke.


10. Is there an Athena Widgets port of DDD?

    No.  If you want DDD running with a free widget set, you should
    support the Hungry Programmer's Team - they develop LessTif, a
    free Motif-compliant widget set.  Check out their WWW page at

        http://www.lesstif.org/

    [Note: We HAVE considered to build DDD on a free widget set.  But
    Athena is definitively not powerful enough, and alternative
    approaches like Tcl/Tk did not provide the necessary asynchronous
    interprocess communication facilities required to build an
    efficient interface.  So go and support the LessTif team instead.]


11. Will DDD work with LessTif?

    As of LessTif 0.75a, the resulting DDD executable is already quite
    usable; there are several DDD users who use a DDD built with
    LessTif.  See the file `PROBLEMS' for a recent list of problems
    and fixes.


12. DDD reports `imake', `Imakefile', and/or `xmkmf' problems when
    being started.  How come?

    To run properly, OSF/Motif requires a file called `XKeysymDB' in
    the X project root.  Since we distribute DDD binaries, the X
    project root compiled into the X libraries (and thus hard-coded in
    the DDD binary) may not be valid on the actual machine.

    Upon start-up, DDD checks for `XKeysymDB' in its built-in X
    project root.  If `XKeysymDB' is not found, Motif won't be able to
    find it as well.  DDD fixes this situation by calling `xmkmf' to
    determine the X project root and setting up its environment
    accordingly before creating the first Motif widget.

    Usually, determining the X project root is not required if DDD
    runs on the machine it was compiled on.  If this happens anyway,
    run `ddd --check-configuration' to find out why DDD finds it
    necessary to determine the X project root and to identify possible
    flaws in your X configuration.  The code for all this can be found
    in `xconfig.C'.

    As of DDD 2.0, `xmkmf' is called only if it resides in your path.


13. How can I change DDD resources (especially colors)?

    For DDD 2.0 and later, see the section `RESOURCES/Colors' in the
    DDD manual.

    The general idea is to copy the appropriate resource lines from
    the `Ddd' file contained in the DDD distribution (type
    `./configure -v; cd ddd; make Ddd' to create it from scratch) in
    your `~/.dddinit' file.  For instance, to make the background less
    bright as in DDD 1.2 and before, insert the following lines in
    `~/.dddinit':

        Ddd*XmText.background:          light grey
        Ddd*XmTextField.background:     light grey
        Ddd*GraphEdit.background:       light grey
        Ddd*XmList.background:          light grey

    To set up the size and the placement of the DDD main windows, use:

        Ddd*command_shell.geometry:     +0+0
        Ddd*source_view_shell.geometry: +0+220
        Ddd*data_disp_shell.geometry:   +0+670

    (or similar values - see the X(1) manual page for details on
     geometry specifications)


14. I want to use DDD interprocess communication in my own
    application.  How do I proceed?

    There is a demonstration program named `ttytest' in the DDD
    package.  Just type `make ttytest'.  It should be relatively
    easy to customize this application.

    Here are some pointers: If you want to talk with a separate
    process, use the `TTYAgent' class, as defined in `TTYAgent.C'.
    Using the `write' method, you can send arbitrary data to the
    process; you can define an `Input' handler that will be called
    each time the process sends data to you.  The header files of
    `TTYAgent' and its superclasses should contain sufficient
    information.  As all communication is handled asynchronously, you
    can realize a usual Xt-based interface using Athena widgets, Motif
    widgets, or another Xt-based toolkit.


15. I want to use the DDD graph editor in my own application.
    How do I proceed?

    There is a demonstration program named `test-graph' in the DDD
    package.  Just type `make test-graph'.  It should be relatively
    easy to customize this application.

    Here are some pointers: The `GraphEdit' widget, as defined in
    `GraphEdit.h' contains the DDD graph editor.  Variants with Athena
    panners and Motif scrollbars are found in `PannedGE.h' and
    `ScrolledGE.h', respectively.  The `GraphEdit' widget works on a
    `Graph' structure, which is defined in `Graph.h'; a graph is
    composed of nodes and edges, both forming class hierarchies whose
    top classes are defined in `GraphNode.h' and `GraphEdge.h',
    respectively.  The graph nodes in DDD are Box graph nodes, defined
    in `BoxGraphN.h'; a box is a (possibly structured) rectangular
    entity holding strings, lines, or figures.  See also the DDD paper
    `doc/ddd-paper.ps' for details on boxes and how they are composed.


16. How do I set fonts in DDD?  How do I change the font size?

    For DDD 2.0 and later, see the section `RESOURCES' in the manual.

    For DDD 1.x, the general scheme is to see the `fontList' resources
    in the `Ddd' file and copy/modify the appropriate lines to your
    `~/.dddinit' file.  (Note: This won't work for the data display.
    See question #18, below.)

    These are the settings from DDD 1.4b:

    Ddd*fontList: \
    -*-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*=charset,\
    -*-lucida sans typewriter-medium-r-*-*-12-*-*-*-*-*-*-*=tt,\
    -*-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*=key,\
    -*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*=rm,\
    -*-helvetica-medium-o-*-*-12-*-*-*-*-*-*-*=sl,\
    -*-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*=bf,\
    -*-helvetica-bold-o-*-*-12-*-*-*-*-*-*-*=bs,\
    -*-helvetica-bold-r-*-*-18-*-*-*-*-*-*-*=Logo,\
    -*-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*=logo,\
    -*-symbol-*-*-*-*-12-*-*-*-*-*-*-*=symbol

    Ddd*XmTextField.FontList: \
    -*-lucidatypewriter-medium-r-*-*-12-*-*-*-*-*-*-*=charset
    Ddd*XmText.FontList:      \
    -*-lucidatypewriter-medium-r-*-*-12-*-*-*-*-*-*-*=charset


    Vinnie Shelton <shelton@icd.teradyne.com> suggests the following
    resolution-independent settings:

    Ddd*fontList: \
    -*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-*=charset,\
    -*-lucida sans typewriter-medium-r-*-*-*-120-*-*-*-*-iso8859-*=tt,\
    -*-helvetica-bold-r-*-*-*-120-*-*-*-*-*-*=key,\
    -*-helvetica-medium-r-*-*-*-120-*-*-*-*-*-*=rm,\
    -*-helvetica-medium-o-*-*-*-120-*-*-*-*-*-*=sl,\
    -*-helvetica-bold-r-*-*-*-120-*-*-*-*-*-*=bf,\
    -*-helvetica-bold-o-*-*-*-120-*-*-*-*-*-*=bs,\
    -*-helvetica-bold-r-*-*-*-140-*-*-*-*-*-*=Logo,\
    -*-helvetica-bold-r-*-*-*-120-*-*-*-*-*-*=logo,\
    -*-symbol-*-*-*-*-*-120-*-*-*-*-*-*=symbol

    Ddd*XmTextField.FontList: \
    -*-lucidatypewriter-medium-r-*-*-*-120-*-*-*-*-*-*=charset
    Ddd*XmText.FontList:      \
    -*-lucidatypewriter-medium-r-*-*-*-120-*-*-*-*-*-*=charset


17. How do I set up my own VSL library?

    1. Set up a `vsl' directory that holds the VSL libraries
       (e.g. `/home/tom/lib/vsl/').

    2. From the DDD source distribution, copy the files `vsllib/*.vsl' and
       `ddd/ddd.vsl' to the `vsl' directory.

    3. Add the following lines to your `~/.dddinit' file:

           Ddd*vslLibrary: 	(full path of `ddd.vsl')
           Ddd*vslPath:	 	(name of your VSL directory goes here)

       For example, if you have installed the VSL files in
       `/home/tom/lib/vsl/', write:

           Ddd*vslLibrary: 	/home/tom/lib/vsl/ddd.vsl
           Ddd*vslPath:	 	/home/tom/lib/vsl

    4. Due to a bug in DDD 1.4d and earlier, the `vslPath' resource is
       ignored.  In these DDD releases, you must set the environment
       variable VSL_INCLUDE to the name of your VSL directory before
       invoking DDD.  For example:

           (sh)  $ VSL_INCLUDE=/home/tom/lib/vsl; export VSL_INCLUDE
           (csh) % setenv VSL_INCLUDE /home/tom/lib/vsl

       (In DDD 2.0 and later, the `vslPath' resource overrides the
        VSL_INCLUDE environment variable).

    5. In DDD 1.4d and later, you can use the `--vsl-verbose' option
       to see which files are actually accessed:

           $ ddd --vsl-verbose
           /home/tom/lib/vsl/ddd.vsl: reading(/home/tom/lib/vsl/ddd.vsl
           (/home/tom/lib/vsl/std.vsl(/home/tom/lib/vsl/builtin.vsl))
           (/home/tom/lib/vsl/fonts.vsl)), done.

    6. Go and change `ddd.vsl' (or any other VSL file) as you wish.


18. How do I set up font sizes in the data display?

    For DDD 2.0 and later, see the section `RESOURCES/Data Display' in
    the manual.  The general idea is to add and edit the definition

	Ddd*vslDefs: \n\
	#pragma replace stdfontsize \n\
	stdfontsize() = 12;

    to your `~/.dddinit' file.

    In DDD 1.x, you can proceed as follows:
    a) WITH recompiling:
       In the file `fonts.vsl', change the line

          stdfontsize() = 12;

       to the appropriate font size (in pixels), remove the file
       `ddd.vsl.h' and re-make DDD.

    b) WITHOUT recompiling:
       Set up your own VSL library (see question #17, above).  Then,
       change the file `fonts.vsl' as described in a).


19. Can I add my own command buttons in DDD ?

    In DDD 2.0 and later, you can specify an individual button list
    to be inserted under the command window (`commandButtons') or
    under the source window (`sourceButtons').  See the DDD manual
    for details.

    All buttons in the button list send the named command to GDB.
    Commands ending with '...' insert their name, followed by a space.
    Commands ending with a control character insert the given control
    character.  As of DDD 2.0, commands ending with `()' insert the
    current contents of the argument field `()'.

    Here is an example to insert into ~/.dddinit:

	Ddd*sourceButtons: print *():display *()

    This creates two buttons labeled `print *()' and `display *()'.
    Entering `foo' in the `()' argument field and pressing `print *()'
    invokes the GDB command `print *foo'.

    For DDD 1.x, the `commandButtons' and `sourceButtons' resources
    are already defined as follows:

    Ddd*commandButtons: Yes:No:interrupt^C
    
    Ddd*sourceButtons: run:step:next:stepi:nexti:cont:finish:kill:\
    up:down:Back:Forward:Edit:interrupt^C

    You may wish to replace some of these buttons by buttons of your
    own.  The `Ddd' app-defaults file contains some examples.


20. How do I pass ^C to the debugged program ?

    Assuming you use GDB as inferior debugger, typing `signal 2' at
    the `(gdb)' prompt will resume program execution with a SIGINT
    signal.

    If it's the character rather than the signal you're interested in,
    run your program in the separate execution window (see the
    `Options' menu) and type ^C there.


21. How do I disable the command tool?

    David M. Karr <dkarr@nmo.gtegsc.com> suggests:

    In the section of your .dddinit file where you set your personal
    resources, add the following:

    Ddd*sourceButtons: \
    Edit:run:break^C:where:step:next:cont:up:down:Back:Forward
    Ddd*toolButtons:
 
    Setting the "toolButtons" resource to Null makes the window not
    appear.  I put some of the commands that were on the "toolButtons"
    list into my "sourceButtons" list.

$Id: FAQ,v 1.32 1997/03/06 15:22:39 zeller Exp $

