[PATCH] D84555: Add Syntax Highlighting to Disassembly View
Yifan Shen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 24 13:46:59 PDT 2020
aelitashen created this revision.
aelitashen added reviewers: wallace, clayborg.
Herald added projects: LLDB, LLVM.
Herald added subscribers: llvm-commits, lldb-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D84555
Files:
lldb/tools/lldb-vscode/lldb-vscode.cpp
llvm/utils/vscode/llvm/package.json
llvm/utils/vscode/llvm/syntaxes/disassembly.json
Index: llvm/utils/vscode/llvm/syntaxes/disassembly.json
===================================================================
--- /dev/null
+++ llvm/utils/vscode/llvm/syntaxes/disassembly.json
@@ -0,0 +1,31 @@
+{
+ "name": "Disassembly",
+ "scopeName": "source.disassembly",
+ "uuid": "db74b3e8-fa2c-4b4e-b973-1ecc54d45ed0",
+ "patterns": [
+ {
+ "comment": "Address, bytes and opcode",
+ "name": "meta.instruction",
+ "match": "^([A-Za-z0-9]+):\\s([A-Z0-9]{2}\\s)+>?\\s+(\\w+)",
+ "captures": {
+ "1": {"name": "constant.numeric"},
+ "3": {"name": "keyword.opcode"}
+ }
+ },
+ {
+ "comment": "Numeric constant",
+ "name": "constant.numeric",
+ "match": "(\\$|\\b)((0x)|[0-9])[A-Za-z0-9]+\\b"
+ },
+ {
+ "comment": "Register",
+ "name": "variable.language",
+ "match": "%[A-Za-z][A-Za-z0-9]*"
+ },
+ {
+ "comment": "End of line comment",
+ "name": "comment.line.semicolon",
+ "match": ";.*$"
+ }
+ ]
+}
Index: llvm/utils/vscode/llvm/package.json
===================================================================
--- llvm/utils/vscode/llvm/package.json
+++ llvm/utils/vscode/llvm/package.json
@@ -39,6 +39,15 @@
".ll"
],
"configuration": "./language-configuration.json"
+ },
+ {
+ "id": "lldb.disassembly",
+ "aliases": [
+ "Disassembly"
+ ],
+ "extensions": [
+ ".disasm"
+ ]
}
],
"grammars": [
@@ -51,6 +60,11 @@
"language": "llvm",
"scopeName": "source.llvm",
"path": "./syntaxes/ll.tmLanguage.json"
+ },
+ {
+ "language": "lldb.disassembly",
+ "scopeName": "source.disassembly",
+ "path": "./syntaxes/disassembly.json"
}
],
"taskDefinitions": [
Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===================================================================
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -2188,6 +2188,7 @@
} else {
response["success"] = llvm::json::Value(false);
}
+ EmplaceSafeString(body, "mimeType", "text/x-lldb.disassembly");
response.try_emplace("body", std::move(body));
g_vsc.SendJSON(llvm::json::Value(std::move(response)));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84555.280580.patch
Type: text/x-patch
Size: 2494 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200724/27170d36/attachment-0001.bin>
More information about the llvm-commits
mailing list