Useful .dbxrc entries
My ~/.dbxrc
#############################
set -o emacs # emacs-style editing; makes cursor keys usable in dbx
##### Aliases
alias n='next' # next line, step over calls
alias ni='nexti' # next instruction, step over calls
alias s='step' # next line, step into calls
alias si='stepi' # next instruction, step into calls
alias w='where -l -h' # stack trace, show hidden frames and loadobject
alias p='print'
alias pp='print +p' # rarely required "don't prettyprint" option
alias ph='print -f llx '# print number in hex; useful for registers
alias lw='list -w' # list current line and several lines before/after
alias c='cont' # continue execution
alias t='threads' # show threads
alias l='list'
alias lo='loadobject' # rarely used command, but with a very long name
alias b='stop in' # stop in function; for example, `b main'
alias f='frame -h' # switch to certain stack frame even if it's hidden
alias q='exit' # exit dbx
alias start='stop in main -temp; run'
# convenient alias for gdb start command
##### dbxenv's
dbxenv follow_fork_mode child
# child is I guess most useful in everyday life,
# but your experience may differ
dbxenv trace_speed 0.01
# otherwise it takes ages to trace through a PLT entry;
# useful with logging on (see function log() below)
##### functions
# Useful shortcut for saving your session to a file; acts like a trigger:
# log logfile - start logging everything (both your input and dbx output,
# but not debuggee output)
# log - stop logging
log() {
dbxenv session_log_file_name $1
if [ "$1" != "" ]; then
echo "Logging to: $1"
else
echo "Logging off"
fi
}
# Somewhat useful undo function for "why did I just hit step again?"
# situations. It removes topmost stack frame and re-enters the function
# once again. Needless to say that global state remains the same; there's
# no undo for global state in dbx.
undo()
{
pop
step
}
##### environment variables
PS1='(dbx:$vfunc) ' # this prompt shows function you are currently in;
# for example: (dbx:main)
Notes
- On where command:
I have -l (dash-el) option always on because I work with a lot of unfamiliar code
and sometimes it's not obvious from source tree organization in which
loadobject particular function winds up; where -l leaves no questions
like this.
Also, I usually need to see raw stack trace with no frames hidden (-h option); this is probably not for every day use as I work on dbx itself where this feature is most useful.
You additions are welcomed. Please post comments and I'll add your entries to a new section in this post for easier use.
References
- Using the dbx Initialization File - from Debugging a Program With dbx manual
- help .dbxrc in dbx