diff --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp --- a/lldb/tools/lldb-vscode/lldb-vscode.cpp +++ b/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))); } diff --git a/llvm/utils/vscode/llvm/package.json b/llvm/utils/vscode/llvm/package.json --- a/llvm/utils/vscode/llvm/package.json +++ b/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": [ diff --git a/llvm/utils/vscode/llvm/syntaxes/disassembly.json b/llvm/utils/vscode/llvm/syntaxes/disassembly.json new file mode 100644 --- /dev/null +++ b/llvm/utils/vscode/llvm/syntaxes/disassembly.json @@ -0,0 +1,31 @@ +{ + "name": "Disassembly", + "scopeName": "source.disassembly", + "uuid": "9ade615f-5d82-4ac5-b22f-a1998c356ebe", + "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": ";.*$" + } + ] +}