Customizing dbx
This chapter describes the dbx
environment variables you can use to customize certain attributes of your debugging environment, and how to use the initialization file, .dbxrc
, to preserve your changes and adjustments from session to session.
This chapter is organized into the following sections:
Using the .dbxrc
File
The dbx
initialization file, .dbxrc
, stores dbx
commands that are executed each time you start dbx
. Typically, the file contains commands that customize your debugging environment, but you can place any dbx
commands in the file. If you customize dbx
from the command line while you are debugging, those settings apply only to the current debugging session.
Note A .dbxrc
file should not contain commands that execute your code. However, you can put such commands in a file, and then use the dbx source
command to execute the commands in that file.
During startup, dbx
searches for .dbxrc
first. The search order is:
- Current directory
./.dbxrc
- Home directory
$HOME/.dbxrc
If .dbxrc
is not found, dbx
prints a warning message and searches for .dbxinit
(dbx
mode). The search order is:
- Current directory
./.dbxinit
- Home directory
$HOME/.dbxinit
Creating a .dbxrc
File
To suppress the warning message and create a .dbxrc
file that contains common customizations and aliases, type in the command pane:
You can then customize the resulting file by using your text editor to uncomment the entries you want to have executed.
Initialization File Sample
Here is a sample .dbxrc
file:
dbxenv input_case_sensitive false
catch FPE
|
The first line changes the default setting for the case sensitivity control:
dbxenv
refers to the set of debugging environment attributes.
input_case_sensitive
refers to the matching control.
false
is the control setting.
The next line is a debugging command, catch
, which adds a system signal, FPE
to the default list of signals to which dbx
responds, stopping the program.
For more information, see "Typical Entries in a .dbxrc File," "Useful Aliases in a .dbxrc File,", and "Useful Functions in a .dbxrc File" in the Using dbx Commands section of the Sun WorkShop online help.
The dbx
Environment Variables and the Korn Shell
Each dbx
environment variable is also accessible as a ksh
variable. The name of the ksh
variable is derived from the dbx
environment varaible by prefixing it with DBX_
. For example dbxenv stack_verbose
and echo $DBX_stack_verbose
yield the same output.
Customizing dbx
in Sun WorkShop
If you use dbx
through the Dbx Commands window in Sun WorkShop Debugging as well as from the command line in a shell, you can customize dbx
most effectively by taking advantage of the customization features in Sun WorkShop Debugging.
Setting Debugging Options
If you use dbx
primarily in the Dbx Commands window in Sun WorkShop Debugging, you should set most dbx
environment variables using the Debugging Options dialog box. See the "Debugging Options Dialog Box" in the Using the Debugging Window section in the Sun WorkShop online help.
When you set debugging options using the Debugging Options dialog box, the dbxenv
commands for the corresponding environment variables are stored in the Sun WorkShop configuration file .workshoprc
. When you start to debug a program in the Sun WorkShop Debugging window, any settings in your .dbxrc
file that conflict with those in your .workshoprc
take precedence.
Maintaining a Unified Set of Options
If you use dbx
both from the command line in a shell and from within Sun WorkShop, you can create a unified set of options that customizes dbx
for both modes.
To create a unified set of options:
1. In the Sun WorkShop Debugging window, choose Debug Debugging Options.
2. Click Save as Defaults to make your current option settings your defaults.
3. Open your .dbxrc
file in an editor window.
4. Near the top, type the line source $HOME/.workshoprc
.
5. Move the relevant dbxenv
commands to a location after the source line, or delete them, or comment them out.
6. Save the file.
- Any changes made through the Debugging Options dialog box are now available to
dbx
both when using Sun WorkShop and when running in a shell.
Maintaining Two Sets of Options
To maintain different options settings for running dbx
within Sun WorkShop and from the command line in a shell, you can use the havegui
variable in your .dbxrc
file to conditionalize your dbxenv
commands. For example:
if $havegui
then
dbxenv follow_fork_mode ask
dbxenv stack_verbose on
else
dbxenv follow_fork_mode parent
dbxenv stack_verbose off
|
Storing Custom Buttons
Sun WorkShop Debugging includes the Button Editor for adding, removing, and editing buttons in the Custom Buttons window (and also the Debugging window and editor window tool bars). You no longer need to use the button
command to store buttons in your .dbxrc
file. You cannot add buttons to, or remove buttons from, your .dbxrc
file with the Button Editor.
You cannot permanently delete a button stored in your .dbxrc
file with the Button Editor. The button will reappear in your next debugging session. You can remove such a button by editing your .dbxrc
file.
Setting dbx
Environment Variables With the dbxenv
Command
You can use the dbxenv
command to set the dbx environment variables that customize your dbx sessions.
To display the value of a specific variable, type:
To show all variables and their values, type:
To set the value of a variable, type:
(dbx) dbxenv variable value
|
Note Each variable has a corresponding ksh environment variable such as DBX_trace_speed
. You can assign the variable directly or with the dbxenv
command; they are equivalent.
TABLE 2-1 shows all of the dbx
environment variables that you can set:
TABLE 2-1 dbx
Environment Variables
dbx Environment Variable |
What the Variable Does |
allow_critical_exclusion on|off |
Normally loadobject -x disallows the exclusion of certain shared libraries critical to dbx functionality. By setting this variable to on that restriction is defeated. While this variable is on only core files can be debugged. Default: off . |
aout_cache_size number |
Size of a.out loadobject cache; set this to number when debugging number programs serially from a single dbx . A number of zero still allows caching of shared objects. See locache_enable . Default: 1. |
array_bounds_check on|off |
If set to on , dbx checks the array bounds. Default: on . |
cfront_demangling on|off |
Governs demangling of Cfront (SC 2.0 and SC 2.0.1) names while loading a program. It is necessary to set this parameter to on or start dbx with the -F option if debugging programs compiled with Cfront or programs linked with Cfront compiled libraries. If set to off , dbx loads the program approximately 15% faster. Default: off . |
delay_xs on|off |
Governs whether debugging information for modules compiled with the -xs option is loaded at dbx startup or delayed. Default: on . |
disassembler_version autodetect|v8|v9|v9vis |
SPARC platform: Sets the version of dbx 's built-in disassembler for SPARC V8, V9, or V9 with the Visual Instruction set. Default is autodetect , which sets the mode dynamically depending on the type of the machine a.out is running on. x86 platforms: The valid choice is autodetect . |
fix_verbose on|off |
Governs the printing of compilation line during a fix . Default: off |
follow_fork_inherit on|off |
When following a child, inherits or does not inherit events. Default: off |
follow_fork_mode parent|child|both|ask |
Determines which process is followed after a fork; that is, when the current process executes a fork , vfork , or fork1 . If set to parent , the process follows the parent. If set to child , it follows the child. If set to both , it follows the child, but the parent process remains active. If set to ask , you are asked which process to follow whenever a fork is detected. Default: parent . |
follow_fork_mode_inner unset| parent|child|both |
Of relevance after a fork has been detected if follow_fork_mode was set to ask , and you chose stop . By setting this variable, you need not use cont -follow . |
input_case_sensitive autodetect| true|false |
If set to autodetect , dbx automatically selects case sensitivity based on the language of the file: false for FORTRAN 77 or Fortran 95 files, otherwise true . If true , case matters in variable and function names; otherwise, case is not significant. Default: autodetect. |
language_mode autodetect|main|c| ansic|c++|objc|fortran| fortran90|native_java |
Governs the language used for parsing and evaluating expressions. autodetect : sets to the language of the current file. Useful if debugging programs with mixed languages (default). main : sets language of the main routine in the program. Useful if debugging homogeneous programs. c , c++ , ansic , c++ , objc , fortran , fortran90 , native_java : sets to selected language. |
locache_enable on|off |
Enables or disables loadobject cache entirely. Default: on . |
mt_scalable on|off |
When enabled, dbx will be more conservative in its resource usage and will be able to debug processes with upwards of 300 LWPs. The down side is significant slowdown. Default: off . |
output_auto_flush on|off |
Automatically calls fflush() after each call . Default: on |
output_base 8|10|16|automatic |
Default base for printing integer constants. Default: automatic (pointers in hexadecimal characters, all else in decimal). |
output_dynamic_type on|off |
When set to on , -d is the default for printing, displaying, and inspecting. Default: off . |
output_inherited_members on|off |
When set to on , -r is the default for printing, displaying, and inspecting. Default: off . |
output_list_size num |
Governs the default number of lines to print in the list command. Default: 10. |
output_log_file_name filename |
Name of the command logfile. Default: /tmp/dbx.log. uniqueID |
output_max_string_length number |
Sets number of characters printed for char *s . Default: 512. |
output_pretty_print on|off |
Sets -p as the default for printing, displaying, and inspecting. Default: off . |
output_short_file_name on|off |
Displays short path names for files. Default: on . |
overload_function on|off |
For C++, if set to on , does automatic function overload resolution. Default: on . |
overload_operator on|off |
For C++, if set to on , does automatic operator overload resolution. Default: on . |
pop_auto_destruct on|off |
If set to on , automatically calls appropriate destructors for locals when pop ping a frame. Default: on . |
proc_exclusive_attach on|off |
If set to on , keeps dbx from attaching to a process if another tool is already attached. Warning: be aware that if more than one tool attaches to a process and tries to control it chaos ensues. Default: on . |
rtc_auto_continue on|off |
Logs errors to rtc_error_log_file_name and continue. Default: off . |
rtc_auto_suppress on|off |
If set to on , an RTC error at a given location is reported only once. Default: off . |
rtc_biu_at_exit on|off|verbose |
Used when memory use checking is on explicitly or via check -all . If the value is on , a non-verbose memory use (blocks in use) report is produced at program exit. If the value is verbose , a verbose memory use report is produced at program exit. The value off causes no output. Default: on . |
rtc_error_limit number |
Number of RTC errors to be reported. Default: 1000. |
rtc_error_log_file_name filename |
Name of file to which RTC errors are logged if rtc_auto_continue is set. Default: /tmp/dbx.errlog. uniqueID |
rtc_error_stack on|Off
|
If set to on , stack traces show frames corresponding to RTC internal mechanisms. Default: off . |
rtc_inherit on|Off
|
If set to on , enables runtime checking on child processes that are executed from the debugged program and causes LD_PRELOAD to be inherited. Default: off . |
rtc_mel_at_exit on|off|verbose |
Used when memory leak checking is on . If the value is on , a non-verbose memory leak report is produced at program exit. If the value is verbose , a verbose memory leak report is produced at program exit. The value off causes no output. Default: on . |
rtc_use_traps on|off
|
Used to enable a work around for the eight megabyte code limitation on runtime checking. If set to on , it causes dbx to use UltraSparc trap instructions when they are available. Default: off . |
run_autostart on|off |
If set to on with no active program, step , next , stepi , and nexti implicitly run the program and stop at the language-dependent main routine. If set to on , cont implies run when necessary. Default: off . |
run_io stdio|pt |
Governs whether the user program's input/output is redirected to dbx 's stdio or a specific pty. The pty is provided by run_pty . Default: stdio . |
run_pty ptyname |
Sets the name of the pty to use when run_io is set to pty . Ptys are used by graphical user interface wrappers. |
run_quick on|off |
If set to on , no symbolic information is loaded. The symbolic information can be loaded on demand using prog -readsysms . Until then, dbx behaves as if the program being debugged is stripped. Default: off . |
run_savetty on | off |
Multiplexes tty settings, process group, and keyboard settings (if -kbd was used on the command line) between dbx and the program being debugged. Useful when debugging editors and shells. Set to on if dbx gets SIGTTIN or SIGTTOU and pops back into the shell. Set to off to gain a slight speed advantage. The setting is irrelevant if dbx is attached to the program being debugged or is running under Sun WorkShop. Default: on . |
run_setpgrp on | off |
If set to on , when a program is run setpgrp(2) is called right after the fork. Default: off . |
scope_global_enums on |off |
If set to on , enumerators are put in global scope and not in file scope. Set before debugging information is processed (~/.dbxrc ). Default: off . |
scope_look_aside on | off |
If set to on , finds file static symbols, even when not in scope. Default: on. |
session_log_file_name filename |
Name of the file where dbx logs all commands and their output. Output is appended to the file. Default: "" (no session logging). |
stack_find_source on|off |
When set to on , dbx attempts to find and automatically pop up to a stack frame with source when the program being debugged comes to a stop in a function that is not compiled with -g . Default: on . |
stack_max_size number |
Sets the default size for the where command. Default: 100. |
stack_verbose on|off |
Governs the printing of arguments and line information in where . Default: on . |
step_events on|off |
When set to on , allows breakpoints while stepping and nexting. Default: off . |
step_granularity statement | line |
Controls granularity of source line stepping. When set to statement the following code: a(); b(); takes the two next commands to execute. When set to line a single next command executes the code. The granularity of line is particularly useful when dealing with multiline macros. Default: statement . |
suppress_startup_message number |
Sets the release level below which the startup message is not printed. Default: 3.01. |
symbol_info_compression on|off |
When set to on , reads debugging information for each include file only once. Default: on . |
trace_speed number |
Sets the speed of tracing execution. Value is the number of seconds to pause between steps. Default: 0.50. |