Next Planet of Monkeys

    gdbmi-parser

    1.0.0 • Public • Published

    gdbmi-parser

    This is a parser for the output from GDB running with the MI text interface. More information about GBI/MI is available here: https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html

    The command line

    The command line tool can take a filename as an argument, or read the content from stdin. It can operate in two modes, output, and lines (default). In output mode, it expects to see an entire GDB/MI transaction, starting with 0 or more bits of debugging output, followed by a result, followed by being dropped back at a (gdb) prompt with a trailing newline. The JSON-ified version will be written to stdout.

    In lines mode, the CLI will read the input file, split it by lines (\n only), then parse each line. A JSON-ified array of each line's content will be written to stdout, with null in place of empty lines.

    API

    The main file, src/gdbmi.js exports two main objects, lineParser and outputParser - these are the PEG.js generated parsers for the entire output of a GDB/MI command, or just a single line - refer above for more information.

    Call the parse method on the parse to do the actual parsing, or use the shortcuts, parseLine and parseOutput.

    The parser

    The parser is generated by PEG.js from the grammar file at src/gdbmi.pegjs. If you want to rebuild the parsers, you need to install dev dependencies, and run:

    ./node_modules/.bin/pegjs --allowed-start-rules output src/gdbmi.pegjs src/gdbmi-output.js
    ./node_modules/.bin/pegjs --allowed-start-rules single_line src/gdbmi.pegjs src/gdbmi-line.js
    

    Install

    npm i gdbmi-parser

    DownloadsWeekly Downloads

    2

    Version

    1.0.0

    License

    ISC

    Last publish

    Collaborators

    • trix