(ddd.info)Shared Structures


Next: Display Shortcuts Prev: Dereferencing Pointers Up: Examining Structures
Enter node , (file) or (file)node

7.3.4.3 Shared Structures
.........................

By default, DDD does not recognize shared data structures--that is, a
data object referenced by multiple other data objects.  For instance,
if two pointers `p1' and `p2' point at the same data object `d', the
data displays `d', `*p1', and `*p2' will be separate, although they
denote the same object.

   DDD provides a special mode which makes it detect these situations.
DDD recognizes if two or more data displays are stored at the same
physical address, and if this is so, merges all these "aliases" into
one single data display, the _original data display_.  This mode is
called _Alias Detection_; it is enabled via `Data => Detect Aliases'.

   When alias detection is enabled, DDD inquires the memory location
(the _address_) of each data display after each program step.  If two
displays have the same address, they are merged into one.  More
specifically, only the one which has least recently changed remains
(the _original data display_); all other aliases are _suppressed_, i.e.
completely hidden.  The edges leading to the aliases are replaced by
edges leading to the original data display.

   An edge created by alias detection is somewhat special: rather than
connecting two displays directly, it goes through an "edge hint",
describing an arc connecting the two displays and the edge hint.

   Each edge hint is a placeholder for a suppressed alias; selecting an
edge hint is equivalent to selecting the alias.  This way, you can
easily delete display aliases by simply selecting the edge hint and
clicking on `Undisp'.

   To access suppressed display aliases, you can also use the Display
Editor.  Suppressed displays are listed in the Display Editor as
_aliases_ of the original data display.  Via the Display Editor, you
can select, change, and delete suppressed displays.

   Suppressed displays become visible again as soon as

   * alias detection is disabled,

   * their address changes such that they are no more aliases, or

   * the original data display is deleted, such that the least recently
     changed alias becomes the new original data display.

   Please note the following _caveats_ with alias detection:

   * Alias detection requires that the current programming language
     provides a means to determine the address of an arbitrary data
     object.  Currently, only C, C++, and Java are supported.

   * Some inferior debuggers (for instance, SunOS DBX) produce incorrect
     output for address expressions.  Given a pointer P, you may verify
     the correct function of your inferior debugger by comparing the
     values of P and `&P' (unless P actually points to itself).  You
     can also examine the data display addresses, as shown in the
     Display Editor.

   * Alias detection slows down DDD slightly, which is why you can turn
     it off.  You may consider to enable it only at need--for instance,
     while examining some complex data structure--and disable it while
     examining control flow (i.e., stepping through your program).  DDD
     will automatically restore edges and data displays when switching
     modes.

   Alias detection is controlled by the following resources:

 -- Resource: deleteAliasDisplays (class DeleteAliasDisplays)
     If this is `on' (default), the `Undisplay ()' button also deletes
     all aliases of the selected displays.  If this is `off', only the
     selected displays are deleted; the aliases remain, and one of the
     aliases will be unsuppressed.

 -- Resource: detectAliases (class DetectAliases)
     If `on' (default), DDD attempts to recognize shared data
     structures.  If `off', shared data structures are not recognized.

 -- Resource: typedAliases (class TypedAliases)
     If `on' (default), DDD requires structural equivalence in order to
     recognize shared data structures.  If this is `off', two displays
     at the same address are considered aliases, regardless of their
     structure.


automatically generated by info2www version 1.2.2.9