Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Daffodil Command Line Interface (CLI) comes with a built-in interactive debugger that pauses parsing and allows for user inspection of the parsing state. To start Daffodil in debugger mode, provide the global --debug/-d option, for example:

Code Block
languagebash
./daffodil --debug parse --schema schema.dfdl.xsd input.dat

Enabling the debugger displays a (debug) prompt, at which point various commands can be entered to control parsing and inspect Daffodil state. Below is the list of commands and their descriptions.

Commands

...

break

...

<element_id>

...

Create a breakpoint, causing the debugger to stop when the element
with the <element_id> name is created.

...

break element.foo

...

clear

...

clear

...

condition

...

<breakpoint_id> <dfdl_expression>

...

Set a condition on a specified breakpoint. When a breakpoint
is encountered, the debugger only pauses if the DFDL expression
evaluates to true. If the result of the DFDL expressions is not
a boolean value, it is treated as false.

...

condition 1 dfdl:occursIndex() = 3

...

continue

...

Continue parsing the input data until a breakpoint is encountered. At
which point, pause parsing and display a debugger console to the user.

...

continue

...

delete

...

<type> <id>

...

Remove a breakpoint or display. Valid values for <type> are "breakpoint"
and "display".

...

delete breakpoint 1
delete display 1

...

disable

...

<type> <id>

...

Disable a breakpoint or display. Valid values for <type> are "breakpoint"
and "display".

...

disable breakpoint 1
disable display 1

...

display

...

<debugger command>

...

Execute a debugger command every time a debugger console is displayed
to the user.

...

display info infoset

...

enable

...

<type> <id>

...

Enable a breakpoint or display. Valid values for <type> are "breakpoint"
and "display".

...

enable breakpoint 1
enable display 1

...

eval

...

[type] <dfdl_expression>

...

Evaluate a DFDL expression. The [type] argument determines how to
display the result of the dfdl_expression. The value of [type] may
be "string", "number", "boolean", or "node". If [type] is not given,
then "node" is assumed."

...

eval number dfdl:occursIndex()

...

help

...

[<command>]

...

Display help. If a command is given, display help information specific
to that command and its subcommands.

...

help
help info

...

info

...

<item>...

...

Print various pieces of internal information to the console. The valid items are:

itemdescription
arrayIndexcurrent index of the element in an array
bitLimitcurrent bit limit
bitPositioncurrent bit position in the data
breakpointslist of breakpoints
childIndexcurrent child index
datainput data
discriminatorwhether or not a discriminator is set
displayslist of displays
infosetcurrent infoset
occursCountoccurs count
pathpath in the schema, using schema component designator

...

info data infoset

...

quit

...

quit

...

set

...

<setting> <value>

...

Change a debugger setting. The settings are:

SettingTypeDescription
dataLengthintegernumber of bytes to display when displaying input data. If negative, display all input data.
infosetLinesintegernumber of lines of the infoset to display. This displays the last X number of lines. If negative, display the entire infoset
removeHiddenbooleanwhether or not to remove hidden elements (via dfdl:hiddenGroupRef) when displaying the infoset
wrapLengthintegernumber of character at which to wrap data or infoset when printed to the console

...

set dataLength -1
set wrapLength 50
set removeHidden true

...

step

...

step

...

undisplay

...

<display_id>

...

this page has moved to https://daffodil.apache.org/debugger/