Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update BPF lexer #1346

Merged
merged 4 commits into from Oct 16, 2019
Merged

Update BPF lexer #1346

merged 4 commits into from Oct 16, 2019

Conversation

pchaigno
Copy link
Contributor

This pull request updates the BPF lexer to support several constructs from the two main disassemblers, bpftool and objdump:

  • w4 syntax for registers used in 32bit ALU instructions.
  • map[id:671] to refer to pointer to the map with id 671.
  • call bpf_skb_load_bytes#7684912 to refer to a call to helper bpf_skb_load_bytes.
  • line numbers
  • (bf) and 61 12 04 00 00 00 00 00 for the hexadecimal encoding of the opcode and instruction respectively.

I'm adding basic support for the hexadecimal output (Generic group) so that it doesn't break highlighting. By supporting this, we make it easier for users to directly highlight the output of bpftool and objdump. I've updated the sample file with raw outputs from both bpftool and objdump.

@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Oct 11, 2019
@pyrmont pyrmont self-assigned this Oct 11, 2019
Copy link
Contributor

@pyrmont pyrmont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments:

lib/rouge/lexers/bpf.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/bpf.rb Show resolved Hide resolved
lib/rouge/lexers/bpf.rb Show resolved Hide resolved
@pyrmont pyrmont added author-action The PR has been reviewed but action by the author is needed and removed needs-review The PR needs to be reviewed labels Oct 14, 2019
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
@pyrmont pyrmont merged commit 762801b into rouge-ruby:master Oct 16, 2019
@pyrmont
Copy link
Contributor

pyrmont commented Oct 16, 2019

@pchaigno Thanks for adding this support and I'm sorry I didn't get it into master before cutting the v3.12.0 release :(

We're about to move to a monthly release schedule for new versions of Rouge so I'm afraid there'll be a bit of a wait. The next version is scheduled to be released on 12 November.

Thanks again for contributing to Rouge!

@pyrmont pyrmont removed the author-action The PR has been reviewed but action by the author is needed label Oct 16, 2019
@pchaigno pchaigno deleted the update-bpf-lexer branch October 16, 2019 08:09
@pchaigno
Copy link
Contributor Author

We're about to move to a monthly release schedule for new versions of Rouge so I'm afraid there'll be a bit of a wait. The next version is scheduled to be released on 12 November.

No problem. It takes many months to update the dependencies in GitHub Pages gem anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants