HPlogo HP/DDE Debugger User's Guide: HP 9000 Series 700/800 Computers > Chapter 6 Customizing the Debugger

Using Startup Command Files

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

When you invoke the debugger, it executes three startup command files. Startup command files contain commands that define command aliases and commands that customize the debugging environment.

The startup files and their order of execution are:

  1. User interface manager startup file. Contains default definitions for macros and for debugging environment settings. You can override these defaults definitions using your personal startup file (see “Using a Personal Startup File to Customize the Debugger ”) . To find out the name and location of the user interface startup file for each user interface manager, see Appendix E “User Interface Managers ”.

    NOTE: If you specify -do on the dde command line, the debugger executes the -do option's command list after executing the user interface manager startup file.
  2. Personal startup file. Contains commands that tailor the debugging environment to your personal tastes and that define personal command aliases. “Using a Personal Startup File to Customize the Debugger ” describes personal startup files and how to create them.

  3. Target manager startup file. Contains macro definitions specific to the target machine. For example, it contains a definition of the macro regs, which displays the machine registers.

    The debugger executes the target manager startup file after invoking or attaching to a target program, but before activating the target program. The debugger re-executes the target manager startup file whenever you issue the debug command. See Appendix C “Target Managers ” for more information on the target managers.

Using a Personal Startup File to Customize the Debugger

A personal startup file contains debugger commands that you want executed each time you invoke the debugger. To create a personal startup file, create a file called .dderc in either your current working directory or in your $HOME directory. In .dderc, place any commands that you want to execute at debugger startup.

When you invoke the debugger, it searches for .dderc in the current working directory. If the debugger does not find .dderc in your current working directory, it then searches your $HOME directory.

A personal startup file typically contains commands that:

  • Set debugger properties (such as the maximum number of array elements that the debugger will print) to values that you use frequently (property array_dim_max)

  • Define command aliases, which let you more easily enter commands or a sequence of commands that you use frequently (alias)

In addition, you can define a special alias, called `after_debug. This alias can contain commands that you want the debugger to execute after it invokes the target program; for example, `after_debug might set a breakpoint or invoke a command file containing commands specific to the target program. To use `after_debug, define it with an alias command in your personal startup file. For example, the alias command

alias `after_debug breakpoint sum; go

causes the debugger to set a breakpoint at the first executable statement in the procedure sum and then to execute the go command.

A Sample Personal Startup File

The directory /opt/langtools/dde/contrib contains sample startup files that you can use as models for your own .dderc file. (On Solaris systems, the directory is /opt/softbench/dde/dde/contrib.) The file names and contents are:

dderc_abbrev

Shortcuts for HP/DDE commands

dderc_hints

Examples of specialized macros

dderc_xdb

Aliases that map HP/DDE commands to xdb equivalents

dbx_macros

Macros that simulate dbx syntax

dderc_threads

Modifications that are useful when debugging multi-threaded applications

The following example shows the types of commands that are typically found in an HP/DDE personal startup file.

    property array_dim_max 10      # Print a maximum of 10
# elements of an array.

property echo -graphic # In the debugger output area,
# echo commands entered
# using dialog boxes, pop-up
# menus, or specially
# defined keys.

alias so step -over # Use "so" on an empty
# line to step execution,
# stepping over called
# routines.

alias s step # Use "s" to step
# execution, stepping into
# called routines.

alias gr go -return # Use "gr" to return to
# the calling procedure.

alias `after_debug delete intercept signal SIGVTALRM
# When starting up the
# target program, delete
# the intercept for the
# SIGVTALRM signal.

alias ls sh ls # Use "ls" to list directory.

# The following dump command aliases vary the format
# (hexadecimal, decimal, or character) used to display
# memory. "addr" is a memory address or mnemonic (such
# as PC) that you must supply as an argument when you
# invoke one of the aliases.

alias Dh(addr) dump -from addr -bits 256 -hex
alias Dd(addr) dump -from addr -bits 256 -decimal
alias Da(addr) dump -from addr -bits 256 -character

# The following dump command aliases take two arguments:
# addr and n. Use n to specify the number of bits you
# want grouped as a unit in the resulting display of
# memory.

alias Dan(it,n) dump -from it -bits n -character
alias Dn(it,n) dump -from it -bits n -hex


# The following alias searches for procedure names
# containing the character string str, and prints the
# fully qualified name for each procedure name displayed.

alias find(str) list blocks >tmp; sh grep str tmp