Use the vertical bar (|) operator to pipeline dcmds. The purpose of a
pipeline is to pass values from one dcmd or walker to another. The
values passed usually are virtual addresses. Pipeline stages might be used to map
a pointer from one type of data structure to a pointer to
a corresponding data structure, to sort a list of addresses, or to select
the addresses of structures with certain properties.
MDB executes each dcmd in the pipeline in order from left to
right. The left-most dcmd is executed using the current value of dot, or
using the value specified by an explicit expression at the start of the
command. A pipe operator (|) causes MDB to create a shared buffer between the
output of the dcmd to its left and the MDB parser, and
an empty list of values.
As the dcmd executes, its standard output is placed in the pipe
and then consumed and evaluated by the parser, as if MDB were reading
this data from standard input. Each line must consist of an arithmetic expression
terminated by a NEWLINE or semicolon (;). The value of the expression is appended
to the list of values associated with the pipe. If a syntax error
is detected, the pipeline is aborted.
When the dcmd to the left of a | operator completes, the list
of values associated with the pipe is then used to invoke the
dcmd to the right of the | operator. For each value in the
list, dot is set to this value, and the right-hand dcmd is executed.
Only the output of the right-most dcmd in the pipeline is written to
standard output. If any dcmd in the pipeline produces output to standard error,
these messages are written directly to standard error and are not processed as
part of the pipeline.