VSCode grammar extension to color higlight scripts for GDB and GDB outputs logs.
- Rendering of frame items in gdb-log
- Rendering of file locations, experimental
Disclaimer: for the moment, all the commands that I use are rendered. Commits will slow down. May not update at all.
This extension provides a grammar file to parse and color GDB command files.
file.gdb
will be treated as gdb source files
- EXPERIMENTAL
file.gdb-log
,file.gdblog
,file.gdb.log
will be treated as gdb output logs.
Unlike other languague, GDB will accept incomplete word when there's no ambiguity,
so set loggging overwrite off
is as valid as set lo ov of
.
That means that you just can't put every keyword in one regexp to render each keyword. To have a consistant color hilight each command has it's own regexp.
- All scopes must finish by
.gdb
. - The scope goes from general to specific.
- For GDB commands, first scope is
meta
. Then it depends on the GDB logic: is it acommand
, ablock
, avariable
? Examples:meta.block.conditional.gdb
means its a GDB block of text in a conditional statement.meta.command.delete.gdb
means its gdb's delerte command.
- One command per PR. The PR must have the .gdb to test it. Ideally, an image should be copied in the PR to show the output.
Use the VSCode command editor.action.inspectTMScopes
( Developer: Inspect Editor Tokens and Scopes
in command palette ) to check the syntax highlighting.
Here, the comment was rendered as a comment.line.number-sign.gdb
.
One can use also the hello_world code lo launch GDB and check command. This can be launched with make -C hello_world
.
Then several commands are available to writte test files given a command ( and prefix and suffix if necessary).
To print the list of commands
(gdb) help user-defined
all_regex -- Given a word foo, writes the regex to match f, fo, foo
check_test -- Source file and execute command in it
create_test -- Given a prefix, a word and a suffix, write all gdb possibilities to a file
See images/naming-conventions.png for particular scopes and their visual effect.