Page MenuHomePhabricator

[lldb-vscode ]Add Syntax Highlighting to Disassembly View
ClosedPublic

Authored by aelitashen on Jul 24 2020, 1:46 PM.

Details

Summary

When lldb cannot find source file thus IDE renders a disassembly view, add syntax highlighting for constants, registers and final line comments for better debugging experience.
The original plain disassembly view looks like:


An ideal view is like the screenshot attached.

In this diff, the mimeType is a kind of media type for formatting the content in the response to a source request. Elements in the disassembly view, like constants, registers and final line comments are colored for highlighting.
A built-in support in the VSCode IDE for syntax highlighting will identify the which mimeType to apply and render the disassembly view as expected.

Diff Detail

Event Timeline

aelitashen created this revision.Jul 24 2020, 1:46 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 24 2020, 1:46 PM
aelitashen retitled this revision from Add Syntax Highlighting to Disassembly View to [lldb-vscode ]Add Syntax Highlighting to Disassembly View.Jul 24 2020, 1:50 PM
aelitashen edited the summary of this revision. (Show Details)
wallace requested changes to this revision.Jul 24 2020, 2:29 PM

can you include a screenshot of how the view looked before (without the colors)?

Also explain that this is done via a mime-type identification and a built-in support in the IDE for syntax highlighting

Don't forget to use the new UUID I gave you

This revision now requires changes to proceed.Jul 24 2020, 2:29 PM
aelitashen edited the summary of this revision. (Show Details)Jul 24 2020, 2:38 PM

Use unique id for disassembly.json

aelitashen edited the summary of this revision. (Show Details)Jul 24 2020, 3:01 PM
aelitashen edited the summary of this revision. (Show Details)
wallace accepted this revision.Jul 24 2020, 3:03 PM

Very good!

This revision is now accepted and ready to land.Jul 24 2020, 3:03 PM

This seems very x86 centric. I forwarded a few examples of ARM and ARM64 disassembly to Yifan so we can improve some of the regexes.

It would be possible as well to have two media types with their corresponding syntax files, one for x86, and another for arm

Cover ARM and ARM64 case in disassembly syntax highlighting

Move the sample files to the syntaxes folder.
Besides, the path /llvm/syntaxes/disassembly.json should just be syntaxes/disassembly.json. There's no need to have that llvm subfolder there

Move everything to the right place

Looks better. Can we test this?

I don't think there's any easy way to test this. I was reading the VSCode documentation and there's no nice test framework for this. So at this point I'm okay with it without test, as it's very easy to check that it works by visual inspection.

clayborg accepted this revision.Aug 3 2020, 5:36 PM
This revision was landed with ongoing or failed builds.Aug 4 2020, 1:32 PM
This revision was automatically updated to reflect the committed changes.