User`s guide
28
Chapter 4: Controlling dbx
member. Because the command is too long to fit onto one line, this example
uses the backslash character (\) to continue the command on a second line:
(dbx) alias foll "print *(struct list *)$p ; \
set $p = (long)((struct list *)($p))->next"
Casting $p to an integer type when following the link (the second
assignment in the alias) is essential. If omitted, dbx may leave the $p
reference symbolic and if so, goes into an infinite loop. (Type Ctrl-c to
interrupt dbx if it gets into the infinite loop.)
Before using this alias, you must set $p to point at the first list member. In this
example, assume that the program variable top points to the first list
member. Then you can use the “foll” alias to follow the linked list, printing
the contents of each member as you proceed:
(dbx) set $p = top
(dbx) foll
struct list {
next = 0x7fffc71c
value = 57
}
(dbx) foll
struct list {
next = 0x7fffc724
value = 3
}
(dbx) foll
struct list {
next = 0x7fffc72c
value = 12
}
Recording and Playing Back
dbx
Input and Output
dbx allows you to play back your input and record dbx’s output. dbx saves the
information that you capture in files, which allows you to create command
scripts that you can use in subsequent dbx sessions.