diff --git a/gdb-port/README.md b/gdb-port/README.md index c7ba895a6620e0ea6ce8f2e032039e595ec8adeb..cc3c6514d1fa6efc53ea2f65f848740e6163cfa2 100644 --- a/gdb-port/README.md +++ b/gdb-port/README.md @@ -88,6 +88,19 @@ Steps execution until the "current" parser (the one `h_do_parse()` has been call In terms of call stack navigation, this is roughly analogous to executing `finish` to step out of the current stack frame, followed by stepping into the next function call. (With the difference, that this commands steps between "frames" of the parser stack) +``` +hammer-parse-step-to-result <number> +``` + +Select a parser on the stack, step to when it returns its result, and print it. + +`<number>` select a parser on the parser stack according to the following rules: +- If zero, the the "current" parser (which `h_do_parse` is about to apply) is selected +- If positive, the selected parser will be `<number>`th item from the top of the stack (with the "current" parser being 0) +- If negative, parsers are counted from the bottom of the stack, with the bottom of the stack being -1. Note: positive is 0-indexed, negative is 1-indexed + +This command will step until the selected `h_do_parse` frame returns its value. If applicable, it extracts the AST returned, and prints it. Afterwards, it will step to the next `h_do_parse` invocation. (This corresponds to stepping until the next time the parser stack grows in size, for example from a parser combinator applying its constituent parsers. For example: after selecting an element of a `h_sequence()` combinator for printing AST results, execution will stop when the next element of said sequence is about to be applied.) + ## Querying ```