Stopping at `a_b` and invoking the command will stop at the applications of the following parsers:
Stopping at `a_b` and invoking the command will stop at the applications of the following parsers:
```
a, b, b_2, b_2
a, b, b_2, b_2
```
Invoking `hammer-parse-step 2` would result in the following list:
Invoking `hammer-parse-step 2` would result in the following list:
```
b, b_2
b, b_2
```
This is not equivalent to advancing the input stream by [number] bytes, rather, it is equivalent to running until the next [number] pushes on the parser stack. See also `hammer-parser-backtrace`.
This is not equivalent to advancing the input stream by `[number]` bytes, rather, it is equivalent to running until the next `[number]` pushes on the parser stack. See also `hammer-parser-backtrace`.
If the GDB parameter "hammer-extended-parse-step-info" is set to "on", it will also invoke hammer-parser-backtrace and hammer-parser-preview-input.
If the GDB parameter "hammer-extended-parse-step-info" is set to "on", it will also invoke hammer-parser-backtrace and hammer-parser-preview-input.
...
@@ -72,7 +76,7 @@ Alias of GDB `continue`. May change later.
...
@@ -72,7 +76,7 @@ Alias of GDB `continue`. May change later.
hammer-parser-backtrace [number]
hammer-parser-backtrace [number]
```
```
Print the "call stack" for parsers. A call to `perform_lowlevel_parse` corresponds to a push to the stack, while a return from it corresponds to popping the stack. `<number>` controls the number of items to print. If the parameter is not given, the entire stack is printed.
Print the "call stack" for parsers. A call to `perform_lowlevel_parse` corresponds to a push to the stack, while a return from it corresponds to popping the stack. `[number]` controls the number of items to print. If the parameter is not given, the entire stack is printed.
```
```
hammer-parser-mem-use <address>
hammer-parser-mem-use <address>
...
@@ -90,7 +94,7 @@ Print bytes allocated in the contexts of parsers matching `<name>`. `<name>` is
...
@@ -90,7 +94,7 @@ Print bytes allocated in the contexts of parsers matching `<name>`. `<name>` is
hammer-parser-preview-input
hammer-parser-preview-input
```
```
Interprets the next 32 bytes of input as a UTF-8, and prints the resulting string.
Interprets the next 32 bytes of input as UTF-8, and prints the resulting string.
```
```
hammer-parser-top-per-arena-mem
hammer-parser-top-per-arena-mem
...
@@ -108,6 +112,6 @@ Sums up each parser's memory use across all arenas, and prints the parser with t
...
@@ -108,6 +112,6 @@ Sums up each parser's memory use across all arenas, and prints the parser with t
This tool is currently built and tested against the pdf parser. It makes a few assumptions:
This tool is currently built and tested against the pdf parser. It makes a few assumptions:
- Presence of an `init_parser()` function that declares the parser's H_RULEs. This will later be parameterized to support other parsers built with Hammer.
- Presence of an `init_parser()` function that declares the parser's `H_RULE`s. This will later be parameterized to support other parsers built with Hammer.
- The parser using Hammer's Packrat backend
- The parser using Hammer's Packrat backend
- The return instructions in `init_parser()`, `perform_lowlevel_parse()`, `h_packrat_parse()` will be rendered as "ret" or "retq" by GDB
- The return instructions in `init_parser()`, `perform_lowlevel_parse()`, `h_packrat_parse()` will be rendered as "ret" or "retq" by GDB