diff --git a/gdb-port/README b/gdb-port/README index 5c893d5ecccdde1607dfb47f7340660d7e01ba84..fc3d22a9b81154bbee72b4de3d81456dafb523ce 100644 --- a/gdb-port/README +++ b/gdb-port/README @@ -58,6 +58,8 @@ 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`. +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. + ``` hammer-parse-continue ``` @@ -84,6 +86,23 @@ hammer-parser-mem-use-name <name> Print bytes allocated in the contexts of parsers matching `<name>`. `<name>` is either the name given to a parser in the H_RULE declaration, or `(Unnamed <type>)`, for example: `(Unnamed sequence)`. If multiple parsers match the name given, stats for all matching parsers will be printed. +``` +hammer-parser-preview-input +``` + +Interprets the next 32 bytes of input as a UTF-8, and prints the resulting string. + +``` +hammer-parser-top-per-arena-mem +``` + +Finds the parser with highest number of allocated bytes in a single arena. + +``` +hammer-parser-top-total-arena-mem +``` + +Sums up each parser's memory use across all arenas, and prints the parser with the highest total allocated bytes. # Limitations diff --git a/gdb-port/parser-name-instrumentation-gdb.py b/gdb-port/parser-name-instrumentation-gdb.py index e2a79d57744020cd2f615572bec6d283a2d5d575..139cce341c9882e4238004a06656d216697ac0e3 100644 --- a/gdb-port/parser-name-instrumentation-gdb.py +++ b/gdb-port/parser-name-instrumentation-gdb.py @@ -515,9 +515,6 @@ class HammerParserPreviewInput(gdb.Command): HammerParserPreviewInput() -# TODO: a convenience feature for printing input preview + backtrace after step would be nice -# idea: a configuration option which HammerParseStep could check, invoke the other 2 commands if true - # Call when execution stopped at breakpoint in main def locate_perform_lowlevel_parse_retq(): arch = gdb.selected_frame().architecture()